Share About content: add material-free KlottrAboutContent; use it inside Android AlertDialog
This commit is contained in:
@@ -142,6 +142,7 @@ import app.klottr.ui.FornsokDetailContent // Ny: delad Fornsök-layout
|
|||||||
import app.klottr.ui.FoundList // Delad, material-fri listkomponent för "Hittat"
|
import app.klottr.ui.FoundList // Delad, material-fri listkomponent för "Hittat"
|
||||||
import app.klottr.ui.FoundContent // Delat innehåll för “Hittat”
|
import app.klottr.ui.FoundContent // Delat innehåll för “Hittat”
|
||||||
import app.klottr.ui.FoundDetailContent // Delad detalj-UI (CMP)
|
import app.klottr.ui.FoundDetailContent // Delad detalj-UI (CMP)
|
||||||
|
import app.klottr.ui.KlottrAboutContent
|
||||||
import app.klottr.ui.KlottrHomeContent // Ny: delat mittinnehåll
|
import app.klottr.ui.KlottrHomeContent // Ny: delat mittinnehåll
|
||||||
import app.klottr.ui.NearbyContent // Delat material-fritt innehåll för Närliggande
|
import app.klottr.ui.NearbyContent // Delat material-fritt innehåll för Närliggande
|
||||||
import app.klottr.ui.MapPanelShell
|
import app.klottr.ui.MapPanelShell
|
||||||
@@ -338,30 +339,26 @@ fun AboutDialog(onDismiss: () -> Unit) {
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.widthIn(max = dialogWidth)
|
.widthIn(max = dialogWidth)
|
||||||
) {
|
) {
|
||||||
Column(
|
KlottrAboutContent(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
header = {
|
||||||
horizontalAlignment = Alignment.Start
|
|
||||||
) {
|
|
||||||
// logga centrerad
|
|
||||||
Row(
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
horizontalArrangement = Arrangement.Center
|
|
||||||
) {
|
|
||||||
Image(
|
Image(
|
||||||
painter = painterResource(R.drawable.klottr_logo_v2_line),
|
painter = painterResource(R.drawable.klottr_logo_v2_line),
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
modifier = Modifier.height(48.dp)
|
modifier = Modifier.height(48.dp)
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
|
lines = listOf(
|
||||||
Spacer(Modifier.height(40.dp)) // tomrad
|
"Version ${BuildConfig.VERSION_NAME} (${BuildConfig.BUILD_TYPE}) • build $versionCode",
|
||||||
|
"Byggd ${BuildConfig.BUILD_TIME_UTC}",
|
||||||
Text("Version ${BuildConfig.VERSION_NAME} (${BuildConfig.BUILD_TYPE}) • build $versionCode")
|
"Utvecklad av Fabian Norlin.",
|
||||||
Text("Byggd ${BuildConfig.BUILD_TIME_UTC}")
|
"IOS-ansvarig: Olov Hedman."
|
||||||
Spacer(Modifier.height(8.dp))
|
"Mejlkontakt: utv@ointressant.se"
|
||||||
Text("Utvecklad av Fabian Norlin.")
|
),
|
||||||
Text("Mejlkontakt: utv@ointressant.se")
|
lineStyle = MaterialTheme.typography.bodyMedium.copy(
|
||||||
}
|
color = MaterialTheme.colorScheme.onSurface
|
||||||
|
),
|
||||||
|
spacingDp = 12
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package app.klottr.ui
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.*
|
||||||
|
import androidx.compose.foundation.text.BasicText
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.text.TextStyle
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Material-fri About-layout. Android/iOS ger in header (t.ex. logotyp) och textraderna.
|
||||||
|
*/
|
||||||
|
@Composable
|
||||||
|
fun KlottrAboutContent(
|
||||||
|
header: @Composable () -> Unit,
|
||||||
|
lines: List<String>,
|
||||||
|
lineStyle: TextStyle,
|
||||||
|
spacingDp: Int = 12
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalAlignment = Alignment.Start
|
||||||
|
) {
|
||||||
|
// Header (t.ex. centrerad logga)
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalArrangement = Arrangement.Center
|
||||||
|
) {
|
||||||
|
header()
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(Modifier.height((spacingDp * 3).dp))
|
||||||
|
|
||||||
|
lines.forEachIndexed { i, s ->
|
||||||
|
if (i > 0) Spacer(Modifier.height(8.dp))
|
||||||
|
BasicText(s, style = lineStyle)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user