Skip to content

Commit d488eeb

Browse files
authored
fix: 2 bugfixes (brand not removable + minor issue) (#6199)
* Always unfocus before showing the "May exit…" sheet * Fix: unable to remove reordered brands
1 parent 2ecb24e commit d488eeb

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

packages/smooth_app/lib/pages/product/add_basic_details_page.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ class _AddBasicDetailsPageState extends State<AddBasicDetailsPage> {
6161
final SimpleInputPageBrandsHelper _brandsHelper =
6262
SimpleInputPageBrandsHelper();
6363
late final MultilingualHelper _multilingualHelper;
64-
late final FocusNode _focusNode;
6564

6665
/// Only used when there's not enough place
6766
bool _showPhotosBanner = false;
@@ -81,7 +80,6 @@ class _AddBasicDetailsPageState extends State<AddBasicDetailsPage> {
8180
monolingualText: _product.productName,
8281
productLanguage: _product.lang,
8382
);
84-
_focusNode = FocusNode();
8583
}
8684

8785
@override
@@ -137,7 +135,6 @@ class _AddBasicDetailsPageState extends State<AddBasicDetailsPage> {
137135
_productNameController.dispose();
138136
_brandsController.dispose();
139137
_weightController.dispose();
140-
_focusNode.dispose();
141138
super.dispose();
142139
}
143140

packages/smooth_app/lib/pages/product/may_exit_page_helper.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ class MayExitPageHelper {
1818
Future<bool?> openSaveBeforeLeavingDialog(
1919
final BuildContext context, {
2020
final String? title,
21+
final bool unfocus = true,
2122
}) async {
23+
if (unfocus) {
24+
FocusManager.instance.primaryFocus?.unfocus();
25+
}
26+
2227
final AppLocalizations appLocalizations = AppLocalizations.of(context);
2328
final SmoothColorsThemeExtension extension =
2429
context.extension<SmoothColorsThemeExtension>();

packages/smooth_app/lib/pages/product/simple_input_page_helpers.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ abstract class AbstractSimpleInputPageHelper extends ChangeNotifier {
207207

208208
/// Mainly used when reordering the list.
209209
void replaceItems(final List<String> items) {
210-
_terms = items;
210+
_terms = List<String>.of(items);
211211
_changed = true;
212212
notifyListeners();
213213
}

0 commit comments

Comments
 (0)