Kam*_*zik 18 android dart nestedscrollview flutter
我对 NestedScrollView 有一些问题。我已经使用 BottomNavigationBar 实现了 PageView,有时,当我在两个屏幕之间切换时,出现此错误:
'package:flutter/src/widgets/nested_scroll_view.dart':失败的断言:第 501 行 pos 14:'position.minScrollExtent != null && position.pixels != null':不是真的。
child: NestedScrollView(
controller: _controller,
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverAppBar(
automaticallyImplyLeading: false,
pinned: true,
expandedHeight: 140.0,
floating: false,
centerTitle: true,
flexibleSpace: FlexibleSpaceBar(
centerTitle: true,
background: new Container(
child: FutureBuilder(
future: CoverImagesApi().getImageFile(1),
builder: (context, snapshot) {
if(snapshot.data != null) {
return Container(
child: Column(
children: <Widget>[
Expanded(
flex: 5,
child: Container(
alignment: Alignment.topCenter,
),
),
Expanded(
flex: 2,
child: new Container(
child: Center(
child: Text('Obecná tabu?a',
style: TextStyle(
fontSize: 26.0,
fontWeight: FontWeight.bold
),
textAlign: TextAlign.center,
),
),
decoration: BoxDecoration(
color: Color.fromRGBO(255, 255, 255, 0.8)
),
alignment: Alignment.bottomCenter, //variable above
)
),
],
),
decoration: new BoxDecoration(
image: new DecorationImage(
fit: BoxFit.cover
image: snapshot.data.existsSync() ? Image.file(snapshot.data).image : AssetImage('assets/tabula.jpg'),
),
),
);
} else {
return Container(height: 0.0, width: 0.0);
}
}
),
),
),
),
];
},
body: DataFiller(scaffoldKey: _scaffoldKey),
)
Run Code Online (Sandbox Code Playgroud)
有人有什么想法吗?
没有什么问题,只要热重启就可以解决问题。这是因为热重载不会更改应用程序的状态,并且您执行了draws from state不存在的操作(它假设它存在)。
如果所有其他方法都失败,请尝试清理您的应用程序,这应该很好
| 归档时间: |
|
| 查看次数: |
3655 次 |
| 最近记录: |