From 598ecb324dddee99cab083d6735790750996ae5d Mon Sep 17 00:00:00 2001 From: Shi-Hao Hong Date: Wed, 17 Jul 2019 10:08:51 -0700 Subject: [PATCH] Add clarifying docs on MaterialButton.colorBrightness (#36202) * Add clarifying docs on MaterialButton.colorBrightness --- packages/flutter/lib/src/material/button_theme.dart | 9 +++++---- packages/flutter/lib/src/material/material_button.dart | 8 +++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/flutter/lib/src/material/button_theme.dart b/packages/flutter/lib/src/material/button_theme.dart index 0102034a1c4..2bd426f4a63 100644 --- a/packages/flutter/lib/src/material/button_theme.dart +++ b/packages/flutter/lib/src/material/button_theme.dart @@ -562,10 +562,11 @@ class ButtonThemeData extends Diagnosticable { /// Otherwise the text color depends on the value of [getTextTheme] /// and [getBrightness]. /// - /// * [ButtonTextTheme.normal], [Colors.white] if [getBrightness] is dark, - /// otherwise [Colors.black87]. - /// * ButtonTextTheme.accent], [colorScheme.secondary]. - /// * [ButtonTextTheme.primary], if [getFillColor] is dark then [Colors.white], + /// * [ButtonTextTheme.normal]: [Colors.white] is used if [getBrightness] + /// resolves to [Brightness.dark]. [Colors.black87] is used if + /// [getBrightness] resolves to [Brightness.light]. + /// * [ButtonTextTheme.accent]: [colorScheme.secondary]. + /// * [ButtonTextTheme.primary]: If [getFillColor] is dark then [Colors.white], /// otherwise if [button] is a [FlatButton] or an [OutlineButton] then /// [colorScheme.primary], otherwise [Colors.black]. Color getTextColor(MaterialButton button) { diff --git a/packages/flutter/lib/src/material/material_button.dart b/packages/flutter/lib/src/material/material_button.dart index d17e9ddc5fe..f5151c42402 100644 --- a/packages/flutter/lib/src/material/material_button.dart +++ b/packages/flutter/lib/src/material/material_button.dart @@ -257,7 +257,13 @@ class MaterialButton extends StatelessWidget { /// The theme brightness to use for this button. /// - /// Defaults to the theme's brightness, [ThemeData.brightness]. + /// Defaults to the theme's brightness in [ThemeData.brightness]. Setting + /// this value determines the button text's colors based on + /// [ButtonThemeData.getTextColor]. + /// + /// See also: + /// + /// * [ButtonTextTheme], uses [Brightness] to determine text color. final Brightness colorBrightness; /// The button's label.