defaultAppbar static method

AppBar defaultAppbar({
  1. required String title,
  2. PreferredSizeWidget? bottom,
  3. List<Widget>? actions,
  4. bool backButton = false,
  5. bool centerTitle = true,
  6. bool gradientColorBackground = false,
  7. Widget? leading,
  8. double toolbarHeight = 56,
  9. List<Color>? gradientColors,
})

Implementation

static AppBar defaultAppbar({
  required String title,
  PreferredSizeWidget? bottom,
  List<Widget>? actions,
  bool backButton = false,
  bool centerTitle = true,
  bool gradientColorBackground = false,
  Widget? leading,
  double toolbarHeight = 56,
  List<Color>? gradientColors,
}) {
  return AppBar(
    centerTitle: centerTitle,
    title: Texts.headline6(title),
    toolbarHeight: toolbarHeight,
    bottom: bottom,
    actions: actions,
    leading: backButton
        ? IconButton(
            onPressed: () => Get.back(),
            icon: Icon(
              Platform.isIOS ? Icons.arrow_back_ios : Icons.arrow_back,
            ),
          )
        : leading,
    flexibleSpace: gradientColors != null
        ? Container(
            decoration: BoxDecoration(
              gradient: LinearGradient(
                tileMode: TileMode.clamp,
                begin: Alignment.centerLeft,
                end: Alignment.centerRight,
                colors: gradientColors,
              ),
            ),
          )
        : Container(
            decoration:
                BoxDecoration(color: Get.theme.appBarTheme.backgroundColor),
          ),
  );
}