File tree Expand file tree Collapse file tree 2 files changed +30
-5
lines changed Expand file tree Collapse file tree 2 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -131,15 +131,14 @@ class CupertinoButton extends StatefulWidget {
131131
132132 /// Creates an iOS-style button with a filled background.
133133 ///
134- /// The background color is derived from the [CupertinoTheme] 's `primaryColor` .
135- ///
136- /// To specify a custom background color, use the [color] argument of the
137- /// default constructor.
134+ /// The background color is derived from the [color] argument.
135+ /// The foreground color is the [CupertinoTheme] 's `primaryContrastingColor` .
138136 const CupertinoButton .filled ({
139137 super .key,
140138 required this .child,
141139 this .sizeStyle = CupertinoButtonSize .large,
142140 this .padding,
141+ this .color,
143142 this .disabledColor = CupertinoColors .tertiarySystemFill,
144143 @Deprecated (
145144 'Use minimumSize instead. '
@@ -158,7 +157,6 @@ class CupertinoButton extends StatefulWidget {
158157 required this .onPressed,
159158 }) : assert (pressedOpacity == null || (pressedOpacity >= 0.0 && pressedOpacity <= 1.0 )),
160159 assert (minimumSize == null || minSize == null ),
161- color = null ,
162160 _style = _CupertinoButtonStyle .filled;
163161
164162 /// The widget below this widget in the tree.
Original file line number Diff line number Diff line change @@ -595,6 +595,33 @@ void main() {
595595 .decoration
596596 as BoxDecoration ;
597597 expect (decoration.color, isSameColorAs (CupertinoColors .systemBlue.darkColor));
598+
599+ await tester.pumpWidget (
600+ CupertinoApp (
601+ home: CupertinoButton .filled (
602+ color: CupertinoColors .systemRed,
603+ onPressed: () {},
604+ child: Builder (
605+ builder: (BuildContext context) {
606+ textStyle = DefaultTextStyle .of (context).style;
607+ return const Placeholder ();
608+ },
609+ ),
610+ ),
611+ ),
612+ );
613+
614+ decoration =
615+ tester
616+ .widget <DecoratedBox >(
617+ find.descendant (
618+ of: find.byType (CupertinoButton ),
619+ matching: find.byType (DecoratedBox ),
620+ ),
621+ )
622+ .decoration
623+ as BoxDecoration ;
624+ expect (decoration.color, isSameColorAs (CupertinoColors .systemRed));
598625 });
599626
600627 testWidgets ("All CupertinoButton const maps keys' match the available style sizes" , (
You can’t perform that action at this time.
0 commit comments