Commit c246ecd
authored
Fix the scrolling layout deviation of
This PR changes `CupertinoActionSheet`'s layout algorithm, so that the actions section always has the lower priority to take up vertical space with a fixed minimum height of 84.3 px.
Currently `CupertinoActionSheet` uses a very complicated rule the determine the sizes of various sections:
1. If there are <= 3 buttons and a cancel button, or 1 button without a cancel button, then the actions section should never scroll.
2. Otherwise, then the content section takes priority to take over spaces but must leave at least `actionsMinHeight` for the actions section.
This has been the case since `CupertinoActionSheet` was first introduced ([first PR](flutter#19232)). Maybe it was the case before, but it's no longer reproducible on the latest SwiftUI.
The following images for comparison (left to right: Current Flutter, Flutter after this PR, SwiftUI). Pay attention to whether the actions section scrolls. (There are also some height/padding issues, which will be fixed in a future PR.)
Two buttons:
<img width="1006" alt="image" src="https://github.com/flutter/flutter/assets/1596656/27ca5df7-1140-4bfd-9a5f-3b5972632c92">
Three buttons:
<img width="1025" alt="image" src="https://github.com/flutter/flutter/assets/1596656/f2be6a5c-1713-4ffe-9705-27a668e5133d">
Four buttons:
<img width="1024" alt="image" src="https://github.com/flutter/flutter/assets/1596656/5b90d9f4-11ed-4c04-bdea-0b81b1d2bd3d">
In SwiftUI, the action section seems to always have a minimum height of ~84 pixels regardless of the number of buttons. Therefore this PR also fixed this behavior, and adjusted the related tests.CupertinoActionSheet (flutter#149439)1 parent c03fb95 commit c246ecd
File tree
2 files changed
+11
-33
lines changed- packages/flutter
- lib/src/cupertino
- test/cupertino
2 files changed
+11
-33
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
631 | 631 | | |
632 | 632 | | |
633 | 633 | | |
634 | | - | |
635 | 634 | | |
636 | 635 | | |
637 | 636 | | |
| |||
918 | 917 | | |
919 | 918 | | |
920 | 919 | | |
921 | | - | |
922 | 920 | | |
923 | 921 | | |
924 | 922 | | |
925 | 923 | | |
926 | 924 | | |
927 | 925 | | |
928 | 926 | | |
929 | | - | |
930 | 927 | | |
931 | 928 | | |
932 | 929 | | |
| |||
980 | 977 | | |
981 | 978 | | |
982 | 979 | | |
983 | | - | |
984 | | - | |
985 | | - | |
986 | | - | |
987 | | - | |
988 | | - | |
989 | | - | |
990 | | - | |
991 | | - | |
992 | | - | |
993 | | - | |
994 | | - | |
995 | | - | |
996 | | - | |
997 | | - | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
998 | 983 | | |
999 | 984 | | |
1000 | 985 | | |
1001 | | - | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
1002 | 990 | | |
1003 | 991 | | |
1004 | 992 | | |
| |||
1019 | 1007 | | |
1020 | 1008 | | |
1021 | 1009 | | |
1022 | | - | |
1023 | | - | |
1024 | | - | |
1025 | | - | |
1026 | | - | |
1027 | | - | |
1028 | | - | |
1029 | | - | |
1030 | | - | |
1031 | | - | |
| 1010 | + | |
| 1011 | + | |
1032 | 1012 | | |
1033 | 1013 | | |
1034 | 1014 | | |
| |||
1037 | 1017 | | |
1038 | 1018 | | |
1039 | 1019 | | |
1040 | | - | |
1041 | 1020 | | |
1042 | 1021 | | |
1043 | 1022 | | |
| |||
1046 | 1025 | | |
1047 | 1026 | | |
1048 | 1027 | | |
1049 | | - | |
1050 | 1028 | | |
1051 | 1029 | | |
1052 | 1030 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
719 | 719 | | |
720 | 720 | | |
721 | 721 | | |
722 | | - | |
| 722 | + | |
723 | 723 | | |
724 | 724 | | |
725 | 725 | | |
| |||
753 | 753 | | |
754 | 754 | | |
755 | 755 | | |
756 | | - | |
| 756 | + | |
757 | 757 | | |
758 | 758 | | |
759 | 759 | | |
| |||
0 commit comments