Skip to content

Commit a7c45cd

Browse files
Restore Edit and Delete options in DropdownMenu (#214)
* Initial plan * Add Edit and Delete options to DropdownMenu in DeeprItem Co-authored-by: yogeshpaliyal <[email protected]> * Style delete menu item with error colors Co-authored-by: yogeshpaliyal <[email protected]> * Fix import ordering lint error Co-authored-by: yogeshpaliyal <[email protected]> * Remove unsupported containerColor parameter from MenuDefaults.itemColors Co-authored-by: yogeshpaliyal <[email protected]> * Style delete menu item with error colors --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: yogeshpaliyal <[email protected]> Co-authored-by: Yogesh Choudhary Paliyal <[email protected]>
1 parent 6f7c3e3 commit a7c45cd

File tree

1 file changed

+34
-0
lines changed
  • app/src/main/java/com/yogeshpaliyal/deepr/ui/screens/home

1 file changed

+34
-0
lines changed

app/src/main/java/com/yogeshpaliyal/deepr/ui/screens/home/DeeprItem.kt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import androidx.compose.material3.FilterChip
2828
import androidx.compose.material3.Icon
2929
import androidx.compose.material3.IconButton
3030
import androidx.compose.material3.MaterialTheme
31+
import androidx.compose.material3.MenuDefaults
3132
import androidx.compose.material3.OutlinedButton
3233
import androidx.compose.material3.Text
3334
import androidx.compose.runtime.Composable
@@ -47,8 +48,10 @@ import com.yogeshpaliyal.deepr.R
4748
import com.yogeshpaliyal.deepr.Tags
4849
import compose.icons.TablerIcons
4950
import compose.icons.tablericons.DotsVertical
51+
import compose.icons.tablericons.Edit
5052
import compose.icons.tablericons.Note
5153
import compose.icons.tablericons.Refresh
54+
import compose.icons.tablericons.Trash
5255
import java.text.DateFormat
5356
import java.text.SimpleDateFormat
5457
import java.util.Locale
@@ -272,6 +275,37 @@ fun DeeprItem(
272275
)
273276
},
274277
)
278+
DropdownMenuItem(
279+
text = { Text(stringResource(R.string.edit)) },
280+
onClick = {
281+
onItemClick(MenuItem.Edit(account))
282+
expanded = false
283+
},
284+
leadingIcon = {
285+
Icon(
286+
TablerIcons.Edit,
287+
contentDescription = stringResource(R.string.edit),
288+
)
289+
},
290+
)
291+
DropdownMenuItem(
292+
text = { Text(stringResource(R.string.delete)) },
293+
onClick = {
294+
onItemClick(MenuItem.Delete(account))
295+
expanded = false
296+
},
297+
leadingIcon = {
298+
Icon(
299+
TablerIcons.Trash,
300+
contentDescription = stringResource(R.string.delete),
301+
)
302+
},
303+
colors =
304+
MenuDefaults.itemColors(
305+
textColor = MaterialTheme.colorScheme.error,
306+
leadingIconColor = MaterialTheme.colorScheme.error,
307+
),
308+
)
275309
}
276310
}
277311

0 commit comments

Comments
 (0)