SingleChildScrollView高度达到最大高度,并且背景图像呈颤动状态

时间:2019-01-17 13:23:01

标签: android scroll flutter

在“登录”屏幕上,有一个背景图像,所有内容均可滚动,但是SingleChildScrollView未显示macth_parent的高度。我的目标是像here

一样进行设计
 class MyLoginOne extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return new Scaffold(
         body: new Container(
           decoration: new BoxDecoration(
               image: new DecorationImage(
                   fit: BoxFit.cover,
                   image:new NetworkImage('https://i.pinimg.com/originals/c2/47/e9/c247e913a0214313045a8a5c39f8522b.jpg')
               )
           ),
           child: new BackdropFilter(
             filter:new ImageFilter.blur(sigmaX: 1.1,sigmaY:1.1),
             child: new Container(
               decoration: new BoxDecoration(color: Colors.black45.withOpacity(0.5)),
               child: new SingleChildScrollView(
                 child: new Container(
                   child: new Column(
                 children: <Widget>[
                 new Container(
                     height: 200.0,
                     child: new Stack(
                       children: <Widget>[
                         new Align(
                             alignment: AlignmentDirectional.center,
                             child:new Container(
                               height: 120.0,
                               width: 120.0,
                               decoration: new BoxDecoration(
                                   shape: BoxShape.circle,
                                   color: Colors.white30
                               ),
                             )
                         ),
                         new Align(
                           alignment: AlignmentDirectional.center,
                           child: new Container(
                             child: new Text("Farha",style: new TextStyle(
                                 color: Colors.white,
                                 fontSize: 14.0,
                                 fontFamily: "WorkSansLight"
                             ),),
                       ),),],))],),),)),), ));}}

我的圆形容器的高度大约为200.0,但是SingleChildScrollView未显示完整高度。

enter image description here

2 个答案:

答案 0 :(得分:4)

所需布局的代码-不是100%,但是可以完成工作。您可以根据需要完成它。

services:

  redis:
    image: redis:latest
    container_name: jh_redis
    ports:
     - '6379:6379'
    command: redis-server --appendonly yes --requirepass my_strong_password 

输出:

enter image description here

答案 1 :(得分:2)

Container小部件将自行调整其子级的大小,除非指定。 就您而言:

...
Container(
    height: double.infinity, // <-----
    decoration: new BoxDecoration(
        image: new DecorationImage(
            fit: BoxFit.cover,
            image: new NetworkImage(
                'https://i.pinimg.com/originals/c2/47/e9/c247e913a0214313045a8a5c39f8522b.jpg')))
...