@@ -263,8 +263,8 @@ void main() {
263
263
expect (_getMaterial (tester).surfaceTintColor, null );
264
264
expect (_getMaterial (tester).elevation, 0 );
265
265
expect (tester.getSize (find.byType (NavigationBar )).height, 80 );
266
- expect (_indicator (tester)? .color, const Color (0x3d2196f3 ));
267
- expect (_indicator (tester)? .shape, RoundedRectangleBorder (borderRadius: BorderRadius .circular (16 )));
266
+ expect (_getIndicatorDecoration (tester)? .color, const Color (0x3d2196f3 ));
267
+ expect (_getIndicatorDecoration (tester)? .shape, RoundedRectangleBorder (borderRadius: BorderRadius .circular (16 )));
268
268
269
269
// M3 settings from the token database.
270
270
await tester.pumpWidget (
@@ -292,8 +292,8 @@ void main() {
292
292
expect (_getMaterial (tester).surfaceTintColor, ThemeData ().colorScheme.surfaceTint);
293
293
expect (_getMaterial (tester).elevation, 3 );
294
294
expect (tester.getSize (find.byType (NavigationBar )).height, 80 );
295
- expect (_indicator (tester)? .color, const Color (0xff2196f3 ));
296
- expect (_indicator (tester)? .shape, const StadiumBorder ());
295
+ expect (_getIndicatorDecoration (tester)? .color, const Color (0xff2196f3 ));
296
+ expect (_getIndicatorDecoration (tester)? .shape, const StadiumBorder ());
297
297
});
298
298
299
299
testWidgets ('NavigationBar shows tooltips with text scaling ' , (WidgetTester tester) async {
@@ -807,21 +807,21 @@ void main() {
807
807
testWidgets ('Navigation destination updates indicator color and shape' , (WidgetTester tester) async {
808
808
final ThemeData theme = ThemeData (useMaterial3: true );
809
809
const Color color = Color (0xff0000ff );
810
- const ShapeBorder shape = CircleBorder ();
810
+ const ShapeBorder shape = RoundedRectangleBorder ();
811
811
812
- Widget buildNaviagationBar ({Color ? indicatorColor, ShapeBorder ? indicatorShape}) {
812
+ Widget buildNavigationBar ({Color ? indicatorColor, ShapeBorder ? indicatorShape}) {
813
813
return MaterialApp (
814
814
theme: theme,
815
815
home: Scaffold (
816
816
bottomNavigationBar: NavigationBar (
817
- destinations: < Widget > [
817
+ indicatorColor: indicatorColor,
818
+ indicatorShape: indicatorShape,
819
+ destinations: const < Widget > [
818
820
NavigationDestination (
819
- icon: const Icon (Icons .ac_unit),
821
+ icon: Icon (Icons .ac_unit),
820
822
label: 'AC' ,
821
- indicatorColor: indicatorColor,
822
- indicatorShape: indicatorShape,
823
823
),
824
- const NavigationDestination (
824
+ NavigationDestination (
825
825
icon: Icon (Icons .access_alarm),
826
826
label: 'Alarm' ,
827
827
),
@@ -832,17 +832,17 @@ void main() {
832
832
);
833
833
}
834
834
835
- await tester.pumpWidget (buildNaviagationBar ());
835
+ await tester.pumpWidget (buildNavigationBar ());
836
836
837
837
// Test default indicator color and shape.
838
- expect (_indicator (tester)? .color, theme.colorScheme.secondaryContainer);
839
- expect (_indicator (tester)? .shape, const StadiumBorder ());
838
+ expect (_getIndicatorDecoration (tester)? .color, theme.colorScheme.secondaryContainer);
839
+ expect (_getIndicatorDecoration (tester)? .shape, const StadiumBorder ());
840
840
841
- await tester.pumpWidget (buildNaviagationBar (indicatorColor: color, indicatorShape: shape));
841
+ await tester.pumpWidget (buildNavigationBar (indicatorColor: color, indicatorShape: shape));
842
842
843
843
// Test custom indicator color and shape.
844
- expect (_indicator (tester)? .color, color);
845
- expect (_indicator (tester)? .shape, shape);
844
+ expect (_getIndicatorDecoration (tester)? .color, color);
845
+ expect (_getIndicatorDecoration (tester)? .shape, shape);
846
846
});
847
847
848
848
group ('Material 2' , () {
@@ -852,21 +852,21 @@ void main() {
852
852
testWidgets ('Navigation destination updates indicator color and shape' , (WidgetTester tester) async {
853
853
final ThemeData theme = ThemeData (useMaterial3: false );
854
854
const Color color = Color (0xff0000ff );
855
- const ShapeBorder shape = CircleBorder ();
855
+ const ShapeBorder shape = RoundedRectangleBorder ();
856
856
857
- Widget buildNaviagationBar ({Color ? indicatorColor, ShapeBorder ? indicatorShape}) {
857
+ Widget buildNavigationBar ({Color ? indicatorColor, ShapeBorder ? indicatorShape}) {
858
858
return MaterialApp (
859
859
theme: theme,
860
860
home: Scaffold (
861
861
bottomNavigationBar: NavigationBar (
862
- destinations: < Widget > [
862
+ indicatorColor: indicatorColor,
863
+ indicatorShape: indicatorShape,
864
+ destinations: const < Widget > [
863
865
NavigationDestination (
864
- icon: const Icon (Icons .ac_unit),
866
+ icon: Icon (Icons .ac_unit),
865
867
label: 'AC' ,
866
- indicatorColor: indicatorColor,
867
- indicatorShape: indicatorShape,
868
868
),
869
- const NavigationDestination (
869
+ NavigationDestination (
870
870
icon: Icon (Icons .access_alarm),
871
871
label: 'Alarm' ,
872
872
),
@@ -877,20 +877,20 @@ void main() {
877
877
);
878
878
}
879
879
880
- await tester.pumpWidget (buildNaviagationBar ());
880
+ await tester.pumpWidget (buildNavigationBar ());
881
881
882
882
// Test default indicator color and shape.
883
- expect (_indicator (tester)? .color, theme.colorScheme.secondary.withOpacity (0.24 ));
883
+ expect (_getIndicatorDecoration (tester)? .color, theme.colorScheme.secondary.withOpacity (0.24 ));
884
884
expect (
885
- _indicator (tester)? .shape,
885
+ _getIndicatorDecoration (tester)? .shape,
886
886
const RoundedRectangleBorder (borderRadius: BorderRadius .all (Radius .circular (16 ))),
887
887
);
888
888
889
- await tester.pumpWidget (buildNaviagationBar (indicatorColor: color, indicatorShape: shape));
889
+ await tester.pumpWidget (buildNavigationBar (indicatorColor: color, indicatorShape: shape));
890
890
891
891
// Test custom indicator color and shape.
892
- expect (_indicator (tester)? .color, color);
893
- expect (_indicator (tester)? .shape, shape);
892
+ expect (_getIndicatorDecoration (tester)? .color, color);
893
+ expect (_getIndicatorDecoration (tester)? .shape, shape);
894
894
});
895
895
});
896
896
}
@@ -912,7 +912,7 @@ Material _getMaterial(WidgetTester tester) {
912
912
);
913
913
}
914
914
915
- ShapeDecoration ? _indicator (WidgetTester tester) {
915
+ ShapeDecoration ? _getIndicatorDecoration (WidgetTester tester) {
916
916
return tester.firstWidget <Container >(
917
917
find.descendant (
918
918
of: find.byType (FadeTransition ),
0 commit comments