Put players table in an OutlinedBox, makes the UI look more consistent.
This commit is contained in:
1 parent
c32732714e
commit
e49451b28e
3 files changed
+55
-32
No files matched your search
+19
-9
@@ -192,15 +192,25 @@ private fun PlayersAndSettings(
|
|||||||
|
|
||||||
MenuSpacer()
|
MenuSpacer()
|
||||||
|
|
||||||
PlayersTable(
|
OutlinedBox(
|
||||||
rows = buildList {
|
label = { Text(stringResource(R.string.netplay_players_label)) },
|
||||||
add(listOf("Player", "Ping", "Mapping"))
|
) {
|
||||||
addAll(players.map { listOf(it.name, it.ping.toString(), it.mapping) })
|
PlayersTable(
|
||||||
repeat(4 - players.size) { add(listOf("", "", "")) }
|
rows = buildList {
|
||||||
},
|
add(
|
||||||
modifier = Modifier
|
listOf(
|
||||||
.fillMaxWidth()
|
stringResource(R.string.netplay_players_name),
|
||||||
)
|
stringResource(R.string.netplay_players_ping),
|
||||||
|
stringResource(R.string.netplay_players_mapping),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
addAll(players.map { listOf(it.name, it.ping.toString(), it.mapping) })
|
||||||
|
repeat(4 - players.size) { add(listOf("", "", "")) }
|
||||||
|
},
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+32
-23
@@ -135,9 +135,10 @@ fun MenuSpacer() = Spacer(modifier = Modifier.height(16.dp))
|
|||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun OutlinedBox(
|
fun OutlinedBox(
|
||||||
onClick: () -> Unit,
|
|
||||||
label: @Composable () -> Unit,
|
label: @Composable () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
|
onClick: (() -> Unit)? = null,
|
||||||
|
fadeContentTop: Boolean = false,
|
||||||
content: @Composable () -> Unit,
|
content: @Composable () -> Unit,
|
||||||
) {
|
) {
|
||||||
Box(
|
Box(
|
||||||
@@ -153,24 +154,30 @@ fun OutlinedBox(
|
|||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
) {
|
) {
|
||||||
content()
|
content()
|
||||||
Box(
|
if (fadeContentTop) {
|
||||||
modifier = Modifier
|
Box(
|
||||||
.fillMaxWidth()
|
modifier = Modifier
|
||||||
.height(16.dp)
|
.fillMaxWidth()
|
||||||
.background(
|
.height(16.dp)
|
||||||
Brush.verticalGradient(
|
.background(
|
||||||
colors = listOf(
|
Brush.verticalGradient(
|
||||||
MaterialTheme.colorScheme.surface,
|
colors = listOf(
|
||||||
Color.Transparent
|
MaterialTheme.colorScheme.surface,
|
||||||
|
Color.Transparent
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
enabled = true,
|
enabled = true,
|
||||||
singleLine = false,
|
singleLine = false,
|
||||||
contentPadding = OutlinedTextFieldDefaults.contentPadding(top = 0.dp),
|
contentPadding = if (fadeContentTop) {
|
||||||
|
OutlinedTextFieldDefaults.contentPadding(top = 0.dp)
|
||||||
|
} else {
|
||||||
|
OutlinedTextFieldDefaults.contentPadding()
|
||||||
|
},
|
||||||
visualTransformation = VisualTransformation.None,
|
visualTransformation = VisualTransformation.None,
|
||||||
interactionSource = interactionSource,
|
interactionSource = interactionSource,
|
||||||
label = { label() },
|
label = { label() },
|
||||||
@@ -183,15 +190,17 @@ fun OutlinedBox(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
Box(
|
if (onClick != null) {
|
||||||
modifier = Modifier
|
Box(
|
||||||
.fillMaxSize()
|
modifier = Modifier
|
||||||
.clip(MaterialTheme.shapes.extraSmall)
|
.fillMaxSize()
|
||||||
.clickable(
|
.clip(MaterialTheme.shapes.extraSmall)
|
||||||
interactionSource = interactionSource,
|
.clickable(
|
||||||
indication = LocalIndication.current,
|
interactionSource = interactionSource,
|
||||||
onClick = onClick,
|
indication = LocalIndication.current,
|
||||||
)
|
onClick = onClick,
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1003,4 +1003,8 @@ It can efficiently compress both junk data and encrypted Wii data.
|
|||||||
<string name="netplay_message_buffer_changed">Buffer size changed to %1$d</string>
|
<string name="netplay_message_buffer_changed">Buffer size changed to %1$d</string>
|
||||||
<string name="netplay_message_host_input_authority_changed">"Host input authority %1$s"</string>
|
<string name="netplay_message_host_input_authority_changed">"Host input authority %1$s"</string>
|
||||||
<string name="netplay_game_label">Game</string>
|
<string name="netplay_game_label">Game</string>
|
||||||
|
<string name="netplay_players_label">Players</string>
|
||||||
|
<string name="netplay_players_name">Name</string>
|
||||||
|
<string name="netplay_players_ping">Ping</string>
|
||||||
|
<string name="netplay_players_mapping">Mapping</string>
|
||||||
</resources>
|
</resources>
|
||||||
Reference in new issue
Block a user