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

View file

@ -16,40 +16,27 @@ class BottomControlsBar extends StatelessWidget {
@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)),
),
return ClipRRect(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(Dimens.borderRadiusL),
topRight: Radius.circular(Dimens.borderRadiusL),
),
child: ClipRRect(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(Dimens.borderRadiusL),
topRight: Radius.circular(Dimens.borderRadiusL),
),
child: ColoredBox(
color: Theme.of(context).colorScheme.surfaceElevated1,
child: SafeArea(
top: false,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: Dimens.paddingL),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
if (left != null) Expanded(child: Center(child: left)) else const Spacer(),
SizedBox.fromSize(
size: const Size.square(Dimens.grid72),
child: center,
),
if (right != null) Expanded(child: Center(child: right)) else const Spacer(),
],
),
child: ColoredBox(
color: Theme.of(context).colorScheme.surfaceElevated1,
child: SafeArea(
top: false,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: Dimens.paddingL),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
if (left != null) Expanded(child: Center(child: left)) 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_bloc/flutter_bloc.dart';
import 'package:lightmeter/data/models/exposure_pair.dart';
import 'package:lightmeter/generated/l10n.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/bottom_controls_bar/widget_bottom_controls_bar.dart';
@ -94,7 +95,7 @@ class TimerScreenState extends State<TimerScreen> with TickerProviderStateMixin
),
const Spacer(),
BottomControlsBar(
left: IconButton(
left: IconButton.filledTonal(
onPressed: () {
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,
),
),
],
),