日期/时间选择器颤动:OK / CANCEL按钮不可见

问题描述 投票:4回答:1

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

_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

android ios dart flutter
1个回答
1
投票

你需要覆盖 - buttonTheme:

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

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.