Unverified Commit 606abc91 authored by Masayuki Ono (mono)'s avatar Masayuki Ono (mono) Committed by GitHub

Fix title color of license detail page (#63249)

parent 430e3cf0
......@@ -917,7 +917,11 @@ class _PackageLicensePageState extends State<_PackageLicensePage> {
if (widget.scrollController == null) {
page = Scaffold(
appBar: AppBar(
title: _PackageLicensePageTitle(title, subtitle, theme.primaryTextTheme),
title: _PackageLicensePageTitle(
title,
subtitle,
theme.appBarTheme.textTheme ?? theme.primaryTextTheme,
),
),
body: Center(
child: Material(
......
......@@ -234,6 +234,115 @@ void main() {
expect(find.text('Another license'), findsOneWidget);
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/54385
testWidgets('_PackageLicensePage title style without AppBarTheme', (
WidgetTester tester,
) async {
LicenseRegistry.addLicense(() {
return Stream<LicenseEntry>.fromIterable(<LicenseEntry>[
const LicenseEntryWithLineBreaks(<String>['AAA'], 'BBB'),
]);
});
const TextStyle titleTextStyle = TextStyle(
fontSize: 20,
color: Colors.black,
inherit: false,
);
const TextStyle subtitleTextStyle = TextStyle(
fontSize: 15,
color: Colors.red,
inherit: false,
);
await tester.pumpWidget(
MaterialApp(
theme: ThemeData(
primaryTextTheme: const TextTheme(
headline6: titleTextStyle,
subtitle2: subtitleTextStyle,
),
),
home: const Center(
child: LicensePage(),
),
),
);
await tester.pumpAndSettle();
// Check for packages.
expect(find.text('AAA'), findsOneWidget);
// Check license is displayed after entering into license page for 'AAA'.
await tester.tap(find.text('AAA'));
await tester.pumpAndSettle(const Duration(milliseconds: 100));
// Check for titles style.
final Text title = tester.widget(find.text('AAA'));
expect(title.style, titleTextStyle);
final Text subtitle = tester.widget(find.text('1 license.'));
expect(subtitle.style, subtitleTextStyle);
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/54385
testWidgets('_PackageLicensePage title style with AppBarTheme', (
WidgetTester tester,
) async {
LicenseRegistry.addLicense(() {
return Stream<LicenseEntry>.fromIterable(<LicenseEntry>[
const LicenseEntryWithLineBreaks(<String>['AAA'], 'BBB'),
]);
});
const TextStyle titleTextStyle = TextStyle(
fontSize: 20,
color: Colors.black,
);
const TextStyle subtitleTextStyle = TextStyle(
fontSize: 15,
color: Colors.red,
);
await tester.pumpWidget(
MaterialApp(
theme: ThemeData(
// Not used because appBarTheme is prioritized.
primaryTextTheme: const TextTheme(
headline6: TextStyle(
fontSize: 12,
color: Colors.grey,
),
subtitle2: TextStyle(
fontSize: 10,
color: Colors.grey,
),
),
appBarTheme: const AppBarTheme(
textTheme: TextTheme(
headline6: titleTextStyle,
subtitle2: subtitleTextStyle,
),
),
),
home: const Center(
child: LicensePage(),
),
),
);
await tester.pumpAndSettle();
// Check for packages.
expect(find.text('AAA'), findsOneWidget);
// Check license is displayed after entering into license page for 'AAA'.
await tester.tap(find.text('AAA'));
await tester.pumpAndSettle(const Duration(milliseconds: 100));
// Check for titles style.
final Text title = tester.widget(find.text('AAA'));
expect(title.style, titleTextStyle);
final Text subtitle = tester.widget(find.text('1 license.'));
expect(subtitle.style, subtitleTextStyle);
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/54385
testWidgets('LicensePage respects the notch', (WidgetTester tester) async {
const double safeareaPadding = 27.0;
......
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