Hide delete option for files not owned by the user

This commit is contained in:
Neeraj Gupta 2021-09-15 10:00:53 +05:30
parent 128c207e55
commit 2b4cbf8131
No known key found for this signature in database
GPG key ID: 3C5A1684DC1729E1

View file

@ -85,6 +85,7 @@ class FadingAppBarState extends State<FadingAppBar> {
AppBar _buildAppBar() { AppBar _buildAppBar() {
final List<Widget> actions = []; final List<Widget> actions = [];
// only show fav option for files owned by the user
if (widget.file.ownerID == null || widget.file.ownerID == widget.userId) { if (widget.file.ownerID == null || widget.file.ownerID == widget.userId) {
actions.add(_getFavoriteButton()); actions.add(_getFavoriteButton());
} }
@ -109,6 +110,9 @@ class FadingAppBarState extends State<FadingAppBar> {
), ),
); );
} }
// only show delete option for files owned by the user
if (widget.file.ownerID == null ||
widget.file.ownerID == widget.userId) {
items.add( items.add(
PopupMenuItem( PopupMenuItem(
value: 2, value: 2,
@ -125,6 +129,7 @@ class FadingAppBarState extends State<FadingAppBar> {
), ),
), ),
); );
}
return items; return items;
}, },
onSelected: (value) { onSelected: (value) {