2021-01-15 19:41:55 +01:00
|
|
|
import 'package:adaptive_theme/adaptive_theme.dart';
|
2021-04-24 09:29:17 +02:00
|
|
|
import 'package:fluffychat/views/widgets/layouts/max_width_body.dart';
|
2020-11-25 20:39:54 +01:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
|
|
|
2021-04-15 13:03:14 +02:00
|
|
|
import '../../config/app_config.dart';
|
|
|
|
import '../widgets/matrix.dart';
|
2021-04-18 09:18:23 +02:00
|
|
|
import '../settings_style.dart';
|
2020-11-25 20:39:54 +01:00
|
|
|
|
2021-04-18 09:18:23 +02:00
|
|
|
class SettingsStyleUI extends StatelessWidget {
|
|
|
|
final SettingsStyleController controller;
|
2020-11-25 20:39:54 +01:00
|
|
|
|
2021-04-18 09:18:23 +02:00
|
|
|
const SettingsStyleUI(this.controller, {Key key}) : super(key: key);
|
2021-01-15 19:41:55 +01:00
|
|
|
|
2020-11-25 20:39:54 +01:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2021-04-18 09:18:23 +02:00
|
|
|
controller.currentTheme ??= AdaptiveTheme.of(context).mode;
|
2020-11-25 20:39:54 +01:00
|
|
|
return Scaffold(
|
|
|
|
appBar: AppBar(
|
2021-01-16 14:24:52 +01:00
|
|
|
leading: BackButton(),
|
2020-11-25 20:39:54 +01:00
|
|
|
title: Text(L10n.of(context).changeTheme),
|
|
|
|
),
|
2021-04-09 18:26:44 +02:00
|
|
|
body: MaxWidthBody(
|
|
|
|
withScrolling: true,
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
RadioListTile<AdaptiveThemeMode>(
|
2021-04-18 09:18:23 +02:00
|
|
|
groupValue: controller.currentTheme,
|
2021-04-09 18:26:44 +02:00
|
|
|
value: AdaptiveThemeMode.system,
|
|
|
|
title: Text(L10n.of(context).systemTheme),
|
2021-04-18 09:18:23 +02:00
|
|
|
onChanged: controller.switchTheme,
|
2020-11-25 20:39:54 +01:00
|
|
|
),
|
2021-04-09 18:26:44 +02:00
|
|
|
RadioListTile<AdaptiveThemeMode>(
|
2021-04-18 09:18:23 +02:00
|
|
|
groupValue: controller.currentTheme,
|
2021-04-09 18:26:44 +02:00
|
|
|
value: AdaptiveThemeMode.light,
|
|
|
|
title: Text(L10n.of(context).lightTheme),
|
2021-04-18 09:18:23 +02:00
|
|
|
onChanged: controller.switchTheme,
|
2020-11-25 20:39:54 +01:00
|
|
|
),
|
2021-04-09 18:26:44 +02:00
|
|
|
RadioListTile<AdaptiveThemeMode>(
|
2021-04-18 09:18:23 +02:00
|
|
|
groupValue: controller.currentTheme,
|
2021-04-09 18:26:44 +02:00
|
|
|
value: AdaptiveThemeMode.dark,
|
|
|
|
title: Text(L10n.of(context).darkTheme),
|
2021-04-18 09:18:23 +02:00
|
|
|
onChanged: controller.switchTheme,
|
2021-04-09 18:26:44 +02:00
|
|
|
),
|
|
|
|
Divider(height: 1),
|
|
|
|
ListTile(
|
|
|
|
title: Text(
|
|
|
|
L10n.of(context).wallpaper,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Theme.of(context).accentColor,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
2021-02-07 08:59:58 +01:00
|
|
|
),
|
|
|
|
),
|
2021-04-09 18:26:44 +02:00
|
|
|
if (Matrix.of(context).wallpaper != null)
|
|
|
|
ListTile(
|
|
|
|
title: Image.file(
|
|
|
|
Matrix.of(context).wallpaper,
|
|
|
|
height: 38,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
),
|
|
|
|
trailing: Icon(
|
|
|
|
Icons.delete_forever_outlined,
|
|
|
|
color: Colors.red,
|
|
|
|
),
|
2021-04-18 09:18:23 +02:00
|
|
|
onTap: controller.deleteWallpaperAction,
|
2021-02-07 08:59:58 +01:00
|
|
|
),
|
2021-04-09 18:26:44 +02:00
|
|
|
Builder(builder: (context) {
|
|
|
|
return ListTile(
|
|
|
|
title: Text(L10n.of(context).changeWallpaper),
|
|
|
|
trailing: Icon(Icons.wallpaper_outlined),
|
2021-04-18 09:18:23 +02:00
|
|
|
onTap: controller.setWallpaperAction,
|
2021-04-09 18:26:44 +02:00
|
|
|
);
|
|
|
|
}),
|
|
|
|
Divider(height: 1),
|
|
|
|
ListTile(
|
|
|
|
title: Text(
|
|
|
|
L10n.of(context).fontSize,
|
2021-02-07 08:59:58 +01:00
|
|
|
style: TextStyle(
|
2021-04-09 18:26:44 +02:00
|
|
|
color: Theme.of(context).accentColor,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
subtitle: Text('(*${AppConfig.fontSizeFactor})'),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
child: Container(
|
|
|
|
margin: const EdgeInsets.symmetric(horizontal: 16),
|
|
|
|
padding:
|
|
|
|
const EdgeInsets.symmetric(vertical: 6, horizontal: 10),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Theme.of(context).secondaryHeaderColor,
|
|
|
|
borderRadius: BorderRadius.circular(16),
|
|
|
|
),
|
|
|
|
child: Text(
|
|
|
|
'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: Theme.of(context).textTheme.bodyText1.fontSize *
|
|
|
|
AppConfig.fontSizeFactor,
|
|
|
|
),
|
2021-02-07 08:59:58 +01:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2021-04-09 18:26:44 +02:00
|
|
|
Slider(
|
|
|
|
min: 0.5,
|
|
|
|
max: 2.5,
|
|
|
|
divisions: 4,
|
|
|
|
value: AppConfig.fontSizeFactor,
|
|
|
|
semanticFormatterCallback: (d) => d.toString(),
|
2021-04-18 09:18:23 +02:00
|
|
|
onChanged: controller.changeFontSizeFactor,
|
2021-04-09 18:26:44 +02:00
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2020-11-25 20:39:54 +01:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|