简体   繁体   English

底部溢出 93 像素的 RenderFlex

[英]A RenderFlex overflowed by 93 pixels on the bottom

在此处输入图像描述

Form(
              key: _formKey,
              child: Container(
                alignment: Alignment.center,
                height: 55,
                width: 200,
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(10),
                  border: Border.all(color: Colors.black,width: 2)
                ),
                child: DropdownButtonHideUnderline(
                  child: DropDownField(
                    value: value,
                    enabled: true,
                    items: locationItem,
                    itemsVisibleInDropdown: 2,
                    onValueChanged: (value) {
                      setState(() {
                        this.value = value!;
                        locationId = value;
                        print(value);
                        print(locationId);
                      });
                    },
                  ),
                ),
              ),
            )

I have tried Singlechildscrollerview also any answer regarding this:我已经尝试过 Singlechildscrollerview 也有关于这个的任何答案:

Try below code hope its help to you.试试下面的代码希望它对你有帮助。 Refer DropdownButton-class here在此处参考 DropdownButton 类

Variable declaration:变量声明:

String dropdownValue = 'One';

Your Widget:你的小工具:

 Container(
        alignment: Alignment.center,
        height: 55,
        width: 200,
        decoration: BoxDecoration(
            borderRadius: BorderRadius.circular(10),
            border: Border.all(color: Colors.black, width: 2)),
        child: DropdownButtonHideUnderline(
          child: DropdownButton<String>(
            value: dropdownValue,
            icon: const Icon(Icons.arrow_downward),
            elevation: 16,
            style: const TextStyle(color: Colors.deepPurple),
            onChanged: (String newValue) {
              setState(() {
                dropdownValue = newValue;
              });
            },
            items: <String>['One', 'Two', 'Free', 'Four']
                .map<DropdownMenuItem<String>>((String value) {
              return DropdownMenuItem<String>(
                value: value,
                child: Text(value),
              );
            }).toList(),
          ),
        ),
      ),

Your Dropdown->你的下拉列表-> 在此处输入图像描述

Your dropdown after selecting->选择后的下拉列表-> 在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM