adjusted some colors

This commit is contained in:
Vadim 2023-01-30 14:15:36 +03:00
parent 48d8439216
commit 31b7528e64
9 changed files with 81 additions and 61 deletions

View file

@ -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,
);
}

View file

@ -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),
),
),
),
);
}
}

View file

@ -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,
),
);
}
}

View file

@ -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>() != EvSourceType.camera
child: Center(
child: IconButton(
onPressed: onSwitchEvSourceType,
icon: Icon(context.watch<EvSourceType>() != EvSourceType.camera
? Icons.camera_rear
: Icons.wb_incandescent,
: Icons.wb_incandescent),
),
),
)
else
@ -49,9 +50,11 @@ class MeteringBottomControls extends StatelessWidget {
onTap: onMeasure,
),
Expanded(
child: MeteringSecondaryButton(
child: Center(
child: IconButton(
onPressed: onSettings,
icon: Icons.settings,
icon: const Icon(Icons.settings),
),
),
),
],

View file

@ -141,14 +141,8 @@ class AnimatedDialogState extends State<AnimatedDialog> 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,
),
),
),
);
}

View file

@ -12,12 +12,10 @@ class ReadingValue {
}
class ReadingValueContainer extends StatelessWidget {
final Color? backgroundColor;
late final List<Widget> _items;
ReadingValueContainer({
required List<ReadingValue> 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(

View file

@ -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(),
),
),

View file

@ -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<MeteringScreen> {
),
),
),
MeteringBottomControls(
MeteringBottomControlsProvider(
onSwitchEvSourceType: context.read<Environment>().hasLightSensor
? EvSourceTypeProvider.of(context).toggleType
: null,

View file

@ -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,