mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
AppBar extensions for Scaffold et al Add support for the appbar behavior described in the "Flexible space with image" section of https://www.google.com/design/spec/patterns/scrolling-techniques.html#scrolling-techniques-scrolling. For now, an "AppBar" is a toolbar, a toolbar and a tabbar arranged in a column, or a toolbar and flexible space widget arranged in a stack with the toolbar on top. The AppBar occupies the space behind the status bar, i.e. its origin is at the top of the screen. The Scaffold listens for scroll notifications from a Scrollable descendant identified by scrollableKey. Scrolling downwards from the top causes the Scaffold to shrink its appBar's height from appBarHeight to 0. Scrolling downwards when the appBar isn't visible causes its toolbar to reappear. Applications can specify the flexibleSpace - essentially the appbar's background - with a WidgetBuilder. The contents of the flexible space can track the appbar's relative height with Scaffold.of(context).appBarAnimation, an animation that's 0.0 when the appbar is fully visible and 1.0 when it has disappeared. Added FlexibleSpaceBar to simplify building a flexible space widget that animates a title and a background image per the Material Design spec. To enable the new behavior, specify the following Scaffold properties: ``` return new Scaffold( appBarHeight: appBarHeight, scrollableKey: scrollableKey, appBarBehavior: AppBarBehavior.scroll, ... ) ``` AppBarHeight should be greater than kToolBarHeight. Typically it will be much greater. ScrollableKey identifies the Scrollable that the Scaffold will track. AppBarBehavior.scroll indicates that the appbar will resize in response to scrolling. The Scrollable must be a descendant of the Scaffold body and must specify the same scrollableKey as well as a padding value that accounts for the appbar's height. For example: ``` body: new ScrollableViewport( key: scrollableKey, child: new Padding(padding: new EdgeDims.only(top: appBarHeight) ... ) ``` Also: - Added scrollableKey and scrollablePadding to MaterialList. They're applied to the ScrollableList child. - Fixed the padding support in ScrollableList. - Added a foregroundAlpha property to ToolBar. It controls the opacity of the icon and text themes' colors. - Removed the toolbar's "bottom" widget property. Use the flexibleSpace WidgetBuilder instead.
Add support for the appbar behavior described in the "Flexible space with image" section of https://www.google.com/design/spec/patterns/scrolling-techniques.html#scrolling-techniques-scrolling.
Flutter
Flutter is a new way to build high-performance, cross-platform mobile apps. Flutter is optimized for today's, and tomorrow's, mobile devices. We are focused on low-latency input and high frame rates on Android and iOS.
Flutter is an early-stage open-source project. We are still missing core features like accessibility, text input, localization, and more. However, you can build demos and examples today. We hope you try it out and send us feedback.
-
For information about using Flutter to build apps, please see the getting started guide.
-
For information about contributing code to Flutter itself, please see CONTRIBUTING.md.
Community
Join us on IRC at #flutter on Freenode or join our mailing list,
flutter-dev@googlegroups.com.
Description
Flutter makes it easy and fast to build beautiful apps for mobile and beyond
androidapp-frameworkcross-platformdartdart-platformdesktopflutterflutter-packagefuchsiaioslinux-desktopmacosmaterial-designmobilemobile-developmentskiawebweb-frameworkwindows
Readme
2.5 GiB
Languages
Dart
75%
C++
16.5%
Objective-C++
2.9%
Java
2.8%
Objective-C
0.7%
Other
1.9%