我的Flutter上的空格有问题

问题描述 投票:0回答:1

我不明白我在做什么错。我为我在素食食谱上开发的应用程序创建了一个小的详细页面。我有一个我无法带走的空间,我也不知道是什么产生的。空间是您看到的红色圆圈。你能帮助我吗 ?谢谢,文森佐

My Detail Page


class _CookDetailState extends State<CookDetail> {

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        leading: IconButton(
          icon: Icon(Icons.arrow_back, color: Colors.white),
          onPressed: () => Navigator.of(context).pop(),
  ), 
        title: Text(this.widget.ricetta.title),
        backgroundColor: AppColors.darkModeBackgroundColor),
      body: Stack(
        children: <Widget>[
          Positioned(
            top: 0,
            left: 0,
            right: 0,
            bottom: 0,
            child: Hero(
              tag: this.widget.ricetta.title,
              child: Container(
                decoration:
                    BoxDecoration(image: DecorationImage(image: NetworkImage("https://cdn.pixabay.com/photo/2017/09/16/19/21/salad-2756467__340.jpg"),
                      fit: BoxFit.cover)),
              ),
            ),
          ),


          // white container
          Positioned(
            left: 24.0,
            right: 24.0,
            bottom: 16.0,
            child: Container(
              //height: MediaQuery.of(context).size.height * 0.75,
              //height: 650,
              child: ClipRect(
                child: BackdropFilter(
                  filter: ImageFilter.blur(sigmaX: 100, sigmaY: 200),
                  child: Container(
                       padding: EdgeInsets.all(16.0),
                       height: 500,
                       decoration: BoxDecoration(borderRadius: BorderRadius.circular(16.0), color: Colors.white.withOpacity(0.2)),
                      child: SingleChildScrollView(
                        child: Container(
                    padding: EdgeInsets.all(16.0),
                    height: 800,
                    decoration: BoxDecoration(borderRadius: BorderRadius.circular(16.0), color: Colors.white.withOpacity(0.2)),
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: <Widget>[
                        Row(
                          children: <Widget>[
                            Text(
                              this.widget.ricetta.title, 
                              style: TextStyle(color: Colors.white, fontSize: 20.0, fontWeight: FontWeight.bold),
                            ),
                            Spacer(),
                            Icon(
                              Icons.favorite_border,
                              size: 24.0,
                              color: Colors.white,
                            ),
                          ],
                        ),
                        new Container(
                          child: ListView(
                            shrinkWrap: true,
                            children: <Widget>[
                              this._generateList(this.widget.ricetta.listIngredieti),
                              this._generateStep(this.widget.ricetta.listPassaggio),
                            ],
                          ),
                        ),
                      ],
                    ),
                  ),  
                        ),
                      ),
                ),
              ),
            ),
          ),
        ],
      ),
    );
  }


  Widget _generateList(List<Ingrediente> listIngrediente){

    return Column(
      children: <Widget>[
        for ( var myElement in listIngrediente ) Text(
            myElement.title + " " + myElement.quantita,
            style: TextStyle(color: Colors.white, fontSize: 12, fontWeight: FontWeight.w600))
      ],
    );
  }

  Widget _generateStep(List<StepRicetta> listStep){
    return Column(
      children: <Widget>[
        for (var myStep in listStep) CheckboxListTile(title: AutoSizeText(myStep.title),
          value: false, onChanged: (bool selected){
              print("Valore selected");
          },
          secondary: const Icon(Icons.hourglass_empty),
        )
      ],
    );
  }

}

[我的概念是保留文字“食谱1”,使其处于阻塞状态,仅滚动显示与成分清单有关的清单,例如“放入面包”,“放入300克水”

android ios flutter
1个回答
0
投票

我想您的第二个EdgeInsets.all(16.0)创建了空间,您是否尝试过这个:EdgeInset.only(left: 16.0, right: 16.0)

© www.soinside.com 2019 - 2024. All rights reserved.