fooder-app/lib/components/button.dart

47 lines
1.3 KiB
Dart
Raw Permalink Normal View History

2024-03-28 16:25:49 +01:00
import 'package:flutter/material.dart';
class FButton extends StatelessWidget {
final String labelText;
final double padding;
final double insidePadding;
final double fontSize;
final Function()? onPressed;
2024-03-30 14:07:10 +01:00
const FButton(
{super.key,
required this.labelText,
this.padding = 8,
this.insidePadding = 24,
this.fontSize = 20,
this.onPressed});
2024-03-28 16:25:49 +01:00
@override
Widget build(BuildContext context) {
var theme = Theme.of(context);
var colorScheme = theme.colorScheme;
return GestureDetector(
2024-03-30 14:07:10 +01:00
onTap: onPressed,
child: Padding(
padding: EdgeInsets.symmetric(vertical: padding, horizontal: padding),
child: Container(
padding: EdgeInsets.symmetric(vertical: insidePadding),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
2024-04-04 19:03:41 +02:00
color: colorScheme.surfaceTint.withOpacity(0.85),
2024-03-29 16:47:25 +01:00
),
2024-03-30 14:07:10 +01:00
child: Center(
child: Text(
labelText,
style: theme.textTheme.labelLarge!.copyWith(
fontWeight: FontWeight.bold,
fontSize: fontSize,
2024-04-04 19:03:41 +02:00
color: colorScheme.onPrimary,
2024-03-30 14:07:10 +01:00
),
2024-03-28 16:25:49 +01:00
),
),
),
2024-03-30 14:07:10 +01:00
));
2024-03-28 16:25:49 +01:00
}
}