git-touch-android-ios-app/lib/widgets/action_entry.dart

37 lines
1017 B
Dart
Raw Normal View History

2020-01-04 15:47:48 +01:00
import 'package:flutter/cupertino.dart';
2019-09-28 18:25:14 +02:00
import 'package:flutter/material.dart';
import 'package:git_touch/models/theme.dart';
import 'package:provider/provider.dart';
class ActionEntry extends StatelessWidget {
final IconData iconData;
2020-01-31 09:54:01 +01:00
final String url;
2019-09-28 18:25:14 +02:00
final VoidCallback onTap;
2020-01-31 09:54:01 +01:00
ActionEntry({this.url, this.iconData, this.onTap});
2019-09-28 18:25:14 +02:00
@override
Widget build(BuildContext context) {
2020-01-31 09:54:01 +01:00
final theme = Provider.of<ThemeModel>(context);
switch (theme.theme) {
2019-09-28 18:25:14 +02:00
case AppThemeType.cupertino:
2020-01-04 15:47:48 +01:00
return CupertinoButton(
minSize: 0,
2019-09-29 07:47:18 +02:00
child: Icon(iconData, size: 22),
2020-01-04 15:47:48 +01:00
padding: EdgeInsets.zero,
2020-01-31 09:54:01 +01:00
onPressed: () {
if (onTap != null) onTap();
if (url != null) theme.push(context, url);
},
2019-09-28 18:25:14 +02:00
);
default:
return IconButton(
icon: Icon(iconData),
2020-01-31 09:54:01 +01:00
onPressed: () {
if (onTap != null) onTap();
if (url != null) theme.push(context, url);
},
2019-09-28 18:25:14 +02:00
);
}
}
}