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

94 lines
3.1 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-14 19:13:14 +02:00
import 'package:git_touch/screens/object.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';
import '../scaffolds/simple.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
return SimpleScaffold(
2019-09-11 13:59:47 +02:00
title: AppBarTitle('Settings'),
bodyBuilder: () {
2019-02-08 16:20:28 +01:00
return Column(
children: <Widget>[
2019-09-14 20:05:34 +02:00
borderView1,
2019-09-04 16:37:22 +02:00
TableView(headerText: 'ACCOUNTS', items: [
TableViewItem(
2019-09-04 16:59:33 +02:00
text: Text('Switch to another account'),
2019-09-04 16:37:22 +02:00
screenBuilder: (_) => LoginScreen(),
),
]),
2019-09-14 20:05:34 +02:00
borderView1,
2019-09-04 16:37:22 +02:00
TableView(headerText: 'THEME', items: [
TableViewItem(
2019-09-14 17:48:01 +02:00
text: Text('Material'),
2019-09-15 11:36:09 +02:00
rightWidget: _buildRightWidget(
2019-09-19 15:10:50 +02:00
themeProvider.theme == AppThemeType.material),
2019-09-04 16:37:22 +02:00
onTap: () {
2019-09-19 15:10:50 +02:00
if (themeProvider.theme != AppThemeType.material) {
themeProvider.setTheme(AppThemeType.material);
2019-09-04 16:37:22 +02:00
}
},
2019-09-14 17:48:01 +02:00
hideRightChevron: true,
2019-09-04 16:37:22 +02:00
),
TableViewItem(
2019-09-14 17:48:01 +02:00
text: Text('Cupertino'),
2019-09-04 16:59:33 +02:00
rightWidget: _buildRightWidget(
2019-09-19 15:10:50 +02:00
themeProvider.theme == AppThemeType.cupertino),
2019-09-04 16:37:22 +02:00
onTap: () {
2019-09-19 15:10:50 +02:00
if (themeProvider.theme != AppThemeType.cupertino) {
themeProvider.setTheme(AppThemeType.cupertino);
2019-09-04 16:37:22 +02:00
}
},
2019-09-14 17:48:01 +02:00
hideRightChevron: true,
2019-09-04 16:37:22 +02:00
),
]),
2019-09-14 20:05:34 +02:00
borderView1,
2019-09-14 17:48:01 +02:00
TableView(headerText: 'ABOUT', items: [
2019-09-04 16:37:22 +02:00
TableViewItem(
2019-09-15 09:08:09 +02:00
text: Text('Source Code'),
2019-09-23 12:28:33 +02:00
screenBuilder: (_) => RepositoryScreen('pd4d10', 'git-touch'),
2019-09-14 17:48:01 +02:00
),
TableViewItem(
2019-09-14 19:13:14 +02:00
text: Text('License'),
rightWidget: Text('MIT'),
screenBuilder: (_) => ObjectScreen(
owner: 'pd4d10',
name: 'git-touch',
branch: 'master',
paths: ['LICENSE'],
type: 'blob',
),
),
TableViewItem(
2019-09-15 09:08:09 +02:00
text: Text('Rate This App'),
2019-09-04 16:37:22 +02:00
onTap: () {
LaunchReview.launch(
androidAppId: 'io.github.pd4d10.gittouch',
iOSAppId: '1452042346',
);
},
2019-09-14 17:48:01 +02:00
),
2019-09-04 16:37:22 +02:00
]),
2019-02-08 16:20:28 +01:00
],
);
},
);
}
}