diff --git a/lib/components/atomic_components/shared_components_atoms/tabview.dart b/lib/components/atomic_components/shared_components_atoms/tabview.dart index 32114202..30348b8d 100644 --- a/lib/components/atomic_components/shared_components_atoms/tabview.dart +++ b/lib/components/atomic_components/shared_components_atoms/tabview.dart @@ -10,7 +10,7 @@ class TabViewUtil extends StatelessWidget { String labelTab1; String labelTab2; final TabController controller; - final Function(bool) onEditingChanged; + final Function([bool]) onEditingChanged; Widget widget1; Widget widget2; @@ -59,7 +59,7 @@ class TabViewUtil extends StatelessWidget { ], controller: controller, onTap: (i) async { - if (i == 1) onEditingChanged(false); + onEditingChanged(); [() async {}, () async {}][i](); }, ), diff --git a/lib/pages/pets_page/pets_page_widget.dart b/lib/pages/pets_page/pets_page_widget.dart index 8816c468..0fb09390 100644 --- a/lib/pages/pets_page/pets_page_widget.dart +++ b/lib/pages/pets_page/pets_page_widget.dart @@ -86,9 +86,9 @@ class _PetsPageWidgetState extends State ); } - void onEditingChanged(bool value) { + void onEditingChanged([bool? value]) { setState(() { - _model.handleEditingChanged(value); + _model.handleEditingChanged(value!); }); } diff --git a/lib/pages/vehicles_on_the_property/vehicles_on_the_property.dart b/lib/pages/vehicles_on_the_property/vehicles_on_the_property.dart index dfaade25..180c672b 100644 --- a/lib/pages/vehicles_on_the_property/vehicles_on_the_property.dart +++ b/lib/pages/vehicles_on_the_property/vehicles_on_the_property.dart @@ -116,9 +116,18 @@ class _VehiclePageState extends State } } - void onEditingChanged(bool value) { - if (_model.isEditing) setState(() {}); - _model.handleEditingChanged(value); + void onEditingChanged([bool? value]) { + bool isFirst = _model.tabBarController.index == 0; + + if (_model.isEditing & isFirst) { + _model.handleEditingChanged(false); + setState(() {}); + } + // if (isFirst) FocusScope.of(context).unfocus(); + if (isFirst) { + FocusScope.of(context).unfocus(); + // FocusScope.of(context).nextFocus(); + } } Widget _buildVehicleHistory(BuildContext context) {