mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 07:20:39 +00:00
added default equipment profile
This commit is contained in:
parent
a12c9b8558
commit
b6a7f68b5c
3 changed files with 24 additions and 21 deletions
|
@ -16,18 +16,18 @@ class EquipmentProfileProvider extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
|
class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
|
||||||
final List<EquipmentProfileData> _profiles = [];
|
final List<EquipmentProfileData> _profiles = [
|
||||||
|
const EquipmentProfileData(
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
apertureValues: apertureValues,
|
||||||
|
ndValues: ndValues,
|
||||||
|
shutterSpeedValues: shutterSpeedValues,
|
||||||
|
isoValues: isoValues,
|
||||||
|
)
|
||||||
|
];
|
||||||
|
|
||||||
late EquipmentProfileData _selectedProfile = _profiles.isNotEmpty
|
late EquipmentProfileData _selectedProfile = _profiles.first;
|
||||||
? _profiles.first
|
|
||||||
: const EquipmentProfileData(
|
|
||||||
id: 'default',
|
|
||||||
name: '',
|
|
||||||
apertureValues: apertureValues,
|
|
||||||
ndValues: ndValues,
|
|
||||||
shutterSpeedValues: shutterSpeedValues,
|
|
||||||
isoValues: isoValues,
|
|
||||||
);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
|
@ -105,12 +105,12 @@ class _EquipmentProfilePicker extends StatelessWidget {
|
||||||
title: S.of(context).equipmentProfiles,
|
title: S.of(context).equipmentProfiles,
|
||||||
selectedValue: selectedValue,
|
selectedValue: selectedValue,
|
||||||
values: values,
|
values: values,
|
||||||
itemTitleBuilder: (_, value) => Text(value.name),
|
itemTitleBuilder: (_, value) => Text(value.id.isEmpty ? S.of(context).none : value.name),
|
||||||
onChanged: onChanged,
|
onChanged: onChanged,
|
||||||
closedChild: ReadingValueContainer.singleValue(
|
closedChild: ReadingValueContainer.singleValue(
|
||||||
value: ReadingValue(
|
value: ReadingValue(
|
||||||
label: S.of(context).equipmentProfiles,
|
label: S.of(context).equipmentProfiles,
|
||||||
value: selectedValue.name,
|
value: selectedValue.id.isEmpty ? S.of(context).none : selectedValue.name,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -50,15 +50,18 @@ class _EquipmentProfilesScreenState extends State<EquipmentProfilesScreen> {
|
||||||
Dimens.grid56 +
|
Dimens.grid56 +
|
||||||
kFloatingActionButtonMargin,
|
kFloatingActionButtonMargin,
|
||||||
),
|
),
|
||||||
separatorBuilder: (context, index) => const SizedBox(height: Dimens.grid16),
|
separatorBuilder: (context, index) =>
|
||||||
|
index > 0 ? const SizedBox(height: Dimens.grid16) : const SizedBox.shrink(),
|
||||||
itemCount: profilesCount,
|
itemCount: profilesCount,
|
||||||
itemBuilder: (context, index) => EquipmentProfileContainer(
|
itemBuilder: (context, index) => index > 0
|
||||||
key: profileContainersKeys[index],
|
? EquipmentProfileContainer(
|
||||||
data: EquipmentProfiles.of(context)![index],
|
key: profileContainersKeys[index],
|
||||||
onExpand: () => _keepExpandedAt(index),
|
data: EquipmentProfiles.of(context)![index],
|
||||||
onUpdate: (profileData) => _updateProfileAt(profileData, index),
|
onExpand: () => _keepExpandedAt(index),
|
||||||
onDelete: () => _removeProfileAt(index),
|
onUpdate: (profileData) => _updateProfileAt(profileData, index),
|
||||||
),
|
onDelete: () => _removeProfileAt(index),
|
||||||
|
)
|
||||||
|
: const SizedBox.shrink(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
|
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
|
||||||
|
|
Loading…
Reference in a new issue