mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 07:20:39 +00:00
more accurate sliders values
This commit is contained in:
parent
5614ef8ef3
commit
cb220f9e9e
3 changed files with 48 additions and 22 deletions
|
@ -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<double> onChanged;
|
||||
|
||||
const ExposureOffsetSlider({
|
||||
required this.range,
|
||||
required this.value,
|
||||
required this.onChanged,
|
||||
super.key,
|
||||
}) : super(
|
||||
});
|
||||
|
||||
@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) => value.toStringSignedAsFixed(1),
|
||||
valueAdapter: (value) => S.of(context).evValue(value.toStringSignedAsFixed(1)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<double> onChanged;
|
||||
|
||||
const ZoomSlider({
|
||||
required this.range,
|
||||
required this.value,
|
||||
required this.onChanged,
|
||||
super.key,
|
||||
}) : super(
|
||||
});
|
||||
|
||||
@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(1)}',
|
||||
valueAdapter: (value) => 'x${value.toStringAsFixed(2)}',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ class RulerSlider extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
valueAdapter(value),
|
||||
|
|
Loading…
Reference in a new issue