des*_*ona 3 flutter cupertinonavigationbar
我想增加CupertinoNavigationBar身高。代码是这样的:
child: CustomCupertinoNavigationBar(
padding: EdgeInsetsDirectional.zero,
backgroundColor: Colors.white,
middle: Semantics(
label: "dashboard-main-page-title",
child: Text(
"My Title",
style: TextStyles.HankenSans_Bold_18_PrimaryBlack,
key: Key('dashboard-main-page-title'),
),
),
leading: Semantics(
label: "dashboard-back-button",
child: Material(
color: Colors.white,
child: CustomBackButton(
onPressHandler: () {
Navigation().openMyAccountPage();
},
),
),
),
);
Run Code Online (Sandbox Code Playgroud)
我尝试创建自己的定制库比蒂诺。我复制 cupertino/nav_bar.dart 并更改了_kNavBarPersistentHeight参数,const double _kNavBarPersistentHeight = 58.0;但它导致 IOS 中出现两个导航栏。有人能帮我解决这个问题吗?非常感激。
我解决了这个问题
appBar: PreferredSize(
preferredSize: Size.fromHeight(100.0),
child: Container(
height: 120,
child: CupertinoNavigationBar(
padding: EdgeInsetsDirectional.zero,
backgroundColor: Colors.white,
middle: Semantics(
label: "dashboard-main-page-title",
child: Text(
CustomerLoyaltyLocalizations.instance.dashboardMainPageTitle,
style: TextStyles.HankenSans_Bold_18_PrimaryBlack,
key: Key('dashboard-main-page-title'),
),
),
leading: Semantics(
label: "dashboard-back-button",
child: Material(
color: Colors.white,
child: CustomBackButton(
onPressHandler: () {
Navigation().openMyAccountPage();
},
),
),
),
),
),
),
Run Code Online (Sandbox Code Playgroud)
首先我使用 PreferredSize,然后在 CupertinoNavigationBar 之前使用 Container widget。
| 归档时间: |
|
| 查看次数: |
2540 次 |
| 最近记录: |