Skip to content

Commit

Permalink
fix: 4301 - "other lists" button always visible (#4302)
Browse files Browse the repository at this point in the history
Impacted file:
* `product_list_page.dart`: the "other lists" button is now always visible
  • Loading branch information
monsieurtanuki authored Jul 14, 2023
1 parent aa73434 commit bd38e61
Showing 1 changed file with 42 additions and 45 deletions.
87 changes: 42 additions & 45 deletions packages/smooth_app/lib/pages/product/common/product_list_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,53 +125,50 @@ class _ProductListPageState extends State<ProductListPage>
),
appBar: SmoothAppBar(
centerTitle: _selectionMode ? false : null,
actions: !(enableClear || enableRename)
? null
: <Widget>[
IconButton(
icon: const Icon(CupertinoIcons.square_list),
onPressed: () async {
final ProductList? selected =
await Navigator.push<ProductList>(
context,
MaterialPageRoute<ProductList>(
builder: (BuildContext context) =>
const AllProductListPage(),
fullscreenDialog: true,
),
);
if (selected == null) {
return;
}
if (context.mounted) {
await DaoProductList(localDatabase).get(selected);
if (context.mounted) {
setState(() => productList = selected);
}
}
},
),
PopupMenuButton<ProductListPopupItem>(
onSelected: (final ProductListPopupItem action) async {
final ProductList? differentProductList =
await action.doSomething(
productList: productList,
localDatabase: localDatabase,
context: context,
);
if (differentProductList != null) {
setState(() => productList = differentProductList);
}
},
itemBuilder: (BuildContext context) =>
<PopupMenuEntry<ProductListPopupItem>>[
if (enableRename) _rename.getMenuItem(appLocalizations),
_share.getMenuItem(appLocalizations),
_openInWeb.getMenuItem(appLocalizations),
if (enableClear) _clear.getMenuItem(appLocalizations),
],
actions: <Widget>[
IconButton(
icon: const Icon(CupertinoIcons.square_list),
onPressed: () async {
final ProductList? selected = await Navigator.push<ProductList>(
context,
MaterialPageRoute<ProductList>(
builder: (BuildContext context) => const AllProductListPage(),
fullscreenDialog: true,
),
);
if (selected == null) {
return;
}
if (context.mounted) {
await DaoProductList(localDatabase).get(selected);
if (context.mounted) {
setState(() => productList = selected);
}
}
},
),
if (enableClear || enableRename)
PopupMenuButton<ProductListPopupItem>(
onSelected: (final ProductListPopupItem action) async {
final ProductList? differentProductList =
await action.doSomething(
productList: productList,
localDatabase: localDatabase,
context: context,
);
if (differentProductList != null) {
setState(() => productList = differentProductList);
}
},
itemBuilder: (BuildContext context) =>
<PopupMenuEntry<ProductListPopupItem>>[
if (enableRename) _rename.getMenuItem(appLocalizations),
_share.getMenuItem(appLocalizations),
_openInWeb.getMenuItem(appLocalizations),
if (enableClear) _clear.getMenuItem(appLocalizations),
],
),
],
title: AutoSizeText(
ProductQueryPageHelper.getProductListLabel(
productList,
Expand Down

0 comments on commit bd38e61

Please sign in to comment.