mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-10-19 06:40:59 +00:00
5c27f726c5
* wip * added start/stop button * animated timeline * fixed timer stop state * added reset button (wip) * added `onExposurePairTap` callback * integrated `TimerScreen` to navigation * separated `TimerTimeline` * fixed timeline flickering * added milliseconds to timer * synchronized timeline with actual timer * reused `BottomControlsBar` * fixed default scaffold background color * moved center button size to the bar itself * display selected exposure pair on timer screen * separated reusable `AnimatedCircluarButton` * release camera when timer is opened * added `TimerInteractor` * added `TimerBloc` test * fixed hours parsing * added scenarios for timer golden test * adjusted timer timeline colors * show iso & nd values on timer screen * automatically close timer screen after timeout * added timer autostart * reverted theme changes * updated goldens * typo * removed timer screen auto-dismiss * increased timer vibration duration * replaced outlined locks * increased 1/3 values font size
80 lines
2.1 KiB
Dart
80 lines
2.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:lightmeter/res/dimens.dart';
|
|
import 'package:lightmeter/screens/shared/filled_circle/widget_circle_filled.dart';
|
|
|
|
class AnimatedCircluarButton extends StatefulWidget {
|
|
final double? progress;
|
|
final bool isPressed;
|
|
final VoidCallback onPressed;
|
|
final Widget? child;
|
|
|
|
const AnimatedCircluarButton({
|
|
this.progress = 1.0,
|
|
required this.isPressed,
|
|
required this.onPressed,
|
|
this.child,
|
|
super.key,
|
|
});
|
|
|
|
@override
|
|
State<AnimatedCircluarButton> createState() => _AnimatedCircluarButtonState();
|
|
}
|
|
|
|
class _AnimatedCircluarButtonState extends State<AnimatedCircluarButton> {
|
|
bool _isPressed = false;
|
|
|
|
@override
|
|
void didUpdateWidget(covariant AnimatedCircluarButton oldWidget) {
|
|
super.didUpdateWidget(oldWidget);
|
|
if (oldWidget.isPressed != widget.isPressed) {
|
|
_isPressed = widget.isPressed;
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GestureDetector(
|
|
onTap: widget.onPressed,
|
|
onTapDown: (_) {
|
|
setState(() {
|
|
_isPressed = true;
|
|
});
|
|
},
|
|
onTapUp: (_) {
|
|
setState(() {
|
|
_isPressed = false;
|
|
});
|
|
},
|
|
onTapCancel: () {
|
|
setState(() {
|
|
_isPressed = false;
|
|
});
|
|
},
|
|
child: Stack(
|
|
children: [
|
|
Center(
|
|
child: AnimatedScale(
|
|
duration: Dimens.durationS,
|
|
scale: _isPressed ? 0.9 : 1.0,
|
|
child: FilledCircle(
|
|
color: Theme.of(context).colorScheme.onSurface,
|
|
size: Dimens.grid72 - Dimens.grid8,
|
|
child: Center(
|
|
child: widget.child,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Positioned.fill(
|
|
child: CircularProgressIndicator(
|
|
/// This key is needed to make indicator start from the same point every time
|
|
key: ValueKey(widget.progress),
|
|
color: Theme.of(context).colorScheme.onSurface,
|
|
value: widget.progress,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|