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

32 lines
679 B
Dart
Raw Normal View History

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