diff --git a/lib/application.dart b/lib/application.dart index 1311779..5afcde9 100644 --- a/lib/application.dart +++ b/lib/application.dart @@ -39,11 +39,11 @@ class Application extends StatelessWidget { data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0), child: child!, ), - initialRoute: "timer", + initialRoute: "metering", routes: { - "metering": (context) => const MeteringFlow(), - "settings": (context) => const SettingsFlow(), - "timer": (context) => const TimerFlow(), + "metering": (_) => const MeteringFlow(), + "settings": (_) => const SettingsFlow(), + "timer": (context) => TimerFlow(args: ModalRoute.of(context)!.settings.arguments! as TimerFlowArgs), }, ), ); diff --git a/lib/screens/metering/components/shared/readings_container/components/shared/reading_value_container/widget_container_reading_value.dart b/lib/screens/metering/components/shared/readings_container/components/shared/reading_value_container/widget_container_reading_value.dart index 0abc0f4..cb038e5 100644 --- a/lib/screens/metering/components/shared/readings_container/components/shared/reading_value_container/widget_container_reading_value.dart +++ b/lib/screens/metering/components/shared/readings_container/components/shared/reading_value_container/widget_container_reading_value.dart @@ -14,11 +14,13 @@ class ReadingValue { class ReadingValueContainer extends StatelessWidget implements AnimatedDialogClosedChild { late final List _items; + final bool locked; final Color? color; final Color? textColor; ReadingValueContainer({ required List values, + this.locked = false, this.color, this.textColor, super.key, @@ -34,6 +36,7 @@ class ReadingValueContainer extends StatelessWidget implements AnimatedDialogClo ReadingValueContainer.singleValue({ required ReadingValue value, + this.locked = false, this.color, this.textColor, super.key, @@ -50,10 +53,24 @@ class ReadingValueContainer extends StatelessWidget implements AnimatedDialogClo color: backgroundColor(context), child: Padding( padding: const EdgeInsets.all(Dimens.paddingM), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: _items, + child: Stack( + children: [ + if (locked) + Positioned( + top: 0, + right: 0, + child: Icon( + Icons.lock_outline, + size: Theme.of(context).textTheme.labelMedium!.fontSize, + color: Theme.of(context).colorScheme.onPrimaryContainer, + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: _items, + ), + ], ), ), ), diff --git a/lib/screens/metering/screen_metering.dart b/lib/screens/metering/screen_metering.dart index 2d0c792..2cd828c 100644 --- a/lib/screens/metering/screen_metering.dart +++ b/lib/screens/metering/screen_metering.dart @@ -14,6 +14,7 @@ import 'package:lightmeter/screens/metering/components/light_sensor_container/pr import 'package:lightmeter/screens/metering/event_metering.dart'; import 'package:lightmeter/screens/metering/state_metering.dart'; import 'package:lightmeter/screens/metering/utils/listener_equipment_profiles.dart'; +import 'package:lightmeter/screens/timer/flow_timer.dart'; import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; class MeteringScreen extends StatelessWidget { @@ -34,7 +35,15 @@ class MeteringScreen extends StatelessWidget { nd: state.nd, onIsoChanged: (value) => context.read().add(IsoChangedEvent(value)), onNdChanged: (value) => context.read().add(NdChangedEvent(value)), - onExposurePairTap: (value) => pushNamed(context, 'timer', arguments: value), + onExposurePairTap: (value) => pushNamed( + context, + 'timer', + arguments: TimerFlowArgs( + exposurePair: value, + isoValue: state.iso, + ndValue: state.nd, + ), + ), ), ), ), diff --git a/lib/screens/timer/components/metering_config/widget_metering_config_timer.dart b/lib/screens/timer/components/metering_config/widget_metering_config_timer.dart index 78e93e0..8d2e199 100644 --- a/lib/screens/timer/components/metering_config/widget_metering_config_timer.dart +++ b/lib/screens/timer/components/metering_config/widget_metering_config_timer.dart @@ -3,12 +3,17 @@ 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'; +import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; class TimerMeteringConfig extends StatelessWidget { final ExposurePair exposurePair; + final IsoValue isoValue; + final NdValue ndValue; const TimerMeteringConfig({ required this.exposurePair, + required this.isoValue, + required this.ndValue, super.key, }); @@ -35,6 +40,32 @@ class TimerMeteringConfig extends StatelessWidget { ), ), ), + const SizedBox(width: Dimens.grid8), + Expanded( + child: Row( + children: [ + Expanded( + child: ReadingValueContainer.singleValue( + value: ReadingValue( + label: S.of(context).iso, + value: isoValue.toString(), + ), + locked: true, + ), + ), + const SizedBox(width: Dimens.grid8), + Expanded( + child: ReadingValueContainer.singleValue( + value: ReadingValue( + label: S.of(context).nd, + value: ndValue.value == 0 ? S.of(context).none : ndValue.value.toString(), + ), + locked: true, + ), + ), + ], + ), + ), ], ), ), diff --git a/lib/screens/timer/flow_timer.dart b/lib/screens/timer/flow_timer.dart index 9e3bf30..112c12b 100644 --- a/lib/screens/timer/flow_timer.dart +++ b/lib/screens/timer/flow_timer.dart @@ -5,13 +5,26 @@ import 'package:lightmeter/interactors/timer_interactor.dart'; import 'package:lightmeter/providers/services_provider.dart'; import 'package:lightmeter/screens/timer/bloc_timer.dart'; import 'package:lightmeter/screens/timer/screen_timer.dart'; +import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; + +class TimerFlowArgs { + final ExposurePair exposurePair; + final IsoValue isoValue; + final NdValue ndValue; + + const TimerFlowArgs({ + required this.exposurePair, + required this.isoValue, + required this.ndValue, + }); +} class TimerFlow extends StatelessWidget { - final ExposurePair exposurePair; + final TimerFlowArgs args; late final _duration = - Duration(milliseconds: (exposurePair.shutterSpeed.value * Duration.millisecondsPerSecond).toInt()); + Duration(milliseconds: (args.exposurePair.shutterSpeed.value * Duration.millisecondsPerSecond).toInt()); - TimerFlow({required this.exposurePair, super.key}); + TimerFlow({required this.args, super.key}); @override Widget build(BuildContext context) { @@ -26,7 +39,9 @@ class TimerFlow extends StatelessWidget { _duration, ), child: TimerScreen( - exposurePair: exposurePair, + exposurePair: args.exposurePair, + isoValue: args.isoValue, + ndValue: args.ndValue, duration: _duration, ), ), diff --git a/lib/screens/timer/screen_timer.dart b/lib/screens/timer/screen_timer.dart index ffafb5e..ab72679 100644 --- a/lib/screens/timer/screen_timer.dart +++ b/lib/screens/timer/screen_timer.dart @@ -10,13 +10,18 @@ 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'; import 'package:lightmeter/screens/timer/state_timer.dart'; +import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; class TimerScreen extends StatefulWidget { final ExposurePair exposurePair; + final IsoValue isoValue; + final NdValue ndValue; final Duration duration; const TimerScreen({ required this.exposurePair, + required this.isoValue, + required this.ndValue, required this.duration, super.key, }); @@ -65,7 +70,11 @@ class TimerScreenState extends State with TickerProviderStateMixin child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - TimerMeteringConfig(exposurePair: widget.exposurePair), + TimerMeteringConfig( + exposurePair: widget.exposurePair, + isoValue: widget.isoValue, + ndValue: widget.ndValue, + ), const Spacer(), Padding( padding: const EdgeInsets.all(Dimens.paddingL), diff --git a/test/screens/timer/goldens/timer_screen.png b/test/screens/timer/goldens/timer_screen.png index c2e3b3f..aa3fd4f 100644 Binary files a/test/screens/timer/goldens/timer_screen.png and b/test/screens/timer/goldens/timer_screen.png differ diff --git a/test/screens/timer/screen_timer_golden_test.dart b/test/screens/timer/screen_timer_golden_test.dart index 4209388..142f3c2 100644 --- a/test/screens/timer/screen_timer_golden_test.dart +++ b/test/screens/timer/screen_timer_golden_test.dart @@ -126,9 +126,13 @@ class _MockTimerFlow extends StatelessWidget { Widget build(BuildContext context) { return GoldenTestApplicationMock( child: TimerFlow( - exposurePair: ExposurePair( - ApertureValue.values.first, - shutterSpeedValue, + args: TimerFlowArgs( + exposurePair: ExposurePair( + ApertureValue.values.first, + shutterSpeedValue, + ), + isoValue: const IsoValue(100, StopType.full), + ndValue: const NdValue(0), ), ), );