mnemo_cards/lib/features/tests/test_widgets/test_button.dart

66 lines
1.6 KiB
Dart
Raw Normal View History

2024-05-22 20:48:44 +00:00
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:mnemo_cards/theme/themes.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: InkWell(
onTap: onTap,
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!,
style: theme.titleLarge,
)
],
),
),
),
);
}
}