Skip to content

Commit

Permalink
fix AppBar docs for backgroundColor & foregroundColor (#142430)
Browse files Browse the repository at this point in the history
Before the M3 migration, the doc made sense. but after, it needed to specify which material version does this issue occur in.
The _AppBarDefaultsM3 don't take the brightness in consideration anymore:

<img width="517" alt="image" src="https://github.com/flutter/flutter/assets/124896814/d4dbe278-5b50-42d7-9143-c54d343efddf">
  • Loading branch information
BiskupMaik authored Feb 5, 2024
1 parent f8a7722 commit 0b5cd50
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions packages/flutter/lib/src/material/app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -489,9 +489,13 @@ class AppBar extends StatefulWidget implements PreferredSizeWidget {
/// The fill color to use for an app bar's [Material].
///
/// If null, then the [AppBarTheme.backgroundColor] is used. If that value is also
/// null, then [AppBar] uses the overall theme's [ColorScheme.primary] if the
/// null:
/// In Material v2 (i.e., when [ThemeData.useMaterial3] is false),
/// then [AppBar] uses the overall theme's [ColorScheme.primary] if the
/// overall theme's brightness is [Brightness.light], and [ColorScheme.surface]
/// if the overall theme's brightness is [Brightness.dark].
/// In Material v3 (i.e., when [ThemeData.useMaterial3] is true),
/// then [AppBar] uses the overall theme's [ColorScheme.surface]
///
/// If this color is a [MaterialStateColor] it will be resolved against
/// [MaterialState.scrolledUnder] when the content of the app's
Expand All @@ -514,10 +518,13 @@ class AppBar extends StatefulWidget implements PreferredSizeWidget {
/// The default color for [Text] and [Icon]s within the app bar.
///
/// If null, then [AppBarTheme.foregroundColor] is used. If that
/// value is also null, then [AppBar] uses the overall theme's
/// [ColorScheme.onPrimary] if the overall theme's brightness is
/// [Brightness.light], and [ColorScheme.onSurface] if the overall
/// theme's brightness is [Brightness.dark].
/// value is also null:
/// In Material v2 (i.e., when [ThemeData.useMaterial3] is false),
/// then [AppBar] uses the overall theme's [ColorScheme.onPrimary] if the
/// overall theme's brightness is [Brightness.light], and [ColorScheme.onSurface]
/// if the overall theme's brightness is [Brightness.dark].
/// In Material v3 (i.e., when [ThemeData.useMaterial3] is true),
/// then [AppBar] uses the overall theme's [ColorScheme.onSurface].
///
/// This color is used to configure [DefaultTextStyle] that contains
/// the toolbar's children, and the default [IconTheme] widgets that
Expand Down

0 comments on commit 0b5cd50

Please sign in to comment.