Forward fix CupertinoDynamicColor by adding toARGB32(). (#158145)
Unblocks landing https://github.com/flutter/engine/pull/56329. @jtmcdole monorepo can't come soon enough...
This commit is contained in:
@@ -1149,6 +1149,11 @@ class CupertinoDynamicColor with Diagnosticable implements Color {
|
||||
@override
|
||||
int get value => _effectiveColor.value;
|
||||
|
||||
@override
|
||||
// TODO(matanl): Remove once https://github.com/flutter/engine/pull/56329 lands in the framework.
|
||||
// ignore: override_on_non_overriding_member, public_member_api_docs
|
||||
int toARGB32() => value;
|
||||
|
||||
@override
|
||||
int get alpha => _effectiveColor.alpha;
|
||||
|
||||
|
||||
@@ -413,6 +413,26 @@ void main() {
|
||||
expect(find.byType(DependentWidget), paints..rect(color: color7));
|
||||
});
|
||||
|
||||
testWidgets('CupertinoDynamicColor toARGB32() is the same as value', (WidgetTester tester) async {
|
||||
late CupertinoDynamicColor color;
|
||||
await tester.pumpWidget(
|
||||
CupertinoApp(
|
||||
theme: const CupertinoThemeData(
|
||||
brightness: Brightness.dark,
|
||||
primaryColor: dynamicColor,
|
||||
),
|
||||
home: Builder(
|
||||
builder: (BuildContext context) {
|
||||
color = CupertinoTheme.of(context).primaryColor as CupertinoDynamicColor;
|
||||
return const Placeholder();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(color.value, color.toARGB32());
|
||||
});
|
||||
|
||||
testWidgets('CupertinoDynamicColor used in a CupertinoTheme', (WidgetTester tester) async {
|
||||
late CupertinoDynamicColor color;
|
||||
await tester.pumpWidget(
|
||||
|
||||
Reference in New Issue
Block a user