mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-21 23:10:40 +00:00
show iso & nd values on timer screen
This commit is contained in:
parent
c98e384109
commit
057c43cc62
8 changed files with 102 additions and 17 deletions
|
@ -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),
|
||||
},
|
||||
),
|
||||
);
|
||||
|
|
|
@ -14,11 +14,13 @@ class ReadingValue {
|
|||
|
||||
class ReadingValueContainer extends StatelessWidget implements AnimatedDialogClosedChild {
|
||||
late final List<Widget> _items;
|
||||
final bool locked;
|
||||
final Color? color;
|
||||
final Color? textColor;
|
||||
|
||||
ReadingValueContainer({
|
||||
required List<ReadingValue> 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,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -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<MeteringBloc>().add(IsoChangedEvent(value)),
|
||||
onNdChanged: (value) => context.read<MeteringBloc>().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,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -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,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -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,
|
||||
),
|
||||
),
|
||||
|
|
|
@ -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<TimerScreen> 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),
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 775 KiB After Width: | Height: | Size: 858 KiB |
|
@ -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),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue