Commit e868e2b
authored
Add SegmentedButton expand feature (flutter#142804)
fix flutter#139486
The `expandedInsets` property enhancement for the `SegmentedButton` widget introduces flexibility in button layout design within Flutter applications. When `expandedInsets` is not null, this property allows the `SegmentedButton` to expand, filling the available horizontal space of its parent container and also have the specified insets, thus ensuring a uniform distribution of segment widths across the button. Conversely, with `expandedInsets` is null, the widget sizes itself based on the intrinsic sizes of its segments, preserving the natural width of each segment. This addition enhances the adaptability of the `SegmentedButton` to various UI designs, enabling developers to achieve both expansive and compact button layouts seamlessly.
### Setting expandedInsets = null
<img width="724" alt="image" src="https://github.com/flutter/flutter/assets/65075121/f173b327-a34b-49f0-a7b1-a212a376c5e3">
### Setting expandedInsets = EdgeInsets.zero
<img width="724" alt="image" src="https://github.com/flutter/flutter/assets/36861262/f141a3d3-80e3-4aeb-b7c8-d56ca77ca049">1 parent b63196d commit e868e2b
File tree
2 files changed
+99
-13
lines changed- packages/flutter
- lib/src/material
- test/material
2 files changed
+99
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
133 | 134 | | |
134 | 135 | | |
135 | 136 | | |
| |||
190 | 191 | | |
191 | 192 | | |
192 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
193 | 201 | | |
194 | 202 | | |
195 | 203 | | |
| |||
539 | 547 | | |
540 | 548 | | |
541 | 549 | | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
549 | 561 | | |
550 | 562 | | |
551 | 563 | | |
| |||
588 | 600 | | |
589 | 601 | | |
590 | 602 | | |
| 603 | + | |
591 | 604 | | |
592 | 605 | | |
593 | 606 | | |
| |||
596 | 609 | | |
597 | 610 | | |
598 | 611 | | |
| 612 | + | |
599 | 613 | | |
600 | 614 | | |
601 | 615 | | |
| |||
605 | 619 | | |
606 | 620 | | |
607 | 621 | | |
| 622 | + | |
608 | 623 | | |
609 | 624 | | |
610 | 625 | | |
| |||
633 | 648 | | |
634 | 649 | | |
635 | 650 | | |
| 651 | + | |
636 | 652 | | |
637 | 653 | | |
638 | 654 | | |
639 | 655 | | |
640 | | - | |
| 656 | + | |
| 657 | + | |
641 | 658 | | |
642 | 659 | | |
643 | 660 | | |
| |||
689 | 706 | | |
690 | 707 | | |
691 | 708 | | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
692 | 719 | | |
693 | 720 | | |
694 | 721 | | |
| |||
770 | 797 | | |
771 | 798 | | |
772 | 799 | | |
773 | | - | |
774 | 800 | | |
775 | | - | |
776 | | - | |
777 | | - | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
778 | 811 | | |
779 | | - | |
780 | 812 | | |
781 | 813 | | |
782 | 814 | | |
| |||
Lines changed: 54 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
855 | 856 | | |
856 | 857 | | |
857 | 858 | | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
858 | 912 | | |
859 | 913 | | |
860 | 914 | | |
| |||
0 commit comments