【发布时间】:2020-11-02 16:21:41
【问题描述】:
我正在阅读这样的颤振代码:
Widget get _appBar {
return Column(
children: <Widget>[
Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0x66000000), Colors.transparent],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
child: Container(
padding: EdgeInsets.fromLTRB(14, 20, 0, 0),
height: 86.0,
decoration: BoxDecoration(
color:
Color.fromARGB((appBarAlpha * 255).toInt(), 255, 255, 255),
boxShadow: [
BoxShadow(
color: appBarAlpha == 1.0
? Colors.black12
: Colors.transparent,
offset: Offset(2, 3),
blurRadius: 6,
spreadRadius: 0.6,
),
]),
child: SearchBar(
searchBarType: appBarAlpha > 0.2
? SearchBarType.homeLight
: SearchBarType.home,
inputBoxClick: _jumpToSearch,
defaultText: SEARCH_BAR_DEFAULT_TEXT,
leftButtonClick: () {},
speakClick: _jumpToSpeak,
rightButtonClick: _jumpToUser,
),
),
),
Container(
height: appBarAlpha > 0.2 ? 0.5 : 0,
decoration: BoxDecoration(
boxShadow: [BoxShadow(color: Colors.black12, blurRadius: 0.5)]))
],
);
}
Widget get _appBar是什么意思?它得到一个appBar控件吗?为什么不直接返回一个 AppBar?
【问题讨论】:
-
你运行完整代码了吗?
标签: flutter