@@ -181,6 +181,33 @@ void main() {
181181 expect (findOverflowBackButton (), findsNothing);
182182 }, skip: kIsWeb); // [intended] We do not use Flutter-rendered context menu on the Web.
183183
184+ testWidgets ('does not paginate if children fit with zero margin' , (WidgetTester tester) async {
185+ final List <Widget > children = List <Widget >.generate (7 , (int i) => const TestBox ());
186+ final double spacerWidth = 1.0 / tester.binding.window.devicePixelRatio;
187+ final double dividerWidth = 1.0 / tester.binding.window.devicePixelRatio;
188+ const double borderRadius = 8.0 ; // Should match _kToolbarBorderRadius
189+ final double width = 7 * TestBox .itemWidth + 6 * (dividerWidth + 2 * spacerWidth) + 2 * borderRadius;
190+ await tester.pumpWidget (
191+ CupertinoApp (
192+ home: Center (
193+ child: SizedBox (
194+ width: width,
195+ child: CupertinoTextSelectionToolbar (
196+ anchorAbove: const Offset (50.0 , 100.0 ),
197+ anchorBelow: const Offset (50.0 , 200.0 ),
198+ children: children,
199+ ),
200+ ),
201+ ),
202+ ),
203+ );
204+
205+ // All children fit on the screen, so they are all rendered.
206+ expect (find.byType (TestBox ), findsNWidgets (children.length));
207+ expect (findOverflowNextButton (), findsNothing);
208+ expect (findOverflowBackButton (), findsNothing);
209+ }, skip: kIsWeb); // [intended] We do not use Flutter-rendered context menu on the Web.
210+
184211 testWidgets ('positions itself at anchorAbove if it fits' , (WidgetTester tester) async {
185212 late StateSetter setState;
186213 const double height = _kToolbarHeight;
0 commit comments