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:
Matan Lurey
2024-11-05 16:07:08 -08:00
committed by GitHub
parent c6dea5e4b4
commit 7a6c81a294
2 changed files with 25 additions and 0 deletions

View File

@@ -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;

View File

@@ -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(