[英]Flutter Appbar title grey background displaying
Flutter AppBar 自定義視圖,在簽名構建中以灰色背景覆蓋標題小部件,調試構建其工作正常。
標題小部件自定義視圖源代碼分享如下,請查收。
_getAppbar(AppTheme themeData) {
return AppBar(
titleSpacing: 0,
centerTitle: false,
leading: Container(
//color: Colors.blue,
margin: EdgeInsets.only(left: 15),
child: CircleAvatar(
radius: 30.0,
child: SvgPicture.asset(
"assets/svg/man.svg",
width: 30,
height: 30,
),
//backgroundColor: Colors.red,
),
),
title: Container(
margin: EdgeInsets.only(left: 10),
alignment: Alignment.centerLeft,
color: Colors.transparent,
child: Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Text(
"Hi, Vikky",
style: TextStyle(
fontSize: 9,
fontWeight: fontRegular,
color: Color(themeData.headerNameColor)),
),
Wrap(crossAxisAlignment: WrapCrossAlignment.center, children: [
Icon(
Icons.location_on,
size: 12,
color: Color(themeData.brandColor),
),
Text(
"Kuzhikkattu Moola",
style: TextStyle(
fontSize: 12,
fontWeight: fontMedium,
color: Color(themeData.textColor)),
)
]),
])),
),
backgroundColor:Colors.transparent,
elevation: 0,
);
調試構建其工作正常,僅在簽名構建中發布。
此問題與不正確使用 ParentDataWidget有關,而不是與顏色有關。 這個問題似乎只在發布模式下而不是在構建模式下
Container(
margin: EdgeInsets.only(left: 10),
alignment: Alignment.centerLeft,
color: Colors.transparent,
child: Expanded( //Issue is here Incorrect use of Expanded Widget
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Text(
"Hi, Vikky",
style: TextStyle(
fontSize: 9,
fontWeight: fontRegular,
color: Color(themeData.headerNameColor)),
),
Wrap(crossAxisAlignment: WrapCrossAlignment.center, children: [
Icon(
Icons.location_on,
size: 12,
color: Color(themeData.brandColor),
),
Text(
"Kuzhikkattu Moola",
style: TextStyle(
fontSize: 12,
fontWeight: fontMedium,
color: Color(themeData.textColor)),
)
]),
])),
),
嘗試通過替換 widget- Expanded來管理您的 UI。 Go 通過此鏈接: 不正確使用父數據小部件
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.