Add bottom to CupertinoNavigationBar to allow for a double-row nav bar (#155959)

Fixes [Support segmented controls in nav bars and double row nav bars](https://github.com/flutter/flutter/issues/10469)

<img width="270" height="600"  alt="Screenshot 2024-09-30 at 3 09 04 PM" src="https://github.com/user-attachments/assets/4003116f-69dd-4f8f-a185-6ca151b74d2d">
This commit is contained in:
Victor Sanni
2024-10-16 12:36:55 -07:00
committed by GitHub
parent fbbbb7d452
commit f9eebe0319
4 changed files with 175 additions and 4 deletions

View File

@@ -0,0 +1,27 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/cupertino.dart';
import 'package:flutter_api_samples/cupertino/nav_bar/cupertino_navigation_bar.1.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('CupertinoNavigationBar with bottom widget', (WidgetTester tester) async {
await tester.pumpWidget(
const example.NavBarApp(),
);
final Finder navBarFinder = find.byType(CupertinoNavigationBar);
final Finder searchFieldFinder = find.byType(CupertinoSearchTextField);
expect(navBarFinder, findsOneWidget);
expect(searchFieldFinder, findsOneWidget);
// The bottom widget is bounded by the navigation bar.
expect(
tester.getBottomLeft(searchFieldFinder).dy,
lessThan(tester.getBottomLeft(navBarFinder).dy),
);
});
}