mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-21 23:10:40 +00:00
switched to local Dimens
This commit is contained in:
parent
18210caf7d
commit
7d23e3584a
10 changed files with 75 additions and 31 deletions
|
@ -31,7 +31,8 @@ class Dimens {
|
|||
|
||||
// TopBar
|
||||
/// Probably this is a bad practice, but with text size locked, the height is always 212
|
||||
static const double readingContainerHeight = 212;
|
||||
static const double readingContainerSingleValueHeight = 76;
|
||||
static const double readingContainerDefaultHeight = 212;
|
||||
|
||||
// `CenteredSlider`
|
||||
static const double cameraSliderTrackHeight = grid4;
|
||||
|
@ -47,8 +48,14 @@ class Dimens {
|
|||
paddingL,
|
||||
paddingM,
|
||||
);
|
||||
static const EdgeInsets dialogActionsPadding = EdgeInsets.fromLTRB(
|
||||
static const EdgeInsets dialogIconTitlePadding = EdgeInsets.fromLTRB(
|
||||
paddingL,
|
||||
0,
|
||||
paddingL,
|
||||
paddingM,
|
||||
);
|
||||
static const EdgeInsets dialogActionsPadding = EdgeInsets.fromLTRB(
|
||||
paddingM,
|
||||
paddingM,
|
||||
paddingL,
|
||||
paddingL,
|
||||
|
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:lightmeter/data/models/exposure_pair.dart';
|
||||
import 'package:lightmeter/platform_config.dart';
|
||||
import 'package:lightmeter/res/dimens.dart';
|
||||
import 'package:lightmeter/screens/metering/components/camera_container/components/camera_view/widget_camera_view.dart';
|
||||
import 'package:lightmeter/screens/metering/components/camera_container/models/camera_error_type.dart';
|
||||
import 'package:lightmeter/screens/metering/components/shared/exposure_pairs_list/widget_list_exposure_pairs.dart';
|
||||
|
@ -44,7 +45,7 @@ class CameraContainer extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final topBarOverflow = Dimens.readingContainerHeight -
|
||||
final topBarOverflow = Dimens.readingContainerDefaultHeight -
|
||||
((MediaQuery.of(context).size.width - Dimens.grid8 - 2 * Dimens.paddingM) / 2) /
|
||||
PlatformConfig.cameraPreviewAspectRatio;
|
||||
return Column(
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:lightmeter/data/models/exposure_pair.dart';
|
||||
import 'package:lightmeter/res/dimens.dart';
|
||||
import 'package:lightmeter/screens/metering/components/shared/exposure_pairs_list/widget_list_exposure_pairs.dart';
|
||||
import 'package:lightmeter/screens/metering/components/shared/metering_top_bar/widget_top_bar_metering.dart';
|
||||
import 'package:lightmeter/screens/metering/components/shared/readings_container/widget_container_readings.dart';
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:lightmeter/res/dimens.dart';
|
||||
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||
|
||||
class ExposurePairsListItem<T extends PhotographyStopValue> extends StatelessWidget {
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:lightmeter/generated/l10n.dart';
|
||||
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||
import 'package:lightmeter/res/dimens.dart';
|
||||
|
||||
typedef DialogPickerItemTitleBuilder<T> = Widget Function(BuildContext context, T value);
|
||||
typedef DialogPickerItemTrailingBuilder<T> = Widget? Function(T selected, T value);
|
||||
|
||||
class DialogPicker<T> extends StatefulWidget {
|
||||
final String title;
|
||||
final String subtitle;
|
||||
final String? subtitle;
|
||||
final T initialValue;
|
||||
final List<T> values;
|
||||
final DialogPickerItemTitleBuilder<T> itemTitleBuilder;
|
||||
final DialogPickerItemTrailingBuilder<T> itemTrailingBuilder;
|
||||
final DialogPickerItemTrailingBuilder<T>? itemTrailingBuilder;
|
||||
final VoidCallback onCancel;
|
||||
final ValueChanged onSelect;
|
||||
|
||||
const DialogPicker({
|
||||
required this.title,
|
||||
required this.subtitle,
|
||||
this.subtitle,
|
||||
required this.initialValue,
|
||||
required this.values,
|
||||
required this.itemTitleBuilder,
|
||||
required this.itemTrailingBuilder,
|
||||
this.itemTrailingBuilder,
|
||||
required this.onCancel,
|
||||
required this.onSelect,
|
||||
super.key,
|
||||
|
@ -56,12 +56,14 @@ class _DialogPickerState<T> extends State<DialogPicker<T>> {
|
|||
style: Theme.of(context).textTheme.headlineSmall!,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: Dimens.grid16),
|
||||
Text(
|
||||
widget.subtitle,
|
||||
style: Theme.of(context).textTheme.bodyMedium!,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
if (widget.subtitle != null) ...[
|
||||
const SizedBox(height: Dimens.grid16),
|
||||
Text(
|
||||
widget.subtitle!,
|
||||
style: Theme.of(context).textTheme.bodyMedium!,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
]
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -79,7 +81,7 @@ class _DialogPickerState<T> extends State<DialogPicker<T>> {
|
|||
style: Theme.of(context).textTheme.bodyLarge!,
|
||||
child: widget.itemTitleBuilder(context, widget.values[index]),
|
||||
),
|
||||
secondary: widget.itemTrailingBuilder(_selectedValue, widget.values[index]),
|
||||
secondary: widget.itemTrailingBuilder?.call(_selectedValue, widget.values[index]),
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
setState(() {
|
||||
|
|
|
@ -6,21 +6,21 @@ import 'components/dialog_picker/widget_picker_dialog.dart';
|
|||
class AnimatedDialogPicker<T> extends StatelessWidget {
|
||||
final _key = GlobalKey<AnimatedDialogState>();
|
||||
final String title;
|
||||
final String subtitle;
|
||||
final String? subtitle;
|
||||
final T selectedValue;
|
||||
final List<T> values;
|
||||
final DialogPickerItemTitleBuilder<T> itemTitleBuilder;
|
||||
final DialogPickerItemTrailingBuilder<T> itemTrailingBuilder;
|
||||
final DialogPickerItemTrailingBuilder<T>? itemTrailingBuilder;
|
||||
final ValueChanged<T> onChanged;
|
||||
final Widget closedChild;
|
||||
|
||||
AnimatedDialogPicker({
|
||||
required this.title,
|
||||
required this.subtitle,
|
||||
this.subtitle,
|
||||
required this.selectedValue,
|
||||
required this.values,
|
||||
required this.itemTitleBuilder,
|
||||
required this.itemTrailingBuilder,
|
||||
this.itemTrailingBuilder,
|
||||
required this.onChanged,
|
||||
required this.closedChild,
|
||||
super.key,
|
||||
|
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:lightmeter/data/models/exposure_pair.dart';
|
||||
import 'package:lightmeter/generated/l10n.dart';
|
||||
import 'package:lightmeter/providers/equipment_profile_provider.dart';
|
||||
import 'package:lightmeter/res/dimens.dart';
|
||||
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||
|
||||
import 'components/animated_dialog_picker/widget_picker_dialog_animated.dart';
|
||||
|
@ -37,12 +38,11 @@ class ReadingsContainer extends StatelessWidget {
|
|||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
if (true) ...[
|
||||
ReadingValueContainer.singleValue(
|
||||
value: ReadingValue(
|
||||
label: S.of(context).equipment,
|
||||
value: EquipmentProfile.of(context)!.name,
|
||||
),
|
||||
if (EquipmentProfile.of(context) != null && EquipmentProfiles.of(context) != null) ...[
|
||||
_EquipmentProfilePicker(
|
||||
selectedValue: EquipmentProfile.of(context)!,
|
||||
values: EquipmentProfiles.of(context)!,
|
||||
onChanged: (value) {},
|
||||
),
|
||||
const _InnerPadding(),
|
||||
],
|
||||
|
@ -62,7 +62,7 @@ class ReadingsContainer extends StatelessWidget {
|
|||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _IsoValueTile(
|
||||
child: _IsoValuePicker(
|
||||
selectedValue: iso,
|
||||
values: isoValues,
|
||||
onChanged: onIsoChanged,
|
||||
|
@ -70,7 +70,7 @@ class ReadingsContainer extends StatelessWidget {
|
|||
),
|
||||
const _InnerPadding(),
|
||||
Expanded(
|
||||
child: _NdValueTile(
|
||||
child: _NdValuePicker(
|
||||
selectedValue: nd,
|
||||
values: ndValues,
|
||||
onChanged: onNdChanged,
|
||||
|
@ -87,12 +87,41 @@ class _InnerPadding extends SizedBox {
|
|||
const _InnerPadding() : super(height: Dimens.grid8, width: Dimens.grid8);
|
||||
}
|
||||
|
||||
class _IsoValueTile extends StatelessWidget {
|
||||
class _EquipmentProfilePicker extends StatelessWidget {
|
||||
final List<EquipmentProfileData> values;
|
||||
final EquipmentProfileData selectedValue;
|
||||
final ValueChanged<EquipmentProfileData> onChanged;
|
||||
|
||||
const _EquipmentProfilePicker({
|
||||
required this.selectedValue,
|
||||
required this.values,
|
||||
required this.onChanged,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AnimatedDialogPicker<EquipmentProfileData>(
|
||||
title: S.of(context).equipmentProfiles,
|
||||
selectedValue: selectedValue,
|
||||
values: values,
|
||||
itemTitleBuilder: (_, value) => Text(value.name),
|
||||
onChanged: onChanged,
|
||||
closedChild: ReadingValueContainer.singleValue(
|
||||
value: ReadingValue(
|
||||
label: S.of(context).equipmentProfiles,
|
||||
value: selectedValue.name,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _IsoValuePicker extends StatelessWidget {
|
||||
final List<IsoValue> values;
|
||||
final IsoValue selectedValue;
|
||||
final ValueChanged<IsoValue> onChanged;
|
||||
|
||||
const _IsoValueTile({
|
||||
const _IsoValuePicker({
|
||||
required this.selectedValue,
|
||||
required this.values,
|
||||
required this.onChanged,
|
||||
|
@ -121,12 +150,12 @@ class _IsoValueTile extends StatelessWidget {
|
|||
}
|
||||
}
|
||||
|
||||
class _NdValueTile extends StatelessWidget {
|
||||
class _NdValuePicker extends StatelessWidget {
|
||||
final List<NdValue> values;
|
||||
final NdValue selectedValue;
|
||||
final ValueChanged<NdValue> onChanged;
|
||||
|
||||
const _NdValueTile({
|
||||
const _NdValuePicker({
|
||||
required this.selectedValue,
|
||||
required this.values,
|
||||
required this.onChanged,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:lightmeter/generated/l10n.dart';
|
||||
import 'package:lightmeter/res/dimens.dart';
|
||||
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||
|
||||
import 'components/equipment_list_tiles/widget_list_tiles_equipments.dart';
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:lightmeter/generated/l10n.dart';
|
||||
import 'package:lightmeter/providers/equipment_profile_provider.dart';
|
||||
import 'package:lightmeter/res/dimens.dart';
|
||||
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||
|
||||
import 'components/equipment_profile_container/widget_container_equipment_profile.dart';
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:lightmeter/generated/l10n.dart';
|
||||
import 'package:lightmeter/res/dimens.dart';
|
||||
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||
|
||||
class DialogFilter<T extends PhotographyValue> extends StatefulWidget {
|
||||
|
|
Loading…
Reference in a new issue