I have a NavigationBar in my app and occasionally I will show a modal bottom sheet.
I would like the bottom sheet to have the same color as the NavigationBar.
What is the default color for the NavigationBar, hence for the modal bottom sheet?
showModalBottomSheet<void>(
context: _scaffoldKey.currentContext!,
builder: (BuildContext context) {
return BottomSheetComponent(marker: marker);
},
clipBehavior: Clip.hardEdge,
)
You can see the default colors of a Flutter widget from the docs or from the source code.
From the documentation, the
backgroundColorproperty ofNavigationBaris described as:You can get
ColorSchemefromTheme.of(context).colorScheme. For example, to get theColorScheme.onSurfacevalue you can do this:If you're asking about the source of the tinted color that applies on the
NavigationBar, that is from the surfaceTintColor property.