最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

dart - DropDown in flutter - Stack Overflow

matteradmin8PV0评论

How can I increase the height of the closed dropdown text area in Flutter (highlighted in red in the image)? I tried increasing the contentPadding vertical value to 40, but it only increases the overall height of the dropdown box, not just the text area. I also attempted to set the height in style and hint, but nothing seems to work to adjust the visible text area of the closed dropdown.

DropdownButtonFormField<ParkingModel>(
    isExpanded: true,
    decoration: InputDecoration(
      errorStyle: const TextStyle(color: Colors.red),
      isDense: false,
      filled: true,
      fillColor: themeChange.getThem() ? AppThemData.grey10 : AppThemData.grey03,
      contentPadding: const EdgeInsets.symmetric(vertical: 40, horizontal: 10),
      prefixIcon: Padding(
        padding: const EdgeInsets.all(1.0),
        child: SvgPicture.asset("assets/icon/ic_car_image.svg", height: 24, width: 24),
      ),
      disabledBorder: UnderlineInputBorder(
        borderRadius: const BorderRadius.only(topLeft: Radius.circular(12), topRight: Radius.circular(12)),
        borderSide: BorderSide(color: themeChange.getThem() ? AppThemData.grey09 : AppThemData.grey04, width: 1),
      ),
      focusedBorder: UnderlineInputBorder(
        borderRadius: const BorderRadius.only(topLeft: Radius.circular(12), topRight: Radius.circular(12)),
        borderSide: BorderSide(color: themeChange.getThem() ? AppThemData.primary06 : AppThemData.primary06, width: 1),
      ),
      enabledBorder: UnderlineInputBorder(
        borderRadius: const BorderRadius.only(topLeft: Radius.circular(12), topRight: Radius.circular(12)),
        borderSide: BorderSide(color: themeChange.getThem() ? AppThemData.grey09 : AppThemData.grey04, width: 1),
      ),
      errorBorder: UnderlineInputBorder(
        borderRadius: const BorderRadius.only(topLeft: Radius.circular(12), topRight: Radius.circular(12)),
        borderSide: BorderSide(color: themeChange.getThem() ? AppThemData.grey09 : AppThemData.grey04, width: 1),
      ),
      border: UnderlineInputBorder(
        borderRadius: const BorderRadius.only(topLeft: Radius.circular(12), topRight: Radius.circular(12)),
        borderSide: BorderSide(color: themeChange.getThem() ? AppThemData.grey09 : AppThemData.grey04, width: 1),
      ),
      hintStyle: TextStyle(
          fontSize: 14,
          color: themeChange.getThem() ? AppThemData.grey06 : AppThemData.grey06,
          fontWeight: FontWeight.w500,
          fontFamily: AppThemData.medium),
    ),
    value: controller.selectedParkingModel.value.id == null ? null : controller.selectedParkingModel.value,
    onChanged: (value) {
      controller.selectedParkingModel.value = value!;
      controller.update();
    },
    style: TextStyle(
        fontSize: 14,
        color: themeChange.getThem() ? AppThemData.grey02 : AppThemData.grey08,
        fontWeight: FontWeight.w500,
        fontFamily: AppThemData.medium),
    hint: Text(
      "Select Your Parking".tr,
      style: TextStyle(color: themeChange.getThem() ? AppThemData.grey07 : AppThemData.grey07),
    ),
    items: controller.parkingList.map((item) {
      return DropdownMenuItem<ParkingModel>(
        value: item,
        child: Container(
          margin: EdgeInsets.fromLTRB(0, 0, 0, 5),
            padding: EdgeInsets.fromLTRB(0, 0, 0, 3),
            child: Text(item.name.toString(), style: const TextStyle(
              fontSize: 14,
            ))),

      );
    }).toList()),

Image_

the text is displaying in the closed dropdown

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far