2019-02-08 12:34:07 +01:00
|
|
|
import 'package:flutter/material.dart';
|
2019-02-08 16:20:28 +01:00
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
2019-02-08 12:34:07 +01:00
|
|
|
import '../scaffolds/simple.dart';
|
2019-02-08 16:20:28 +01:00
|
|
|
import '../providers/settings.dart';
|
|
|
|
import '../widgets/table_view.dart';
|
|
|
|
import '../screens/repo.dart';
|
|
|
|
import '../screens/login.dart';
|
2019-02-08 12:34:07 +01:00
|
|
|
|
|
|
|
class SettingsScreen extends StatefulWidget {
|
|
|
|
@override
|
|
|
|
_SettingsScreenState createState() => _SettingsScreenState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _SettingsScreenState extends State<SettingsScreen> {
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2019-02-08 16:20:28 +01:00
|
|
|
var settings = SettingsProvider.of(context);
|
|
|
|
|
2019-02-08 12:34:07 +01:00
|
|
|
return SimpleScaffold(
|
|
|
|
title: Text('Settings'),
|
|
|
|
bodyBuilder: () {
|
2019-02-08 16:20:28 +01:00
|
|
|
return Column(
|
|
|
|
children: <Widget>[
|
|
|
|
TableView(
|
|
|
|
title: 'ACCOUNTS',
|
|
|
|
items: [
|
|
|
|
TableViewItem(
|
|
|
|
text: 'Switch to another account',
|
|
|
|
screenBuilder: (_) => LoginScreen(),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
TableView(
|
|
|
|
title: 'THEME',
|
|
|
|
items: [
|
|
|
|
TableViewItem(
|
|
|
|
text: 'material',
|
|
|
|
checked: settings.theme == ThemeMap.material,
|
|
|
|
onTap: () {
|
|
|
|
if (settings.theme != ThemeMap.material) {
|
|
|
|
settings.setTheme(ThemeMap.material);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
),
|
|
|
|
TableViewItem(
|
|
|
|
text: 'cupertino',
|
|
|
|
checked: settings.theme == ThemeMap.cupertino,
|
|
|
|
onTap: () {
|
|
|
|
if (settings.theme != ThemeMap.cupertino) {
|
|
|
|
settings.setTheme(ThemeMap.cupertino);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
TableView(
|
|
|
|
title: 'SOURCE CODE',
|
|
|
|
items: [
|
|
|
|
TableViewItem(
|
|
|
|
text: 'pd4d10/git-touch',
|
|
|
|
screenBuilder: (_) => RepoScreen('pd4d10', 'git-touch'),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
TableView(
|
|
|
|
title: 'LICENSE',
|
|
|
|
items: [
|
|
|
|
TableViewItem(
|
|
|
|
text: 'MIT',
|
|
|
|
onTap: () {
|
|
|
|
launch(
|
|
|
|
'https://github.com/pd4d10/git-touch/blob/master/LICENSE');
|
|
|
|
},
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)
|
|
|
|
],
|
|
|
|
);
|
2019-02-08 12:34:07 +01:00
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|