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() {
final List<Widget> actions = [];
// only show fav option for files owned by the user
if (widget.file.ownerID == null || widget.file.ownerID == widget.userId) {
actions.add(_getFavoriteButton());
}
@ -109,22 +110,26 @@ class FadingAppBarState extends State<FadingAppBar> {
),
);
}
items.add(
PopupMenuItem(
value: 2,
child: Row(
children: [
Icon(Platform.isAndroid
? Icons.delete_outline
: CupertinoIcons.delete),
Padding(
padding: EdgeInsets.all(8),
),
Text("delete"),
],
// only show delete option for files owned by the user
if (widget.file.ownerID == null ||
widget.file.ownerID == widget.userId) {
items.add(
PopupMenuItem(
value: 2,
child: Row(
children: [
Icon(Platform.isAndroid
? Icons.delete_outline
: CupertinoIcons.delete),
Padding(
padding: EdgeInsets.all(8),
),
Text("delete"),
],
),
),
),
);
);
}
return items;
},
onSelected: (value) {