@@ -81,32 +81,43 @@ internal fun ZoomToolbar(
8181 val textMeasurer = rememberTextMeasurer()
8282
8383 ButtonGroup (
84+ overflowIndicator = {},
8485 modifier = modifier,
8586 horizontalArrangement = Arrangement .spacedBy(ButtonGroupDefaults .ConnectedSpaceBetween ),
8687 expandedRatio = 0f ,
8788 ) {
88- ToggleButton (
89- checked = selectedOptionIndex == 0 ,
90- onCheckedChange = { onZoomLevelSelected(defaultZoomOptions[0 ]) },
91- shapes = ButtonGroupDefaults .connectedLeadingButtonShapes(),
92- colors = ToggleButtonDefaults .toggleButtonColors(),
93- modifier = Modifier ,
94- ) {
95- val textLayoutResult = textMeasurer.measure(" M.MX" , LocalTextStyle .current)
96- val width = with (LocalDensity .current) { textLayoutResult.size.width.toDp() }
97- Text (options[0 ], Modifier .widthIn(min = width), textAlign = TextAlign .Center )
98- }
99- ToggleButton (
100- checked = selectedOptionIndex == 1 ,
101- onCheckedChange = { onZoomLevelSelected(defaultZoomOptions[1 ]) },
102- shapes = ButtonGroupDefaults .connectedTrailingButtonShapes(),
103- colors = ToggleButtonDefaults .toggleButtonColors(),
104- modifier = Modifier ,
105- ) {
106- val textLayoutResult = textMeasurer.measure(" M.MX" , LocalTextStyle .current)
107- val width = with (LocalDensity .current) { textLayoutResult.size.width.toDp() }
108- Text (options[1 ], Modifier .widthIn(min = width), textAlign = TextAlign .Center )
109- }
89+ customItem(
90+ buttonGroupContent = {
91+ ToggleButton (
92+ checked = selectedOptionIndex == 0 ,
93+ onCheckedChange = { onZoomLevelSelected(defaultZoomOptions[0 ]) },
94+ shapes = ButtonGroupDefaults .connectedLeadingButtonShapes(),
95+ colors = ToggleButtonDefaults .toggleButtonColors(),
96+ modifier = Modifier ,
97+ ) {
98+ val textLayoutResult = textMeasurer.measure(" M.MX" , LocalTextStyle .current)
99+ val width = with (LocalDensity .current) { textLayoutResult.size.width.toDp() }
100+ Text (options[0 ], Modifier .widthIn(min = width), textAlign = TextAlign .Center )
101+ }
102+ },
103+ menuContent = {},
104+ )
105+ customItem(
106+ buttonGroupContent = {
107+ ToggleButton (
108+ checked = selectedOptionIndex == 1 ,
109+ onCheckedChange = { onZoomLevelSelected(defaultZoomOptions[1 ]) },
110+ shapes = ButtonGroupDefaults .connectedTrailingButtonShapes(),
111+ colors = ToggleButtonDefaults .toggleButtonColors(),
112+ modifier = Modifier ,
113+ ) {
114+ val textLayoutResult = textMeasurer.measure(" M.MX" , LocalTextStyle .current)
115+ val width = with (LocalDensity .current) { textLayoutResult.size.width.toDp() }
116+ Text (options[1 ], Modifier .widthIn(min = width), textAlign = TextAlign .Center )
117+ }
118+ },
119+ menuContent = {},
120+ )
110121 }
111122}
112123
0 commit comments