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, onMarkChanged: state.onMarkChanged,
hasUnmarkConfirmation: true, hasUnmarkConfirmation: true,
enableCaption: true, enableCaption: true,
enableBookmark: true,
); );
}, },
placeholder: MultitypeOverview.placeholder, placeholder: MultitypeOverview.placeholder,

View File

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

View File

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