mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-21 23:10:40 +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> {
|
||||
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
|
||||
? _profiles.first
|
||||
: const EquipmentProfileData(
|
||||
id: 'default',
|
||||
name: '',
|
||||
apertureValues: apertureValues,
|
||||
ndValues: ndValues,
|
||||
shutterSpeedValues: shutterSpeedValues,
|
||||
isoValues: isoValues,
|
||||
);
|
||||
late EquipmentProfileData _selectedProfile = _profiles.first;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
|
@ -105,12 +105,12 @@ class _EquipmentProfilePicker extends StatelessWidget {
|
|||
title: S.of(context).equipmentProfiles,
|
||||
selectedValue: selectedValue,
|
||||
values: values,
|
||||
itemTitleBuilder: (_, value) => Text(value.name),
|
||||
itemTitleBuilder: (_, value) => Text(value.id.isEmpty ? S.of(context).none : value.name),
|
||||
onChanged: onChanged,
|
||||
closedChild: ReadingValueContainer.singleValue(
|
||||
value: ReadingValue(
|
||||
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 +
|
||||
kFloatingActionButtonMargin,
|
||||
),
|
||||
separatorBuilder: (context, index) => const SizedBox(height: Dimens.grid16),
|
||||
separatorBuilder: (context, index) =>
|
||||
index > 0 ? const SizedBox(height: Dimens.grid16) : const SizedBox.shrink(),
|
||||
itemCount: profilesCount,
|
||||
itemBuilder: (context, index) => EquipmentProfileContainer(
|
||||
key: profileContainersKeys[index],
|
||||
data: EquipmentProfiles.of(context)![index],
|
||||
onExpand: () => _keepExpandedAt(index),
|
||||
onUpdate: (profileData) => _updateProfileAt(profileData, index),
|
||||
onDelete: () => _removeProfileAt(index),
|
||||
),
|
||||
itemBuilder: (context, index) => index > 0
|
||||
? EquipmentProfileContainer(
|
||||
key: profileContainersKeys[index],
|
||||
data: EquipmentProfiles.of(context)![index],
|
||||
onExpand: () => _keepExpandedAt(index),
|
||||
onUpdate: (profileData) => _updateProfileAt(profileData, index),
|
||||
onDelete: () => _removeProfileAt(index),
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
),
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
|
||||
|
|
Loading…
Reference in a new issue