@@ -434,127 +434,128 @@ private fun FolderItem(
434434 onDragIconClick : () -> Unit ,
435435 modifier : Modifier = Modifier ,
436436) {
437- sharedTransitionScope.run {
438- Box (
439- shadowModifier().sharedBounds(
440- rememberSharedContentState(key = " folderTransition ${folderUi.documentId} " ),
441- animatedVisibilityScope = animatedVisibilityScope ,
442- resizeMode = SharedTransitionScope . ResizeMode . RemeasureToBounds
443- )
444- ) {
445- DropTarget { inBound, data ->
446- val menuItemUI = data?.info as ? MenuItemUi
447- if (inBound && menuItemUI != null ) {
448- LaunchedEffect (menuItemUI ) {
449- moveRequest (menuItemUI, folderUi.documentId)
450- }
437+ // sharedTransitionScope.run {
438+ Box (
439+ shadowModifier()
440+ // .sharedBounds(
441+ // rememberSharedContentState(key = "folderTransition${folderUi.documentId}") ,
442+ // animatedVisibilityScope = animatedVisibilityScope,
443+ // resizeMode = SharedTransitionScope.ResizeMode.RemeasureToBounds
444+ // )
445+ ) {
446+ DropTarget { inBound, data ->
447+ val menuItemUI = data?.info as ? MenuItemUi
448+ if (inBound && menuItemUI != null ) {
449+ LaunchedEffect (menuItemUI) {
450+ moveRequest(menuItemUI, folderUi.documentId)
451451 }
452+ }
452453
453- val bgColor =
454- when {
455- inBound && menuItemUI?.id != folderUi.id -> WriteopiaTheme .colorScheme.highlight
456- folderUi.selected -> WriteopiaTheme .colorScheme.selectedBg
457- else -> WriteopiaTheme .colorScheme.cardBg
458- }
454+ val bgColor =
455+ when {
456+ inBound && menuItemUI?.id != folderUi.id -> WriteopiaTheme .colorScheme.highlight
457+ folderUi.selected -> WriteopiaTheme .colorScheme.selectedBg
458+ else -> WriteopiaTheme .colorScheme.cardBg
459+ }
460+
461+ val textColor = WriteopiaTheme .colorScheme.textLight
459462
460- val textColor = WriteopiaTheme .colorScheme.textLight
461-
462- SwipeBox (
463- modifier = modifier
464- .fillMaxWidth()
465- .background(WriteopiaTheme .colorScheme.cardPlaceHolderBackground)
466- .clip(MaterialTheme .shapes.large)
467- .clickable {
468- folderClick(folderUi.documentId)
469- },
470- isOnEditState = folderUi.selected,
471- swipeListener = { state ->
472- selectionListener(folderUi.documentId, state)
463+ SwipeBox (
464+ modifier = modifier
465+ .fillMaxWidth()
466+ .background(WriteopiaTheme .colorScheme.cardPlaceHolderBackground)
467+ .clip(MaterialTheme .shapes.large)
468+ .clickable {
469+ folderClick(folderUi.documentId)
473470 },
474- cornersShape = MaterialTheme .shapes.large,
475- defaultColor = WriteopiaTheme .colorScheme.cardBg,
476- activeColor = bgColor,
477- activeBorderColor = MaterialTheme .colorScheme.primary
471+ isOnEditState = folderUi.selected,
472+ swipeListener = { state ->
473+ selectionListener(folderUi.documentId, state)
474+ },
475+ cornersShape = MaterialTheme .shapes.large,
476+ defaultColor = WriteopiaTheme .colorScheme.cardBg,
477+ activeColor = bgColor,
478+ activeBorderColor = MaterialTheme .colorScheme.primary
479+ ) {
480+ DragCardTarget (
481+ modifier = modifier.clip(MaterialTheme .shapes.large),
482+ position = position,
483+ dataToDrop = DropInfo (folderUi, position),
484+ iconTintOnHover = MaterialTheme .colorScheme.onBackground,
485+ onIconClick = onDragIconClick,
478486 ) {
479- DragCardTarget (
480- modifier = modifier.clip(MaterialTheme .shapes.large),
481- position = position,
482- dataToDrop = DropInfo (folderUi, position),
483- iconTintOnHover = MaterialTheme .colorScheme.onBackground,
484- onIconClick = onDragIconClick,
487+ Column (
488+ modifier = Modifier
489+ .background(color = bgColor, shape = MaterialTheme .shapes.large)
490+ .fillMaxWidth()
491+ .padding(bottom = 26 .dp, top = 10 .dp)
492+ .align(Alignment .Center ),
493+ horizontalAlignment = Alignment .CenterHorizontally
485494 ) {
486- Column (
487- modifier = Modifier
488- .background(color = bgColor, shape = MaterialTheme .shapes.large)
489- .fillMaxWidth()
490- .padding(bottom = 26 .dp, top = 10 .dp)
491- .align(Alignment .Center ),
492- horizontalAlignment = Alignment .CenterHorizontally
493- ) {
494- var showIconsOptions by remember { mutableStateOf(false ) }
495- val tint = folderUi.icon?.tint?.let (::Color )
496- ? : MaterialTheme .colorScheme.primary
497-
498- Icon (
499- modifier = Modifier
500- .padding(6 .dp)
501- .clip(MaterialTheme .shapes.large)
502- .clickable { showIconsOptions = ! showIconsOptions }
503- .size(56 .dp)
504- .padding(6 .dp),
505- imageVector = folderUi.icon?.label?.let (WrIcons ::fromName)
506- ? : folder,
507- contentDescription = " Folder" ,
508- tint = tint
509- )
495+ var showIconsOptions by remember { mutableStateOf(false ) }
496+ val tint = folderUi.icon?.tint?.let (::Color )
497+ ? : MaterialTheme .colorScheme.primary
510498
511- DropdownMenu (
512- expanded = showIconsOptions,
513- onDismissRequest = { showIconsOptions = false },
514- modifier = Modifier .background(WriteopiaTheme .colorScheme.cardBg),
515- ) {
516- IconsPicker (
517- iconSelect = { icon, tint ->
518- changeIcon(
519- folderUi.id,
520- icon,
521- tint
522- )
523- }
524- )
525- }
499+ Icon (
500+ modifier = Modifier
501+ .padding(6 .dp)
502+ .clip(MaterialTheme .shapes.large)
503+ .clickable { showIconsOptions = ! showIconsOptions }
504+ .size(56 .dp)
505+ .padding(6 .dp),
506+ imageVector = folderUi.icon?.label?.let (WrIcons ::fromName)
507+ ? : folder,
508+ contentDescription = " Folder" ,
509+ tint = tint
510+ )
526511
527- Text (
528- modifier = Modifier .padding(horizontal = 12 .dp),
529- text = folderUi.title,
530- color = textColor,
531- fontWeight = FontWeight .Bold ,
532- maxLines = 1 ,
533- overflow = TextOverflow .Ellipsis
512+ DropdownMenu (
513+ expanded = showIconsOptions,
514+ onDismissRequest = { showIconsOptions = false },
515+ modifier = Modifier .background(WriteopiaTheme .colorScheme.cardBg),
516+ ) {
517+ IconsPicker (
518+ iconSelect = { icon, tint ->
519+ changeIcon(
520+ folderUi.id,
521+ icon,
522+ tint
523+ )
524+ }
534525 )
526+ }
535527
536- Spacer (modifier = Modifier .height(4 .dp))
528+ Text (
529+ modifier = Modifier .padding(horizontal = 12 .dp),
530+ text = folderUi.title,
531+ color = textColor,
532+ fontWeight = FontWeight .Bold ,
533+ maxLines = 1 ,
534+ overflow = TextOverflow .Ellipsis
535+ )
537536
538- Text (
539- text = " ${folderUi.itemsCount} items" ,
540- color = textColor,
541- style = MaterialTheme .typography.bodySmall
542- )
543- }
544- }
537+ Spacer (modifier = Modifier .height(4 .dp))
545538
546- if (folderUi.isFavorite) {
547- Icon (
548- modifier = Modifier .align(Alignment .TopEnd ).size(40 .dp).padding(12 .dp),
549- imageVector = WrIcons .favorites,
550- contentDescription = " Favorite" ,
551- tint = MaterialTheme .colorScheme.onBackground
539+ Text (
540+ text = " ${folderUi.itemsCount} items" ,
541+ color = textColor,
542+ style = MaterialTheme .typography.bodySmall
552543 )
553544 }
554545 }
546+
547+ if (folderUi.isFavorite) {
548+ Icon (
549+ modifier = Modifier .align(Alignment .TopEnd ).size(40 .dp).padding(12 .dp),
550+ imageVector = WrIcons .favorites,
551+ contentDescription = " Favorite" ,
552+ tint = MaterialTheme .colorScheme.onBackground
553+ )
554+ }
555555 }
556556 }
557557 }
558+ // }
558559}
559560
560561@OptIn(ExperimentalSharedTransitionApi ::class )
0 commit comments