【发布时间】:2018-05-24 19:22:40
【问题描述】:
Flutter - SliverAppBar TabBar 未显示
一开始以为是flexibleSpace的问题,所以评论了,但是黄+黑的边框还在。
Youtube视频^^^
return new DefaultTabController(
length: 2,
child: new Scaffold(
body: new NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
new SliverAppBar(
forceElevated: innerBoxIsScrolled,
floating: true,
//elevation: elevation,
pinned: true,
expandedHeight: 250.0,
bottom: new TabBar(
tabs: <Tab>[
new Tab(
text: 'green',
icon: new Icon(Icons.show_chart),
),
new Tab(
text: 'purple',
icon: new Icon(Icons.history),
),
],
),
flexibleSpace: new FlexibleSpaceBar(
title: new FarsiText(
"آقای نوری",
style: titleTextStyle,
),
centerTitle: true,
background: new Container(
decoration: new BoxDecoration(
gradient: new LinearGradient(
begin: const Alignment(0.5, -0.5),
end: const Alignment(-1.5, 1.5),
colors: <Color>[
Colors.purple[400],
Colors.lightBlue[100],
],
),
),
padding: new EdgeInsets.only(
top: screenWidth / 4,
bottom: screenWidth / 7,
),
child: new Column(
children: <Widget>[
new Stack(
overflow: Overflow.visible,
children: <Widget>[
new CircleAvatar2(
boxShadow: new BoxShadow(
color: Colors.white70,
spreadRadius: 0.0,
blurRadius: 50.0,
),
radius: 40.0,
backgroundImage:
const AssetImage("assets/images/noori.jpg"),
),
new Positioned(
child: new Container(
padding: const EdgeInsets.all(3.0),
decoration: new BoxDecoration(
borderRadius: new BorderRadius.all(
const Radius.circular(8.0),
),
border: new Border.all(
color: Colors.white,
width: 1.5,
),
),
child: new FarsiText(
"تایید شده",
color: Colors.white,
fontSize: 15.0,
),
),
left: -100.0,
),
],
),
],
),
),
),
leading: getAppBarLeading(context),
),
];
},
body: new TabBarView(
children: <Widget>[
new Center(
child: new Container(
height: 1000.0,
color: Colors.green.shade200,
child: new Center(
child: new FlutterLogo(colors: Colors.green),
),
),
),
new Center(
child: new Container(
height: 1000.0,
color: Colors.purple.shade200,
child: new Center(
child: new FlutterLogo(colors: Colors.purple),
),
),
),
],
),
),
),
);
【问题讨论】:
-
嗨,你用什么
FarsiText代替了那个波斯文本的Text小部件?将它用于 Fasi 应用程序有什么好处吗? -
@HossainKhademian 它是 Text Class 的包装器