flutter中NavigationBar的默认颜色是什么

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

我的应用程序中有一个

NavigationBar
,偶尔我会显示模态底部表单。 我希望底板的颜色与
NavigationBar
相同。
NavigationBar
的默认颜色是什么,因此模态底部表单的默认颜色是什么?

showModalBottomSheet<void>(
  context: _scaffoldKey.currentContext!,
  builder: (BuildContext context) {
    return BottomSheetComponent(marker: marker);
  },
  clipBehavior: Clip.hardEdge,
)
flutter navigationbar flutter-showmodalbottomsheet bottom-navigation-bar
1个回答
0
投票

您可以从文档或源代码中查看 Flutter 小部件的默认颜色。

从文档中,backgroundColor

NavigationBar
属性描述为:

导航栏本身的颜色。

如果为 null,则使用 NavigationBarThemeData.backgroundColor。如果该值也为 null,则如果 ThemeData.useMaterial3 为 true,则该值为 ColorScheme.surface。如果为 false,则默认使用 ElevationOverlay 混合 ColorScheme.surface 和 ColorScheme.onSurface。

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