display selected exposure pair on timer screen

This commit is contained in:
Vadim 2024-05-03 12:04:54 +02:00
parent 04bd00b2c0
commit 43ab97f87f
6 changed files with 92 additions and 58 deletions

View file

@ -117,5 +117,6 @@
"tooltipResetToZero": "Reset to zero",
"tooltipUseLightSensor": "Use lightsensor",
"tooltipUseCamera": "Use camera",
"tooltipOpenSettings": "Open settings"
"tooltipOpenSettings": "Open settings",
"exposurePair": "Exposure pair"
}

View file

@ -117,5 +117,6 @@
"tooltipResetToZero": "Remise à zéro",
"tooltipUseLightSensor": "Utiliser un capteur de lumière",
"tooltipUseCamera": "Utiliser la caméra",
"tooltipOpenSettings": "Ouvrir les paramètres"
"tooltipOpenSettings": "Ouvrir les paramètres",
"exposurePair": "Paire d'exposition"
}

View file

@ -117,5 +117,6 @@
"tooltipResetToZero": "Сбросить до 0",
"tooltipUseLightSensor": "Использовать датчик освещенности",
"tooltipUseCamera": "Использовать камеру",
"tooltipOpenSettings": "Открыть настройки"
"tooltipOpenSettings": "Открыть настройки",
"exposurePair": "Пара экспозиции"
}

View file

@ -117,5 +117,6 @@
"resetToZero": "重置为零",
"tooltipUseLightSensor": "使用光线传感器",
"tooltipUseCamera": "使用摄像头",
"tooltipOpenSettings": "打开设置"
"tooltipOpenSettings": "打开设置",
"exposurePair": "曝光对"
}

View file

@ -0,0 +1,43 @@
import 'package:flutter/material.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/metering/components/shared/readings_container/components/shared/reading_value_container/widget_container_reading_value.dart';
class TimerMeteringConfig extends StatelessWidget {
final ExposurePair exposurePair;
const TimerMeteringConfig({
required this.exposurePair,
super.key,
});
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface,
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(Dimens.borderRadiusL),
bottomRight: Radius.circular(Dimens.borderRadiusL),
),
),
padding: const EdgeInsets.all(Dimens.paddingM),
child: SafeArea(
bottom: false,
child: Row(
children: [
Expanded(
child: ReadingValueContainer.singleValue(
value: ReadingValue(
label: S.of(context).exposurePair,
value: exposurePair.toString(),
),
),
),
],
),
),
);
}
}

View file

@ -4,6 +4,7 @@ import 'package:lightmeter/data/models/exposure_pair.dart';
import 'package:lightmeter/res/dimens.dart';
import 'package:lightmeter/screens/shared/bottom_controls_bar/widget_bottom_controls_bar.dart';
import 'package:lightmeter/screens/timer/bloc_timer.dart';
import 'package:lightmeter/screens/timer/components/metering_config/widget_metering_config_timer.dart';
import 'package:lightmeter/screens/timer/components/text/widget_text_timer.dart';
import 'package:lightmeter/screens/timer/components/timeline/widget_timeline_timer.dart';
import 'package:lightmeter/screens/timer/event_timer.dart';
@ -64,69 +65,55 @@ class _TimerScreenState extends State<TimerScreen> with TickerProviderStateMixin
listenWhen: (previous, current) => previous.runtimeType != current.runtimeType,
listener: (context, state) => _updateAnimations(state),
child: Scaffold(
appBar: AppBar(
automaticallyImplyLeading: false,
centerTitle: true,
elevation: 0,
title: Text(
widget.exposurePair.toString(),
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface,
fontSize: Dimens.grid24,
),
),
),
body: SafeArea(
bottom: false,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Spacer(),
Padding(
padding: const EdgeInsets.all(Dimens.paddingL),
child: SizedBox.fromSize(
size: Size.square(MediaQuery.sizeOf(context).width - Dimens.paddingL * 4),
child: ValueListenableBuilder(
valueListenable: timelineAnimation,
builder: (_, value, child) => TimerTimeline(
progress: value,
child: TimerText(
timeLeft: Duration(milliseconds: (widget.duration.inMilliseconds * value).toInt()),
duration: widget.duration,
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TimerMeteringConfig(exposurePair: widget.exposurePair),
const Spacer(),
Padding(
padding: const EdgeInsets.all(Dimens.paddingL),
child: SizedBox.fromSize(
size: Size.square(MediaQuery.sizeOf(context).width - Dimens.paddingL * 4),
child: ValueListenableBuilder(
valueListenable: timelineAnimation,
builder: (_, value, child) => TimerTimeline(
progress: value,
child: TimerText(
timeLeft: Duration(milliseconds: (widget.duration.inMilliseconds * value).toInt()),
duration: widget.duration,
),
),
),
),
const Spacer(),
BottomControlsBar(
left: IconButton(
),
const Spacer(),
BottomControlsBar(
left: IconButton(
onPressed: () {
context.read<TimerBloc>().add(const ResetTimerEvent());
},
icon: const Icon(Icons.restore),
),
center: BlocBuilder<TimerBloc, TimerState>(
builder: (_, state) => FloatingActionButton(
shape: state is TimerResumedState ? null : const CircleBorder(),
onPressed: () {
context.read<TimerBloc>().add(const ResetTimerEvent());
if (timelineAnimation.value == 0) {
return;
}
final event = state is TimerStoppedState ? const StartTimerEvent() : const StopTimerEvent();
context.read<TimerBloc>().add(event);
},
icon: const Icon(Icons.restore),
),
center: BlocBuilder<TimerBloc, TimerState>(
builder: (_, state) => FloatingActionButton(
shape: state is TimerResumedState ? null : const CircleBorder(),
onPressed: () {
if (timelineAnimation.value == 0) {
return;
}
final event = state is TimerStoppedState ? const StartTimerEvent() : const StopTimerEvent();
context.read<TimerBloc>().add(event);
},
child: AnimatedIcon(
icon: AnimatedIcons.play_pause,
progress: startStopIconAnimation,
),
child: AnimatedIcon(
icon: AnimatedIcons.play_pause,
progress: startStopIconAnimation,
),
),
right: Navigator.of(context).canPop() ? const CloseButton() : null,
),
],
),
right: Navigator.of(context).canPop() ? const CloseButton() : null,
),
],
),
),
),