【发布时间】:2020-04-17 20:33:00
【问题描述】:
所以,我正在尝试制作像 this one 这样的页面,但现在我遇到了溢出错误:
我在网上看到有人用SingleChildScrollView解决了这个问题,但是上面的文章使用NestedScrollView来使用条子,所以我不知道该怎么做。
由于下面的错误,我还尝试将Extended 放在各处,但没有任何效果。
代码是那个:(完整代码在my github)
return Scaffold(
appBar: AppBar(
elevation: 0.0,
backgroundColor: Color(0x00ffffff),
title: Text('Account'),
),
body: DefaultTabController(
length: 2,
child: RefreshIndicator(
onRefresh: getArtistImage,
key: _refreshIndicatorKey,
child: NestedScrollView(
headerSliverBuilder: (context, _) {
return [
SliverList(
delegate: SliverChildListDelegate([
Column(
children: <Widget>[
!loaded
? SafeArea(
top: true,
child: Column(
children: <Widget>[
Container(
child: LinearProgressIndicator(
backgroundColor: whiteLoadingBackground,
valueColor: AlwaysStoppedAnimation(
Colors.white60),
),
height: 3,
),
UserProfile(widget.user, recentTracks)
],
),
)
: Container(
child: Stack(
children: <Widget>[
Container(
height: MediaQuery
.of(context)
.size
.width,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Color(0x56000000),
Color(0x88000000),
Color(0xff000000)
],
begin: FractionalOffset.topCenter,
end: AlignmentDirectional.bottomCenter,
)),
),
PageModel(
title: 'My Account',
children: UserProfile(
widget.user, recentTracks))
],
),
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(artistImage),
alignment: Alignment.topCenter,
fit: BoxFit.fitWidth),
))
],
),
]),
)
];
},
physics:
AlwaysScrollableScrollPhysics(parent: BouncingScrollPhysics()),
body: Column(
children: <Widget>[
TabBar(
tabs: <Widget>[
Tab(
text: 'Last Scrobbles',
icon: Icon(Icons.queue_music),
),
Tab(
text: 'Charts',
icon: Icon(Icons.show_chart),
)
],
),
Expanded(
child: TabBarView(
children: <Widget>[
recentTracks != null
? Container(
child: UserBottomInformation(
widget.user, recentTracks),
)
: Text('ue'),
Text('pag 2')
],
),
)
],
),
),
),
),
);
【问题讨论】: