feat: Use Android system accent color

This commit is contained in:
Krille Fear 2022-12-24 11:48:48 +01:00
commit a35229bf7d
11 changed files with 183 additions and 113 deletions

View file

@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:adaptive_theme/adaptive_theme.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:fluffychat/widgets/layouts/max_width_body.dart';
@ -15,7 +14,6 @@ class SettingsStyleView extends StatelessWidget {
@override
Widget build(BuildContext context) {
controller.currentTheme ??= AdaptiveTheme.of(context).mode;
const colorPickerSize = 32.0;
final wallpaper = Matrix.of(context).wallpaper;
return Scaffold(
@ -63,8 +61,7 @@ class SettingsStyleView extends StatelessWidget {
child: SizedBox(
width: colorPickerSize,
height: colorPickerSize,
child: AppConfig.colorSchemeSeed?.value ==
color.value
child: controller.currentColor == color
? const Center(
child: Icon(
Icons.check,
@ -80,21 +77,21 @@ class SettingsStyleView extends StatelessWidget {
),
),
const Divider(height: 1),
RadioListTile<AdaptiveThemeMode>(
RadioListTile<ThemeMode>(
groupValue: controller.currentTheme,
value: AdaptiveThemeMode.system,
value: ThemeMode.system,
title: Text(L10n.of(context)!.systemTheme),
onChanged: controller.switchTheme,
),
RadioListTile<AdaptiveThemeMode>(
RadioListTile<ThemeMode>(
groupValue: controller.currentTheme,
value: AdaptiveThemeMode.light,
value: ThemeMode.light,
title: Text(L10n.of(context)!.lightTheme),
onChanged: controller.switchTheme,
),
RadioListTile<AdaptiveThemeMode>(
RadioListTile<ThemeMode>(
groupValue: controller.currentTheme,
value: AdaptiveThemeMode.dark,
value: ThemeMode.dark,
title: Text(L10n.of(context)!.darkTheme),
onChanged: controller.switchTheme,
),