1
0
mirror of https://github.com/git-touch/git-touch synced 2024-12-19 03:33:42 +01:00
git-touch-android-ios-app/lib/screens/settings.dart

83 lines
2.7 KiB
Dart
Raw Normal View History

2019-09-04 16:59:33 +02:00
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:git_touch/models/theme.dart';
2019-09-25 11:06:36 +02:00
import 'package:git_touch/scaffolds/single.dart';
2019-09-04 16:59:33 +02:00
import 'package:git_touch/utils/utils.dart';
2019-09-11 13:59:47 +02:00
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:provider/provider.dart';
2019-03-10 06:13:40 +01:00
import 'package:launch_review/launch_review.dart';
2019-02-08 16:20:28 +01:00
import '../widgets/table_view.dart';
2019-12-13 06:13:45 +01:00
final settingsRouter = RouterScreen(
'/settings',
(context, parameters) => SettingsScreen(),
);
2019-09-14 17:48:01 +02:00
class SettingsScreen extends StatelessWidget {
2019-09-04 16:59:33 +02:00
Widget _buildRightWidget(bool checked) {
if (!checked) return null;
2019-09-15 09:08:09 +02:00
return Icon(Octicons.check, color: CupertinoColors.activeBlue, size: 24);
2019-09-04 16:59:33 +02:00
}
@override
Widget build(BuildContext context) {
var themeProvider = Provider.of<ThemeModel>(context);
2019-02-08 16:20:28 +01:00
2019-09-25 11:06:36 +02:00
return SingleScaffold(
2019-09-11 13:59:47 +02:00
title: AppBarTitle('Settings'),
2019-09-25 11:06:36 +02:00
body: Column(
2019-09-25 08:24:20 +02:00
children: <Widget>[
2019-10-02 10:09:54 +02:00
CommonStyle.verticalGap,
2019-09-25 08:24:20 +02:00
TableView(headerText: 'ACCOUNTS', items: [
TableViewItem(
text: Text('Switch to another account'),
2019-12-12 13:29:56 +01:00
url: '/login',
2019-09-25 08:24:20 +02:00
),
]),
2019-10-02 10:09:54 +02:00
CommonStyle.verticalGap,
2019-09-25 08:24:20 +02:00
TableView(headerText: 'THEME', items: [
TableViewItem(
text: Text('Material'),
rightWidget: _buildRightWidget(
themeProvider.theme == AppThemeType.material),
onTap: () {
if (themeProvider.theme != AppThemeType.material) {
themeProvider.setTheme(AppThemeType.material);
}
},
hideRightChevron: true,
),
TableViewItem(
text: Text('Cupertino'),
rightWidget: _buildRightWidget(
themeProvider.theme == AppThemeType.cupertino),
onTap: () {
if (themeProvider.theme != AppThemeType.cupertino) {
themeProvider.setTheme(AppThemeType.cupertino);
}
},
hideRightChevron: true,
),
]),
2019-10-02 10:09:54 +02:00
CommonStyle.verticalGap,
2019-09-25 08:24:20 +02:00
TableView(headerText: 'ABOUT', items: [
2019-12-12 13:29:56 +01:00
TableViewItem(text: Text('Source Code'), url: '/pd4d10/git-touch'),
2019-09-25 08:24:20 +02:00
TableViewItem(
2019-12-12 13:29:56 +01:00
text: Text('Feedback'), url: '/pd4d10/git-touch/issues/new'),
TableViewItem(text: Text('Credits'), url: '/help/credits'),
2019-09-25 08:24:20 +02:00
TableViewItem(
text: Text('Rate This App'),
onTap: () {
LaunchReview.launch(
androidAppId: 'io.github.pd4d10.gittouch',
iOSAppId: '1452042346',
);
},
),
]),
],
),
);
}
}