hide DynamicColorListTile if unavailable

This commit is contained in:
Vadim 2023-01-30 11:38:49 +03:00
parent 8a4f141cf2
commit ca5b30a026
2 changed files with 7 additions and 18 deletions

View file

@ -9,20 +9,6 @@ class DynamicColorListTile extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (context.read<DynamicColorState>() == DynamicColorState.unavailable) {
return Opacity(
opacity: 0.5,
child: IgnorePointer(
child: SwitchListTile(
secondary: const Icon(Icons.colorize),
title: Text(S.of(context).dynamicColor),
value: false,
enableFeedback: false,
onChanged: (value) {},
),
),
);
}
return SwitchListTile( return SwitchListTile(
secondary: const Icon(Icons.colorize), secondary: const Icon(Icons.colorize),
title: Text(S.of(context).dynamicColor), title: Text(S.of(context).dynamicColor),

View file

@ -1,6 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:lightmeter/data/models/dynamic_colors_state.dart';
import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/res/dimens.dart'; import 'package:lightmeter/res/dimens.dart';
import 'package:provider/provider.dart';
import 'components/calibration/widget_list_tile_calibration.dart'; import 'components/calibration/widget_list_tile_calibration.dart';
import 'components/haptics/provider_list_tile_haptics.dart'; import 'components/haptics/provider_list_tile_haptics.dart';
@ -64,10 +66,11 @@ class SettingsScreen extends StatelessWidget {
), ),
SettingsSection( SettingsSection(
title: S.of(context).theme, title: S.of(context).theme,
children: const [ children: [
ThemeTypeListTile(), const ThemeTypeListTile(),
PrimaryColorListTile(), const PrimaryColorListTile(),
DynamicColorListTile(), if (context.read<DynamicColorState>() != DynamicColorState.unavailable)
const DynamicColorListTile(),
], ],
), ),
SettingsSection( SettingsSection(