【发布时间】:2020-12-21 08:55:22
【问题描述】:
我正在使用 Flutter 创建一个应用程序。在我的 main.dart 文件中,我为这样的对话框指定了一个主题:
theme: ThemeData(
primaryColor: Color(0xff2d2d2d),
colorScheme: ColorScheme.dark(primary: Color(0xffe2e2e2)),
accentColor: Color(0xffe2e2e2),
dialogTheme: DialogTheme(
backgroundColor: Color(0xff2d2d2d),
titleTextStyle: TextStyle(
fontWeight: FontWeight.w500,
fontSize: 16,
color: Color(0xffe2e2e2)),
),
)
一切正常,但我的应用中有一些页面颜色相反。我使用searchable_dropdown 包在其中一个下拉列表中放置了一个下拉列表,它创建了一个包含国家列表的对话框,但它采用了该主题的所有颜色。有没有办法让它以某种方式忽略默认主题并提供另一个主题?
这是下拉菜单的代码:
SearchableDropdown.single(
items: countries.map<DropdownMenuItem<String>>((country) {
return (DropdownMenuItem<String>(
child: Text(country['name']), value: country['name']));
}).toList(),
value: _country,
searchHint: null,
onChanged: (value) {
setState(() {
_country = value;
});
},
dialogBox: false,
isExpanded: true,
menuConstraints: BoxConstraints.tight(Size.fromHeight(350))),
【问题讨论】:
标签: flutter dialog flutter-layout