diff --git a/lib/providers/theme_provider.dart b/lib/providers/theme_provider.dart index 6a1a47c..c8cf228 100644 --- a/lib/providers/theme_provider.dart +++ b/lib/providers/theme_provider.dart @@ -4,6 +4,7 @@ import 'package:flutter/scheduler.dart'; import 'package:lightmeter/data/models/dynamic_colors_state.dart'; import 'package:lightmeter/data/models/theme_type.dart'; import 'package:lightmeter/data/shared_prefs_service.dart'; +import 'package:lightmeter/res/dimens.dart'; import 'package:material_color_utilities/material_color_utilities.dart'; import 'package:provider/provider.dart'; @@ -174,12 +175,31 @@ class _ThemeDataProvider extends StatelessWidget { brightness: scheme.brightness, primaryColor: primaryColor, colorScheme: scheme, + appBarTheme: AppBarTheme( + elevation: 4, + color: scheme.surface, + surfaceTintColor: scheme.surfaceTint, + ), + cardTheme: CardTheme( + clipBehavior: Clip.antiAlias, + color: scheme.surface, + elevation: 4, + margin: EdgeInsets.zero, + shadowColor: Colors.transparent, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(Dimens.borderRadiusL)), + surfaceTintColor: scheme.surfaceTint, + ), dialogBackgroundColor: scheme.surface, dialogTheme: DialogTheme( backgroundColor: scheme.surface, surfaceTintColor: scheme.surfaceTint, elevation: 6, ), + listTileTheme: ListTileThemeData( + style: ListTileStyle.list, + iconColor: scheme.onSurface, + textColor: scheme.onSurface, + ), scaffoldBackgroundColor: scheme.surface, ); } diff --git a/lib/screens/metering/components/bottom_controls/components/secondary_button/widget_button_secondary.dart b/lib/screens/metering/components/bottom_controls/components/secondary_button/widget_button_secondary.dart deleted file mode 100644 index 5bed4c5..0000000 --- a/lib/screens/metering/components/bottom_controls/components/secondary_button/widget_button_secondary.dart +++ /dev/null @@ -1,31 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:lightmeter/res/dimens.dart'; -import 'package:lightmeter/screens/shared/filled_circle/widget_circle_filled.dart'; - -class MeteringSecondaryButton extends StatelessWidget { - final IconData icon; - final VoidCallback onPressed; - - const MeteringSecondaryButton({ - required this.icon, - required this.onPressed, - super.key, - }); - - @override - Widget build(BuildContext context) { - return Center( - child: FilledCircle( - color: Theme.of(context).colorScheme.surfaceVariant, - size: Dimens.grid48, - child: Center( - child: IconButton( - onPressed: onPressed, - color: Theme.of(context).colorScheme.onSurface, - icon: Icon(icon), - ), - ), - ), - ); - } -} diff --git a/lib/screens/metering/components/bottom_controls/provider_bottom_controls.dart b/lib/screens/metering/components/bottom_controls/provider_bottom_controls.dart new file mode 100644 index 0000000..fe88167 --- /dev/null +++ b/lib/screens/metering/components/bottom_controls/provider_bottom_controls.dart @@ -0,0 +1,39 @@ +import 'package:flutter/material.dart'; +import 'package:lightmeter/res/dimens.dart'; + +import 'widget_bottom_controls.dart'; + +class MeteringBottomControlsProvider extends StatelessWidget { + final VoidCallback? onSwitchEvSourceType; + final VoidCallback onMeasure; + final VoidCallback onSettings; + + const MeteringBottomControlsProvider({ + required this.onSwitchEvSourceType, + required this.onMeasure, + required this.onSettings, + super.key, + }); + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + return IconButtonTheme( + data: IconButtonThemeData( + style: ButtonStyle( + backgroundColor: MaterialStatePropertyAll(scheme.surface), + elevation: const MaterialStatePropertyAll(4), + iconColor: MaterialStatePropertyAll(scheme.onSurface), + shadowColor: const MaterialStatePropertyAll(Colors.transparent), + surfaceTintColor: MaterialStatePropertyAll(scheme.surfaceTint), + fixedSize: const MaterialStatePropertyAll(Size(Dimens.grid48, Dimens.grid48)), + ), + ), + child: MeteringBottomControls( + onSwitchEvSourceType: onSwitchEvSourceType, + onMeasure: onMeasure, + onSettings: onSettings, + ), + ); + } +} diff --git a/lib/screens/metering/components/bottom_controls/widget_bottom_controls.dart b/lib/screens/metering/components/bottom_controls/widget_bottom_controls.dart index 5f89cea..9f3f0a2 100644 --- a/lib/screens/metering/components/bottom_controls/widget_bottom_controls.dart +++ b/lib/screens/metering/components/bottom_controls/widget_bottom_controls.dart @@ -4,7 +4,6 @@ import 'package:lightmeter/res/dimens.dart'; import 'package:provider/provider.dart'; import 'components/measure_button/widget_button_measure.dart'; -import 'components/secondary_button/widget_button_secondary.dart'; class MeteringBottomControls extends StatelessWidget { final VoidCallback? onSwitchEvSourceType; @@ -36,11 +35,13 @@ class MeteringBottomControls extends StatelessWidget { children: [ if (onSwitchEvSourceType != null) Expanded( - child: MeteringSecondaryButton( - onPressed: onSwitchEvSourceType!, - icon: context.watch() != EvSourceType.camera - ? Icons.camera_rear - : Icons.wb_incandescent, + child: Center( + child: IconButton( + onPressed: onSwitchEvSourceType, + icon: Icon(context.watch() != EvSourceType.camera + ? Icons.camera_rear + : Icons.wb_incandescent), + ), ), ) else @@ -49,9 +50,11 @@ class MeteringBottomControls extends StatelessWidget { onTap: onMeasure, ), Expanded( - child: MeteringSecondaryButton( - onPressed: onSettings, - icon: Icons.settings, + child: Center( + child: IconButton( + onPressed: onSettings, + icon: const Icon(Icons.settings), + ), ), ), ], diff --git a/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/components/animated_dialog/widget_dialog_animated.dart b/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/components/animated_dialog/widget_dialog_animated.dart index 276f83a..068804e 100644 --- a/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/components/animated_dialog/widget_dialog_animated.dart +++ b/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/components/animated_dialog/widget_dialog_animated.dart @@ -141,13 +141,7 @@ class AnimatedDialogState extends State with SingleTickerProvide onTap: _openDialog, child: Opacity( opacity: _isDialogShown ? 0 : 1, - child: ClipRRect( - borderRadius: BorderRadius.circular(Dimens.borderRadiusM), - child: ColoredBox( - color: Theme.of(context).colorScheme.primaryContainer, - child: widget.child ?? widget.closedChild, - ), - ), + child: widget.child ?? widget.closedChild, ), ); } diff --git a/lib/screens/metering/components/shared/readings_container/components/reading_value_container/widget_container_reading_value.dart b/lib/screens/metering/components/shared/readings_container/components/reading_value_container/widget_container_reading_value.dart index e973beb..d1c55c7 100644 --- a/lib/screens/metering/components/shared/readings_container/components/reading_value_container/widget_container_reading_value.dart +++ b/lib/screens/metering/components/shared/readings_container/components/reading_value_container/widget_container_reading_value.dart @@ -12,12 +12,10 @@ class ReadingValue { } class ReadingValueContainer extends StatelessWidget { - final Color? backgroundColor; late final List _items; ReadingValueContainer({ required List values, - this.backgroundColor, super.key, }) { _items = []; @@ -31,7 +29,6 @@ class ReadingValueContainer extends StatelessWidget { ReadingValueContainer.singleValue({ required ReadingValue value, - this.backgroundColor, super.key, }) : _items = [_ReadingValueBuilder(value)]; @@ -40,7 +37,7 @@ class ReadingValueContainer extends StatelessWidget { return ClipRRect( borderRadius: BorderRadius.circular(Dimens.borderRadiusM), child: ColoredBox( - color: backgroundColor ?? Theme.of(context).colorScheme.primaryContainer, + color: Theme.of(context).colorScheme.primaryContainer, child: Padding( padding: const EdgeInsets.all(Dimens.paddingM), child: Column( 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 28c7028..9815034 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 @@ -89,7 +89,6 @@ class _IsoValueTile extends StatelessWidget { evDifferenceBuilder: (selected, other) => selected.toStringDifference(other), onChanged: onChanged, closedChild: ReadingValueContainer.singleValue( - backgroundColor: null, value: ReadingValue( label: S.of(context).iso, value: value.value.toString(), @@ -119,9 +118,8 @@ class _NdValueTile extends StatelessWidget { evDifferenceBuilder: (selected, other) => other.toStringDifference(selected), onChanged: onChanged, closedChild: ReadingValueContainer.singleValue( - backgroundColor: null, value: ReadingValue( - label: S.of(context).iso, + label: S.of(context).nd, value: value.value.toString(), ), ), diff --git a/lib/screens/metering/screen_metering.dart b/lib/screens/metering/screen_metering.dart index 2dba320..465b5bb 100644 --- a/lib/screens/metering/screen_metering.dart +++ b/lib/screens/metering/screen_metering.dart @@ -5,7 +5,7 @@ import 'package:lightmeter/data/models/photography_values/photography_value.dart import 'package:lightmeter/environment.dart'; import 'package:lightmeter/providers/ev_source_type_provider.dart'; -import 'components/bottom_controls/widget_bottom_controls.dart'; +import 'components/bottom_controls/provider_bottom_controls.dart'; import 'components/camera_container/provider_container_camera.dart'; import 'components/light_sensor_container/provider_container_light_sensor.dart'; import 'bloc_metering.dart'; @@ -57,7 +57,7 @@ class _MeteringScreenState extends State { ), ), ), - MeteringBottomControls( + MeteringBottomControlsProvider( onSwitchEvSourceType: context.read().hasLightSensor ? EvSourceTypeProvider.of(context).toggleType : null, diff --git a/lib/screens/settings/components/shared/settings_section/widget_settings_section.dart b/lib/screens/settings/components/shared/settings_section/widget_settings_section.dart index 134dbdd..3bce4d8 100644 --- a/lib/screens/settings/components/shared/settings_section/widget_settings_section.dart +++ b/lib/screens/settings/components/shared/settings_section/widget_settings_section.dart @@ -20,10 +20,7 @@ class SettingsSection extends StatelessWidget { Dimens.paddingM, Dimens.paddingM, ), - child: Material( - clipBehavior: Clip.antiAlias, - borderRadius: BorderRadius.circular(Dimens.borderRadiusL), - color: Theme.of(context).colorScheme.primaryContainer, + child: Card( child: Padding( padding: const EdgeInsets.symmetric(vertical: Dimens.paddingM), child: Column( @@ -34,7 +31,10 @@ class SettingsSection extends StatelessWidget { padding: const EdgeInsets.only(left: Dimens.paddingM), child: Text( title, - style: Theme.of(context).textTheme.labelLarge, + style: Theme.of(context) + .textTheme + .labelLarge + ?.copyWith(color: Theme.of(context).colorScheme.onSurface), ), ), ...children,