mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 07:20:39 +00:00
integrated TimerScreen
to navigation
This commit is contained in:
parent
922824e4c8
commit
0605605e54
8 changed files with 73 additions and 64 deletions
|
@ -18,7 +18,7 @@ class CameraContainerProvider extends StatelessWidget {
|
||||||
final ValueChanged<IsoValue> onIsoChanged;
|
final ValueChanged<IsoValue> onIsoChanged;
|
||||||
final ValueChanged<NdValue> onNdChanged;
|
final ValueChanged<NdValue> onNdChanged;
|
||||||
final List<ExposurePair> exposurePairs;
|
final List<ExposurePair> exposurePairs;
|
||||||
final ValueChanged<ShutterSpeedValue> onExposurePairTap;
|
final ValueChanged<ExposurePair> onExposurePairTap;
|
||||||
|
|
||||||
const CameraContainerProvider({
|
const CameraContainerProvider({
|
||||||
required this.fastest,
|
required this.fastest,
|
||||||
|
|
|
@ -29,7 +29,7 @@ class CameraContainer extends StatelessWidget {
|
||||||
final ValueChanged<IsoValue> onIsoChanged;
|
final ValueChanged<IsoValue> onIsoChanged;
|
||||||
final ValueChanged<NdValue> onNdChanged;
|
final ValueChanged<NdValue> onNdChanged;
|
||||||
final List<ExposurePair> exposurePairs;
|
final List<ExposurePair> exposurePairs;
|
||||||
final ValueChanged<ShutterSpeedValue> onExposurePairTap;
|
final ValueChanged<ExposurePair> onExposurePairTap;
|
||||||
|
|
||||||
const CameraContainer({
|
const CameraContainer({
|
||||||
required this.fastest,
|
required this.fastest,
|
||||||
|
|
|
@ -15,7 +15,7 @@ class LightSensorContainerProvider extends StatelessWidget {
|
||||||
final ValueChanged<IsoValue> onIsoChanged;
|
final ValueChanged<IsoValue> onIsoChanged;
|
||||||
final ValueChanged<NdValue> onNdChanged;
|
final ValueChanged<NdValue> onNdChanged;
|
||||||
final List<ExposurePair> exposurePairs;
|
final List<ExposurePair> exposurePairs;
|
||||||
final ValueChanged<ShutterSpeedValue> onExposurePairTap;
|
final ValueChanged<ExposurePair> onExposurePairTap;
|
||||||
|
|
||||||
const LightSensorContainerProvider({
|
const LightSensorContainerProvider({
|
||||||
required this.fastest,
|
required this.fastest,
|
||||||
|
|
|
@ -14,7 +14,7 @@ class LightSensorContainer extends StatelessWidget {
|
||||||
final ValueChanged<IsoValue> onIsoChanged;
|
final ValueChanged<IsoValue> onIsoChanged;
|
||||||
final ValueChanged<NdValue> onNdChanged;
|
final ValueChanged<NdValue> onNdChanged;
|
||||||
final List<ExposurePair> exposurePairs;
|
final List<ExposurePair> exposurePairs;
|
||||||
final ValueChanged<ShutterSpeedValue> onExposurePairTap;
|
final ValueChanged<ExposurePair> onExposurePairTap;
|
||||||
|
|
||||||
const LightSensorContainer({
|
const LightSensorContainer({
|
||||||
required this.fastest,
|
required this.fastest,
|
||||||
|
|
|
@ -5,11 +5,10 @@ import 'package:lightmeter/providers/films_provider.dart';
|
||||||
import 'package:lightmeter/res/dimens.dart';
|
import 'package:lightmeter/res/dimens.dart';
|
||||||
import 'package:lightmeter/screens/metering/components/shared/exposure_pairs_list/components/exposure_pairs_list_item/widget_item_list_exposure_pairs.dart';
|
import 'package:lightmeter/screens/metering/components/shared/exposure_pairs_list/components/exposure_pairs_list_item/widget_item_list_exposure_pairs.dart';
|
||||||
import 'package:lightmeter/screens/shared/icon_placeholder/widget_icon_placeholder.dart';
|
import 'package:lightmeter/screens/shared/icon_placeholder/widget_icon_placeholder.dart';
|
||||||
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
|
||||||
|
|
||||||
class ExposurePairsList extends StatelessWidget {
|
class ExposurePairsList extends StatelessWidget {
|
||||||
final List<ExposurePair> exposurePairs;
|
final List<ExposurePair> exposurePairs;
|
||||||
final ValueChanged<ShutterSpeedValue> onExposurePairTap;
|
final ValueChanged<ExposurePair> onExposurePairTap;
|
||||||
|
|
||||||
const ExposurePairsList(this.exposurePairs, {required this.onExposurePairTap, super.key});
|
const ExposurePairsList(this.exposurePairs, {required this.onExposurePairTap, super.key});
|
||||||
|
|
||||||
|
@ -30,60 +29,66 @@ class ExposurePairsList extends StatelessWidget {
|
||||||
key: ValueKey(exposurePairs.hashCode),
|
key: ValueKey(exposurePairs.hashCode),
|
||||||
padding: const EdgeInsets.symmetric(vertical: Dimens.paddingL),
|
padding: const EdgeInsets.symmetric(vertical: Dimens.paddingL),
|
||||||
itemCount: exposurePairs.length,
|
itemCount: exposurePairs.length,
|
||||||
itemBuilder: (_, index) => Stack(
|
itemBuilder: (_, index) {
|
||||||
alignment: Alignment.center,
|
final exposurePair = ExposurePair(
|
||||||
children: [
|
exposurePairs[index].aperture,
|
||||||
GestureDetector(
|
Films.selectedOf(context).reciprocityFailure(exposurePairs[index].shutterSpeed),
|
||||||
onTap: () {
|
);
|
||||||
onExposurePairTap(Films.selectedOf(context).reciprocityFailure(exposurePairs[index].shutterSpeed));
|
return Stack(
|
||||||
},
|
alignment: Alignment.center,
|
||||||
child: Row(
|
children: [
|
||||||
key: ValueKey(index),
|
GestureDetector(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
onTap: () {
|
||||||
children: [
|
onExposurePairTap(exposurePair);
|
||||||
Expanded(
|
},
|
||||||
child: Align(
|
child: Row(
|
||||||
alignment: Alignment.centerLeft,
|
key: ValueKey(index),
|
||||||
child: ExposurePairsListItem(
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
exposurePairs[index].aperture,
|
children: [
|
||||||
tickOnTheLeft: false,
|
Expanded(
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: ExposurePairsListItem(
|
||||||
|
exposurePair.aperture,
|
||||||
|
tickOnTheLeft: false,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
Expanded(
|
||||||
Expanded(
|
child: Align(
|
||||||
child: Align(
|
alignment: Alignment.centerLeft,
|
||||||
alignment: Alignment.centerLeft,
|
child: ExposurePairsListItem(
|
||||||
child: ExposurePairsListItem(
|
exposurePair.shutterSpeed,
|
||||||
Films.selectedOf(context).reciprocityFailure(exposurePairs[index].shutterSpeed),
|
tickOnTheLeft: true,
|
||||||
tickOnTheLeft: true,
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
Positioned(
|
||||||
Positioned(
|
top: 0,
|
||||||
top: 0,
|
bottom: 0,
|
||||||
bottom: 0,
|
child: LayoutBuilder(
|
||||||
child: LayoutBuilder(
|
builder: (context, constraints) => Align(
|
||||||
builder: (context, constraints) => Align(
|
alignment: index == 0
|
||||||
alignment: index == 0
|
? Alignment.bottomCenter
|
||||||
? Alignment.bottomCenter
|
: (index == exposurePairs.length - 1 ? Alignment.topCenter : Alignment.center),
|
||||||
: (index == exposurePairs.length - 1 ? Alignment.topCenter : Alignment.center),
|
child: SizedBox(
|
||||||
child: SizedBox(
|
height: index == 0 || index == exposurePairs.length - 1
|
||||||
height: index == 0 || index == exposurePairs.length - 1
|
? constraints.maxHeight / 2
|
||||||
? constraints.maxHeight / 2
|
: constraints.maxHeight,
|
||||||
: constraints.maxHeight,
|
child: ColoredBox(
|
||||||
child: ColoredBox(
|
color: Theme.of(context).colorScheme.onBackground,
|
||||||
color: Theme.of(context).colorScheme.onBackground,
|
child: const SizedBox(width: 1),
|
||||||
child: const SizedBox(width: 1),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
);
|
||||||
),
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
@ -34,7 +34,7 @@ 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) => context.read<MeteringBloc>().add(SetTimerEvent(value)),
|
onExposurePairTap: (value) => Navigator.pushNamed(context, 'timer', arguments: value),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -49,7 +49,7 @@ class MeteringScreen extends StatelessWidget {
|
||||||
onMeasure: () => context.read<MeteringBloc>().add(const MeasureEvent()),
|
onMeasure: () => context.read<MeteringBloc>().add(const MeasureEvent()),
|
||||||
onSettings: () {
|
onSettings: () {
|
||||||
context.read<MeteringBloc>().add(const SettingsOpenedEvent());
|
context.read<MeteringBloc>().add(const SettingsOpenedEvent());
|
||||||
Navigator.pushNamed(context, 'settings').then((value) {
|
Navigator.pushNamed(context, 'settings').then((_) {
|
||||||
context.read<MeteringBloc>().add(const SettingsClosedEvent());
|
context.read<MeteringBloc>().add(const SettingsClosedEvent());
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -84,7 +84,7 @@ class MeteringContainerBuidler extends StatelessWidget {
|
||||||
final NdValue nd;
|
final NdValue nd;
|
||||||
final ValueChanged<IsoValue> onIsoChanged;
|
final ValueChanged<IsoValue> onIsoChanged;
|
||||||
final ValueChanged<NdValue> onNdChanged;
|
final ValueChanged<NdValue> onNdChanged;
|
||||||
final ValueChanged<ShutterSpeedValue> onExposurePairTap;
|
final ValueChanged<ExposurePair> onExposurePairTap;
|
||||||
|
|
||||||
const MeteringContainerBuidler({
|
const MeteringContainerBuidler({
|
||||||
required this.ev,
|
required this.ev,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:lightmeter/data/models/exposure_pair.dart';
|
||||||
import 'package:lightmeter/interactors/metering_interactor.dart';
|
import 'package:lightmeter/interactors/metering_interactor.dart';
|
||||||
import 'package:lightmeter/providers/services_provider.dart';
|
import 'package:lightmeter/providers/services_provider.dart';
|
||||||
import 'package:lightmeter/res/dimens.dart';
|
import 'package:lightmeter/res/dimens.dart';
|
||||||
|
@ -7,7 +8,9 @@ import 'package:lightmeter/screens/timer/bloc_timer.dart';
|
||||||
import 'package:lightmeter/screens/timer/screen_timer.dart';
|
import 'package:lightmeter/screens/timer/screen_timer.dart';
|
||||||
|
|
||||||
class TimerFlow extends StatelessWidget {
|
class TimerFlow extends StatelessWidget {
|
||||||
const TimerFlow({super.key});
|
final ExposurePair exposurePair;
|
||||||
|
|
||||||
|
const TimerFlow({required this.exposurePair, super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -35,11 +38,9 @@ class TimerFlow extends StatelessWidget {
|
||||||
child: BlocProvider(
|
child: BlocProvider(
|
||||||
create: (context) => TimerBloc(
|
create: (context) => TimerBloc(
|
||||||
MeteringInteractorProvider.of(context),
|
MeteringInteractorProvider.of(context),
|
||||||
60,
|
exposurePair.shutterSpeed.value.toInt(),
|
||||||
),
|
|
||||||
child: const TimerScreen(
|
|
||||||
duration: const Duration(seconds: 60),
|
|
||||||
),
|
),
|
||||||
|
child: TimerScreen(exposurePair: exposurePair),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,6 +2,7 @@ import 'dart:math';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
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/timer/bloc_timer.dart';
|
import 'package:lightmeter/screens/timer/bloc_timer.dart';
|
||||||
|
@ -10,9 +11,9 @@ import 'package:lightmeter/screens/timer/state_timer.dart';
|
||||||
import 'package:material_color_utilities/material_color_utilities.dart';
|
import 'package:material_color_utilities/material_color_utilities.dart';
|
||||||
|
|
||||||
class TimerScreen extends StatefulWidget {
|
class TimerScreen extends StatefulWidget {
|
||||||
final Duration duration;
|
final ExposurePair exposurePair;
|
||||||
|
|
||||||
const TimerScreen({required this.duration, super.key});
|
const TimerScreen({required this.exposurePair, super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<TimerScreen> createState() => _TimerScreenState();
|
State<TimerScreen> createState() => _TimerScreenState();
|
||||||
|
@ -28,7 +29,10 @@ class _TimerScreenState extends State<TimerScreen> with TickerProviderStateMixin
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
timelineController = AnimationController(vsync: this, duration: widget.duration);
|
timelineController = AnimationController(
|
||||||
|
vsync: this,
|
||||||
|
duration: Duration(seconds: widget.exposurePair.shutterSpeed.value.toInt()),
|
||||||
|
);
|
||||||
timelineAnimation = Tween<double>(begin: 1, end: 0).animate(timelineController);
|
timelineAnimation = Tween<double>(begin: 1, end: 0).animate(timelineController);
|
||||||
|
|
||||||
startStopIconController = AnimationController(vsync: this, duration: Dimens.durationS);
|
startStopIconController = AnimationController(vsync: this, duration: Dimens.durationS);
|
||||||
|
@ -60,7 +64,7 @@ class _TimerScreenState extends State<TimerScreen> with TickerProviderStateMixin
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
title: Text(
|
title: Text(
|
||||||
'Test',
|
widget.exposurePair.toString(),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).colorScheme.onSurface,
|
color: Theme.of(context).colorScheme.onSurface,
|
||||||
fontSize: Dimens.grid24,
|
fontSize: Dimens.grid24,
|
||||||
|
@ -245,7 +249,6 @@ class _TimelinePainter extends CustomPainter {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void paint(Canvas canvas, Size size) {
|
void paint(Canvas canvas, Size size) {
|
||||||
print('PROGRESS: $progress');
|
|
||||||
late final double radiansProgress = 2 * pi * progress;
|
late final double radiansProgress = 2 * pi * progress;
|
||||||
final radius = size.height / 2;
|
final radius = size.height / 2;
|
||||||
final timerCenter = Offset(radius, radius);
|
final timerCenter = Offset(radius, radius);
|
||||||
|
|
Loading…
Reference in a new issue