use filled tonal icon buttons

This commit is contained in:
Vadim 2024-05-07 20:18:05 +02:00
parent 4a27c27270
commit 5e764d3876
3 changed files with 29 additions and 37 deletions

View file

@ -28,7 +28,7 @@ class MeteringBottomControls extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BottomControlsBar( return BottomControlsBar(
left: onSwitchEvSourceType != null left: onSwitchEvSourceType != null
? IconButton( ? IconButton.filledTonal(
onPressed: onSwitchEvSourceType, onPressed: onSwitchEvSourceType,
icon: Icon( icon: Icon(
UserPreferencesProvider.evSourceTypeOf(context) != EvSourceType.camera UserPreferencesProvider.evSourceTypeOf(context) != EvSourceType.camera
@ -46,7 +46,7 @@ class MeteringBottomControls extends StatelessWidget {
onPressed: onMeasure, onPressed: onMeasure,
child: ev != null ? _EvValueText(ev: ev!, ev100: ev100!) : null, child: ev != null ? _EvValueText(ev: ev!, ev100: ev100!) : null,
), ),
right: IconButton( right: IconButton.filledTonal(
onPressed: onSettings, onPressed: onSettings,
icon: const Icon(Icons.settings), icon: const Icon(Icons.settings),
tooltip: S.of(context).tooltipOpenSettings, tooltip: S.of(context).tooltipOpenSettings,

View file

@ -16,40 +16,27 @@ class BottomControlsBar extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final scheme = Theme.of(context).colorScheme; return ClipRRect(
return IconButtonTheme( borderRadius: const BorderRadius.only(
data: IconButtonThemeData( topLeft: Radius.circular(Dimens.borderRadiusL),
style: ButtonStyle( topRight: Radius.circular(Dimens.borderRadiusL),
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: ClipRRect( child: ColoredBox(
borderRadius: const BorderRadius.only( color: Theme.of(context).colorScheme.surfaceElevated1,
topLeft: Radius.circular(Dimens.borderRadiusL), child: SafeArea(
topRight: Radius.circular(Dimens.borderRadiusL), top: false,
), child: Padding(
child: ColoredBox( padding: const EdgeInsets.symmetric(vertical: Dimens.paddingL),
color: Theme.of(context).colorScheme.surfaceElevated1, child: Row(
child: SafeArea( mainAxisAlignment: MainAxisAlignment.spaceEvenly,
top: false, children: [
child: Padding( if (left != null) Expanded(child: Center(child: left)) else const Spacer(),
padding: const EdgeInsets.symmetric(vertical: Dimens.paddingL), SizedBox.fromSize(
child: Row( size: const Size.square(Dimens.grid72),
mainAxisAlignment: MainAxisAlignment.spaceEvenly, child: center,
children: [ ),
if (left != null) Expanded(child: Center(child: left)) else const Spacer(), if (right != null) Expanded(child: Center(child: right)) else const Spacer(),
SizedBox.fromSize( ],
size: const Size.square(Dimens.grid72),
child: center,
),
if (right != null) Expanded(child: Center(child: right)) else const Spacer(),
],
),
), ),
), ),
), ),

View file

@ -1,6 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:lightmeter/data/models/exposure_pair.dart'; import 'package:lightmeter/data/models/exposure_pair.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/res/dimens.dart'; import 'package:lightmeter/res/dimens.dart';
import 'package:lightmeter/screens/shared/animated_circular_button/widget_button_circular_animated.dart'; import 'package:lightmeter/screens/shared/animated_circular_button/widget_button_circular_animated.dart';
import 'package:lightmeter/screens/shared/bottom_controls_bar/widget_bottom_controls_bar.dart'; import 'package:lightmeter/screens/shared/bottom_controls_bar/widget_bottom_controls_bar.dart';
@ -94,7 +95,7 @@ class TimerScreenState extends State<TimerScreen> with TickerProviderStateMixin
), ),
const Spacer(), const Spacer(),
BottomControlsBar( BottomControlsBar(
left: IconButton( left: IconButton.filledTonal(
onPressed: () { onPressed: () {
context.read<TimerBloc>().add(const ResetTimerEvent()); context.read<TimerBloc>().add(const ResetTimerEvent());
}, },
@ -117,7 +118,11 @@ class TimerScreenState extends State<TimerScreen> with TickerProviderStateMixin
), ),
), ),
), ),
right: const CloseButton(), right: IconButton.filledTonal(
onPressed: Navigator.of(context).pop,
icon: const Icon(Icons.close),
tooltip: S.of(context).tooltipClose,
),
), ),
], ],
), ),