🛠️ Add .animateItem() modifier to Reader Chapter/Separator
This commit is contained in:
parent
f43059d5ec
commit
dbd9ebff91
2 changed files with 45 additions and 29 deletions
|
|
@ -1,9 +1,11 @@
|
||||||
package ua.acclorite.book_story.presentation.reader
|
package ua.acclorite.book_story.presentation.reader
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.lazy.LazyItemScope
|
||||||
import androidx.compose.material3.HorizontalDivider
|
import androidx.compose.material3.HorizontalDivider
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
|
|
@ -21,7 +23,7 @@ import ua.acclorite.book_story.domain.reader.ReaderTextAlignment
|
||||||
import ua.acclorite.book_story.presentation.core.components.common.HighlightedText
|
import ua.acclorite.book_story.presentation.core.components.common.HighlightedText
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ReaderLayoutTextChapter(
|
fun LazyItemScope.ReaderLayoutTextChapter(
|
||||||
chapter: Chapter,
|
chapter: Chapter,
|
||||||
chapterTitleAlignment: ReaderTextAlignment,
|
chapterTitleAlignment: ReaderTextAlignment,
|
||||||
fontColor: Color,
|
fontColor: Color,
|
||||||
|
|
@ -29,6 +31,14 @@ fun ReaderLayoutTextChapter(
|
||||||
highlightedReading: Boolean,
|
highlightedReading: Boolean,
|
||||||
highlightedReadingThickness: FontWeight
|
highlightedReadingThickness: FontWeight
|
||||||
) {
|
) {
|
||||||
|
Column(
|
||||||
|
Modifier
|
||||||
|
.animateItem(
|
||||||
|
fadeInSpec = null,
|
||||||
|
fadeOutSpec = null
|
||||||
|
)
|
||||||
|
.fillMaxWidth()
|
||||||
|
) {
|
||||||
Spacer(modifier = Modifier.height(22.dp))
|
Spacer(modifier = Modifier.height(22.dp))
|
||||||
if (highlightedReading) {
|
if (highlightedReading) {
|
||||||
HighlightedText(
|
HighlightedText(
|
||||||
|
|
@ -58,4 +68,5 @@ fun ReaderLayoutTextChapter(
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
HorizontalDivider(color = fontColor.copy(0.4f))
|
HorizontalDivider(color = fontColor.copy(0.4f))
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package ua.acclorite.book_story.presentation.reader
|
package ua.acclorite.book_story.presentation.reader
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.lazy.LazyItemScope
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.material3.HorizontalDivider
|
import androidx.compose.material3.HorizontalDivider
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
|
@ -11,13 +12,17 @@ import androidx.compose.ui.unit.Dp
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ReaderLayoutTextSeparator(
|
fun LazyItemScope.ReaderLayoutTextSeparator(
|
||||||
sidePadding: Dp,
|
sidePadding: Dp,
|
||||||
fontColor: Color
|
fontColor: Color
|
||||||
) {
|
) {
|
||||||
HorizontalDivider(
|
HorizontalDivider(
|
||||||
thickness = 3.dp,
|
thickness = 3.dp,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
.animateItem(
|
||||||
|
fadeInSpec = null,
|
||||||
|
fadeOutSpec = null
|
||||||
|
)
|
||||||
.padding(horizontal = sidePadding)
|
.padding(horizontal = sidePadding)
|
||||||
.clip(CircleShape),
|
.clip(CircleShape),
|
||||||
color = fontColor.copy(0.3f)
|
color = fontColor.copy(0.3f)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue