提交 21b2e786 authored 作者: shixiaochen's avatar shixiaochen

1、优化MyPageAppBar(返回箭头展示隐藏)

上级 7faedf75
...@@ -4,7 +4,7 @@ class MyPageAppBar extends StatelessWidget implements PreferredSizeWidget { ...@@ -4,7 +4,7 @@ class MyPageAppBar extends StatelessWidget implements PreferredSizeWidget {
final String? title; // 标题 final String? title; // 标题
final Color? backgroundColor; // 背景颜色 final Color? backgroundColor; // 背景颜色
final Color? foregroundColor; // 前景颜色 final Color? foregroundColor; // 前景颜色
final bool showBack; // 是否展示返回箭头 final bool showBack; // 是否展示返回箭头
final bool primary; final bool primary;
final List<Widget>? actions; // 右侧widget final List<Widget>? actions; // 右侧widget
final Widget? leading; // 左侧widget final Widget? leading; // 左侧widget
...@@ -29,13 +29,15 @@ class MyPageAppBar extends StatelessWidget implements PreferredSizeWidget { ...@@ -29,13 +29,15 @@ class MyPageAppBar extends StatelessWidget implements PreferredSizeWidget {
return AppBar( return AppBar(
key: key, key: key,
centerTitle: true, centerTitle: true,
title: titleWidget ?? Text(title ?? "", style: TextStyle(color: foregroundColor)), title: titleWidget ??
Text(title ?? "", style: TextStyle(color: foregroundColor)),
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
foregroundColor: foregroundColor, foregroundColor: foregroundColor,
primary: primary, primary: primary,
actions: actions, actions: actions,
leading: leading, leading: !showBack ? null : leading,
elevation: elevation, elevation: elevation,
// If false and [leading] is null, leading space is given to [title].
automaticallyImplyLeading: showBack, automaticallyImplyLeading: showBack,
); );
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论