mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-21 23:10:40 +00:00
mock add/delete
This commit is contained in:
parent
5e814184f0
commit
2ef59d9eb6
3 changed files with 30 additions and 6 deletions
|
@ -45,11 +45,27 @@ class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
|
|||
});
|
||||
}
|
||||
|
||||
void addProfile(EquipmentProfileData data) {}
|
||||
/// Creates a default equipment profile
|
||||
void addProfile() {
|
||||
_profiles.add(const EquipmentProfileData(
|
||||
id: 'default',
|
||||
name: '',
|
||||
apertureValues: apertureValues,
|
||||
ndValues: ndValues,
|
||||
shutterSpeedValues: shutterSpeedValues,
|
||||
isoValues: isoValues,
|
||||
));
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
void updateProdile(EquipmentProfileData data) {}
|
||||
void updateProdile(EquipmentProfileData data) {
|
||||
//
|
||||
}
|
||||
|
||||
void deleteProfile(EquipmentProfileData data) {}
|
||||
void deleteProfile(EquipmentProfileData data) {
|
||||
_profiles.remove(data);
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
|
||||
class EquipmentProfiles extends InheritedWidget {
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:lightmeter/generated/l10n.dart';
|
||||
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||
|
||||
import 'components/equipment_list_tiles/widget_list_tiles_equipments.dart';
|
||||
|
||||
class EquipmentListTilesSection extends StatefulWidget {
|
||||
final EquipmentProfileData data;
|
||||
final VoidCallback onDelete;
|
||||
|
||||
const EquipmentListTilesSection({required this.data, super.key});
|
||||
const EquipmentListTilesSection({
|
||||
required this.data,
|
||||
required this.onDelete,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
State<EquipmentListTilesSection> createState() => _EquipmentListTilesSectionState();
|
||||
|
@ -63,7 +67,7 @@ class _EquipmentListTilesSectionState extends State<EquipmentListTilesSection> {
|
|||
children: [
|
||||
_collapseButton(),
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
onPressed: widget.onDelete,
|
||||
icon: const Icon(Icons.delete),
|
||||
),
|
||||
],
|
||||
|
|
|
@ -37,6 +37,10 @@ class _EquipmentProfileScreenState extends State<EquipmentProfileScreen> {
|
|||
itemCount: EquipmentProfiles.of(context)?.length ?? 0,
|
||||
itemBuilder: (_, index) => EquipmentListTilesSection(
|
||||
data: EquipmentProfiles.of(context)![index],
|
||||
onDelete: () {
|
||||
EquipmentProfileProvider.of(context)
|
||||
.deleteProfile(EquipmentProfiles.of(context)![index]);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue