@@ -574,6 +574,78 @@ void main() {
574
574
expect (navToolbar.middleSpacing, 40 );
575
575
});
576
576
577
+ testWidgets ("SliverAppBar.medium's title uses AppBarTheme.foregroundColor" , (WidgetTester tester) async {
578
+ const Color foregroundColor = Color (0xff00ff00 );
579
+ await tester.pumpWidget (MaterialApp (
580
+ theme: ThemeData (appBarTheme: const AppBarTheme (foregroundColor: foregroundColor)),
581
+ home: CustomScrollView (
582
+ slivers: < Widget > [
583
+ SliverAppBar .medium (
584
+ title: const Text ('Medium Title' ),
585
+ ),
586
+ ],
587
+ ),
588
+ ));
589
+
590
+ final RichText text = tester.firstWidget (find.byType (RichText ));
591
+ expect (text.text.style! .color, foregroundColor);
592
+ });
593
+
594
+ testWidgets (
595
+ "SliverAppBar.medium's foregroundColor takes priority over AppBarTheme.foregroundColor" , (WidgetTester tester) async {
596
+ const Color foregroundColor = Color (0xff00ff00 );
597
+ await tester.pumpWidget (MaterialApp (
598
+ theme: ThemeData (appBarTheme: const AppBarTheme (foregroundColor: Color (0xffff0000 ))),
599
+ home: CustomScrollView (
600
+ slivers: < Widget > [
601
+ SliverAppBar .medium (
602
+ foregroundColor: foregroundColor,
603
+ title: const Text ('Medium Title' ),
604
+ ),
605
+ ],
606
+ ),
607
+ ));
608
+
609
+ final RichText text = tester.firstWidget (find.byType (RichText ));
610
+ expect (text.text.style! .color, foregroundColor);
611
+ });
612
+
613
+ testWidgets ("SliverAppBar.large's title uses AppBarTheme.foregroundColor" , (WidgetTester tester) async {
614
+ const Color foregroundColor = Color (0xff00ff00 );
615
+ await tester.pumpWidget (MaterialApp (
616
+ theme: ThemeData (appBarTheme: const AppBarTheme (foregroundColor: foregroundColor)),
617
+ home: CustomScrollView (
618
+ slivers: < Widget > [
619
+ SliverAppBar .large (
620
+ title: const Text ('Large Title' ),
621
+ ),
622
+ ],
623
+ ),
624
+ ));
625
+
626
+ final RichText text = tester.firstWidget (find.byType (RichText ));
627
+ expect (text.text.style! .color, foregroundColor);
628
+ });
629
+
630
+ testWidgets (
631
+ "SliverAppBar.large's foregroundColor takes priority over AppBarTheme.foregroundColor" , (WidgetTester tester) async {
632
+ const Color foregroundColor = Color (0xff00ff00 );
633
+ await tester.pumpWidget (MaterialApp (
634
+ theme: ThemeData (appBarTheme: const AppBarTheme (foregroundColor: Color (0xffff0000 ))),
635
+ home: CustomScrollView (
636
+ slivers: < Widget > [
637
+ SliverAppBar .large (
638
+ foregroundColor: foregroundColor,
639
+ title: const Text ('Large Title' ),
640
+ ),
641
+ ],
642
+ ),
643
+ ));
644
+
645
+ final RichText text = tester.firstWidget (find.byType (RichText ));
646
+ expect (text.text.style! .color, foregroundColor);
647
+ });
648
+
577
649
testWidgets ('Default AppBarTheme debugFillProperties' , (WidgetTester tester) async {
578
650
final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder ();
579
651
const AppBarTheme ().debugFillProperties (builder);
0 commit comments