![]() Fixes [Support search box inside large title nav bar](https://github.com/flutter/flutter/issues/18103) Part of [Support segmented controls in nav bars and double row nav bars](https://github.com/flutter/flutter/issues/10469) ## None mode (Current default) https://github.com/user-attachments/assets/d798314e-940f-4311-9a9a-fe999c65f280 ## Always mode https://github.com/user-attachments/assets/950a85aa-8ca2-42ea-bf8b-3cb8f95e616e ## Automatic mode https://github.com/user-attachments/assets/c7c7240b-d493-4036-a987-30f61d02bac3 ## With CupertinoSlidingSegmentedControl https://github.com/user-attachments/assets/59f4aec4-8d9c-4223-915b-97b73cb25dc8 <details> <summary>Sample Code</summary> ```dart // 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'; /// Flutter code sample for [CupertinoSliverNavigationBar]. void main() => runApp(const SliverNavBarApp()); class SliverNavBarApp extends StatelessWidget { const SliverNavBarApp({super.key}); @override Widget build(BuildContext context) { return const CupertinoApp( theme: CupertinoThemeData(brightness: Brightness.light), home: SliverNavBarExample(), ); } } class SliverNavBarExample extends StatelessWidget { const SliverNavBarExample({super.key}); @override Widget build(BuildContext context) { return const CupertinoPageScaffold( // A ScrollView that creates custom scroll effects using slivers. child: SafeArea( child: CustomScrollView( // A list of sliver widgets. slivers: <Widget>[ CupertinoSliverNavigationBar( leading: SizedBox( width: 100, child: Row( children: [ Icon(CupertinoIcons.back), Text( 'Lists', style: TextStyle(color: CupertinoColors.activeBlue), ), ], ), ), trailing: Icon(CupertinoIcons.plus), largeTitle: Text('iPhone'), // Change to desired mode. drawerMode: NavigationDrawerMode.none, drawer: Padding( padding: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 16.0), child: CupertinoSearchTextField(), ), ), SliverFillRemaining( child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ Text('Drag me up', textAlign: TextAlign.center), ], ), ), ], ), ), ); } } ``` </details> |
||
---|---|---|
.. | ||
api | ||
flutter_view | ||
hello_world | ||
image_list | ||
layers | ||
platform_channel | ||
platform_channel_swift | ||
platform_view | ||
splash | ||
texture | ||
.clang-format | ||
flutter_gallery.readme | ||
README.md |
Flutter Examples
This directory contains several examples of using Flutter. To run an example,
use flutter run
inside that example's directory. See the getting started
guide to install the flutter
tool.
For additional samples, see the
flutter/samples
repo.
Available examples include:
-
Hello, world The hello world app is a minimal Flutter app that shows the text "Hello, world!"
-
Flutter gallery The flutter gallery app no longer lives in this repo. Please see the gallery repo.
-
Layers The layers vignettes show how to use the various layers in the Flutter framework. For details, see the layers README.
-
Platform Channel The platform channel app demonstrates how to connect a Flutter app to platform-specific APIs. For documentation, see https://flutter.dev/to/platform-channels/.
-
Platform Channel Swift The platform channel swift app is the same as platform channel but the iOS version is in Swift and there is no Android version.
Notes
Note on Gradle wrapper files in .gitignore
:
Gradle wrapper files should normally be checked into source control. The example projects don't do that to avoid having several copies of the wrapper binary in the Flutter repo. Instead, the Gradle wrapper is injected by Flutter tooling, and the wrapper files are .gitignore'd to avoid making the Flutter repository dirty as a side effect of running the examples.