1
0
mirror of https://github.com/git-touch/git-touch synced 2024-12-24 14:51:28 +01:00
git-touch-android-ios-app/lib/widgets/mutation_button.dart

43 lines
1.2 KiB
Dart
Raw Normal View History

2020-01-12 07:49:46 +01:00
import 'package:flutter/cupertino.dart';
import 'package:git_touch/models/theme.dart';
2020-02-06 07:23:54 +01:00
import 'package:git_touch/widgets/link.dart';
2020-01-12 07:49:46 +01:00
import 'package:provider/provider.dart';
class MutationButton extends StatelessWidget {
2020-02-06 07:23:54 +01:00
final bool active;
2020-01-12 07:49:46 +01:00
final String text;
final VoidCallback onPressed;
MutationButton({
2020-02-06 07:23:54 +01:00
@required this.active,
2020-01-12 07:49:46 +01:00
@required this.text,
@required this.onPressed,
});
@override
Widget build(BuildContext context) {
final theme = Provider.of<ThemeModel>(context);
2020-02-06 07:23:54 +01:00
final textColor = active ? theme.palette.background : theme.palette.primary;
final backgroundColor =
active ? theme.palette.primary : theme.palette.background;
return Link(
onTap: onPressed,
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 12,
vertical: 4,
),
decoration: BoxDecoration(
color: backgroundColor,
borderRadius: BorderRadius.all(Radius.circular(20)),
border: Border.all(color: theme.palette.primary),
),
child: Text(
text,
style: TextStyle(fontSize: 17, color: textColor),
2020-01-14 06:33:02 +01:00
),
2020-01-12 07:49:46 +01:00
),
);
}
}