git-touch-android-ios-app/lib/screens/settings.dart

67 lines
2.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-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,
),
]),
],
),
);
}
}