From a875a9c8a83afaf9a8e6bb117a8e7aa893607e1a Mon Sep 17 00:00:00 2001 From: Vadim Date: Tue, 4 Apr 2023 18:22:55 +0300 Subject: [PATCH] added icons to all dialogs --- .../dialog_picker/widget_picker_dialog.dart | 35 +++++++++++++------ .../widget_picker_dialog_animated.dart | 3 ++ .../widget_container_readings.dart | 4 +++ .../language/widget_list_tile_language.dart | 1 + .../widget_dialog_calibration.dart | 3 +- .../widget_dialog_equipment_profile_name.dart | 3 ++ .../widget_list_tile_fractional_stops.dart | 1 + .../widget_dialog_picker.dart | 5 ++- .../widget_dialog_picker_primary_color.dart | 3 +- .../widget_list_tile_theme_type.dart | 1 + 10 files changed, 45 insertions(+), 14 deletions(-) diff --git a/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/components/dialog_picker/widget_picker_dialog.dart b/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/components/dialog_picker/widget_picker_dialog.dart index 62ba265..a5d6d45 100644 --- a/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/components/dialog_picker/widget_picker_dialog.dart +++ b/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/components/dialog_picker/widget_picker_dialog.dart @@ -6,6 +6,7 @@ typedef DialogPickerItemTitleBuilder = Widget Function(BuildContext context, typedef DialogPickerItemTrailingBuilder = Widget? Function(T selected, T value); class DialogPicker extends StatefulWidget { + final IconData icon; final String title; final String? subtitle; final T initialValue; @@ -16,6 +17,7 @@ class DialogPicker extends StatefulWidget { final ValueChanged onSelect; const DialogPicker({ + required this.icon, required this.title, this.subtitle, required this.initialValue, @@ -47,25 +49,36 @@ class _DialogPickerState extends State> { return Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - Padding( - padding: Dimens.dialogTitlePadding, - child: Column( - children: [ - Text( + Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Padding( + padding: Dimens.dialogTitlePadding, + child: Icon(widget.icon), + ), + Padding( + padding: Dimens.dialogIconTitlePadding, + child: Text( widget.title, style: Theme.of(context).textTheme.headlineSmall!, textAlign: TextAlign.center, ), - if (widget.subtitle != null) ...[ - const SizedBox(height: Dimens.grid16), - Text( + ), + if (widget.subtitle != null) + Padding( + padding: const EdgeInsets.fromLTRB( + Dimens.paddingL, + 0, + Dimens.paddingL, + Dimens.paddingM, + ), + child: Text( widget.subtitle!, style: Theme.of(context).textTheme.bodyMedium!, textAlign: TextAlign.center, ), - ] - ], - ), + ), + ], ), const Divider(), Expanded( diff --git a/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/widget_picker_dialog_animated.dart b/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/widget_picker_dialog_animated.dart index 0bbdabc..0c3cd48 100644 --- a/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/widget_picker_dialog_animated.dart +++ b/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/widget_picker_dialog_animated.dart @@ -5,6 +5,7 @@ import 'components/dialog_picker/widget_picker_dialog.dart'; class AnimatedDialogPicker extends StatelessWidget { final _key = GlobalKey(); + final IconData icon; final String title; final String? subtitle; final T selectedValue; @@ -15,6 +16,7 @@ class AnimatedDialogPicker extends StatelessWidget { final Widget closedChild; AnimatedDialogPicker({ + required this.icon, required this.title, this.subtitle, required this.selectedValue, @@ -32,6 +34,7 @@ class AnimatedDialogPicker extends StatelessWidget { key: _key, closedChild: closedChild, openedChild: DialogPicker( + icon: icon, title: title, subtitle: subtitle, initialValue: selectedValue, diff --git a/lib/screens/metering/components/shared/readings_container/widget_container_readings.dart b/lib/screens/metering/components/shared/readings_container/widget_container_readings.dart index dc8a5f7..d443add 100644 --- a/lib/screens/metering/components/shared/readings_container/widget_container_readings.dart +++ b/lib/screens/metering/components/shared/readings_container/widget_container_readings.dart @@ -106,6 +106,7 @@ class _EquipmentProfilePicker extends StatelessWidget { @override Widget build(BuildContext context) { return AnimatedDialogPicker( + icon: Icons.camera, title: S.of(context).equipmentProfile, selectedValue: EquipmentProfile.of(context), values: EquipmentProfiles.of(context), @@ -137,6 +138,7 @@ class _FilmPicker extends StatelessWidget { @override Widget build(BuildContext context) { return AnimatedDialogPicker( + icon: Icons.camera_roll, title: S.of(context).film, selectedValue: selectedValue, values: values, @@ -166,6 +168,7 @@ class _IsoValuePicker extends StatelessWidget { @override Widget build(BuildContext context) { return AnimatedDialogPicker( + icon: Icons.iso, title: S.of(context).iso, subtitle: S.of(context).filmSpeed, selectedValue: selectedValue, @@ -200,6 +203,7 @@ class _NdValuePicker extends StatelessWidget { @override Widget build(BuildContext context) { return AnimatedDialogPicker( + icon: Icons.filter_b_and_w, title: S.of(context).nd, subtitle: S.of(context).ndFilterFactor, selectedValue: selectedValue, diff --git a/lib/screens/settings/components/general/components/language/widget_list_tile_language.dart b/lib/screens/settings/components/general/components/language/widget_list_tile_language.dart index 06c4e79..4bea398 100644 --- a/lib/screens/settings/components/general/components/language/widget_list_tile_language.dart +++ b/lib/screens/settings/components/general/components/language/widget_list_tile_language.dart @@ -18,6 +18,7 @@ class LanguageListTile extends StatelessWidget { showDialog( context: context, builder: (_) => DialogPicker( + icon: Icons.language, title: S.of(context).chooseLanguage, selectedValue: context.read(), values: SupportedLocale.values, diff --git a/lib/screens/settings/components/metering/components/calibration/components/calibration_dialog/widget_dialog_calibration.dart b/lib/screens/settings/components/metering/components/calibration/components/calibration_dialog/widget_dialog_calibration.dart index 62025ac..fc26df3 100644 --- a/lib/screens/settings/components/metering/components/calibration/components/calibration_dialog/widget_dialog_calibration.dart +++ b/lib/screens/settings/components/metering/components/calibration/components/calibration_dialog/widget_dialog_calibration.dart @@ -17,7 +17,8 @@ class CalibrationDialog extends StatelessWidget { Widget build(BuildContext context) { final bool hasLightSensor = context.read().hasLightSensor; return AlertDialog( - titlePadding: Dimens.dialogTitlePadding, + icon: const Icon(Icons.settings_brightness), + titlePadding: Dimens.dialogIconTitlePadding, title: Text(S.of(context).calibration), contentPadding: const EdgeInsets.symmetric(horizontal: Dimens.paddingL), content: SingleChildScrollView( diff --git a/lib/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_name_dialog/widget_dialog_equipment_profile_name.dart b/lib/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_name_dialog/widget_dialog_equipment_profile_name.dart index d202b94..e3014ac 100644 --- a/lib/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_name_dialog/widget_dialog_equipment_profile_name.dart +++ b/lib/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_name_dialog/widget_dialog_equipment_profile_name.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:lightmeter/generated/l10n.dart'; +import 'package:lightmeter/res/dimens.dart'; class EquipmentProfileNameDialog extends StatefulWidget { final String initialValue; @@ -22,6 +23,8 @@ class _EquipmentProfileNameDialogState extends State @override Widget build(BuildContext context) { return AlertDialog( + icon: const Icon(Icons.edit), + titlePadding: Dimens.dialogIconTitlePadding, title: Text(S.of(context).equipmentProfileName), content: TextField( autofocus: true, diff --git a/lib/screens/settings/components/metering/components/fractional_stops/widget_list_tile_fractional_stops.dart b/lib/screens/settings/components/metering/components/fractional_stops/widget_list_tile_fractional_stops.dart index d164430..65a6309 100644 --- a/lib/screens/settings/components/metering/components/fractional_stops/widget_list_tile_fractional_stops.dart +++ b/lib/screens/settings/components/metering/components/fractional_stops/widget_list_tile_fractional_stops.dart @@ -18,6 +18,7 @@ class StopTypeListTile extends StatelessWidget { showDialog( context: context, builder: (_) => DialogPicker( + icon: Icons.straighten, title: S.of(context).showFractionalStops, selectedValue: context.read(), values: StopType.values, diff --git a/lib/screens/settings/components/shared/dialog_picker.dart/widget_dialog_picker.dart b/lib/screens/settings/components/shared/dialog_picker.dart/widget_dialog_picker.dart index 8044fb4..c893027 100644 --- a/lib/screens/settings/components/shared/dialog_picker.dart/widget_dialog_picker.dart +++ b/lib/screens/settings/components/shared/dialog_picker.dart/widget_dialog_picker.dart @@ -3,12 +3,14 @@ import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/res/dimens.dart'; class DialogPicker extends StatefulWidget { + final IconData icon; final String title; final T selectedValue; final List values; final String Function(BuildContext context, T value) titleAdapter; const DialogPicker({ + required this.icon, required this.title, required this.selectedValue, required this.values, @@ -26,7 +28,8 @@ class _DialogPickerState extends State> { @override Widget build(BuildContext context) { return AlertDialog( - titlePadding: Dimens.dialogTitlePadding, + icon: Icon(widget.icon), + titlePadding: Dimens.dialogIconTitlePadding, title: Text(widget.title), contentPadding: EdgeInsets.zero, content: Column( diff --git a/lib/screens/settings/components/theme/components/primary_color/components/primary_color_picker_dialog/widget_dialog_picker_primary_color.dart b/lib/screens/settings/components/theme/components/primary_color/components/primary_color_picker_dialog/widget_dialog_picker_primary_color.dart index e2e6b8e..9a4dd07 100644 --- a/lib/screens/settings/components/theme/components/primary_color/components/primary_color_picker_dialog/widget_dialog_picker_primary_color.dart +++ b/lib/screens/settings/components/theme/components/primary_color/components/primary_color_picker_dialog/widget_dialog_picker_primary_color.dart @@ -24,7 +24,8 @@ class _PrimaryColorDialogPickerState extends State { @override Widget build(BuildContext context) { return AlertDialog( - titlePadding: Dimens.dialogTitlePadding, + icon: const Icon(Icons.palette), + titlePadding: Dimens.dialogIconTitlePadding, title: Text(S.of(context).choosePrimaryColor), content: SizedBox( height: Dimens.grid48, diff --git a/lib/screens/settings/components/theme/components/theme_type/widget_list_tile_theme_type.dart b/lib/screens/settings/components/theme/components/theme_type/widget_list_tile_theme_type.dart index 53df421..3c43224 100644 --- a/lib/screens/settings/components/theme/components/theme_type/widget_list_tile_theme_type.dart +++ b/lib/screens/settings/components/theme/components/theme_type/widget_list_tile_theme_type.dart @@ -18,6 +18,7 @@ class ThemeTypeListTile extends StatelessWidget { showDialog( context: context, builder: (_) => DialogPicker( + icon: Icons.brightness_6, title: S.of(context).chooseTheme, selectedValue: context.read(), values: ThemeType.values,