TSliverAppBar constructor

const TSliverAppBar({
  1. Key? key,
  2. Widget? title,
  3. TextStyle? titleStyle,
  4. List<Widget>? actions,
  5. IconData? leadingIcon,
  6. VoidCallback? leadingOnPressed,
  7. bool showBackArrow = false,
  8. double expandedHeight = 200.0,
  9. Widget? flexibleSpace,
  10. Widget? background,
  11. bool floating = false,
  12. bool pinned = true,
  13. bool snap = false,
  14. bool useTitleInFlexibleSpace = true,
  15. Color? backgroundColor,
})

A customizable and flexible SliverAppBar with scrolling effects.

This widget provides advanced app bar functionality with options to:

  • Customize the title using title and its style via titleStyle.
  • Show a back arrow using showBackArrow, or use a custom icon with leadingIcon.
  • Provide a callback for the leading icon press event with leadingOnPressed.
  • Add action buttons using the actions parameter.
  • Control the expanded height of the app bar with expandedHeight.
  • Add custom content when the app bar is expanded using flexibleSpace.
  • Set a custom background using background.
  • Control scrolling behavior with floating, pinned, and snap.

Note: If both title and a FlexibleSpaceBar.title are provided, both titles will be displayed simultaneously when scrolling. To avoid redundancy, prefer providing only one title source.

Implementation

const TSliverAppBar({
  super.key,
  this.title,
  this.titleStyle,
  this.actions,
  this.leadingIcon,
  this.leadingOnPressed,
  this.showBackArrow = false,
  this.expandedHeight = 200.0,
  this.flexibleSpace,
  this.background,
  this.floating = false,
  this.pinned = true,
  this.snap = false,
  this.useTitleInFlexibleSpace = true,
  this.backgroundColor,
});