【问题标题】:Dropdown menu with rounded corners in flutter颤动中带有圆角的下拉菜单
【发布时间】:2021-08-28 21:15:56
【问题描述】:

我发现如果我修改 material/dropdown.dart 中的类 _DropdownMenuPainter 并更改 BorderRadius.circular(2.0) BorderRadius.circular(24.0),我得到了我想要的结果,因为我想在我的 DropdownButton 菜单上有圆角。

但是我认为这不是一个好的做法,因为更改不会在我的项目中。如何在我的项目中进行此修改?

【问题讨论】:

    标签: flutter dart menu dropdown rounded-corners


    【解决方案1】:

    DropdownButton 中使用borderRadius 属性应该可以解决问题。

    DropdownButton(
     borderRadius:BorderRadius.circular(10),
     child: ...
    )
    

    【讨论】:

    • DropdownButton borderRadius 属性是在 Flutter 2.5 上添加的。事先我必须在我的应用程序上覆盖整个类。我正在使用 import 'package:flutter/material.dart' hide DropdownButton, DropdownButtonFormField, DropdownButtonHideUnderline, DropdownMenuItem;
    猜你喜欢
    • 1970-01-01
    • 2021-11-29
    • 1970-01-01
    • 2022-11-10
    • 2013-10-26
    • 1970-01-01
    • 2019-03-09
    • 1970-01-01
    • 2023-03-13
    相关资源
    最近更新 更多