Skip to content

Commit

Permalink
Add NavigationView Popup Color
Browse files Browse the repository at this point in the history
Signed-off-by: 舰队的偶像-岛风酱! <[email protected]>
  • Loading branch information
frg2089 committed Jul 29, 2023
1 parent 222e917 commit 2410741
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Added `FluentThemeData.selectionColor`, which defaults to the accent color normal shade ([#897](https://github.com/bdlukaa/fluent_ui/issues/897))
- Flyout reverse transition duration is properly set ([#893](https://github.com/bdlukaa/fluent_ui/issues/893))
- Remove view padding when app bar is provided ([#884](https://github.com/bdlukaa/fluent_ui/issues/884))
- Added `NavigationPaneThemeData.popupBackgroundColor`, which defaults to the black color normal shade

## 4.7.0

Expand Down
8 changes: 8 additions & 0 deletions lib/src/controls/navigation/navigation_view/style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ class NavigationPaneThemeData with Diagnosticable {
/// is used.
final Color? backgroundColor;

/// The minimal pane background color. If null, [Colors.black]
/// is used.
final Color? popupBackgroundColor;

/// The color of the tiles. If null, [ButtonThemeData.uncheckedInputColor]
/// is used
final ButtonState<Color?>? tileColor;
Expand Down Expand Up @@ -115,6 +119,7 @@ class NavigationPaneThemeData with Diagnosticable {

const NavigationPaneThemeData({
this.backgroundColor,
this.popupBackgroundColor,
this.tileColor,
this.highlightColor,
this.labelPadding,
Expand Down Expand Up @@ -201,6 +206,7 @@ class NavigationPaneThemeData with Diagnosticable {
EdgeInsetsGeometry.lerp(a?.headerPadding, b?.headerPadding, t),
tileColor: ButtonState.lerp(a?.tileColor, b?.tileColor, t, Color.lerp),
backgroundColor: Color.lerp(a?.backgroundColor, b?.backgroundColor, t),
popupBackgroundColor: Color.lerp(a?.popupBackgroundColor, b?.popupBackgroundColor, t),
itemHeaderTextStyle:
TextStyle.lerp(a?.itemHeaderTextStyle, b?.itemHeaderTextStyle, t),
selectedTextStyle: ButtonState.lerp(
Expand Down Expand Up @@ -229,6 +235,7 @@ class NavigationPaneThemeData with Diagnosticable {
headerPadding: style?.headerPadding ?? headerPadding,
tileColor: style?.tileColor ?? tileColor,
backgroundColor: style?.backgroundColor ?? backgroundColor,
popupBackgroundColor: style?.popupBackgroundColor ?? popupBackgroundColor,
itemHeaderTextStyle: style?.itemHeaderTextStyle ?? itemHeaderTextStyle,
selectedTextStyle: style?.selectedTextStyle ?? selectedTextStyle,
unselectedTextStyle: style?.unselectedTextStyle ?? unselectedTextStyle,
Expand All @@ -249,6 +256,7 @@ class NavigationPaneThemeData with Diagnosticable {
properties
..add(DiagnosticsProperty('tileColor', tileColor))
..add(ColorProperty('backgroundColor', backgroundColor))
..add(ColorProperty('popupBackgroundColor', popupBackgroundColor))
..add(ColorProperty('highlightColor', highlightColor))
..add(
DiagnosticsProperty<EdgeInsetsGeometry>('labelPadding', labelPadding))
Expand Down
2 changes: 1 addition & 1 deletion lib/src/controls/navigation/navigation_view/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ class NavigationViewState extends State<NavigationView> {
height: MediaQuery.sizeOf(context).height,
child: PaneScrollConfiguration(
child: ColoredBox(
color: Colors.black,
color: theme.popupBackgroundColor ?? Colors.black,
child: Mica(
backgroundColor: overlayBackgroundColor(),
child: Container(
Expand Down

0 comments on commit 2410741

Please sign in to comment.