Closed
Description
Use case
I see that SegmentedButton are only ment to be horizontal, but we often see the need to arrange them vertically.
An example below (snipped from an android/kotlin app):
Proposal
Please add a direction
parameter in SegmentedButton, which turns the direction of the layout.
...such as this one, actually suggested from Gemini:
import 'package:flutter/material.dart';
// ...
SegmentedButton<int>(
style: ButtonStyle(
// Customize the button style for verticalorientation
padding: MaterialStateProperty.all(EdgeInsets.symmetric(vertical: 12.0, horizontal: 8.0)),
textStyle: MaterialStateProperty.all(TextStyle(fontSize: 16.0)),
// Add more styling as needed
),
segments: const <ButtonSegment<int>>[
ButtonSegment<int>(value: 0, label: Text('Option 1')),
ButtonSegment<int>(value: 1, label: Text('Option 2')),
ButtonSegment<int>(value: 2, label: Text('Option 3')),
// Add more segments as needed
],
selected: <int>{0}, // Set initial selection
onSelectionChanged: (Set<int> newSelection) {
// Handle selection changes
print('Selected segment: ${newSelection.first}');
},
direction: Axis.vertical, // Set the direction to vertical
)
the call has been forwarded...
Metadata
Metadata
Assignees
Labels
Issues that are less important to the Flutter projectNothing broken; request for a new capabilityA detailed proposal for a change to Flutterflutter/packages/flutter/material repository.flutter/packages/flutter repository. See also f: labels.Issue is closed as already fixed in a newer versionOwned by Design Languages teamTriaged by Design Languages team