Unverified Commit 9240c9a0 authored by Kate Lovett's avatar Kate Lovett Committed by GitHub

Remove deprecated OutlineButton (#98546)

parent cd9e30bb
...@@ -104,7 +104,6 @@ export 'src/material/navigation_bar_theme.dart'; ...@@ -104,7 +104,6 @@ export 'src/material/navigation_bar_theme.dart';
export 'src/material/navigation_rail.dart'; export 'src/material/navigation_rail.dart';
export 'src/material/navigation_rail_theme.dart'; export 'src/material/navigation_rail_theme.dart';
export 'src/material/no_splash.dart'; export 'src/material/no_splash.dart';
export 'src/material/outline_button.dart';
export 'src/material/outlined_button.dart'; export 'src/material/outlined_button.dart';
export 'src/material/outlined_button_theme.dart'; export 'src/material/outlined_button_theme.dart';
export 'src/material/page.dart'; export 'src/material/page.dart';
......
...@@ -26,10 +26,10 @@ import 'theme_data.dart'; ...@@ -26,10 +26,10 @@ import 'theme_data.dart';
/// [ButtonStyle] of a [TextButton], [ElevatedButton] or an /// [ButtonStyle] of a [TextButton], [ElevatedButton] or an
/// [OutlinedButton]. /// [OutlinedButton].
/// ///
/// FlatButton, RaisedButton, and OutlineButton have been replaced by /// FlatButton and RaisedButton have been replaced by
/// TextButton, ElevatedButton, and OutlinedButton respectively. /// TextButton and ElevatedButton respectively.
/// ButtonTheme has been replaced by TextButtonTheme, /// ButtonTheme has been replaced by TextButtonTheme and
/// ElevatedButtonTheme, and OutlinedButtonTheme. The original classes /// ElevatedButtonTheme. The original classes
/// have been deprecated, please migrate code that uses them. /// have been deprecated, please migrate code that uses them.
/// There's a detailed migration guide for the new button and button /// There's a detailed migration guide for the new button and button
/// theme classes in /// theme classes in
......
...@@ -11,7 +11,6 @@ import 'constants.dart'; ...@@ -11,7 +11,6 @@ import 'constants.dart';
import 'flat_button.dart'; import 'flat_button.dart';
import 'material_button.dart'; import 'material_button.dart';
import 'material_state.dart'; import 'material_state.dart';
import 'outline_button.dart';
import 'raised_button.dart'; import 'raised_button.dart';
import 'theme.dart'; import 'theme.dart';
import 'theme_data.dart' show MaterialTapTargetSize; import 'theme_data.dart' show MaterialTapTargetSize;
...@@ -22,7 +21,7 @@ import 'theme_data.dart' show MaterialTapTargetSize; ...@@ -22,7 +21,7 @@ import 'theme_data.dart' show MaterialTapTargetSize;
/// ///
/// See also: /// See also:
/// ///
/// * [RaisedButton], [FlatButton], [OutlineButton], which are configured /// * [RaisedButton] and [FlatButton] which are configured
/// based on the ambient [ButtonTheme]. /// based on the ambient [ButtonTheme].
enum ButtonTextTheme { enum ButtonTextTheme {
/// Button text is black or white depending on [ThemeData.brightness]. /// Button text is black or white depending on [ThemeData.brightness].
...@@ -69,7 +68,7 @@ enum ButtonBarLayoutBehavior { ...@@ -69,7 +68,7 @@ enum ButtonBarLayoutBehavior {
/// ///
/// See also: /// See also:
/// ///
/// * [FlatButton] [RaisedButton], and [OutlineButton], which are styled /// * [FlatButton] and [RaisedButton] which are styled
/// based on the ambient button theme. /// based on the ambient button theme.
/// * [RawMaterialButton], which can be used to configure a button that doesn't /// * [RawMaterialButton], which can be used to configure a button that doesn't
/// depend on any inherited themes. /// depend on any inherited themes.
...@@ -175,10 +174,10 @@ class ButtonTheme extends InheritedTheme { ...@@ -175,10 +174,10 @@ class ButtonTheme extends InheritedTheme {
/// * [ElevatedButton], [ElevatedButtonTheme], [ElevatedButtonThemeData], /// * [ElevatedButton], [ElevatedButtonTheme], [ElevatedButtonThemeData],
/// * [OutlinedButton], [OutlinedButtonTheme], [OutlinedButtonThemeData] /// * [OutlinedButton], [OutlinedButtonTheme], [OutlinedButtonThemeData]
/// ///
/// FlatButton, RaisedButton, and OutlineButton have been replaced by /// FlatButton and RaisedButton have been replaced by
/// TextButton, ElevatedButton, and OutlinedButton respectively. /// TextButton and ElevatedButton respectively.
/// ButtonTheme has been replaced by TextButtonTheme, /// ButtonTheme has been replaced by TextButtonTheme and
/// ElevatedButtonTheme, and OutlinedButtonTheme. The original classes /// ElevatedButtonTheme. The original classes
/// have been deprecated, please migrate code that uses them. /// have been deprecated, please migrate code that uses them.
/// There's a detailed migration guide for the new button and button /// There's a detailed migration guide for the new button and button
/// theme classes in /// theme classes in
...@@ -197,8 +196,8 @@ class ButtonThemeData with Diagnosticable { ...@@ -197,8 +196,8 @@ class ButtonThemeData with Diagnosticable {
/// [height] parameters must greater than or equal to zero. /// [height] parameters must greater than or equal to zero.
/// ///
/// The ButtonTheme's methods that have a [MaterialButton] parameter and /// The ButtonTheme's methods that have a [MaterialButton] parameter and
/// have a name with a `get` prefix are used by [RaisedButton], /// have a name with a `get` prefix are used by [RaisedButton]
/// [OutlineButton], and [FlatButton] to configure a [RawMaterialButton]. /// and [FlatButton] to configure a [RawMaterialButton].
const ButtonThemeData({ const ButtonThemeData({
this.textTheme = ButtonTextTheme.normal, this.textTheme = ButtonTextTheme.normal,
this.minWidth = 88.0, this.minWidth = 88.0,
...@@ -279,8 +278,7 @@ class ButtonThemeData with Diagnosticable { ...@@ -279,8 +278,7 @@ class ButtonThemeData with Diagnosticable {
/// ///
/// See also: /// See also:
/// ///
/// * [getPadding], which is used by [RaisedButton], [OutlineButton] /// * [getPadding], which is used by [RaisedButton] and [FlatButton].
/// and [FlatButton].
EdgeInsetsGeometry get padding { EdgeInsetsGeometry get padding {
if (_padding != null) if (_padding != null)
return _padding!; return _padding!;
...@@ -306,8 +304,7 @@ class ButtonThemeData with Diagnosticable { ...@@ -306,8 +304,7 @@ class ButtonThemeData with Diagnosticable {
/// ///
/// See also: /// See also:
/// ///
/// * [getShape], which is used by [RaisedButton], [OutlineButton] /// * [getShape], which is used by [RaisedButton] and [FlatButton].
/// and [FlatButton].
ShapeBorder get shape { ShapeBorder get shape {
if (_shape != null) if (_shape != null)
return _shape!; return _shape!;
...@@ -369,8 +366,7 @@ class ButtonThemeData with Diagnosticable { ...@@ -369,8 +366,7 @@ class ButtonThemeData with Diagnosticable {
/// ///
/// See also: /// See also:
/// ///
/// * [getFocusColor], which is used by [RaisedButton], [OutlineButton] /// * [getFocusColor], which is used by [RaisedButton] and [FlatButton].
/// and [FlatButton].
final Color? _focusColor; final Color? _focusColor;
/// The fill color of the button when a pointer is hovering over it. /// The fill color of the button when a pointer is hovering over it.
...@@ -382,8 +378,7 @@ class ButtonThemeData with Diagnosticable { ...@@ -382,8 +378,7 @@ class ButtonThemeData with Diagnosticable {
/// ///
/// See also: /// See also:
/// ///
/// * [getHoverColor], which is used by [RaisedButton], [OutlineButton] /// * [getHoverColor], which is used by [RaisedButton] and [FlatButton].
/// and [FlatButton].
final Color? _hoverColor; final Color? _hoverColor;
/// The color of the overlay that appears when a button is pressed. /// The color of the overlay that appears when a button is pressed.
...@@ -392,8 +387,7 @@ class ButtonThemeData with Diagnosticable { ...@@ -392,8 +387,7 @@ class ButtonThemeData with Diagnosticable {
/// ///
/// See also: /// See also:
/// ///
/// * [getHighlightColor], which is used by [RaisedButton], [OutlineButton] /// * [getHighlightColor], which is used by [RaisedButton] and [FlatButton].
/// and [FlatButton].
final Color? _highlightColor; final Color? _highlightColor;
/// The color of the ink "splash" overlay that appears when a button is tapped. /// The color of the ink "splash" overlay that appears when a button is tapped.
...@@ -402,8 +396,7 @@ class ButtonThemeData with Diagnosticable { ...@@ -402,8 +396,7 @@ class ButtonThemeData with Diagnosticable {
/// ///
/// See also: /// See also:
/// ///
/// * [getSplashColor], which is used by [RaisedButton], [OutlineButton] /// * [getSplashColor], which is used by [RaisedButton] and [FlatButton].
/// and [FlatButton].
final Color? _splashColor; final Color? _splashColor;
/// A set of thirteen colors that can be used to derive the button theme's /// A set of thirteen colors that can be used to derive the button theme's
...@@ -424,8 +417,7 @@ class ButtonThemeData with Diagnosticable { ...@@ -424,8 +417,7 @@ class ButtonThemeData with Diagnosticable {
// //
// See also: // See also:
// //
// * [getMaterialTargetTapSize], which is used by [RaisedButton], // * [getMaterialTargetTapSize], which is used by [RaisedButton] and [FlatButton].
// [OutlineButton] and [FlatButton].
final MaterialTapTargetSize? _materialTapTargetSize; final MaterialTapTargetSize? _materialTapTargetSize;
/// The [button]'s overall brightness. /// The [button]'s overall brightness.
...@@ -489,7 +481,7 @@ class ButtonThemeData with Diagnosticable { ...@@ -489,7 +481,7 @@ class ButtonThemeData with Diagnosticable {
/// Otherwise, returns [MaterialButton.disabledColor] if it is non-null and /// Otherwise, returns [MaterialButton.disabledColor] if it is non-null and
/// the button is disabled. /// the button is disabled.
/// ///
/// Otherwise, if button is a [FlatButton] or an [OutlineButton] then null is /// Otherwise, if button is a [FlatButton] then null is
/// returned. /// returned.
/// ///
/// Otherwise, if button is a [RaisedButton], returns the `buttonColor` /// Otherwise, if button is a [RaisedButton], returns the `buttonColor`
...@@ -510,7 +502,7 @@ class ButtonThemeData with Diagnosticable { ...@@ -510,7 +502,7 @@ class ButtonThemeData with Diagnosticable {
if (fillColor != null) if (fillColor != null)
return fillColor; return fillColor;
if (button is FlatButton || button is OutlineButton || button.runtimeType == MaterialButton) if (button is FlatButton || button.runtimeType == MaterialButton)
return null; return null;
if (button.enabled && button is RaisedButton && _buttonColor != null) if (button.enabled && button is RaisedButton && _buttonColor != null)
...@@ -542,7 +534,7 @@ class ButtonThemeData with Diagnosticable { ...@@ -542,7 +534,7 @@ class ButtonThemeData with Diagnosticable {
/// [getBrightness] resolves to [Brightness.light]. /// [getBrightness] resolves to [Brightness.light].
/// * [ButtonTextTheme.accent]: [ColorScheme.secondary] of [colorScheme]. /// * [ButtonTextTheme.accent]: [ColorScheme.secondary] of [colorScheme].
/// * [ButtonTextTheme.primary]: If [getFillColor] is dark then [Colors.white], /// * [ButtonTextTheme.primary]: If [getFillColor] is dark then [Colors.white],
/// otherwise if [button] is a [FlatButton] or an [OutlineButton] then /// otherwise if [button] is a [FlatButton] then
/// [ColorScheme.primary] of [colorScheme], otherwise [Colors.black]. /// [ColorScheme.primary] of [colorScheme], otherwise [Colors.black].
Color getTextColor(MaterialButton button) { Color getTextColor(MaterialButton button) {
if (!button.enabled) if (!button.enabled)
...@@ -565,7 +557,7 @@ class ButtonThemeData with Diagnosticable { ...@@ -565,7 +557,7 @@ class ButtonThemeData with Diagnosticable {
: getBrightness(button) == Brightness.dark; : getBrightness(button) == Brightness.dark;
if (fillIsDark) if (fillIsDark)
return Colors.white; return Colors.white;
if (button is FlatButton || button is OutlineButton) if (button is FlatButton)
return colorScheme!.primary; return colorScheme!.primary;
return Colors.black; return Colors.black;
} }
...@@ -577,7 +569,7 @@ class ButtonThemeData with Diagnosticable { ...@@ -577,7 +569,7 @@ class ButtonThemeData with Diagnosticable {
/// Returns the button's [MaterialButton.splashColor] if it is non-null. /// Returns the button's [MaterialButton.splashColor] if it is non-null.
/// ///
/// Otherwise, returns the value of the `splashColor` constructor parameter /// Otherwise, returns the value of the `splashColor` constructor parameter
/// it is non-null and [button] is a [RaisedButton] or an [OutlineButton]. /// it is non-null and [button] is a [RaisedButton].
/// ///
/// Otherwise, returns the value of the `splashColor` constructor parameter /// Otherwise, returns the value of the `splashColor` constructor parameter
/// if it is non-null and [button] is a [FlatButton] and /// if it is non-null and [button] is a [FlatButton] and
...@@ -588,7 +580,7 @@ class ButtonThemeData with Diagnosticable { ...@@ -588,7 +580,7 @@ class ButtonThemeData with Diagnosticable {
if (button.splashColor != null) if (button.splashColor != null)
return button.splashColor!; return button.splashColor!;
if (_splashColor != null && (button is RaisedButton || button is OutlineButton)) if (_splashColor != null && button is RaisedButton)
return _splashColor!; return _splashColor!;
if (_splashColor != null && button is FlatButton) { if (_splashColor != null && button is FlatButton) {
...@@ -669,15 +661,13 @@ class ButtonThemeData with Diagnosticable { ...@@ -669,15 +661,13 @@ class ButtonThemeData with Diagnosticable {
/// ///
/// Returns the button's [MaterialButton.focusElevation] if it is non-null. /// Returns the button's [MaterialButton.focusElevation] if it is non-null.
/// ///
/// If button is a [FlatButton] or an [OutlineButton] then the focus /// If button is a [FlatButton] then the focus
/// elevation is 0.0, otherwise the highlight elevation is 4.0. /// elevation is 0.0, otherwise the highlight elevation is 4.0.
double getFocusElevation(MaterialButton button) { double getFocusElevation(MaterialButton button) {
if (button.focusElevation != null) if (button.focusElevation != null)
return button.focusElevation!; return button.focusElevation!;
if (button is FlatButton) if (button is FlatButton)
return 0.0; return 0.0;
if (button is OutlineButton)
return 0.0;
return 4.0; return 4.0;
} }
...@@ -685,15 +675,13 @@ class ButtonThemeData with Diagnosticable { ...@@ -685,15 +675,13 @@ class ButtonThemeData with Diagnosticable {
/// ///
/// Returns the button's [MaterialButton.hoverElevation] if it is non-null. /// Returns the button's [MaterialButton.hoverElevation] if it is non-null.
/// ///
/// If button is a [FlatButton] or an [OutlineButton] then the hover /// If button is a [FlatButton] then the hover
/// elevation is 0.0, otherwise the highlight elevation is 4.0. /// elevation is 0.0, otherwise the highlight elevation is 4.0.
double getHoverElevation(MaterialButton button) { double getHoverElevation(MaterialButton button) {
if (button.hoverElevation != null) if (button.hoverElevation != null)
return button.hoverElevation!; return button.hoverElevation!;
if (button is FlatButton) if (button is FlatButton)
return 0.0; return 0.0;
if (button is OutlineButton)
return 0.0;
return 4.0; return 4.0;
} }
...@@ -701,15 +689,13 @@ class ButtonThemeData with Diagnosticable { ...@@ -701,15 +689,13 @@ class ButtonThemeData with Diagnosticable {
/// ///
/// Returns the button's [MaterialButton.highlightElevation] if it is non-null. /// Returns the button's [MaterialButton.highlightElevation] if it is non-null.
/// ///
/// If button is a [FlatButton] or an [OutlineButton] then the highlight /// If button is a [FlatButton] then the highlight
/// elevation is 0.0, otherwise the highlight elevation is 8.0. /// elevation is 0.0, otherwise the highlight elevation is 8.0.
double getHighlightElevation(MaterialButton button) { double getHighlightElevation(MaterialButton button) {
if (button.highlightElevation != null) if (button.highlightElevation != null)
return button.highlightElevation!; return button.highlightElevation!;
if (button is FlatButton) if (button is FlatButton)
return 0.0; return 0.0;
if (button is OutlineButton)
return 0.0;
return 8.0; return 8.0;
} }
...@@ -730,7 +716,7 @@ class ButtonThemeData with Diagnosticable { ...@@ -730,7 +716,7 @@ class ButtonThemeData with Diagnosticable {
/// Returns the button's [MaterialButton.padding] if it is non-null. /// Returns the button's [MaterialButton.padding] if it is non-null.
/// ///
/// If this is a button constructed with [RaisedButton.icon] or /// If this is a button constructed with [RaisedButton.icon] or
/// [FlatButton.icon] or [OutlineButton.icon] then the padding is: /// [FlatButton.icon] then the padding is:
/// `EdgeInsetsDirectional.only(start: 12.0, end: 16.0)`. /// `EdgeInsetsDirectional.only(start: 12.0, end: 16.0)`.
/// ///
/// Otherwise, returns [padding] if it is non-null. /// Otherwise, returns [padding] if it is non-null.
......
...@@ -14,10 +14,10 @@ import 'theme_data.dart'; ...@@ -14,10 +14,10 @@ import 'theme_data.dart';
/// ///
/// ### This class is deprecated, please use [TextButton] instead. /// ### This class is deprecated, please use [TextButton] instead.
/// ///
/// FlatButton, RaisedButton, and OutlineButton have been replaced by /// FlatButton and RaisedButton have been replaced by
/// [TextButton], [ElevatedButton], and [OutlinedButton] respectively. /// [TextButton] and [ElevatedButton] respectively.
/// ButtonTheme has been replaced by [TextButtonTheme], /// ButtonTheme has been replaced by [TextButtonTheme] and
/// [ElevatedButtonTheme], and [OutlinedButtonTheme]. The original classes /// [ElevatedButtonTheme]. The original classes
/// will eventually be removed, please migrate code that uses them. /// will eventually be removed, please migrate code that uses them.
/// There's a detailed migration guide for the new button and button /// There's a detailed migration guide for the new button and button
/// theme classes in /// theme classes in
......
...@@ -21,10 +21,10 @@ import 'theme_data.dart'; ...@@ -21,10 +21,10 @@ import 'theme_data.dart';
/// ///
/// ### This class is obsolete. /// ### This class is obsolete.
/// ///
/// FlatButton, RaisedButton, and OutlineButton have been replaced by /// FlatButton and RaisedButton have been replaced by
/// TextButton, ElevatedButton, and OutlinedButton respectively. /// TextButton and ElevatedButton respectively.
/// ButtonTheme has been replaced by TextButtonTheme, /// ButtonTheme has been replaced by TextButtonTheme and
/// ElevatedButtonTheme, and OutlinedButtonTheme. The appearance of the /// ElevatedButtonTheme. The appearance of the
/// new widgets can be customized by specifying a [ButtonStyle] /// new widgets can be customized by specifying a [ButtonStyle]
/// or by creating a one-off style using a `styleFrom` method like /// or by creating a one-off style using a `styleFrom` method like
/// [TextButton.styleFrom]. The original button classes /// [TextButton.styleFrom]. The original button classes
...@@ -38,8 +38,8 @@ import 'theme_data.dart'; ...@@ -38,8 +38,8 @@ import 'theme_data.dart';
/// MaterialButtons whose [onPressed] and [onLongPress] callbacks are null will be disabled. To have /// MaterialButtons whose [onPressed] and [onLongPress] callbacks are null will be disabled. To have
/// an enabled button, make sure to pass a non-null value for [onPressed] or [onLongPress]. /// an enabled button, make sure to pass a non-null value for [onPressed] or [onLongPress].
/// ///
/// Rather than using this class directly, consider using [FlatButton], /// Rather than using this class directly, consider using [FlatButton]
/// [OutlineButton], or [RaisedButton], which configure this class with /// or [RaisedButton], which configure this class with
/// appropriate defaults that match the material design specification. /// appropriate defaults that match the material design specification.
/// ///
/// To create a button directly, without inheriting theme defaults, use /// To create a button directly, without inheriting theme defaults, use
...@@ -457,8 +457,8 @@ class MaterialButton extends StatelessWidget { ...@@ -457,8 +457,8 @@ class MaterialButton extends StatelessWidget {
} }
} }
/// The type of [MaterialButton]s created with RaisedButton.icon, FlatButton.icon, /// The type of [MaterialButton]s created with RaisedButton.icon] and
/// and OutlineButton.icon. /// FlatButton.icon.
/// ///
/// This mixin only exists to give the "label and icon" button widgets a distinct /// This mixin only exists to give the "label and icon" button widgets a distinct
/// type for the sake of [ButtonTheme]. /// type for the sake of [ButtonTheme].
......
This diff is collapsed.
...@@ -16,10 +16,10 @@ import 'theme_data.dart'; ...@@ -16,10 +16,10 @@ import 'theme_data.dart';
/// ///
/// ### This class is deprecated, please use [ElevatedButton] instead. /// ### This class is deprecated, please use [ElevatedButton] instead.
/// ///
/// FlatButton, RaisedButton, and OutlineButton have been replaced by /// FlatButton and RaisedButton have been replaced by
/// [TextButton], [ElevatedButton], and [OutlinedButton] respectively. /// [TextButton] and [ElevatedButton] respectively.
/// ButtonTheme has been replaced by [TextButtonTheme], /// ButtonTheme has been replaced by [TextButtonTheme] and
/// [ElevatedButtonTheme], and [OutlinedButtonTheme]. The original classes /// [ElevatedButtonTheme]. The original classes
/// will eventually be removed, please migrate code that uses them. /// will eventually be removed, please migrate code that uses them.
/// There's a detailed migration guide for the new button and button /// There's a detailed migration guide for the new button and button
/// theme classes in /// theme classes in
......
...@@ -81,7 +81,6 @@ const Color _kDarkThemeSplashColor = Color(0x40CCCCCC); ...@@ -81,7 +81,6 @@ const Color _kDarkThemeSplashColor = Color(0x40CCCCCC);
/// * [OutlinedButton] /// * [OutlinedButton]
/// * [TextButton] /// * [TextButton]
/// * [ElevatedButton] /// * [ElevatedButton]
/// * [OutlineButton]
/// * [FlatButton] /// * [FlatButton]
/// * [RaisedButton] /// * [RaisedButton]
/// * The time picker widget ([showTimePicker]) /// * The time picker widget ([showTimePicker])
...@@ -2469,7 +2468,6 @@ class _FifoCache<K, V> { ...@@ -2469,7 +2468,6 @@ class _FifoCache<K, V> {
/// * [InputDecorator] (which gives density support to [TextField], etc.) /// * [InputDecorator] (which gives density support to [TextField], etc.)
/// * [ListTile] /// * [ListTile]
/// * [MaterialButton] /// * [MaterialButton]
/// * [OutlineButton]
/// * [OutlinedButton] /// * [OutlinedButton]
/// * [Radio] /// * [Radio]
/// * [RawMaterialButton] /// * [RawMaterialButton]
......
...@@ -127,93 +127,6 @@ void main() { ...@@ -127,93 +127,6 @@ void main() {
}); });
}); });
group('OutlineButton', () {
testWidgets('theme: ThemeData.light(), enabled: true, highlightElevation: 2.0', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
theme: ThemeData.light(),
home: Center(
child: OutlineButton(
onPressed: () { }, // button.enabled == true
// Causes the button to be filled with the theme's canvasColor
// instead of Colors.transparent before the button material's
// elevation is animated to 2.0.
highlightElevation: 2.0,
child: const Text('button'),
),
),
),
);
final RawMaterialButton raw = tester.widget<RawMaterialButton>(find.byType(RawMaterialButton));
expect(raw.textStyle!.color, const Color(0xdd000000));
expect(raw.fillColor, const Color(0x00fafafa));
expect(raw.highlightColor, const Color(0x29000000)); // Was Color(0x66bcbcbc)
expect(raw.splashColor, const Color(0x1f000000)); // Was Color(0x66c8c8c8)
expect(raw.elevation, 0.0);
expect(raw.highlightElevation, 0.0);
expect(raw.disabledElevation, 0.0);
expect(raw.constraints, defaultButtonConstraints);
expect(raw.padding, defaultButtonPadding);
// animationDuration can't be configured by the theme/constructor
expect(raw.materialTapTargetSize, MaterialTapTargetSize.padded);
});
testWidgets('theme: ThemeData.light(), enabled: true', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
theme: ThemeData.light(),
home: Center(
child: OutlineButton(
onPressed: () { }, // button.enabled == true
child: const Text('button'),
),
),
),
);
final RawMaterialButton raw = tester.widget<RawMaterialButton>(find.byType(RawMaterialButton));
expect(raw.textStyle!.color, const Color(0xdd000000));
expect(raw.fillColor, Colors.transparent);
expect(raw.highlightColor, const Color(0x29000000)); // Was Color(0x66bcbcbc)
expect(raw.splashColor, const Color(0x1f000000)); // Was Color(0x66c8c8c8)
expect(raw.elevation, 0.0);
expect(raw.highlightElevation, 0.0);
expect(raw.disabledElevation, 0.0);
expect(raw.constraints, defaultButtonConstraints);
expect(raw.padding, defaultButtonPadding);
// animationDuration can't be configured by the theme/constructor
expect(raw.materialTapTargetSize, MaterialTapTargetSize.padded);
});
testWidgets('theme: ThemeData.light(), enabled: false', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
theme: ThemeData.light(),
home: const Center(
child: OutlineButton(
onPressed: null, // button.enabled == false
child: Text('button'),
),
),
),
);
final RawMaterialButton raw = tester.widget<RawMaterialButton>(find.byType(RawMaterialButton));
expect(raw.textStyle!.color, const Color(0x61000000));
expect(raw.fillColor, const Color(0x00000000));
// highlightColor, disabled button can't be pressed
// splashColor, disabled button doesn't splash
expect(raw.elevation, 0.0);
expect(raw.highlightElevation, 0.0);
expect(raw.disabledElevation, 0.0);
expect(raw.constraints, defaultButtonConstraints);
expect(raw.padding, defaultButtonPadding);
// animationDuration can't be configured by the theme/constructor
expect(raw.materialTapTargetSize, MaterialTapTargetSize.padded);
});
});
group('FloatingActionButton', () { group('FloatingActionButton', () {
const BoxConstraints defaultFABConstraints = BoxConstraints.tightFor(width: 56.0, height: 56.0); const BoxConstraints defaultFABConstraints = BoxConstraints.tightFor(width: 56.0, height: 56.0);
const ShapeBorder defaultFABShape = CircleBorder(); const ShapeBorder defaultFABShape = CircleBorder();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment