Flutter日期范围选择器的中间颜色不会改变。

huangapple go评论147阅读模式
英文:

Flutter date range picker's in between color won't change

问题

我有一个使用showDateRangePicker选择日期范围的Flutter应用程序。但是,当我选择一个范围时,选定日期之间的颜色变成了青色。我猜想这是标准应用程序颜色之一,因为我自己没有选择青色,但我似乎找不到正确的颜色,以便我可以更改它。

这是它的样子

有人能帮帮我吗?

我已经更改了colorScheme内的每个颜色,但它没有改变范围的颜色。

英文:

I have a Flutter app that uses showDateRangePicker to pick a date range. When I pick a range, though, the color in between the picked dates is somehow cyan. I'm assuming it's one of the standard application colors since I haven't selected cyan anywhere myself, but I can't seem to find the right one so I can change it.

This is what it looks like

Someone please help me out!

I've changed every color inside of colorScheme and it did not change the color of the range.

答案1

得分: 0

在你的主题中设置一个datePickerTheme,并覆盖rangeSelectionBackgroundColor:

theme: ThemeData(
  colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
  datePickerTheme: const DatePickerThemeData(
    rangeSelectionBackgroundColor: Colors.red),
  useMaterial3: true,
),
英文:

Set inside your theme a datePickerTheme and overwrite the rangeSelectionBackgroundcolor:

theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        datePickerTheme: const DatePickerThemeData(
            rangeSelectionBackgroundColor: Colors.red),
        useMaterial3: true,
      ),

huangapple
  • 本文由 发表于 2023年7月3日 21:34:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/76605251.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定