feat: update demo

This commit is contained in:
2023-11-15 04:52:13 +08:00
parent 6c9a9c05d3
commit 0330f5a36c
3 changed files with 77 additions and 56 deletions

View File

@@ -1,5 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission
android:name="${applicationId}.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION"
tools:node="remove" />
<permission
android:name="${applicationId}.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION"
tools:node="remove" />
<application
android:allowBackup="true"

View File

@@ -31,6 +31,6 @@ fun main() = application {
Window(
onCloseRequest = ::exitApplication,
title = "FlexiUI Demo",
state = rememberWindowState(width = 550.dp, height = 800.dp)
state = rememberWindowState(width = 550.dp, height = 900.dp)
) { MainView() }
}

View File

@@ -27,6 +27,8 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.getValue
@@ -62,12 +64,24 @@ fun App() {
val themeColor = remember { mutableStateOf(greenColors()) }
FlexiTheme(colors = themeColor.value) {
Surface {
Column(horizontalAlignment = Alignment.CenterHorizontally) {
AreaBox(modifier = Modifier.weight(1f)) { ContentView() }
Spacer(Modifier.padding(10.dp))
ThemeColorsView(themeColor)
}
}
}
}
@Composable
private fun ContentView() {
var greeting by remember { mutableStateOf("Hello World!") }
var input by remember { mutableStateOf("") }
Column(horizontalAlignment = Alignment.CenterHorizontally) {
AreaBox(modifier = Modifier.weight(1f)) {
val scrollState = rememberScrollState()
Column(
modifier = Modifier.fillMaxSize(),
modifier = Modifier.fillMaxSize()
.verticalScroll(scrollState)
.padding(10.dp),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
@@ -113,17 +127,16 @@ fun App() {
Text(text = "Current Value: ${value.roundToInt()}", modifier = Modifier.width(150.dp))
Spacer(Modifier.padding(10.dp))
Slider(value = value, onValueChange = { value = it })
}
}
Spacer(Modifier.padding(15.dp))
var stepValue by remember { mutableStateOf(25f) }
Text(text = "Current Value: ${stepValue.roundToInt()}", modifier = Modifier.width(150.dp))
Spacer(Modifier.padding(10.dp))
ThemeTestLayout(themeColor)
}
}
Slider(value = stepValue, onValueChange = { stepValue = it }, steps = 3)
}
}
@Composable
private fun ThemeTestLayout(themeColor: MutableState<Colors>) {
private fun ThemeColorsView(themeColor: MutableState<Colors>) {
Text(text = "Here are some theme color tests.")
Spacer(Modifier.padding(10.dp))
Row {