SingleChildScrollView在Column内不起作用

时间:2020-10-10 19:32:14

标签: android flutter interface

我想要滚动查看,但它不起作用。 我将SingleChildScrollView放在Align内,并将Align放在Stack内,然后我把SingleChildScrollView Column内,

这是列表不起作用的原因吗??? 抱歉,解释不清楚?

这是代码:

Align(
                    alignment: Alignment.topCenter,
                    child: Container(
                      child: SingleChildScrollView(
                        child: Column(
                          children: <Widget>[
                            Container(
                              decoration : BoxDecoration(
                                //color: Colors.pink
                              ),
                              child: Padding(
                                padding: const EdgeInsets.only(right : 12.0),
                                child: Text('رقمك السري',
                                  style: TextStyle(
                                    fontSize: 30,
                                    fontWeight: FontWeight.bold,
                                    color : const Color(0xFF193853),
                                  ),
                                ),
                              ),
                            ),
                            Padding(
                                padding: const EdgeInsets.only(top: 120.0),
                                child: Container(
                                  width: 250.0,
                                  decoration: BoxDecoration(
                                    color: Colors.white,
                                    borderRadius: BorderRadius.only(
                                      topLeft: const Radius.circular(50.0),
                                      topRight: const Radius.circular(50.0),
                                      bottomLeft: const Radius.circular(50.0),
                                      bottomRight: const Radius.circular(50.0),
                                    ),
                                  ),
                                  child: Wrap(
                                    crossAxisAlignment: WrapCrossAlignment.center,
                                    children:[
                                      Padding(
                                        padding: const EdgeInsets.all(20.0),
                                        child: Center(
                                          child: Text(
                                            '404040',
                                            style: TextStyle(
                                                color: Colors.grey,
                                                fontWeight: FontWeight.bold,
                                                fontSize: 30.0
                                            ),
                                          ),
                                        ),
                                      )
                                    ],
                                  ),
                                )
                            ),
                            Padding(
                              padding: EdgeInsets.only(top: 10.0),
                              child: Text(
                                'شارك الرقم السري',
                                style: TextStyle(
                                  fontSize: 15.0,
                                  color: const Color(0xFF193853),
                                  fontWeight: FontWeight.bold,
                                ),
                              ),
                            ),
                            Center(
                              child: Row(
                                mainAxisAlignment: MainAxisAlignment.center,
                                crossAxisAlignment: CrossAxisAlignment.center,
                                children: <Widget>[
                                  Padding(
                                    padding: EdgeInsets.only(top: 5.0),
                                    child: GestureDetector(
                                      onTap: (){
                                        print("taped");
                                      },
                                      child: Container(
                                        decoration: BoxDecoration(
                                          color: Color(0xFF193853),
                                          borderRadius: BorderRadius.only(
                                            topLeft: const Radius.circular(50.0),
                                            topRight: const Radius.circular(50.0),
                                            bottomLeft: const Radius.circular(50.0),
                                            bottomRight: const Radius.circular(50.0),
                                          ),
                                        ),
                                        child: Wrap(
                                          crossAxisAlignment: WrapCrossAlignment.center,
                                          children: <Widget>[
                                            Padding(
                                              padding: const EdgeInsets.fromLTRB(5.0, 2.0, 0.0, 2.0),
                                              child: Icon(
                                                Icons.content_copy,
                                                color: Colors.white,
                                                size: 15.0,
                                              ),
                                            ),
                                            Padding(
                                              padding: const EdgeInsets.fromLTRB(5.0, 0.0, 5.0, 0.0),
                                              child: Text(
                                                'نسخ',
                                                style: TextStyle(
                                                  color: Colors.white,
                                                ),
                                              ),
                                            ),
                                          ],
                                        ),
                                      ),
                                    ),
                                  ),
                                  Padding(
                                    padding: EdgeInsets.only(top: 5.0,left: 10.0),
                                    child: GestureDetector(
                                      onTap: (){
                                        print("Taped2");
                                      },
                                      child: Container(
                                        decoration: BoxDecoration(
                                          color: Color(0xFF193853),
                                          borderRadius: BorderRadius.only(
                                            topLeft: const Radius.circular(50.0),
                                            topRight: const Radius.circular(50.0),
                                            bottomLeft: const Radius.circular(50.0),
                                            bottomRight: const Radius.circular(50.0),
                                          ),
                                        ),
                                        child: Wrap(
                                          crossAxisAlignment: WrapCrossAlignment.center,
                                          children: <Widget>[
                                            Padding(
                                              padding: const EdgeInsets.fromLTRB(5.0, 2.0, 0.0, 2.0),
                                              child: Icon(
                                                Icons.share,
                                                color: Colors.white,
                                                size: 15.0,
                                              ),
                                            ),
                                            Padding(
                                              padding: const EdgeInsets.fromLTRB(5.0, 0.0, 5.0, 0.0),
                                              child: Text(
                                                'شارك',
                                                style: TextStyle(
                                                  color: Colors.white,
                                                ),
                                              ),
                                            ),
                                          ],
                                        ),
                                      ),
                                    ),
                                  )
                                ],
                              ),
                            ),
                            Padding(
                              padding: EdgeInsets.only(top: 40.0),
                              child: Text(
                                'في إنتظار باقي اللاعبين',
                                style: TextStyle(
                                    color: Colors.grey[600],
                                    fontSize: 20.0
                                ),
                              ),
                            ),
                            Padding(
                              padding: EdgeInsets.only(top: 0.0 , right: 30.0 , left: 30.0),
                              child: Center(
                                child: Container(
                                  height: 200.0,
                                  child:ListView.builder(
                                    itemCount: items.length,
                                    itemBuilder: (context,index){
                                      return Align(
                                        child: Container(
                                          padding: EdgeInsets.only(top: 20.0),
                                          child: Row(
                                            mainAxisAlignment: MainAxisAlignment.center,
                                            crossAxisAlignment: CrossAxisAlignment.center,
                                            children: <Widget>[
                                              Container(
                                                child: Padding(
                                                  padding: EdgeInsets.only(right: 5,top: 0),
                                                  child: Image.asset(
                                                    items[index].img,
                                                    width: 60.0,
                                                    height: 60.0,
                                                  ),
                                                ),
                                              ),
                                              Padding(
                                                  padding: const EdgeInsets.only(top: 0.0),
                                                  child: Container(
                                                    width: 200.0,
                                                    decoration: BoxDecoration(
                                                      color: Colors.white,
                                                      borderRadius: BorderRadius.only(
                                                        topLeft: const Radius.circular(50.0),
                                                        topRight: const Radius.circular(50.0),
                                                        bottomLeft: const Radius.circular(50.0),
                                                        bottomRight: const Radius.circular(50.0),
                                                      ),
                                                    ),
                                                    child: Wrap(
                                                      crossAxisAlignment: WrapCrossAlignment.center,
                                                      children:[
                                                        Padding(
                                                          padding: const EdgeInsets.all(20.0),
                                                          child: Center(
                                                            child: Text(
                                                              items[index].name,
                                                              style: TextStyle(
                                                                  color: Colors.black,
                                                                  fontWeight: FontWeight.bold,
                                                                  fontSize: 25.0
                                                              ),
                                                            ),
                                                          ),
                                                        )
                                                      ],
                                                    ),
                                                  )
                                              ),
                                            ],
                                          ),
                                        ),
                                      );
                                    },),
                                ),
                              ),
                            ),
                          ],
                        ),
                      ),
                    ),
                  )

1 个答案:

答案 0 :(得分:0)

将此添加到您的ListView.builder

  shrinkWrap: true,
  physics: NeverScrollableScrollPhysics(),