diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index bd61598..dbb189c 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -42,7 +42,9 @@ "meteringScreenFeatureHistogram": "Histogram", "cameraFeatures": "Camera features", "cameraFeatureSpotMetering": "Spot metering", + "cameraFeatureSpotMeteringHint": "Long press the camera view to remove metering spot", "cameraFeatureHistogram": "Histogram", + "cameraFeatureHistogramHint": "Enabling histogram can encrease battery drain", "film": "Film", "filmPush": "Film (push)", "filmPull": "Film (pull)", diff --git a/lib/res/theme.dart b/lib/res/theme.dart index a6320c1..52e0e92 100644 --- a/lib/res/theme.dart +++ b/lib/res/theme.dart @@ -23,7 +23,7 @@ const primaryColorsList = [ ThemeData themeFrom(Color primaryColor, Brightness brightness) { final scheme = _colorSchemeFromColor(primaryColor, brightness); - return ThemeData( + final theme = ThemeData( useMaterial3: true, brightness: scheme.brightness, primaryColor: primaryColor, @@ -60,12 +60,18 @@ ThemeData themeFrom(Color primaryColor, Brightness brightness) { ), scaffoldBackgroundColor: scheme.surface, ); + return theme.copyWith( + listTileTheme: ListTileThemeData( + style: ListTileStyle.list, + iconColor: scheme.onSurface, + textColor: scheme.onSurface, + subtitleTextStyle: theme.textTheme.bodyMedium!.copyWith(color: scheme.onSurfaceVariant), + ), + ); } ColorScheme _colorSchemeFromColor(Color primaryColor, Brightness brightness) { - final scheme = brightness == Brightness.light - ? Scheme.light(primaryColor.value) - : Scheme.dark(primaryColor.value); + final scheme = brightness == Brightness.light ? Scheme.light(primaryColor.value) : Scheme.dark(primaryColor.value); return ColorScheme( brightness: brightness, diff --git a/lib/screens/settings/components/metering/components/camera_features/widget_list_tile_camera_features.dart b/lib/screens/settings/components/metering/components/camera_features/widget_list_tile_camera_features.dart index 9790d30..de0926d 100644 --- a/lib/screens/settings/components/metering/components/camera_features/widget_list_tile_camera_features.dart +++ b/lib/screens/settings/components/metering/components/camera_features/widget_list_tile_camera_features.dart @@ -19,20 +19,26 @@ class CameraFeaturesListTile extends StatelessWidget { icon: Icons.layers_outlined, title: S.of(context).cameraFeatures, values: UserPreferencesProvider.cameraConfigOf(context), - titleAdapter: _toStringLocalized, + titleAdapter: (context, feature) { + switch (feature) { + case CameraFeature.spotMetering: + return S.of(context).cameraFeatureSpotMetering; + case CameraFeature.histogram: + return S.of(context).cameraFeatureHistogram; + } + }, + subtitleAdapter: (context, feature) { + switch (feature) { + case CameraFeature.spotMetering: + return S.of(context).cameraFeatureSpotMeteringHint; + case CameraFeature.histogram: + return S.of(context).cameraFeatureHistogramHint; + } + }, onSave: UserPreferencesProvider.of(context).setCameraFeature, ), ); }, ); } - - String _toStringLocalized(BuildContext context, CameraFeature feature) { - switch (feature) { - case CameraFeature.spotMetering: - return S.of(context).cameraFeatureSpotMetering; - case CameraFeature.histogram: - return S.of(context).cameraFeatureHistogram; - } - } } diff --git a/lib/screens/settings/components/shared/dialog_switch/widget_dialog_switch.dart b/lib/screens/settings/components/shared/dialog_switch/widget_dialog_switch.dart index 4f7b58a..aa3a370 100644 --- a/lib/screens/settings/components/shared/dialog_switch/widget_dialog_switch.dart +++ b/lib/screens/settings/components/shared/dialog_switch/widget_dialog_switch.dart @@ -2,12 +2,15 @@ import 'package:flutter/material.dart'; import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/res/dimens.dart'; +typedef StringAdapter = String Function(BuildContext context, T value); + class DialogSwitch extends StatefulWidget { final IconData icon; final String title; final String? description; final Map values; - final String Function(BuildContext context, T value) titleAdapter; + final StringAdapter titleAdapter; + final StringAdapter? subtitleAdapter; final ValueChanged> onSave; const DialogSwitch({ @@ -16,6 +19,7 @@ class DialogSwitch extends StatefulWidget { this.description, required this.values, required this.titleAdapter, + this.subtitleAdapter, required this.onSave, super.key, }); @@ -53,6 +57,12 @@ class _DialogSwitchState extends State> { (entry) => SwitchListTile( contentPadding: EdgeInsets.symmetric(horizontal: Dimens.dialogTitlePadding.left), title: Text(widget.titleAdapter(context, entry.key)), + subtitle: widget.subtitleAdapter != null + ? Text( + widget.subtitleAdapter!.call(context, entry.key), + style: Theme.of(context).listTileTheme.subtitleTextStyle, + ) + : null, value: _features[entry.key]!, onChanged: (value) { setState(() {