Skip to content

Commit 9c9bb55

Browse files
committed
Move the select components to right below menus and remove the redundant Columns
1 parent e8f7981 commit 9c9bb55

File tree

1 file changed

+21
-26
lines changed
  • demo/src/commonMain/kotlin/com/huanshankeji/compose/material/demo

1 file changed

+21
-26
lines changed

demo/src/commonMain/kotlin/com/huanshankeji/compose/material/demo/Material3.kt

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,27 @@ fun Material3(/*modifier: Modifier = Modifier*/
227227
DropdownMenuContent(setSelection, close)
228228
}
229229
}
230+
// Select components
231+
var selectedValue by remember { mutableStateOf("Option 1") }
232+
Text("Selected: $selectedValue")
233+
FilledSelect(
234+
value = selectedValue,
235+
onValueChange = { selectedValue = it },
236+
label = "Choose option"
237+
) {
238+
SelectOption("Option 1", "Option 1")
239+
SelectOption("Option 2", "Option 2")
240+
SelectOption("Option 3", "Option 3")
241+
}
242+
OutlinedSelect(
243+
value = selectedValue,
244+
onValueChange = { selectedValue = it },
245+
label = "Choose option"
246+
) {
247+
SelectOption("Option 1", "Option 1")
248+
SelectOption("Option 2", "Option 2")
249+
SelectOption("Option 3", "Option 3")
250+
}
230251

231252
LinearProgressIndicator()
232253
LinearProgressIndicator({ 0.5f })
@@ -347,32 +368,6 @@ fun Material3(/*modifier: Modifier = Modifier*/
347368
Text("Selected tab: ${selectedTabIndex + 1}", Modifier.padding(16.dp))
348369
}
349370

350-
// Select components
351-
var selectedValue by remember { mutableStateOf("Option 1") }
352-
Column {
353-
Text("Selected: $selectedValue")
354-
FilledSelect(
355-
value = selectedValue,
356-
onValueChange = { selectedValue = it },
357-
label = "Choose option"
358-
) {
359-
SelectOption("Option 1", "Option 1")
360-
SelectOption("Option 2", "Option 2")
361-
SelectOption("Option 3", "Option 3")
362-
}
363-
}
364-
Column {
365-
OutlinedSelect(
366-
value = selectedValue,
367-
onValueChange = { selectedValue = it },
368-
label = "Choose option"
369-
) {
370-
SelectOption("Option 1", "Option 1")
371-
SelectOption("Option 2", "Option 2")
372-
SelectOption("Option 3", "Option 3")
373-
}
374-
}
375-
376371
// Segmented Buttons - Single select with Selection enum
377372
var selectedSegment by remember { mutableStateOf(Selection.A) }
378373
SingleChoiceSegmentedButtonRow {

0 commit comments

Comments
 (0)