mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-25 00:40:39 +00:00
added zoom slider to equipment profiles settings
This commit is contained in:
parent
cb220f9e9e
commit
37219920a5
5 changed files with 148 additions and 1 deletions
|
@ -60,6 +60,8 @@
|
||||||
"shutterSpeedValuesFilterDescription": "Select the range of shutter speed values to display. This is usually determined by the camera body you are using.",
|
"shutterSpeedValuesFilterDescription": "Select the range of shutter speed values to display. This is usually determined by the camera body you are using.",
|
||||||
"isoValues": "ISO values",
|
"isoValues": "ISO values",
|
||||||
"isoValuesFilterDescription": "Select the ISO values to display. These may be your most commonly used values or those supported by your camera.",
|
"isoValuesFilterDescription": "Select the ISO values to display. These may be your most commonly used values or those supported by your camera.",
|
||||||
|
"lensZoom": "Lens zoom",
|
||||||
|
"lensZoomDescription": "Set the zoom level relative to the phone's camera to match your camera's viewfinder.",
|
||||||
"equipmentProfile": "Equipment profile",
|
"equipmentProfile": "Equipment profile",
|
||||||
"equipmentProfiles": "Equipment profiles",
|
"equipmentProfiles": "Equipment profiles",
|
||||||
"tapToAdd": "Tap to add",
|
"tapToAdd": "Tap to add",
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:lightmeter/generated/l10n.dart';
|
import 'package:lightmeter/generated/l10n.dart';
|
||||||
|
import 'package:lightmeter/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/components/slider_picker_list_tile/widget_list_tile_slider_picker.dart';
|
||||||
import 'package:lightmeter/screens/settings/components/shared/dialog_filter/widget_dialog_filter.dart';
|
import 'package:lightmeter/screens/settings/components/shared/dialog_filter/widget_dialog_filter.dart';
|
||||||
import 'package:lightmeter/screens/settings/components/shared/dialog_range_picker/widget_dialog_picker_range.dart';
|
import 'package:lightmeter/screens/settings/components/shared/dialog_range_picker/widget_dialog_picker_range.dart';
|
||||||
|
import 'package:lightmeter/screens/settings/components/shared/dialog_slider_picker/widget_dialog_slider_picker.dart';
|
||||||
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||||
|
|
||||||
class EquipmentListTiles extends StatelessWidget {
|
class EquipmentListTiles extends StatelessWidget {
|
||||||
|
@ -67,6 +69,15 @@ class EquipmentListTiles extends StatelessWidget {
|
||||||
rangeSelect: true,
|
rangeSelect: true,
|
||||||
onChanged: onShutterSpeedValuesSelected,
|
onChanged: onShutterSpeedValuesSelected,
|
||||||
),
|
),
|
||||||
|
SliderPickerListTile(
|
||||||
|
icon: Icons.zoom_in,
|
||||||
|
title: S.of(context).lensZoom,
|
||||||
|
description: S.of(context).lensZoomDescription,
|
||||||
|
value: 1.0,
|
||||||
|
range: const RangeValues(1, 7),
|
||||||
|
onChanged: (value) {},
|
||||||
|
valueAdapter: (context, value) => 'x${value.toStringAsFixed(2)}',
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:lightmeter/screens/settings/components/shared/dialog_slider_picker/widget_dialog_slider_picker.dart';
|
||||||
|
|
||||||
|
class SliderPickerListTile extends StatelessWidget {
|
||||||
|
final IconData icon;
|
||||||
|
final String title;
|
||||||
|
final String description;
|
||||||
|
final double value;
|
||||||
|
final RangeValues range;
|
||||||
|
final ValueChanged<double> onChanged;
|
||||||
|
final String Function(BuildContext, double) valueAdapter;
|
||||||
|
|
||||||
|
const SliderPickerListTile({
|
||||||
|
required this.icon,
|
||||||
|
required this.title,
|
||||||
|
required this.description,
|
||||||
|
required this.value,
|
||||||
|
required this.range,
|
||||||
|
required this.onChanged,
|
||||||
|
required this.valueAdapter,
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ListTile(
|
||||||
|
leading: Icon(icon),
|
||||||
|
title: Text(title),
|
||||||
|
trailing: Text(value.toString()),
|
||||||
|
onTap: () {
|
||||||
|
showDialog<double>(
|
||||||
|
context: context,
|
||||||
|
builder: (_) => DialogSliderPicker(
|
||||||
|
icon: Icon(icon),
|
||||||
|
title: title,
|
||||||
|
description: description,
|
||||||
|
value: value,
|
||||||
|
range: range,
|
||||||
|
valueAdapter: valueAdapter,
|
||||||
|
),
|
||||||
|
).then((value) {
|
||||||
|
if (value != null) {
|
||||||
|
onChanged(value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -222,7 +222,7 @@ class _AnimatedEquipmentListTiles extends AnimatedWidget {
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
size: Size(
|
size: Size(
|
||||||
double.maxFinite,
|
double.maxFinite,
|
||||||
_progress.value * Dimens.grid56 * 5,
|
_progress.value * Dimens.grid56 * 6,
|
||||||
),
|
),
|
||||||
// https://github.com/gskinnerTeam/flutter-folio/pull/62
|
// https://github.com/gskinnerTeam/flutter-folio/pull/62
|
||||||
child: Opacity(
|
child: Opacity(
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:lightmeter/generated/l10n.dart';
|
||||||
|
import 'package:lightmeter/res/dimens.dart';
|
||||||
|
|
||||||
|
class DialogSliderPicker extends StatefulWidget {
|
||||||
|
final Icon icon;
|
||||||
|
final String title;
|
||||||
|
final String description;
|
||||||
|
final double value;
|
||||||
|
final RangeValues range;
|
||||||
|
final String Function(BuildContext context, double value) valueAdapter;
|
||||||
|
|
||||||
|
const DialogSliderPicker({
|
||||||
|
required this.icon,
|
||||||
|
required this.title,
|
||||||
|
required this.description,
|
||||||
|
required this.value,
|
||||||
|
required this.range,
|
||||||
|
required this.valueAdapter,
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<DialogSliderPicker> createState() => _DialogSliderPickerState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DialogSliderPickerState extends State<DialogSliderPicker> {
|
||||||
|
late double value = widget.value;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
icon: widget.icon,
|
||||||
|
titlePadding: Dimens.dialogIconTitlePadding,
|
||||||
|
title: Text(widget.title),
|
||||||
|
contentPadding: EdgeInsets.zero,
|
||||||
|
content: SizedBox(
|
||||||
|
width: double.maxFinite,
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: Dimens.dialogIconTitlePadding,
|
||||||
|
child: Text(widget.description),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: Dimens.paddingL),
|
||||||
|
child: Text(
|
||||||
|
widget.valueAdapter(context, value),
|
||||||
|
style: Theme.of(context).textTheme.bodyLarge,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Slider(
|
||||||
|
value: value,
|
||||||
|
min: widget.range.start,
|
||||||
|
max: widget.range.end,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
this.value = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actionsPadding: Dimens.dialogActionsPadding,
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: Navigator.of(context).pop,
|
||||||
|
child: Text(S.of(context).cancel),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(value),
|
||||||
|
child: Text(S.of(context).save),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue