2021-02-15 18:58:29 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
class ActionButton extends StatelessWidget {
|
|
|
|
const ActionButton({
|
2022-10-26 16:26:09 +00:00
|
|
|
super.key,
|
2021-02-15 18:58:29 +00:00
|
|
|
this.text,
|
|
|
|
this.onPressed,
|
|
|
|
this.isRed = false,
|
2022-06-05 19:36:32 +00:00
|
|
|
});
|
2021-02-15 18:58:29 +00:00
|
|
|
|
2021-03-15 15:39:44 +00:00
|
|
|
final VoidCallback? onPressed;
|
|
|
|
final String? text;
|
2021-02-15 18:58:29 +00:00
|
|
|
final bool isRed;
|
|
|
|
|
|
|
|
@override
|
2022-06-05 19:36:32 +00:00
|
|
|
Widget build(final BuildContext context) {
|
|
|
|
final NavigatorState navigator = Navigator.of(context);
|
2021-02-15 18:58:29 +00:00
|
|
|
|
|
|
|
return TextButton(
|
|
|
|
child: Text(
|
2021-03-15 15:39:44 +00:00
|
|
|
text!,
|
2022-09-08 15:14:05 +00:00
|
|
|
style: isRed
|
|
|
|
? TextStyle(color: Theme.of(context).colorScheme.error)
|
|
|
|
: null,
|
2021-02-15 18:58:29 +00:00
|
|
|
),
|
|
|
|
onPressed: () {
|
|
|
|
navigator.pop();
|
2022-06-05 22:40:34 +00:00
|
|
|
onPressed?.call();
|
2021-02-15 18:58:29 +00:00
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|