android - 日期/时间选择器 flutter : OK/CANCEL button not visible

标签 android ios dart flutter

flutter 中的日期选择器小部件以白色显示确定/取消按钮,因此在白色背景中不可见。

_displayFromDate = await showDatePicker(
                    context: context,
                    initialDate: now,
                    firstDate: now,
                    lastDate: now.add(new Duration(days: 30)),
                  );

我尝试将页面主题更改为黑色的主要强调色。还是看不出来。按钮在那里,因为我可以点击它们,只是标题不可见。

[✓] Flutter (Channel master, v1.2.3-pre.67, on Mac OS X 10.13.6 17G5019, locale
    en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
[✓] Android Studio (version 3.2)
[✓] Connected device (2 available)

enter image description here

最佳答案

你需要覆盖 - buttonTheme:

theme: ThemeData(
            buttonTheme: ButtonThemeData(textTheme: ButtonTextTheme.accent),
            accentColor: Colors.black,
            primaryColor: Colors.black)

enter image description here

关于android - 日期/时间选择器 flutter : OK/CANCEL button not visible,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54922613/

相关文章:

oop - 使用泛型参数覆盖Dart方法

android - 如果未在 firebase 中链接,则停止使用电话号码登录

android - 在库模块中使用 Google Play Services Gradle 插件

java - 使用 Sax 解析器的 RSS 阅读器丢失标题中的字符

android - 在Textview中为阿拉伯文本着色看起来像是单独的

ios - 如何在 iOS 中的 UIWebView 中显示离线连接错误?

flutter - 如何在行 flutter 中使用标签栏

ios - iPhone和iPad的iOS图像大小

ios - 为客户上传或只是存档应用程序

email - Flutter:验证一种谷歌帐户的方法?