Removing modifiers from remembers and into global singletons.
This commit is contained in:
@@ -269,7 +269,7 @@ fun AuthorGalleryZaps(
|
|||||||
nav: (String) -> Unit,
|
nav: (String) -> Unit,
|
||||||
accountViewModel: AccountViewModel
|
accountViewModel: AccountViewModel
|
||||||
) {
|
) {
|
||||||
Column(modifier = Modifier.padding(start = 10.dp)) {
|
Column(modifier = remember { Modifier.padding(start = 10.dp) }) {
|
||||||
FlowRow() {
|
FlowRow() {
|
||||||
authorNotes.forEach {
|
authorNotes.forEach {
|
||||||
AuthorPictureAndComment(it.request, it.response, backgroundColor, nav, accountViewModel)
|
AuthorPictureAndComment(it.request, it.response, backgroundColor, nav, accountViewModel)
|
||||||
@@ -320,27 +320,41 @@ private fun AuthorPictureAndComment(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
content.let {
|
val route by remember {
|
||||||
val route by remember {
|
derivedStateOf {
|
||||||
derivedStateOf {
|
"User/${content.user?.pubkeyHex}"
|
||||||
"User/${it.user?.pubkeyHex}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
it.user?.let { user ->
|
|
||||||
AuthorPictureAndComment(
|
|
||||||
author = user,
|
|
||||||
comment = it.comment,
|
|
||||||
amount = it.amount,
|
|
||||||
route = route,
|
|
||||||
backgroundColor = backgroundColor,
|
|
||||||
nav = nav,
|
|
||||||
accountViewModel = accountViewModel
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
content.user?.let { user ->
|
||||||
|
AuthorPictureAndComment(
|
||||||
|
author = user,
|
||||||
|
comment = content.comment,
|
||||||
|
amount = content.amount,
|
||||||
|
route = route,
|
||||||
|
backgroundColor = backgroundColor,
|
||||||
|
nav = nav,
|
||||||
|
accountViewModel = accountViewModel
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val amountBoxModifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.clip(shape = CircleShape)
|
||||||
|
|
||||||
|
val textBoxModifier = Modifier.padding(start = 5.dp).fillMaxWidth()
|
||||||
|
|
||||||
|
val simpleModifier = Modifier
|
||||||
|
|
||||||
|
val size = 35.dp
|
||||||
|
|
||||||
|
val sizedModifier = Modifier.size(size)
|
||||||
|
|
||||||
|
val bottomPadding1dp = Modifier.padding(bottom = 1.dp)
|
||||||
|
|
||||||
|
val commentTextSize = 12.sp
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun AuthorPictureAndComment(
|
private fun AuthorPictureAndComment(
|
||||||
author: User,
|
author: User,
|
||||||
@@ -351,8 +365,6 @@ private fun AuthorPictureAndComment(
|
|||||||
nav: (String) -> Unit,
|
nav: (String) -> Unit,
|
||||||
accountViewModel: AccountViewModel
|
accountViewModel: AccountViewModel
|
||||||
) {
|
) {
|
||||||
val authorPictureModifier = remember { Modifier }
|
|
||||||
|
|
||||||
val modifier = remember {
|
val modifier = remember {
|
||||||
Modifier.clickable {
|
Modifier.clickable {
|
||||||
nav(route)
|
nav(route)
|
||||||
@@ -363,19 +375,17 @@ private fun AuthorPictureAndComment(
|
|||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
Box(modifier = remember { Modifier.size(35.dp) }, contentAlignment = Alignment.BottomCenter) {
|
Box(modifier = sizedModifier, contentAlignment = Alignment.BottomCenter) {
|
||||||
FastNoteAuthorPicture(
|
FastNoteAuthorPicture(
|
||||||
author = author,
|
author = author,
|
||||||
size = remember { 35.dp },
|
size = size,
|
||||||
accountViewModel = accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
pictureModifier = authorPictureModifier
|
pictureModifier = simpleModifier
|
||||||
)
|
)
|
||||||
|
|
||||||
amount?.let {
|
amount?.let {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = amountBoxModifier,
|
||||||
.fillMaxSize()
|
|
||||||
.clip(shape = CircleShape),
|
|
||||||
contentAlignment = Alignment.BottomCenter
|
contentAlignment = Alignment.BottomCenter
|
||||||
) {
|
) {
|
||||||
val backgroundColor = MaterialTheme.colors.overPictureBackground
|
val backgroundColor = MaterialTheme.colors.overPictureBackground
|
||||||
@@ -391,8 +401,8 @@ private fun AuthorPictureAndComment(
|
|||||||
text = it,
|
text = it,
|
||||||
fontWeight = FontWeight.Bold,
|
fontWeight = FontWeight.Bold,
|
||||||
color = MaterialTheme.colors.secondaryVariant,
|
color = MaterialTheme.colors.secondaryVariant,
|
||||||
fontSize = 12.sp,
|
fontSize = commentTextSize,
|
||||||
modifier = Modifier.padding(bottom = 1.dp)
|
modifier = bottomPadding1dp
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -400,12 +410,11 @@ private fun AuthorPictureAndComment(
|
|||||||
}
|
}
|
||||||
|
|
||||||
comment?.let {
|
comment?.let {
|
||||||
Spacer(modifier = Modifier.width(5.dp))
|
|
||||||
TranslatableRichTextViewer(
|
TranslatableRichTextViewer(
|
||||||
content = it,
|
content = it,
|
||||||
canPreview = true,
|
canPreview = true,
|
||||||
tags = remember { ImmutableListOfLists() },
|
tags = remember { ImmutableListOfLists() },
|
||||||
modifier = remember { Modifier.fillMaxWidth() },
|
modifier = textBoxModifier,
|
||||||
backgroundColor = backgroundColor,
|
backgroundColor = backgroundColor,
|
||||||
accountViewModel = accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
nav = nav
|
nav = nav
|
||||||
@@ -425,14 +434,24 @@ fun AuthorGallery(
|
|||||||
Column(modifier = remember { Modifier.padding(start = 10.dp) }) {
|
Column(modifier = remember { Modifier.padding(start = 10.dp) }) {
|
||||||
FlowRow() {
|
FlowRow() {
|
||||||
authorNotes.forEach { note ->
|
authorNotes.forEach { note ->
|
||||||
Box(remember { Modifier.size(35.dp) }) {
|
BoxedAuthor(note, backgroundColor, nav, accountViewModel)
|
||||||
NotePictureAndComment(note, backgroundColor, nav, accountViewModel)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun BoxedAuthor(
|
||||||
|
note: Note,
|
||||||
|
backgroundColor: MutableState<Color>,
|
||||||
|
nav: (String) -> Unit,
|
||||||
|
accountViewModel: AccountViewModel
|
||||||
|
) {
|
||||||
|
Box(sizedModifier) {
|
||||||
|
NotePictureAndComment(note, backgroundColor, nav, accountViewModel)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun NotePictureAndComment(
|
private fun NotePictureAndComment(
|
||||||
baseNote: Note,
|
baseNote: Note,
|
||||||
|
|||||||
@@ -841,7 +841,7 @@ fun RenderPoll(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
var hashtags = remember { noteEvent.hashtags().toImmutableList() }
|
val hashtags = remember { noteEvent.hashtags().toImmutableList() }
|
||||||
DisplayUncitedHashtags(hashtags, eventContent, nav)
|
DisplayUncitedHashtags(hashtags, eventContent, nav)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2576,7 +2576,7 @@ private fun RelayBadges(baseNote: Note) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(Modifier.height(10.dp))
|
Spacer(remember { Modifier.height(10.dp) })
|
||||||
|
|
||||||
if (expanded) {
|
if (expanded) {
|
||||||
VerticalRelayPanelWithFlow(lazyRelayList)
|
VerticalRelayPanelWithFlow(lazyRelayList)
|
||||||
@@ -2620,29 +2620,25 @@ private fun VerticalRelayPanelWithFlow(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val showMoreRelaysButtonIconButtonModifier = Modifier.size(24.dp)
|
||||||
|
val showMoreRelaysButtonIconModifier = Modifier.size(15.dp)
|
||||||
|
val showMoreRelaysButtonBoxModifer = Modifier.fillMaxWidth().height(25.dp)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun ShowMoreRelaysButton(onClick: () -> Unit) {
|
private fun ShowMoreRelaysButton(onClick: () -> Unit) {
|
||||||
val boxModifier = remember {
|
|
||||||
Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.height(25.dp)
|
|
||||||
}
|
|
||||||
val iconButtonModifier = remember { Modifier.size(24.dp) }
|
|
||||||
val iconModifier = remember { Modifier.size(15.dp) }
|
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
boxModifier,
|
modifier = showMoreRelaysButtonBoxModifer,
|
||||||
horizontalArrangement = Arrangement.Center,
|
horizontalArrangement = Arrangement.Center,
|
||||||
verticalAlignment = Alignment.Top
|
verticalAlignment = Alignment.Top
|
||||||
) {
|
) {
|
||||||
IconButton(
|
IconButton(
|
||||||
modifier = iconButtonModifier,
|
modifier = showMoreRelaysButtonIconButtonModifier,
|
||||||
onClick = onClick
|
onClick = onClick
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Default.ExpandMore,
|
imageVector = Icons.Default.ExpandMore,
|
||||||
null,
|
null,
|
||||||
modifier = iconModifier,
|
modifier = showMoreRelaysButtonIconModifier,
|
||||||
tint = MaterialTheme.colors.placeholderText
|
tint = MaterialTheme.colors.placeholderText
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user