2024-05-22 20:48:44 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
import 'test_image.dart';
|
|
|
|
|
|
|
|
|
|
class TestButton extends StatelessWidget {
|
|
|
|
|
final String? text;
|
|
|
|
|
final TestImage? image;
|
|
|
|
|
final VoidCallback onTap;
|
|
|
|
|
final Color? color;
|
|
|
|
|
final Color? borderColor;
|
|
|
|
|
|
|
|
|
|
TestButton({
|
|
|
|
|
this.text,
|
|
|
|
|
this.image,
|
|
|
|
|
this.color,
|
|
|
|
|
this.borderColor,
|
|
|
|
|
required this.onTap,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
final theme = Theme.of(context).textTheme;
|
|
|
|
|
return Material(
|
|
|
|
|
borderRadius: BorderRadius.circular(12.0),
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: const EdgeInsets.all(4.0),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: color,
|
|
|
|
|
// border: Border.all(color: borderColor ?? borderGray),
|
|
|
|
|
borderRadius: BorderRadius.circular(12.0),
|
|
|
|
|
boxShadow: const [
|
|
|
|
|
// BoxShadow(
|
|
|
|
|
// color: Colors.black26,
|
|
|
|
|
// blurRadius: 4.0,
|
|
|
|
|
// ),
|
|
|
|
|
],
|
|
|
|
|
),
|
2024-06-22 12:29:18 +00:00
|
|
|
child: GestureDetector(
|
|
|
|
|
// borderRadius: BorderRadius.circular(10.0),
|
2024-05-22 20:48:44 +00:00
|
|
|
onTap: onTap,
|
2024-06-22 12:29:18 +00:00
|
|
|
behavior: HitTestBehavior.opaque,
|
2024-05-22 20:48:44 +00:00
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
if (image != null)
|
|
|
|
|
TestImageWidget(
|
|
|
|
|
image!,
|
|
|
|
|
key: ValueKey(image),
|
|
|
|
|
),
|
|
|
|
|
if (image != null && text != null)
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 4.0,
|
|
|
|
|
),
|
|
|
|
|
if (text != null)
|
|
|
|
|
Text(
|
|
|
|
|
text!,
|
2024-06-22 12:29:18 +00:00
|
|
|
textAlign: TextAlign.center,
|
2024-05-22 20:48:44 +00:00
|
|
|
style: theme.titleLarge,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|