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: Recent item description not editable #354

Merged
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion lib/pages/household_page/shoppinglist.dart
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ class _ShoppinglistPageState extends State<ShoppinglistPage> {
categories: state.categories,
shoppingList: state.selectedShoppinglist,
onRefresh: cubit.refresh,
isDescriptionEditable: false,
isLoading: state is LoadingShoppinglistCubitState,
),
],
Expand Down
10 changes: 2 additions & 8 deletions lib/pages/item_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@ class ItemPage<T extends Item> extends StatefulWidget {
final Household? household;
final ShoppingList? shoppingList;
final List<Category> categories;
final bool isDescriptionEditable;

const ItemPage({
super.key,
required this.item,
this.shoppingList,
this.household,
this.categories = const [],
this.isDescriptionEditable = true,
});

@override
Expand Down Expand Up @@ -125,8 +123,7 @@ class _ItemPageState<T extends Item> extends State<ItemPage<T>> {
onRefresh: cubit.refresh,
child: CustomScrollView(
slivers: [
if (widget.isDescriptionEditable &&
widget.item is ItemWithDescription)
if (widget.item is ItemWithDescription)
SliverPadding(
padding: const EdgeInsets.all(16),
sliver: SliverToBoxAdapter(
Expand Down Expand Up @@ -162,10 +159,7 @@ class _ItemPageState<T extends Item> extends State<ItemPage<T>> {
if (widget.item is! RecipeItem)
SliverPadding(
padding: EdgeInsets.only(
top: (widget.isDescriptionEditable &&
widget.item is ItemWithDescription)
? 0
: 16,
top: (widget.item is ItemWithDescription) ? 0 : 16,
bottom: 16,
left: 16,
right: 16,
Expand Down
3 changes: 0 additions & 3 deletions lib/widgets/home_page/sliver_category_item_grid_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class SliverCategoryItemGridList<T extends Item> extends StatefulWidget {
final ShoppingList? shoppingList; // forwarded to item page on long press
final bool Function(T)? selected;
final bool isLoading;
final bool isDescriptionEditable;

const SliverCategoryItemGridList({
super.key,
Expand All @@ -34,7 +33,6 @@ class SliverCategoryItemGridList<T extends Item> extends StatefulWidget {
this.shoppingList,
this.selected,
this.isLoading = false,
this.isDescriptionEditable = true,
});

@override
Expand Down Expand Up @@ -97,7 +95,6 @@ class _SliverCategoryItemGridListState<T extends Item>
shoppingList: widget.shoppingList,
selected: widget.selected,
isLoading: widget.isLoading,
isDescriptionEditable: widget.isDescriptionEditable,
),
),
],
Expand Down
3 changes: 0 additions & 3 deletions lib/widgets/sliver_item_grid_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class SliverItemGridList<T extends Item> extends StatelessWidget {
household; // forwarded to item page on long press for offline functionality
final bool Function(T)? selected;
final bool isLoading;
final bool isDescriptionEditable;

const SliverItemGridList({
super.key,
Expand All @@ -36,7 +35,6 @@ class SliverItemGridList<T extends Item> extends StatelessWidget {
this.shoppingList,
this.selected,
this.isLoading = false,
this.isDescriptionEditable = true,
});

@override
Expand Down Expand Up @@ -73,7 +71,6 @@ class SliverItemGridList<T extends Item> extends StatelessWidget {
household: household,
shoppingList: shoppingList,
categories: categories ?? const [],
isDescriptionEditable: isDescriptionEditable,
),
),
),
Expand Down