Skip to content

Commit

Permalink
Deleting Entry Bug Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
PLGuerraDesigns committed Oct 13, 2023
1 parent f6c4a84 commit 66a7056
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
15 changes: 15 additions & 0 deletions lib/models/resume.dart
Original file line number Diff line number Diff line change
Expand Up @@ -317,18 +317,33 @@ class Resume extends ChangeNotifier {
element.containsKey(sectionTitle))
.first
.removeWhere((String key, GenericEntry value) => value == entry);
customSections.removeWhere(
(Map<String, GenericEntry> element) => element.keys.isEmpty);
if (customSections
.where((Map<String, GenericEntry> element) =>
element.containsKey(sectionTitle))
.isEmpty) {
addCustomSectionEntry(sectionTitle);
}

notifyListeners();
}

/// Delete a contact.
void onDeleteExperience(Experience experience) {
experiences.remove(experience);
if (experiences.isEmpty) {
addExperience();
}
notifyListeners();
}

/// Delete an education entry.
void onDeleteEducation(Education education) {
educationHistory.remove(education);
if (educationHistory.isEmpty) {
addEducation();
}
notifyListeners();
}

Expand Down
7 changes: 2 additions & 5 deletions lib/screens/input_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ class _ResumeInputFormState extends State<ResumeInputForm> {
confirmText: Strings.remove,
onConfirm: () {
resume.onDeleteCustomSection(title);
Navigator.of(context).pop();
},
),
);
Expand Down Expand Up @@ -430,10 +429,8 @@ class _ResumeInputFormState extends State<ResumeInputForm> {
child: CustomEntry(
portrait: widget.portrait,
genericSection: genericSection[index],
onRemove: () {
resume.onDeleteCustomSectionEntry(
genericSection[index], title);
},
onRemove: () => resume.onDeleteCustomSectionEntry(
genericSection[index], title),
enableEditing: resume.sectionVisible(title),
rebuild: resume.rebuild,
),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: A resume builder app made with flutter.

publish_to: "none"

version: 0.4.5+12
version: 0.4.6+13

environment:
sdk: ">=3.0.6 <4.0.0"
Expand Down

0 comments on commit 66a7056

Please sign in to comment.