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

32 lines
679 B
Dart
Raw Normal View History

2021-02-15 18:58:29 +00:00
import 'package:flutter/material.dart';
import 'package:selfprivacy/config/brand_colors.dart';
class ActionButton extends StatelessWidget {
const ActionButton({
2021-03-15 15:39:44 +00:00
Key? key,
2021-02-15 18:58:29 +00:00
this.text,
this.onPressed,
this.isRed = false,
}) : super(key: key);
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
Widget build(BuildContext context) {
var navigator = Navigator.of(context);
return TextButton(
child: Text(
2021-03-15 15:39:44 +00:00
text!,
2021-02-15 18:58:29 +00:00
style: isRed ? TextStyle(color: BrandColors.red1) : null,
),
onPressed: () {
navigator.pop();
2021-03-15 15:39:44 +00:00
if (onPressed != null) onPressed!();
2021-02-15 18:58:29 +00:00
},
);
}
}