Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 4301 - "other lists" button always visible #4302

Merged
merged 1 commit into from
Jul 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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