Flatten Android visual theme
This commit is contained in:
parent
60af5e6147
commit
276b27f781
1 changed files with 52 additions and 48 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
package com.labfytools.trainlog.ui
|
package com.labfytools.trainlog.ui
|
||||||
|
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.border
|
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.BoxWithConstraints
|
import androidx.compose.foundation.layout.BoxWithConstraints
|
||||||
|
|
@ -9,13 +8,14 @@ import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.ColumnScope
|
import androidx.compose.foundation.layout.ColumnScope
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.imePadding
|
import androidx.compose.foundation.layout.imePadding
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.foundation.rememberScrollState
|
|
||||||
import androidx.compose.foundation.verticalScroll
|
|
||||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.statusBarsPadding
|
import androidx.compose.foundation.layout.statusBarsPadding
|
||||||
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.text.BasicText
|
import androidx.compose.foundation.text.BasicText
|
||||||
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
|
@ -46,7 +46,9 @@ fun TrainlogScreen(
|
||||||
Column(
|
Column(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
.background(colors.background)
|
.background(
|
||||||
|
colors.background
|
||||||
|
)
|
||||||
.statusBarsPadding()
|
.statusBarsPadding()
|
||||||
.navigationBarsPadding()
|
.navigationBarsPadding()
|
||||||
.imePadding()
|
.imePadding()
|
||||||
|
|
@ -56,7 +58,7 @@ fun TrainlogScreen(
|
||||||
.padding(
|
.padding(
|
||||||
PaddingValues(
|
PaddingValues(
|
||||||
horizontal = 16.dp,
|
horizontal = 16.dp,
|
||||||
vertical = 18.dp,
|
vertical = 14.dp,
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
) {
|
) {
|
||||||
|
|
@ -80,7 +82,7 @@ private fun TrainlogBanner(
|
||||||
Modifier
|
Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(
|
.padding(
|
||||||
bottom = 18.dp
|
bottom = 22.dp
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
val wide =
|
val wide =
|
||||||
|
|
@ -90,7 +92,7 @@ private fun TrainlogBanner(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier.fillMaxWidth(),
|
Modifier.fillMaxWidth(),
|
||||||
horizontalAlignment =
|
horizontalAlignment =
|
||||||
Alignment.CenterHorizontally,
|
Alignment.Start,
|
||||||
) {
|
) {
|
||||||
BasicText(
|
BasicText(
|
||||||
text =
|
text =
|
||||||
|
|
@ -105,22 +107,24 @@ private fun TrainlogBanner(
|
||||||
fontWeight = FontWeight.Bold,
|
fontWeight = FontWeight.Bold,
|
||||||
fontSize =
|
fontSize =
|
||||||
if (wide) {
|
if (wide) {
|
||||||
16.sp
|
15.sp
|
||||||
} else {
|
} else {
|
||||||
24.sp
|
22.sp
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
BasicText(
|
BasicText(
|
||||||
text = ":: $subtitle ::",
|
text = subtitle,
|
||||||
modifier =
|
modifier =
|
||||||
Modifier.padding(
|
Modifier.padding(
|
||||||
top = 6.dp
|
top = 6.dp
|
||||||
),
|
),
|
||||||
style =
|
style =
|
||||||
TrainlogTypography.normal.copy(
|
TrainlogTypography.small.copy(
|
||||||
color = colors.muted,
|
color = colors.muted,
|
||||||
|
fontWeight =
|
||||||
|
FontWeight.Bold,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -137,7 +141,7 @@ fun TrainlogFrame(
|
||||||
val colors =
|
val colors =
|
||||||
LocalTrainlogColors.current
|
LocalTrainlogColors.current
|
||||||
|
|
||||||
val borderColor =
|
val accent =
|
||||||
if (active) {
|
if (active) {
|
||||||
colors.warning
|
colors.warning
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -149,30 +153,31 @@ fun TrainlogFrame(
|
||||||
modifier
|
modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(
|
.padding(
|
||||||
bottom = 14.dp
|
bottom = 20.dp
|
||||||
)
|
|
||||||
.border(
|
|
||||||
width = 1.dp,
|
|
||||||
color = borderColor,
|
|
||||||
)
|
|
||||||
.padding(
|
|
||||||
horizontal = 14.dp,
|
|
||||||
vertical = 12.dp,
|
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
BasicText(
|
BasicText(
|
||||||
text = title.uppercase(),
|
text = title.uppercase(),
|
||||||
modifier =
|
|
||||||
Modifier.padding(
|
|
||||||
bottom = 12.dp
|
|
||||||
),
|
|
||||||
style =
|
style =
|
||||||
TrainlogTypography.normal.copy(
|
TrainlogTypography.small.copy(
|
||||||
color = borderColor,
|
color = accent,
|
||||||
fontWeight = FontWeight.Bold,
|
fontWeight =
|
||||||
|
FontWeight.Bold,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Box(
|
||||||
|
modifier =
|
||||||
|
Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(
|
||||||
|
top = 7.dp,
|
||||||
|
bottom = 10.dp,
|
||||||
|
)
|
||||||
|
.height(1.dp)
|
||||||
|
.background(accent)
|
||||||
|
)
|
||||||
|
|
||||||
content()
|
content()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -196,11 +201,7 @@ fun TrainlogAction(
|
||||||
modifier
|
modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(
|
.padding(
|
||||||
vertical = 5.dp
|
vertical = 4.dp
|
||||||
)
|
|
||||||
.border(
|
|
||||||
width = 1.dp,
|
|
||||||
color = colors.surfaceAlt,
|
|
||||||
)
|
)
|
||||||
.background(
|
.background(
|
||||||
colors.surface
|
colors.surface
|
||||||
|
|
@ -210,7 +211,7 @@ fun TrainlogAction(
|
||||||
)
|
)
|
||||||
.padding(
|
.padding(
|
||||||
horizontal = 14.dp,
|
horizontal = 14.dp,
|
||||||
vertical = 14.dp,
|
vertical = 12.dp,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
Column {
|
Column {
|
||||||
|
|
@ -219,21 +220,24 @@ fun TrainlogAction(
|
||||||
style =
|
style =
|
||||||
TrainlogTypography.normal.copy(
|
TrainlogTypography.normal.copy(
|
||||||
color = actualAccent,
|
color = actualAccent,
|
||||||
fontWeight = FontWeight.Bold,
|
fontWeight =
|
||||||
|
FontWeight.Bold,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
BasicText(
|
if (description.isNotEmpty()) {
|
||||||
text = description,
|
BasicText(
|
||||||
modifier =
|
text = description,
|
||||||
Modifier.padding(
|
modifier =
|
||||||
top = 4.dp
|
Modifier.padding(
|
||||||
),
|
top = 3.dp
|
||||||
style =
|
),
|
||||||
TrainlogTypography.small.copy(
|
style =
|
||||||
color = colors.text,
|
TrainlogTypography.small.copy(
|
||||||
),
|
color = colors.text,
|
||||||
)
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -250,7 +254,7 @@ fun TrainlogInfo(
|
||||||
text = text,
|
text = text,
|
||||||
modifier =
|
modifier =
|
||||||
Modifier.padding(
|
Modifier.padding(
|
||||||
vertical = 4.dp
|
vertical = 3.dp
|
||||||
),
|
),
|
||||||
style =
|
style =
|
||||||
TrainlogTypography.normal.copy(
|
TrainlogTypography.normal.copy(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue