diff --git a/lib/models/resume.dart b/lib/models/resume.dart index 9d02b4a..573adfa 100644 --- a/lib/models/resume.dart +++ b/lib/models/resume.dart @@ -317,18 +317,33 @@ class Resume extends ChangeNotifier { element.containsKey(sectionTitle)) .first .removeWhere((String key, GenericEntry value) => value == entry); + customSections.removeWhere( + (Map element) => element.keys.isEmpty); + if (customSections + .where((Map 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(); } diff --git a/lib/screens/input_form.dart b/lib/screens/input_form.dart index d3f9f99..888fd66 100644 --- a/lib/screens/input_form.dart +++ b/lib/screens/input_form.dart @@ -140,7 +140,6 @@ class _ResumeInputFormState extends State { confirmText: Strings.remove, onConfirm: () { resume.onDeleteCustomSection(title); - Navigator.of(context).pop(); }, ), ); @@ -430,10 +429,8 @@ class _ResumeInputFormState extends State { 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, ), diff --git a/pubspec.yaml b/pubspec.yaml index fac8d5c..ebea9c5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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"