mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 07:20:39 +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 {
|
class EquipmentProfiles extends InheritedWidget {
|
||||||
|
|
|
@ -1,14 +1,18 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/scheduler.dart';
|
import 'package:flutter/scheduler.dart';
|
||||||
import 'package:lightmeter/generated/l10n.dart';
|
|
||||||
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||||
|
|
||||||
import 'components/equipment_list_tiles/widget_list_tiles_equipments.dart';
|
import 'components/equipment_list_tiles/widget_list_tiles_equipments.dart';
|
||||||
|
|
||||||
class EquipmentListTilesSection extends StatefulWidget {
|
class EquipmentListTilesSection extends StatefulWidget {
|
||||||
final EquipmentProfileData data;
|
final EquipmentProfileData data;
|
||||||
|
final VoidCallback onDelete;
|
||||||
|
|
||||||
const EquipmentListTilesSection({required this.data, super.key});
|
const EquipmentListTilesSection({
|
||||||
|
required this.data,
|
||||||
|
required this.onDelete,
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<EquipmentListTilesSection> createState() => _EquipmentListTilesSectionState();
|
State<EquipmentListTilesSection> createState() => _EquipmentListTilesSectionState();
|
||||||
|
@ -63,7 +67,7 @@ class _EquipmentListTilesSectionState extends State<EquipmentListTilesSection> {
|
||||||
children: [
|
children: [
|
||||||
_collapseButton(),
|
_collapseButton(),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {},
|
onPressed: widget.onDelete,
|
||||||
icon: const Icon(Icons.delete),
|
icon: const Icon(Icons.delete),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
@ -37,6 +37,10 @@ class _EquipmentProfileScreenState extends State<EquipmentProfileScreen> {
|
||||||
itemCount: EquipmentProfiles.of(context)?.length ?? 0,
|
itemCount: EquipmentProfiles.of(context)?.length ?? 0,
|
||||||
itemBuilder: (_, index) => EquipmentListTilesSection(
|
itemBuilder: (_, index) => EquipmentListTilesSection(
|
||||||
data: EquipmentProfiles.of(context)![index],
|
data: EquipmentProfiles.of(context)![index],
|
||||||
|
onDelete: () {
|
||||||
|
EquipmentProfileProvider.of(context)
|
||||||
|
.deleteProfile(EquipmentProfiles.of(context)![index]);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue