mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-25 17:00:39 +00:00
show sliders values
This commit is contained in:
parent
26175c2c3e
commit
d6ed053079
4 changed files with 58 additions and 78 deletions
|
@ -1,39 +1,17 @@
|
||||||
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 StatelessWidget {
|
class ExposureOffsetSlider extends RulerSlider {
|
||||||
final RangeValues range;
|
ExposureOffsetSlider({
|
||||||
final double value;
|
required super.range,
|
||||||
final ValueChanged<double> onChanged;
|
required super.value,
|
||||||
|
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 Column(
|
|
||||||
children: [
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(Icons.sync),
|
|
||||||
onPressed: value != 0.0 ? () => onChanged(0.0) : null,
|
|
||||||
tooltip: S.of(context).tooltipResetToZero,
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: RulerSlider(
|
|
||||||
icon: Icons.light_mode,
|
icon: Icons.light_mode,
|
||||||
range: range,
|
defaultValue: 0,
|
||||||
value: value,
|
|
||||||
onChanged: onChanged,
|
|
||||||
rulerValueAdapter: (value) => value.toStringSignedAsFixed(0),
|
rulerValueAdapter: (value) => value.toStringSignedAsFixed(0),
|
||||||
),
|
valueAdapter: (value) => value.toStringSignedAsFixed(1),
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +1,16 @@
|
||||||
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 StatelessWidget {
|
class ZoomSlider extends RulerSlider {
|
||||||
final RangeValues range;
|
ZoomSlider({
|
||||||
final double value;
|
required super.range,
|
||||||
final ValueChanged<double> onChanged;
|
required super.value,
|
||||||
|
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 Column(
|
|
||||||
children: [
|
|
||||||
const IconButton(
|
|
||||||
icon: Icon(Icons.lock_open),
|
|
||||||
onPressed: null,
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: RulerSlider(
|
|
||||||
icon: Icons.search,
|
icon: Icons.search,
|
||||||
range: range,
|
defaultValue: range.start,
|
||||||
value: value,
|
rulerValueAdapter: (value) => value.toStringAsFixed(0),
|
||||||
onChanged: onChanged,
|
valueAdapter: (value) => 'x${value.toStringAsFixed(1)}',
|
||||||
rulerValueAdapter: (value) => '${value.toStringAsFixed(0)}x',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,9 +159,9 @@ class _CameraControlsBuilder extends StatelessWidget {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(
|
padding: const EdgeInsets.fromLTRB(
|
||||||
Dimens.paddingL,
|
Dimens.paddingL,
|
||||||
Dimens.paddingM,
|
|
||||||
0,
|
|
||||||
Dimens.paddingL,
|
Dimens.paddingL,
|
||||||
|
0,
|
||||||
|
Dimens.paddingM,
|
||||||
),
|
),
|
||||||
child: BlocBuilder<CameraContainerBloc, CameraContainerState>(
|
child: BlocBuilder<CameraContainerBloc, CameraContainerState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:lightmeter/generated/l10n.dart';
|
||||||
import 'package:lightmeter/res/dimens.dart';
|
import 'package:lightmeter/res/dimens.dart';
|
||||||
import 'package:lightmeter/screens/shared/centered_slider/widget_slider_centered.dart';
|
import 'package:lightmeter/screens/shared/centered_slider/widget_slider_centered.dart';
|
||||||
|
|
||||||
|
@ -6,21 +7,33 @@ class RulerSlider extends StatelessWidget {
|
||||||
final IconData icon;
|
final IconData icon;
|
||||||
final RangeValues range;
|
final RangeValues range;
|
||||||
final double value;
|
final double value;
|
||||||
|
final double defaultValue;
|
||||||
final ValueChanged<double> onChanged;
|
final ValueChanged<double> onChanged;
|
||||||
final String Function(double value) rulerValueAdapter;
|
final String Function(double value) rulerValueAdapter;
|
||||||
|
final String Function(double value) valueAdapter;
|
||||||
|
|
||||||
const RulerSlider({
|
const RulerSlider({
|
||||||
required this.icon,
|
required this.icon,
|
||||||
required this.range,
|
required this.range,
|
||||||
required this.value,
|
required this.value,
|
||||||
|
required this.defaultValue,
|
||||||
required this.onChanged,
|
required this.onChanged,
|
||||||
required this.rulerValueAdapter,
|
required this.rulerValueAdapter,
|
||||||
|
required this.valueAdapter,
|
||||||
super.key,
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Row(
|
return Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
valueAdapter(value),
|
||||||
|
style: Theme.of(context).textTheme.labelLarge,
|
||||||
|
),
|
||||||
|
const SizedBox(height: Dimens.grid8),
|
||||||
|
Expanded(
|
||||||
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
_Ruler(
|
_Ruler(
|
||||||
range.start,
|
range.start,
|
||||||
|
@ -36,6 +49,15 @@ class RulerSlider extends StatelessWidget {
|
||||||
onChanged: onChanged,
|
onChanged: onChanged,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: Dimens.grid4),
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.sync),
|
||||||
|
onPressed: value != defaultValue ? () => onChanged(defaultValue) : null,
|
||||||
|
tooltip: S.of(context).tooltipResetToZero,
|
||||||
|
),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue