-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remade the orderable grid, added popup menu to allow deletion of item
- Loading branch information
1 parent
d7793f4
commit 50785cc
Showing
7 changed files
with
148 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import 'package:context_menus/context_menus.dart'; | ||
import 'package:provider/provider.dart'; | ||
import 'package:flutter/material.dart'; | ||
import '/hive/favorite_model.dart'; | ||
import '/utilities/favorite_state.dart'; | ||
|
||
class DraggablePopMenu extends StatelessWidget { | ||
const DraggablePopMenu({ | ||
required this.items, | ||
required this.selectedItem, | ||
super.key, | ||
}); | ||
final FavoriteModel selectedItem; | ||
final List<FavoriteModel> items; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Consumer<FavoriteState>( | ||
builder: (context, favoriteState, child) { | ||
return GenericContextMenu( | ||
buttonConfigs: [ | ||
ContextMenuButtonConfig( | ||
"Remove from favorites", | ||
icon: const Icon(Icons.delete), | ||
onPressed: () { | ||
favoriteState.toggleFavoriteFunc( | ||
context, favoriteState, selectedItem); | ||
items.removeWhere((item) => item.id == selectedItem.id); | ||
}, | ||
), | ||
], | ||
); | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters