1
0
mirror of https://github.com/git-touch/git-touch synced 2024-12-24 23:01:18 +01:00
git-touch-android-ios-app/lib/screens/settings.dart

90 lines
3.0 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-26 14:34:51 +02:00
import 'package:git_touch/screens/credits.dart';
2019-10-03 06:19:18 +02:00
import 'package:git_touch/screens/issue_form.dart';
2019-09-23 12:28:33 +02:00
import 'package:git_touch/screens/repository.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';
import '../screens/login.dart';
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'),
screenBuilder: (_) => LoginScreen(),
),
]),
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: [
TableViewItem(
text: Text('Source Code'),
screenBuilder: (_) => RepositoryScreen('pd4d10', 'git-touch'),
),
2019-10-03 06:19:18 +02:00
TableViewItem(
text: Text('Feedback'),
screenBuilder: (_) => IssueFormScreen('pd4d10', 'git-touch'),
),
2019-09-26 14:34:51 +02:00
TableViewItem(
text: Text('Credits'),
screenBuilder: (_) => CreditsScreen(),
),
2019-09-25 08:24:20 +02:00
TableViewItem(
text: Text('Rate This App'),
onTap: () {
LaunchReview.launch(
androidAppId: 'io.github.pd4d10.gittouch',
iOSAppId: '1452042346',
);
},
),
]),
],
),
);
}
}