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),
|
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
|
||||||
child: child!,
|
child: child!,
|
||||||
),
|
),
|
||||||
initialRoute: "timer",
|
initialRoute: "metering",
|
||||||
routes: {
|
routes: {
|
||||||
"metering": (context) => const MeteringFlow(),
|
"metering": (_) => const MeteringFlow(),
|
||||||
"settings": (context) => const SettingsFlow(),
|
"settings": (_) => const SettingsFlow(),
|
||||||
"timer": (context) => const TimerFlow(),
|
"timer": (context) => TimerFlow(args: ModalRoute.of(context)!.settings.arguments! as TimerFlowArgs),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -14,11 +14,13 @@ class ReadingValue {
|
||||||
|
|
||||||
class ReadingValueContainer extends StatelessWidget implements AnimatedDialogClosedChild {
|
class ReadingValueContainer extends StatelessWidget implements AnimatedDialogClosedChild {
|
||||||
late final List<Widget> _items;
|
late final List<Widget> _items;
|
||||||
|
final bool locked;
|
||||||
final Color? color;
|
final Color? color;
|
||||||
final Color? textColor;
|
final Color? textColor;
|
||||||
|
|
||||||
ReadingValueContainer({
|
ReadingValueContainer({
|
||||||
required List<ReadingValue> values,
|
required List<ReadingValue> values,
|
||||||
|
this.locked = false,
|
||||||
this.color,
|
this.color,
|
||||||
this.textColor,
|
this.textColor,
|
||||||
super.key,
|
super.key,
|
||||||
|
@ -34,6 +36,7 @@ class ReadingValueContainer extends StatelessWidget implements AnimatedDialogClo
|
||||||
|
|
||||||
ReadingValueContainer.singleValue({
|
ReadingValueContainer.singleValue({
|
||||||
required ReadingValue value,
|
required ReadingValue value,
|
||||||
|
this.locked = false,
|
||||||
this.color,
|
this.color,
|
||||||
this.textColor,
|
this.textColor,
|
||||||
super.key,
|
super.key,
|
||||||
|
@ -50,10 +53,24 @@ class ReadingValueContainer extends StatelessWidget implements AnimatedDialogClo
|
||||||
color: backgroundColor(context),
|
color: backgroundColor(context),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(Dimens.paddingM),
|
padding: const EdgeInsets.all(Dimens.paddingM),
|
||||||
child: Column(
|
child: Stack(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
children: [
|
||||||
mainAxisSize: MainAxisSize.min,
|
if (locked)
|
||||||
children: _items,
|
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/event_metering.dart';
|
||||||
import 'package:lightmeter/screens/metering/state_metering.dart';
|
import 'package:lightmeter/screens/metering/state_metering.dart';
|
||||||
import 'package:lightmeter/screens/metering/utils/listener_equipment_profiles.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';
|
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||||
|
|
||||||
class MeteringScreen extends StatelessWidget {
|
class MeteringScreen extends StatelessWidget {
|
||||||
|
@ -34,7 +35,15 @@ class MeteringScreen extends StatelessWidget {
|
||||||
nd: state.nd,
|
nd: state.nd,
|
||||||
onIsoChanged: (value) => context.read<MeteringBloc>().add(IsoChangedEvent(value)),
|
onIsoChanged: (value) => context.read<MeteringBloc>().add(IsoChangedEvent(value)),
|
||||||
onNdChanged: (value) => context.read<MeteringBloc>().add(NdChangedEvent(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/generated/l10n.dart';
|
||||||
import 'package:lightmeter/res/dimens.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: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 {
|
class TimerMeteringConfig extends StatelessWidget {
|
||||||
final ExposurePair exposurePair;
|
final ExposurePair exposurePair;
|
||||||
|
final IsoValue isoValue;
|
||||||
|
final NdValue ndValue;
|
||||||
|
|
||||||
const TimerMeteringConfig({
|
const TimerMeteringConfig({
|
||||||
required this.exposurePair,
|
required this.exposurePair,
|
||||||
|
required this.isoValue,
|
||||||
|
required this.ndValue,
|
||||||
super.key,
|
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/providers/services_provider.dart';
|
||||||
import 'package:lightmeter/screens/timer/bloc_timer.dart';
|
import 'package:lightmeter/screens/timer/bloc_timer.dart';
|
||||||
import 'package:lightmeter/screens/timer/screen_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 {
|
class TimerFlow extends StatelessWidget {
|
||||||
final ExposurePair exposurePair;
|
final TimerFlowArgs args;
|
||||||
late final _duration =
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -26,7 +39,9 @@ class TimerFlow extends StatelessWidget {
|
||||||
_duration,
|
_duration,
|
||||||
),
|
),
|
||||||
child: TimerScreen(
|
child: TimerScreen(
|
||||||
exposurePair: exposurePair,
|
exposurePair: args.exposurePair,
|
||||||
|
isoValue: args.isoValue,
|
||||||
|
ndValue: args.ndValue,
|
||||||
duration: _duration,
|
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/components/timeline/widget_timeline_timer.dart';
|
||||||
import 'package:lightmeter/screens/timer/event_timer.dart';
|
import 'package:lightmeter/screens/timer/event_timer.dart';
|
||||||
import 'package:lightmeter/screens/timer/state_timer.dart';
|
import 'package:lightmeter/screens/timer/state_timer.dart';
|
||||||
|
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||||
|
|
||||||
class TimerScreen extends StatefulWidget {
|
class TimerScreen extends StatefulWidget {
|
||||||
final ExposurePair exposurePair;
|
final ExposurePair exposurePair;
|
||||||
|
final IsoValue isoValue;
|
||||||
|
final NdValue ndValue;
|
||||||
final Duration duration;
|
final Duration duration;
|
||||||
|
|
||||||
const TimerScreen({
|
const TimerScreen({
|
||||||
required this.exposurePair,
|
required this.exposurePair,
|
||||||
|
required this.isoValue,
|
||||||
|
required this.ndValue,
|
||||||
required this.duration,
|
required this.duration,
|
||||||
super.key,
|
super.key,
|
||||||
});
|
});
|
||||||
|
@ -65,7 +70,11 @@ class TimerScreenState extends State<TimerScreen> with TickerProviderStateMixin
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
TimerMeteringConfig(exposurePair: widget.exposurePair),
|
TimerMeteringConfig(
|
||||||
|
exposurePair: widget.exposurePair,
|
||||||
|
isoValue: widget.isoValue,
|
||||||
|
ndValue: widget.ndValue,
|
||||||
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(Dimens.paddingL),
|
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) {
|
Widget build(BuildContext context) {
|
||||||
return GoldenTestApplicationMock(
|
return GoldenTestApplicationMock(
|
||||||
child: TimerFlow(
|
child: TimerFlow(
|
||||||
exposurePair: ExposurePair(
|
args: TimerFlowArgs(
|
||||||
ApertureValue.values.first,
|
exposurePair: ExposurePair(
|
||||||
shutterSpeedValue,
|
ApertureValue.values.first,
|
||||||
|
shutterSpeedValue,
|
||||||
|
),
|
||||||
|
isoValue: const IsoValue(100, StopType.full),
|
||||||
|
ndValue: const NdValue(0),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue