lemmur-app-android/lib/pages/settings.dart

83 lines
2.3 KiB
Dart
Raw Normal View History

2020-08-31 16:17:39 +02:00
import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:provider/provider.dart';
import '../stores/config_store.dart';
2020-09-03 13:06:10 +02:00
class SettingsPage extends StatelessWidget {
2020-08-31 16:17:39 +02:00
@override
Widget build(BuildContext context) {
var theme = Theme.of(context);
return Scaffold(
appBar: AppBar(
backgroundColor: theme.scaffoldBackgroundColor,
shadowColor: Colors.transparent,
iconTheme: theme.iconTheme,
title: Text('Settings', style: theme.textTheme.headline6),
centerTitle: true,
),
body: Container(
child: ListView(
children: [
ListTile(
leading: Icon(Icons.person),
title: Text('Accounts'),
onTap: () {},
),
ListTile(
leading: Icon(Icons.color_lens),
title: Text('Appearance'),
onTap: () {
Navigator.of(context).push(
2020-08-31 21:04:17 +02:00
MaterialPageRoute(builder: (_) => _AppearanceConfig()));
2020-08-31 16:17:39 +02:00
},
)
],
),
),
);
}
}
2020-08-31 21:04:17 +02:00
class _AppearanceConfig extends StatelessWidget {
2020-08-31 16:17:39 +02:00
@override
Widget build(BuildContext context) {
var theme = Theme.of(context);
return Scaffold(
appBar: AppBar(
backgroundColor: theme.scaffoldBackgroundColor,
shadowColor: Colors.transparent,
iconTheme: theme.iconTheme,
title: Text('Appearance', style: theme.textTheme.headline6),
centerTitle: true,
),
body: Observer(
builder: (ctx) => Column(
children: [
Text(
'Theme',
style: theme.textTheme.headline6,
),
for (final theme in ThemeMode.values)
RadioListTile<ThemeMode>(
value: theme,
title: Text(theme.toString().split('.')[1]),
groupValue: ctx.watch<ConfigStore>().theme,
onChanged: (selected) {
ctx.read<ConfigStore>().theme = selected;
},
),
Text(
'Accent color',
style: theme.textTheme.headline6,
),
// TODO: add accent color picking
],
),
),
);
}
}