From cb220f9e9e526ca6c0f67eac9411a25ded7957b5 Mon Sep 17 00:00:00 2001 From: Vadim <44135514+vodemn@users.noreply.github.com> Date: Fri, 22 Mar 2024 22:53:28 +0100 Subject: [PATCH] more accurate sliders values --- .../widget_slider_exposure_offset.dart | 35 +++++++++++++------ .../zoom_slider/widget_slider_zoom.dart | 34 ++++++++++++------ .../ruler_slider/widget_slider_ruler.dart | 1 + 3 files changed, 48 insertions(+), 22 deletions(-) diff --git a/lib/screens/metering/components/camera_container/components/camera_controls/components/exposure_offset_slider/widget_slider_exposure_offset.dart b/lib/screens/metering/components/camera_container/components/camera_controls/components/exposure_offset_slider/widget_slider_exposure_offset.dart index 0d40881..bd1e71c 100644 --- a/lib/screens/metering/components/camera_container/components/camera_controls/components/exposure_offset_slider/widget_slider_exposure_offset.dart +++ b/lib/screens/metering/components/camera_container/components/camera_controls/components/exposure_offset_slider/widget_slider_exposure_offset.dart @@ -1,17 +1,30 @@ import 'package:flutter/material.dart'; +import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/screens/shared/ruler_slider/widget_slider_ruler.dart'; import 'package:lightmeter/utils/to_string_signed.dart'; -class ExposureOffsetSlider extends RulerSlider { - ExposureOffsetSlider({ - required super.range, - required super.value, - required super.onChanged, +class ExposureOffsetSlider extends StatelessWidget { + final RangeValues range; + final double value; + final ValueChanged onChanged; + + const ExposureOffsetSlider({ + required this.range, + required this.value, + required this.onChanged, super.key, - }) : super( - icon: Icons.light_mode, - defaultValue: 0, - rulerValueAdapter: (value) => value.toStringSignedAsFixed(0), - valueAdapter: (value) => value.toStringSignedAsFixed(1), - ); + }); + + @override + Widget build(BuildContext context) { + return RulerSlider( + range: range, + value: value, + onChanged: onChanged, + icon: Icons.light_mode, + defaultValue: 0, + rulerValueAdapter: (value) => value.toStringSignedAsFixed(0), + valueAdapter: (value) => S.of(context).evValue(value.toStringSignedAsFixed(1)), + ); + } } diff --git a/lib/screens/metering/components/camera_container/components/camera_controls/components/zoom_slider/widget_slider_zoom.dart b/lib/screens/metering/components/camera_container/components/camera_controls/components/zoom_slider/widget_slider_zoom.dart index 60c5b51..7cec404 100644 --- a/lib/screens/metering/components/camera_container/components/camera_controls/components/zoom_slider/widget_slider_zoom.dart +++ b/lib/screens/metering/components/camera_container/components/camera_controls/components/zoom_slider/widget_slider_zoom.dart @@ -1,16 +1,28 @@ import 'package:flutter/material.dart'; import 'package:lightmeter/screens/shared/ruler_slider/widget_slider_ruler.dart'; -class ZoomSlider extends RulerSlider { - ZoomSlider({ - required super.range, - required super.value, - required super.onChanged, +class ZoomSlider extends StatelessWidget { + final RangeValues range; + final double value; + final ValueChanged onChanged; + + const ZoomSlider({ + required this.range, + required this.value, + required this.onChanged, super.key, - }) : super( - icon: Icons.search, - defaultValue: range.start, - rulerValueAdapter: (value) => value.toStringAsFixed(0), - valueAdapter: (value) => 'x${value.toStringAsFixed(1)}', - ); + }); + + @override + Widget build(BuildContext context) { + return RulerSlider( + range: range, + value: value, + onChanged: onChanged, + icon: Icons.search, + defaultValue: range.start, + rulerValueAdapter: (value) => value.toStringAsFixed(0), + valueAdapter: (value) => 'x${value.toStringAsFixed(2)}', + ); + } } diff --git a/lib/screens/shared/ruler_slider/widget_slider_ruler.dart b/lib/screens/shared/ruler_slider/widget_slider_ruler.dart index 79fb1d5..f9f37ff 100644 --- a/lib/screens/shared/ruler_slider/widget_slider_ruler.dart +++ b/lib/screens/shared/ruler_slider/widget_slider_ruler.dart @@ -26,6 +26,7 @@ class RulerSlider extends StatelessWidget { @override Widget build(BuildContext context) { return Column( + crossAxisAlignment: CrossAxisAlignment.end, children: [ Text( valueAdapter(value),