Ver Fonte

Hide favorite icon for files not owned by the user

Neeraj Gupta há 3 anos atrás
pai
commit
128c207e55
2 ficheiros alterados com 6 adições e 1 exclusões
  1. 1 0
      lib/ui/detail_page.dart
  2. 5 1
      lib/ui/fading_app_bar.dart

+ 1 - 0
lib/ui/detail_page.dart

@@ -99,6 +99,7 @@ class _DetailPageState extends State<DetailPage> {
       appBar: FadingAppBar(
         _files[_selectedIndex],
         _onFileDeleted,
+        Configuration.instance.getUserID(),
         100,
         key: _appBarKey,
       ),

+ 5 - 1
lib/ui/fading_app_bar.dart

@@ -24,10 +24,12 @@ class FadingAppBar extends StatefulWidget implements PreferredSizeWidget {
   final File file;
   final Function(File) onFileDeleted;
   final double height;
+  final int userId;
 
   FadingAppBar(
     this.file,
     this.onFileDeleted,
+    this.userId,
     this.height, {
     Key key,
   }) : super(key: key);
@@ -83,7 +85,9 @@ class FadingAppBarState extends State<FadingAppBar> {
 
   AppBar _buildAppBar() {
     final List<Widget> actions = [];
-    actions.add(_getFavoriteButton());
+    if (widget.file.ownerID == null || widget.file.ownerID == widget.userId) {
+      actions.add(_getFavoriteButton());
+    }
     actions.add(PopupMenuButton(
       itemBuilder: (context) {
         final List<PopupMenuItem> items = [];