Skip to content

Commit 3c91363

Browse files
committed
library: Drop SquircleShape
* Also rewrite demo's HomePage * Also optimize dialog
1 parent 7aa2d34 commit 3c91363

File tree

20 files changed

+370
-1097
lines changed

20 files changed

+370
-1097
lines changed

composeApp/src/commonMain/kotlin/MainPage.kt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fun MainPage(
4141
) {
4242
item {
4343
SearchBar(
44-
modifier = Modifier.padding(horizontal = 12.dp, vertical = 12.dp),
44+
modifier = Modifier.padding(horizontal = 12.dp, vertical = 10.dp),
4545
inputField = {
4646
InputField(
4747
query = miuixSearchValue,
@@ -52,7 +52,7 @@ fun MainPage(
5252
label = "Search",
5353
leadingIcon = {
5454
Image(
55-
modifier = Modifier.padding(horizontal = 12.dp),
55+
modifier = Modifier.padding(horizontal = 16.dp),
5656
imageVector = MiuixIcons.Search,
5757
colorFilter = BlendModeColorFilter(
5858
MiuixTheme.colorScheme.onSurfaceContainer,
@@ -100,10 +100,14 @@ fun MainPage(
100100
}
101101
}
102102
if (!expanded) {
103-
item {
103+
item(
104+
key = "text"
105+
) {
104106
TextComponent()
105107
}
106-
item {
108+
item(
109+
key = "other"
110+
) {
107111
OtherComponent(padding)
108112
}
109113
}

composeApp/src/commonMain/kotlin/SecondPage.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fun SecondPage(
2222
contentPadding = PaddingValues(top = padding.calculateTopPadding()),
2323
topAppBarScrollBehavior = topAppBarScrollBehavior
2424
) {
25-
items(25) {
25+
items(20) {
2626
SuperDropdown(
2727
title = "Dropdown",
2828
summary = "Popup near click",

composeApp/src/commonMain/kotlin/ThirdPage.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ import top.yukonga.miuix.kmp.basic.LazyColumn
99
import top.yukonga.miuix.kmp.basic.ScrollBehavior
1010
import top.yukonga.miuix.kmp.extra.SuperDropdown
1111
import top.yukonga.miuix.kmp.extra.SuperSwitch
12-
import top.yukonga.miuix.kmp.utils.Platform
1312
import top.yukonga.miuix.kmp.utils.getWindowSize
14-
import top.yukonga.miuix.kmp.utils.platform
1513

1614
@Composable
1715
fun ThirdPage(
@@ -67,8 +65,6 @@ fun ThirdPage(
6765
onSelectedIndexChange = { colorMode.value = it },
6866
horizontalPadding = 12.dp
6967
)
70-
}
71-
item {
7268
Spacer(modifier = Modifier.height(padding.calculateBottomPadding()))
7369
}
7470
}

composeApp/src/commonMain/kotlin/component/OtherComponent.kt

Lines changed: 27 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import androidx.compose.foundation.layout.PaddingValues
55
import androidx.compose.foundation.layout.Row
66
import androidx.compose.foundation.layout.Spacer
77
import androidx.compose.foundation.layout.fillMaxWidth
8-
import androidx.compose.foundation.layout.height
98
import androidx.compose.foundation.layout.padding
109
import androidx.compose.foundation.layout.width
1110
import androidx.compose.foundation.text.KeyboardActions
@@ -26,6 +25,7 @@ import androidx.compose.ui.unit.sp
2625
import top.yukonga.miuix.kmp.basic.Button
2726
import top.yukonga.miuix.kmp.basic.Card
2827
import top.yukonga.miuix.kmp.basic.Slider
28+
import top.yukonga.miuix.kmp.basic.SmallTitle
2929
import top.yukonga.miuix.kmp.basic.Text
3030
import top.yukonga.miuix.kmp.basic.TextField
3131
import top.yukonga.miuix.kmp.theme.MiuixTheme
@@ -42,10 +42,11 @@ fun OtherComponent(padding: PaddingValues) {
4242
var progress by remember { mutableStateOf(0.5f) }
4343
val progressDisable by remember { mutableStateOf(0.5f) }
4444

45+
SmallTitle(text = "Button")
4546
Row(
4647
modifier = Modifier
47-
.fillMaxWidth()
48-
.padding(horizontal = 12.dp, vertical = 12.dp),
48+
.padding(horizontal = 12.dp)
49+
.padding(bottom = 12.dp),
4950
horizontalArrangement = Arrangement.SpaceBetween
5051
) {
5152
Button(
@@ -71,7 +72,8 @@ fun OtherComponent(padding: PaddingValues) {
7172
Row(
7273
modifier = Modifier
7374
.fillMaxWidth()
74-
.padding(horizontal = 12.dp),
75+
.padding(horizontal = 12.dp)
76+
.padding(bottom = 12.dp),
7577
horizontalArrangement = Arrangement.SpaceBetween
7678
) {
7779
Button(
@@ -91,10 +93,13 @@ fun OtherComponent(padding: PaddingValues) {
9193
)
9294
}
9395

96+
SmallTitle(text = "TextField")
9497
TextField(
9598
value = text1,
9699
onValueChange = { text1 = it },
97-
modifier = Modifier.padding(horizontal = 12.dp, vertical = 12.dp),
100+
modifier = Modifier
101+
.padding(horizontal = 12.dp)
102+
.padding(bottom = 12.dp),
98103
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
99104
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done)
100105
)
@@ -104,42 +109,45 @@ fun OtherComponent(padding: PaddingValues) {
104109
onValueChange = { text2 = it },
105110
backgroundColor = MiuixTheme.colorScheme.secondaryContainer,
106111
label = "Text Field",
107-
modifier = Modifier.padding(horizontal = 12.dp),
112+
modifier = Modifier
113+
.padding(horizontal = 12.dp)
114+
.padding(bottom = 12.dp),
108115
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
109116
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done)
110117
)
111118

119+
SmallTitle(text = "Slider")
112120
Slider(
113121
progress = progress,
114122
onProgressChange = { newProgress -> progress = newProgress },
115-
modifier = Modifier.padding(horizontal = 12.dp, vertical = 12.dp)
123+
modifier = Modifier
124+
.padding(horizontal = 12.dp)
125+
.padding(bottom = 12.dp),
116126
)
117127

118128
Slider(
119129
progress = progressDisable,
120130
onProgressChange = {},
121131
enabled = false,
122-
modifier = Modifier.padding(horizontal = 12.dp)
132+
modifier = Modifier
133+
.padding(horizontal = 12.dp)
134+
.padding(bottom = 12.dp),
123135
)
124136

137+
SmallTitle(text = "Card")
125138
Card(
126139
modifier = Modifier
127140
.fillMaxWidth()
128-
.padding(horizontal = 12.dp, vertical = 12.dp),
141+
.padding(horizontal = 12.dp)
142+
.padding(bottom = 12.dp),
129143
color = MiuixTheme.colorScheme.primaryVariant,
130144
insideMargin = DpSize(16.dp, 16.dp)
131145
) {
132146
Text(
133147
color = MiuixTheme.colorScheme.onPrimary,
134-
text = "Card 123456789",
148+
text = "Card",
135149
fontSize = 19.sp,
136-
fontWeight = FontWeight.Bold
137-
)
138-
Text(
139-
color = MiuixTheme.colorScheme.onPrimaryVariant,
140-
text = "一二三四五六七八九",
141-
fontSize = 15.sp,
142-
fontWeight = FontWeight.Normal
150+
fontWeight = FontWeight.SemiBold
143151
)
144152
}
145153

@@ -150,28 +158,9 @@ fun OtherComponent(padding: PaddingValues) {
150158
.padding(bottom = 12.dp + padding.calculateBottomPadding()),
151159
insideMargin = DpSize(16.dp, 16.dp)
152160
) {
153-
val color = MiuixTheme.colorScheme.onSurface
154-
Text(
155-
color = color,
156-
text = "Card",
157-
style = MiuixTheme.textStyles.paragraph,
158-
fontWeight = FontWeight.SemiBold,
159-
fontSize = 16.sp
160-
)
161-
Spacer(Modifier.height(6.dp))
162-
Text(
163-
color = color,
164-
text = "123456789",
165-
style = MiuixTheme.textStyles.paragraph
166-
)
167-
Text(
168-
color = color,
169-
text = "一二三四五六七八九",
170-
style = MiuixTheme.textStyles.paragraph
171-
)
172161
Text(
173-
color = color,
174-
text = "!@#$%^&*()_+-=",
162+
color = MiuixTheme.colorScheme.onSurface,
163+
text = "Card\nCardCard\nCardCardCard",
175164
style = MiuixTheme.textStyles.paragraph
176165
)
177166
}

0 commit comments

Comments
 (0)