selfprivacy.org.app/lib/ui/components/action_button/action_button.dart

33 lines
661 B
Dart
Raw Normal View History

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