This commit is contained in:
lollipopkit
2023-09-23 10:54:42 +08:00
parent f2981c5b15
commit 5a9fd74470
22 changed files with 117 additions and 136 deletions

View File

@@ -310,10 +310,13 @@ class _SettingPageState extends State<SettingPage> {
Widget _buildAppColor() {
return ListTile(
trailing: ClipOval(
child: Container(
color: primaryColor,
height: 27,
width: 27,
child: ValueBuilder(
listenable: _selectedColorValue,
build: () => Container(
color: primaryColor,
height: 27,
width: 27,
),
),
),
title: Text(l10n.primaryColorSeed),
@@ -368,9 +371,11 @@ class _SettingPageState extends State<SettingPage> {
context.showSnackBar(l10n.failed);
return;
}
// Change [primaryColor] first, then change [_selectedColorValue],
// So the [ValueBuilder] will be triggered with the new value
primaryColor = color;
_selectedColorValue.value = color.value;
_setting.primaryColor.put(_selectedColorValue.value);
primaryColor = color;
context.pop();
RebuildNodes.app.rebuild();
}