SliverAppBar.large constructor
- Key? key,
- Widget? leading,
- bool automaticallyImplyLeading = true,
- Widget? title,
- List<
Widget> ? actions, - Widget? flexibleSpace,
- PreferredSizeWidget? bottom,
- double? elevation,
- double? scrolledUnderElevation,
- Color? shadowColor,
- Color? surfaceTintColor,
- bool forceElevated = false,
- Color? backgroundColor,
- Color? foregroundColor,
- IconThemeData? iconTheme,
- IconThemeData? actionsIconTheme,
- bool primary = true,
- bool? centerTitle,
- bool excludeHeaderSemantics = false,
- double? titleSpacing,
- double? collapsedHeight,
- double? expandedHeight,
- bool floating = false,
- bool pinned = true,
- bool snap = false,
- bool stretch = false,
- double stretchTriggerOffset = 100.0,
- AsyncCallback? onStretchTrigger,
- ShapeBorder? shape,
- double toolbarHeight = _LargeScrollUnderFlexibleConfig.collapsedHeight,
- double? leadingWidth,
- TextStyle? toolbarTextStyle,
- TextStyle? titleTextStyle,
- SystemUiOverlayStyle? systemOverlayStyle,
- bool forceMaterialTransparency = false,
- Clip? clipBehavior,
Creates a Material Design large top app bar that can be placed in a CustomScrollView.
Returns a SliverAppBar configured with appropriate defaults for a large top app bar as defined in Material 3. It starts fully expanded with the title in an area underneath the main row of icons. When the CustomScrollView is scrolled, the title will be scrolled under the main row. When it is fully collapsed, a smaller version of the title will fade in on the main row. The reverse will happen if it is expanded again.
This sample shows how to use SliverAppBar.large in a CustomScrollView.
link
To create a local project with this code sample, run:
flutter create --sample=material.SliverAppBar.SliverAppBar.large.1 mysample
See also:
- AppBar, for a small or center-aligned top app bar.
- SliverAppBar.medium, for a medium top app bar.
- https://m3.material.io/components/top-app-bar/overview, the Material 3 app bar specification.
Implementation
const SliverAppBar.large({
super.key,
this.leading,
this.automaticallyImplyLeading = true,
this.title,
this.actions,
this.flexibleSpace,
this.bottom,
this.elevation,
this.scrolledUnderElevation,
this.shadowColor,
this.surfaceTintColor,
this.forceElevated = false,
this.backgroundColor,
this.foregroundColor,
this.iconTheme,
this.actionsIconTheme,
this.primary = true,
this.centerTitle,
this.excludeHeaderSemantics = false,
this.titleSpacing,
this.collapsedHeight,
this.expandedHeight,
this.floating = false,
this.pinned = true,
this.snap = false,
this.stretch = false,
this.stretchTriggerOffset = 100.0,
this.onStretchTrigger,
this.shape,
this.toolbarHeight = _LargeScrollUnderFlexibleConfig.collapsedHeight,
this.leadingWidth,
this.toolbarTextStyle,
this.titleTextStyle,
this.systemOverlayStyle,
this.forceMaterialTransparency = false,
this.clipBehavior,
}) : assert(floating || !snap, 'The "snap" argument only makes sense for floating app bars.'),
assert(stretchTriggerOffset > 0.0),
assert(
collapsedHeight == null || collapsedHeight >= toolbarHeight,
'The "collapsedHeight" argument has to be larger than or equal to [toolbarHeight].',
),
_variant = _SliverAppVariant.large;