mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 15:30:59 +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:flutter/material.dart';
|
||||||
|
import 'package:lightmeter/generated/l10n.dart';
|
||||||
import 'package:lightmeter/screens/shared/ruler_slider/widget_slider_ruler.dart';
|
import 'package:lightmeter/screens/shared/ruler_slider/widget_slider_ruler.dart';
|
||||||
import 'package:lightmeter/utils/to_string_signed.dart';
|
import 'package:lightmeter/utils/to_string_signed.dart';
|
||||||
|
|
||||||
class ExposureOffsetSlider extends RulerSlider {
|
class ExposureOffsetSlider extends StatelessWidget {
|
||||||
ExposureOffsetSlider({
|
final RangeValues range;
|
||||||
required super.range,
|
final double value;
|
||||||
required super.value,
|
final ValueChanged<double> onChanged;
|
||||||
required super.onChanged,
|
|
||||||
|
const ExposureOffsetSlider({
|
||||||
|
required this.range,
|
||||||
|
required this.value,
|
||||||
|
required this.onChanged,
|
||||||
super.key,
|
super.key,
|
||||||
}) : super(
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return RulerSlider(
|
||||||
|
range: range,
|
||||||
|
value: value,
|
||||||
|
onChanged: onChanged,
|
||||||
icon: Icons.light_mode,
|
icon: Icons.light_mode,
|
||||||
defaultValue: 0,
|
defaultValue: 0,
|
||||||
rulerValueAdapter: (value) => value.toStringSignedAsFixed(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:flutter/material.dart';
|
||||||
import 'package:lightmeter/screens/shared/ruler_slider/widget_slider_ruler.dart';
|
import 'package:lightmeter/screens/shared/ruler_slider/widget_slider_ruler.dart';
|
||||||
|
|
||||||
class ZoomSlider extends RulerSlider {
|
class ZoomSlider extends StatelessWidget {
|
||||||
ZoomSlider({
|
final RangeValues range;
|
||||||
required super.range,
|
final double value;
|
||||||
required super.value,
|
final ValueChanged<double> onChanged;
|
||||||
required super.onChanged,
|
|
||||||
|
const ZoomSlider({
|
||||||
|
required this.range,
|
||||||
|
required this.value,
|
||||||
|
required this.onChanged,
|
||||||
super.key,
|
super.key,
|
||||||
}) : super(
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return RulerSlider(
|
||||||
|
range: range,
|
||||||
|
value: value,
|
||||||
|
onChanged: onChanged,
|
||||||
icon: Icons.search,
|
icon: Icons.search,
|
||||||
defaultValue: range.start,
|
defaultValue: range.start,
|
||||||
rulerValueAdapter: (value) => value.toStringAsFixed(0),
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
valueAdapter(value),
|
valueAdapter(value),
|
||||||
|
|
Loading…
Reference in a new issue