Add enableBookmark parameter to MultitypeOverview and use it in Bookmarks and FilteredBookmarks

The diff adds an `enableBookmark` parameter to the `MultitypeOverview` widget and uses it in the `_BookmarksState` and `_FilteredBookmarksState` to conditionally render the `BookmarkButton`. This allows for more flexibility in rendering the overview widget.
This commit is contained in:
MohammadTaha Basiri 2024-04-01 20:11:01 +03:30
parent 213e000aee
commit f12cf98fd9
3 changed files with 17 additions and 11 deletions

View File

@ -133,6 +133,7 @@ class _BookmarksState extends State<Bookmarks> {
onMarkChanged: state.onMarkChanged,
hasUnmarkConfirmation: true,
enableCaption: true,
enableBookmark: true,
);
},
placeholder: MultitypeOverview.placeholder,

View File

@ -75,6 +75,7 @@ class _FilteredBookmarksState extends State<FilteredBookmarks> {
value,
true,
),
enableBookmark: true,
);
// if (state.type == 'radar') {
// return RadarOverview(

View File

@ -26,6 +26,7 @@ class MultitypeOverview extends StatelessWidget {
final bool hasUnmarkConfirmation;
final void Function(int id, bool value) onMarkChanged;
final bool enableCaption;
final bool enableBookmark;
const MultitypeOverview({
Key? key,
@ -33,6 +34,7 @@ class MultitypeOverview extends StatelessWidget {
required this.onMarkChanged,
this.hasUnmarkConfirmation = false,
this.enableCaption = false,
this.enableBookmark = false,
}) : super(key: key);
get _targetPageArgs {
@ -251,17 +253,19 @@ class MultitypeOverview extends StatelessWidget {
),
),
if (!enableCaption) const Spacer(),
const SizedBox(
width: 12,
),
BookmarkButton(
value: item.marked,
onMarkChanged: (value) => onMarkChanged(item.id, value),
gestureSize: 32,
type: item.type,
itemId: item.id,
askForConfirmation: true,
),
if (enableBookmark) ...[
const SizedBox(
width: 12,
),
BookmarkButton(
value: item.marked,
onMarkChanged: (value) => onMarkChanged(item.id, value),
gestureSize: 32,
type: item.type,
itemId: item.id,
askForConfirmation: true,
),
],
],
),
],