mnemo_cards/lib/features/tests/test_widgets/test_button.dart
2024-07-03 23:56:13 +03:00

66 lines
1.7 KiB
Dart

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,
// ),
],
),
child: GestureDetector(
// borderRadius: BorderRadius.circular(10.0),
onTap: onTap,
behavior: HitTestBehavior.opaque,
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!,
textAlign: TextAlign.center,
style: theme.titleLarge,
)
],
),
),
),
);
}
}