diff --git a/AUTHORS b/AUTHORS index e0504558b0..e3f115f72e 100644 --- a/AUTHORS +++ b/AUTHORS @@ -10,3 +10,4 @@ Wyatt Arent Michael Perrotte Günter Zöchbauer Raju Bitter +Michael Beckler diff --git a/packages/flutter/lib/src/material/bottom_navigation_bar.dart b/packages/flutter/lib/src/material/bottom_navigation_bar.dart index 1e6a7cc021..d30d8ae520 100644 --- a/packages/flutter/lib/src/material/bottom_navigation_bar.dart +++ b/packages/flutter/lib/src/material/bottom_navigation_bar.dart @@ -341,7 +341,8 @@ class BottomNavigationBarState extends State with TickerPro alignment: FractionalOffset.bottomCenter, child: new Container( margin: const EdgeInsets.only(bottom: 10.0), - child: new DefaultTextStyle( + child: new DefaultTextStyle.merge( + context: context, style: new TextStyle( fontSize: 14.0, color: colorTween.evaluate(animations[i]), @@ -411,7 +412,8 @@ class BottomNavigationBarState extends State with TickerPro margin: const EdgeInsets.only(bottom: 10.0), child: new FadeTransition( opacity: animations[i], - child: new DefaultTextStyle( + child: new DefaultTextStyle.merge( + context: context, style: new TextStyle( fontSize: 14.0, color: Colors.white diff --git a/packages/flutter/test/material/bottom_navigation_bar_test.dart b/packages/flutter/test/material/bottom_navigation_bar_test.dart index a053d37c9d..4aff93d670 100644 --- a/packages/flutter/test/material/bottom_navigation_bar_test.dart +++ b/packages/flutter/test/material/bottom_navigation_bar_test.dart @@ -164,4 +164,80 @@ void main() { actions = tester.renderObjectList(find.byType(InkResponse)); expect(actions.elementAt(3).localToGlobal(Point.origin), equals(originalOrigin)); }); + + testWidgets('BottomNavigationBar inherits shadowed app theme for shifting navbar', (WidgetTester tester) async { + await tester.pumpWidget( + new MaterialApp( + theme: new ThemeData(brightness: Brightness.light), + home: new Theme( + data: new ThemeData(brightness: Brightness.dark), + child: new Scaffold( + bottomNavigationBar: new BottomNavigationBar( + type: BottomNavigationBarType.shifting, + labels: [ + new DestinationLabel( + icon: new Icon(Icons.ac_unit), + title: new Text('AC') + ), + new DestinationLabel( + icon: new Icon(Icons.access_alarm), + title: new Text('Alarm') + ), + new DestinationLabel( + icon: new Icon(Icons.access_time), + title: new Text('Time') + ), + new DestinationLabel( + icon: new Icon(Icons.add), + title: new Text('Add') + ) + ] + ) + ) + ) + ) + ); + + await tester.tap(find.text('Alarm')); + await tester.pump(const Duration(seconds: 1)); + expect(Theme.of(tester.element(find.text('Alarm'))).brightness, equals(Brightness.dark)); + }); + + testWidgets('BottomNavigationBar inherits shadowed app theme for fixed navbar', (WidgetTester tester) async { + await tester.pumpWidget( + new MaterialApp( + theme: new ThemeData(brightness: Brightness.light), + home: new Theme( + data: new ThemeData(brightness: Brightness.dark), + child: new Scaffold( + bottomNavigationBar: new BottomNavigationBar( + type: BottomNavigationBarType.fixed, + labels: [ + new DestinationLabel( + icon: new Icon(Icons.ac_unit), + title: new Text('AC') + ), + new DestinationLabel( + icon: new Icon(Icons.access_alarm), + title: new Text('Alarm') + ), + new DestinationLabel( + icon: new Icon(Icons.access_time), + title: new Text('Time') + ), + new DestinationLabel( + icon: new Icon(Icons.add), + title: new Text('Add') + ) + ] + ) + ) + ) + ) + ); + + await tester.tap(find.text('Alarm')); + await tester.pump(const Duration(seconds: 1)); + expect(Theme.of(tester.element(find.text('Alarm'))).brightness, equals(Brightness.dark)); + }); }