mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 15:30:59 +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(
|
||||||
late EquipmentProfileData _selectedProfile = _profiles.isNotEmpty
|
id: '',
|
||||||
? _profiles.first
|
|
||||||
: const EquipmentProfileData(
|
|
||||||
id: 'default',
|
|
||||||
name: '',
|
name: '',
|
||||||
apertureValues: apertureValues,
|
apertureValues: apertureValues,
|
||||||
ndValues: ndValues,
|
ndValues: ndValues,
|
||||||
shutterSpeedValues: shutterSpeedValues,
|
shutterSpeedValues: shutterSpeedValues,
|
||||||
isoValues: isoValues,
|
isoValues: isoValues,
|
||||||
);
|
)
|
||||||
|
];
|
||||||
|
|
||||||
|
late EquipmentProfileData _selectedProfile = _profiles.first;
|
||||||
|
|
||||||
@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
|
||||||
|
? EquipmentProfileContainer(
|
||||||
key: profileContainersKeys[index],
|
key: profileContainersKeys[index],
|
||||||
data: EquipmentProfiles.of(context)![index],
|
data: EquipmentProfiles.of(context)![index],
|
||||||
onExpand: () => _keepExpandedAt(index),
|
onExpand: () => _keepExpandedAt(index),
|
||||||
onUpdate: (profileData) => _updateProfileAt(profileData, index),
|
onUpdate: (profileData) => _updateProfileAt(profileData, index),
|
||||||
onDelete: () => _removeProfileAt(index),
|
onDelete: () => _removeProfileAt(index),
|
||||||
),
|
)
|
||||||
|
: const SizedBox.shrink(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
|
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
|
||||||
|
|
Loading…
Reference in a new issue