File tree Expand file tree Collapse file tree
app/src/main/java/com/quickfilemanager/ui/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,8 +31,10 @@ fun FileListItem(
3131 file : FileItem ,
3232 isSelected : Boolean ,
3333 isSelectionMode : Boolean ,
34+ isFavorite : Boolean = false,
3435 onClick : () -> Unit ,
3536 onLongClick : () -> Unit ,
37+ onFavoriteClick : (() -> Unit )? = null,
3638 modifier : Modifier = Modifier
3739) {
3840 val dateFormat = SimpleDateFormat (" yyyy-MM-dd HH:mm" , Locale .getDefault())
@@ -133,6 +135,17 @@ fun FileListItem(
133135 tint = MaterialTheme .colorScheme.onSurfaceVariant
134136 )
135137 }
138+
139+ // 收藏图标
140+ if (! file.isDirectory && onFavoriteClick != null && ! isSelectionMode) {
141+ IconButton (onClick = onFavoriteClick) {
142+ Icon (
143+ imageVector = if (isFavorite) Icons .Default .Favorite else Icons .Default .FavoriteBorder ,
144+ contentDescription = if (isFavorite) " 取消收藏" else " 收藏" ,
145+ tint = if (isFavorite) Color .Red else MaterialTheme .colorScheme.onSurfaceVariant
146+ )
147+ }
148+ }
136149 }
137150 }
138151}
You can’t perform that action at this time.
0 commit comments