moved center button size to the bar itself

This commit is contained in:
Vadim 2024-05-03 11:32:22 +02:00
parent 41353c9383
commit 04bd00b2c0
3 changed files with 40 additions and 43 deletions

View file

@ -55,33 +55,30 @@ class _MeteringMeasureButtonState extends State<MeteringMeasureButton> {
_isPressed = false; _isPressed = false;
}); });
}, },
child: SizedBox.fromSize( child: Stack(
size: const Size.square(Dimens.grid72), children: [
child: Stack( Center(
children: [ child: AnimatedScale(
Center( duration: Dimens.durationS,
child: AnimatedScale( scale: _isPressed ? 0.9 : 1.0,
duration: Dimens.durationS, child: FilledCircle(
scale: _isPressed ? 0.9 : 1.0, color: Theme.of(context).colorScheme.onSurface,
child: FilledCircle( size: Dimens.grid72 - Dimens.grid8,
color: Theme.of(context).colorScheme.onSurface, child: Center(
size: Dimens.grid72 - Dimens.grid8, child: widget.ev != null ? _EvValueText(ev: widget.ev!, ev100: widget.ev100!) : null,
child: Center(
child: widget.ev != null ? _EvValueText(ev: widget.ev!, ev100: widget.ev100!) : null,
),
), ),
), ),
), ),
Positioned.fill( ),
child: CircularProgressIndicator( Positioned.fill(
/// This key is needed to make indicator start from the same point every time child: CircularProgressIndicator(
key: ValueKey(widget.isMetering), /// This key is needed to make indicator start from the same point every time
color: Theme.of(context).colorScheme.onSurface, key: ValueKey(widget.isMetering),
value: widget.isMetering ? null : 1, color: Theme.of(context).colorScheme.onSurface,
), value: widget.isMetering ? null : 1,
), ),
], ),
), ],
), ),
); );
} }

View file

@ -3,8 +3,8 @@ import 'package:lightmeter/res/dimens.dart';
class BottomControlsBar extends StatelessWidget { class BottomControlsBar extends StatelessWidget {
final Widget center; final Widget center;
final IconButton? left; final Widget? left;
final IconButton? right; final Widget? right;
const BottomControlsBar({ const BottomControlsBar({
required this.center, required this.center,
@ -42,7 +42,10 @@ class BottomControlsBar extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
if (left != null) Expanded(child: Center(child: left)) else const Spacer(), if (left != null) Expanded(child: Center(child: left)) else const Spacer(),
center, SizedBox.fromSize(
size: const Size.square(Dimens.grid72),
child: center,
),
if (right != null) Expanded(child: Center(child: right)) else const Spacer(), if (right != null) Expanded(child: Center(child: right)) else const Spacer(),
], ],
), ),

View file

@ -75,7 +75,6 @@ class _TimerScreenState extends State<TimerScreen> with TickerProviderStateMixin
fontSize: Dimens.grid24, fontSize: Dimens.grid24,
), ),
), ),
actions: [if (Navigator.of(context).canPop()) const CloseButton()],
), ),
body: SafeArea( body: SafeArea(
bottom: false, bottom: false,
@ -108,25 +107,23 @@ class _TimerScreenState extends State<TimerScreen> with TickerProviderStateMixin
}, },
icon: const Icon(Icons.restore), icon: const Icon(Icons.restore),
), ),
center: SizedBox.fromSize( center: BlocBuilder<TimerBloc, TimerState>(
size: const Size.square(Dimens.grid72), builder: (_, state) => FloatingActionButton(
child: BlocBuilder<TimerBloc, TimerState>( shape: state is TimerResumedState ? null : const CircleBorder(),
builder: (_, state) => FloatingActionButton( onPressed: () {
shape: state is TimerResumedState ? null : const CircleBorder(), if (timelineAnimation.value == 0) {
onPressed: () { return;
if (timelineAnimation.value == 0) { }
return; final event = state is TimerStoppedState ? const StartTimerEvent() : const StopTimerEvent();
} context.read<TimerBloc>().add(event);
final event = state is TimerStoppedState ? const StartTimerEvent() : const StopTimerEvent(); },
context.read<TimerBloc>().add(event); child: AnimatedIcon(
}, icon: AnimatedIcons.play_pause,
child: AnimatedIcon( progress: startStopIconAnimation,
icon: AnimatedIcons.play_pause,
progress: startStopIconAnimation,
),
), ),
), ),
), ),
right: Navigator.of(context).canPop() ? const CloseButton() : null,
), ),
], ],
), ),