【发布时间】:2018-12-28 03:10:28
【问题描述】:
我正在练习 Youtube 的动画文本教程,我想在我的布局中实现它。在我的布局中,我有一个背景图片。所以我使用 Stack 以便我的动画文本位于背景图片上方,并且它必须是可滚动的。
没有 ListView 也能完美运行。但是,当我用 ListView 包装 Stack 时......所有小部件都消失了,它是空白的。请帮帮我
这是代码:
Widget build(BuildContext context) {
final double width = MediaQuery.of(context).size.width;
return AnimatedBuilder(
animation: animationController,
builder: (BuildContext context, Widget child) {
return Scaffold(
appBar: new AppBar(....),
//BODY
body: new ListView {
children: <Widget>[
new Stack(
children: <Widget>[
new AspectRatio(
aspectRatio: 100 / 100,
child: new Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/dashboard.png'),
alignment: Alignment.topCenter)),
),
),
new Transform(
transform: Matrix4.translationValues(
animation.value * width,
0.0,
0.0,
),
child: ListView{
children:<Widget>[
new Container(
child: Column(
children: <Widget>[
Row(
children: <Widget>[
Text(
'Have you subscribe',
style: TextStyle(
color: Colors.black,
fontSize: 28.0,
fontFamily: 'Sego'),
)
],
),
],
),
),
],
),
),
],
));
});
}
}
【问题讨论】:
-
请发布您遇到的错误。
-
不是错误对不起,它只是空白。每个小部件都消失了(appbar 除外)