Hide delete option for files not owned by the user
This commit is contained in:
parent
128c207e55
commit
2b4cbf8131
|
@ -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,22 +110,26 @@ class FadingAppBarState extends State<FadingAppBar> {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
items.add(
|
// only show delete option for files owned by the user
|
||||||
PopupMenuItem(
|
if (widget.file.ownerID == null ||
|
||||||
value: 2,
|
widget.file.ownerID == widget.userId) {
|
||||||
child: Row(
|
items.add(
|
||||||
children: [
|
PopupMenuItem(
|
||||||
Icon(Platform.isAndroid
|
value: 2,
|
||||||
? Icons.delete_outline
|
child: Row(
|
||||||
: CupertinoIcons.delete),
|
children: [
|
||||||
Padding(
|
Icon(Platform.isAndroid
|
||||||
padding: EdgeInsets.all(8),
|
? Icons.delete_outline
|
||||||
),
|
: CupertinoIcons.delete),
|
||||||
Text("delete"),
|
Padding(
|
||||||
],
|
padding: EdgeInsets.all(8),
|
||||||
|
),
|
||||||
|
Text("delete"),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
}
|
||||||
return items;
|
return items;
|
||||||
},
|
},
|
||||||
onSelected: (value) {
|
onSelected: (value) {
|
||||||
|
|
Loading…
Reference in a new issue