From d186e344baa37fb12ad1eab502e8ad70a01607e3 Mon Sep 17 00:00:00 2001 From: Matthias Koch <4195507+fmt-Println-MKO@users.noreply.github.com> Date: Mon, 17 Apr 2023 19:49:45 +0200 Subject: [PATCH 01/14] replaced BottomNavigationBar with NavigationBar use Material 3 NavigationBar instead of BottomNavigationBar from M2 --- .../lib/src/adaptive_scaffold.dart | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart b/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart index 3eb9ee6435e..f32d4bc0477 100644 --- a/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart +++ b/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart @@ -317,13 +317,11 @@ class AdaptiveScaffold extends StatefulWidget { }) { return Builder( builder: (_) { - return BottomNavigationBar( - currentIndex: currentIndex ?? 0, - iconSize: iconSize, - items: destinations - .map((NavigationDestination e) => _toBottomNavItem(e)) - .toList(), - onTap: onDestinationSelected, + return NavigationBar( + selectedIndex: currentIndex ?? 0, + // iconSize: iconSize, + destinations: destinations, + onDestinationSelected: onDestinationSelected, ); }, ); @@ -644,14 +642,6 @@ class _AdaptiveScaffoldState extends State { } } -BottomNavigationBarItem _toBottomNavItem(NavigationDestination destination) { - return BottomNavigationBarItem( - label: destination.label, - icon: destination.icon, - activeIcon: destination.selectedIcon, - ); -} - class _BrickLayout extends StatelessWidget { const _BrickLayout({ this.columns = 1, From 8d95eb66800680003b1e8b658a43156a55e643cc Mon Sep 17 00:00:00 2001 From: Matthias Koch Date: Mon, 17 Apr 2023 20:07:02 +0200 Subject: [PATCH 02/14] fixed test to pass new NavigationBar design --- .../lib/src/adaptive_scaffold.dart | 3 +-- .../test/adaptive_scaffold_test.dart | 12 ++++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart b/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart index f32d4bc0477..3e25fe15ab2 100644 --- a/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart +++ b/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart @@ -319,7 +319,6 @@ class AdaptiveScaffold extends StatefulWidget { builder: (_) { return NavigationBar( selectedIndex: currentIndex ?? 0, - // iconSize: iconSize, destinations: destinations, onDestinationSelected: onDestinationSelected, ); @@ -739,4 +738,4 @@ class _BrickLayoutDelegate extends MultiChildLayoutDelegate { return itemPadding != oldDelegate.itemPadding || columnSpacing != oldDelegate.columnSpacing; } -} +} \ No newline at end of file diff --git a/packages/flutter_adaptive_scaffold/test/adaptive_scaffold_test.dart b/packages/flutter_adaptive_scaffold/test/adaptive_scaffold_test.dart index 65035389659..389e902fd84 100644 --- a/packages/flutter_adaptive_scaffold/test/adaptive_scaffold_test.dart +++ b/packages/flutter_adaptive_scaffold/test/adaptive_scaffold_test.dart @@ -33,7 +33,7 @@ void main() { expect(tester.getTopLeft(smallBody), Offset.zero); expect(tester.getTopLeft(smallSBody), const Offset(200, 0)); - expect(tester.getTopLeft(bottomNav), const Offset(0, 744)); + expect(tester.getTopLeft(bottomNav), const Offset(0, 720)); await tester.binding.setSurfaceSize(SimulatedLayout.medium.size); await tester.pumpWidget(SimulatedLayout.medium.app()); @@ -83,22 +83,22 @@ void main() { expect(tester.getTopLeft(b), const Offset(17.6, 0)); expect(tester.getBottomRight(b), - offsetMoreOrLessEquals(const Offset(778.2, 755.2), epsilon: 1.0)); + offsetMoreOrLessEquals(const Offset(778.2, 736), epsilon: 1.0)); expect(tester.getTopLeft(sBody), offsetMoreOrLessEquals(const Offset(778.2, 0), epsilon: 1.0)); expect(tester.getBottomRight(sBody), - offsetMoreOrLessEquals(const Offset(1178.2, 755.2), epsilon: 1.0)); + offsetMoreOrLessEquals(const Offset(1178.2, 736), epsilon: 1.0)); await tester.pump(); await tester.pump(const Duration(milliseconds: 600)); expect(tester.getTopLeft(b), const Offset(70.4, 0)); expect(tester.getBottomRight(b), - offsetMoreOrLessEquals(const Offset(416.0, 788.8), epsilon: 1.0)); + offsetMoreOrLessEquals(const Offset(416.0, 784), epsilon: 1.0)); expect(tester.getTopLeft(sBody), offsetMoreOrLessEquals(const Offset(416, 0), epsilon: 1.0)); expect(tester.getBottomRight(sBody), - offsetMoreOrLessEquals(const Offset(816, 788.8), epsilon: 1.0)); + offsetMoreOrLessEquals(const Offset(816, 784), epsilon: 1.0)); await tester.pump(); await tester.pump(const Duration(milliseconds: 200)); @@ -559,4 +559,4 @@ class PreferredSizeWidgetImpl extends StatelessWidget @override Size get preferredSize => const Size(200, 200); -} +} \ No newline at end of file From 29020c0c5a6892246434019915fd067079c7e216 Mon Sep 17 00:00:00 2001 From: Matthias Koch Date: Mon, 17 Apr 2023 20:17:31 +0200 Subject: [PATCH 03/14] updated version to 0.1.4 --- packages/flutter_adaptive_scaffold/CHANGELOG.md | 6 +++++- packages/flutter_adaptive_scaffold/pubspec.yaml | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/flutter_adaptive_scaffold/CHANGELOG.md b/packages/flutter_adaptive_scaffold/CHANGELOG.md index 793682b7787..0ab08a1101b 100644 --- a/packages/flutter_adaptive_scaffold/CHANGELOG.md +++ b/packages/flutter_adaptive_scaffold/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.1.4 + +* Use Material 3 NavigationBar instead of BottomNavigationBar + ## 0.1.3 * Fixes `groupAlignment` property not available in `standardNavigationRail` - [flutter/flutter#121994](https://github.com/flutter/flutter/issues/121994) @@ -58,4 +62,4 @@ Make fuchsia a mobile platform. ## 0.0.1 -* Initial release +* Initial release \ No newline at end of file diff --git a/packages/flutter_adaptive_scaffold/pubspec.yaml b/packages/flutter_adaptive_scaffold/pubspec.yaml index 8157ffb287b..612ccdf4796 100644 --- a/packages/flutter_adaptive_scaffold/pubspec.yaml +++ b/packages/flutter_adaptive_scaffold/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_adaptive_scaffold description: Widgets to easily build adaptive layouts, including navigation elements. -version: 0.1.3 +version: 0.1.4 issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+flutter_adaptive_scaffold%22 repository: https://github.com/flutter/packages/tree/main/packages/flutter_adaptive_scaffold @@ -14,4 +14,4 @@ dependencies: dev_dependencies: flutter_test: - sdk: flutter + sdk: flutter \ No newline at end of file From 1fe63ce63b35b382bc0e88ba1b50380e5c8984a4 Mon Sep 17 00:00:00 2001 From: Matthias Koch Date: Mon, 17 Apr 2023 20:26:35 +0200 Subject: [PATCH 04/14] fixed formating --- .../flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart | 2 +- .../flutter_adaptive_scaffold/test/adaptive_scaffold_test.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart b/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart index 3e25fe15ab2..52b9abea483 100644 --- a/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart +++ b/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart @@ -738,4 +738,4 @@ class _BrickLayoutDelegate extends MultiChildLayoutDelegate { return itemPadding != oldDelegate.itemPadding || columnSpacing != oldDelegate.columnSpacing; } -} \ No newline at end of file +} diff --git a/packages/flutter_adaptive_scaffold/test/adaptive_scaffold_test.dart b/packages/flutter_adaptive_scaffold/test/adaptive_scaffold_test.dart index 389e902fd84..32562864552 100644 --- a/packages/flutter_adaptive_scaffold/test/adaptive_scaffold_test.dart +++ b/packages/flutter_adaptive_scaffold/test/adaptive_scaffold_test.dart @@ -559,4 +559,4 @@ class PreferredSizeWidgetImpl extends StatelessWidget @override Size get preferredSize => const Size(200, 200); -} \ No newline at end of file +} From 8be3ea686fd46b91554765d2b30794386e14c8fc Mon Sep 17 00:00:00 2001 From: Matthias Koch Date: Mon, 17 Apr 2023 20:35:27 +0200 Subject: [PATCH 05/14] fixed example test --- .../test/adaptive_scaffold_demo_test.dart | 33 +++++++------------ 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/packages/flutter_adaptive_scaffold/example/test/adaptive_scaffold_demo_test.dart b/packages/flutter_adaptive_scaffold/example/test/adaptive_scaffold_demo_test.dart index 41df6dffcfd..2415abd0bbf 100644 --- a/packages/flutter_adaptive_scaffold/example/test/adaptive_scaffold_demo_test.dart +++ b/packages/flutter_adaptive_scaffold/example/test/adaptive_scaffold_demo_test.dart @@ -3,8 +3,7 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_adaptive_scaffold_example/adaptive_scaffold_demo.dart' - as example; +import 'package:flutter_adaptive_scaffold_example/adaptive_scaffold_demo.dart' as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -19,21 +18,18 @@ void main() { await tester.binding.setSurfaceSize(Size(width, 800)); await tester.pumpWidget( MaterialApp( - home: MediaQuery( - data: MediaQueryData(size: Size(width, 800)), - child: const example.MyHomePage()), + home: MediaQuery(data: MediaQueryData(size: Size(width, 800)), child: const example.MyHomePage()), ), ); } - testWidgets('dislays correct item of config based on screen width', - (WidgetTester tester) async { + testWidgets('dislays correct item of config based on screen width', (WidgetTester tester) async { await updateScreen(300, tester); await tester.pumpAndSettle(); expect(smallBody, findsOneWidget); expect(bnav, findsOneWidget); expect(tester.getTopLeft(smallBody), Offset.zero); - expect(tester.getTopLeft(bnav), const Offset(0, 744)); + expect(tester.getTopLeft(bnav), const Offset(0, 720)); expect(body, findsNothing); expect(largeBody, findsNothing); expect(pnav, findsNothing); @@ -60,8 +56,7 @@ void main() { expect(tester.getBottomRight(pnav1), const Offset(208, 800)); }); - testWidgets('adaptive scaffold animations work correctly', - (WidgetTester tester) async { + testWidgets('adaptive scaffold animations work correctly', (WidgetTester tester) async { final Finder b = find.byKey(const Key('body')); final Finder sBody = find.byKey(const Key('sBody')); @@ -72,23 +67,17 @@ void main() { await tester.pump(const Duration(milliseconds: 200)); expect(tester.getTopLeft(b), const Offset(17.6, 0)); - expect(tester.getBottomRight(b), - offsetMoreOrLessEquals(const Offset(778.2, 755.2), epsilon: 1.0)); - expect(tester.getTopLeft(sBody), - offsetMoreOrLessEquals(const Offset(778.2, 0), epsilon: 1.0)); - expect(tester.getBottomRight(sBody), - offsetMoreOrLessEquals(const Offset(1178.2, 755.2), epsilon: 1.0)); + expect(tester.getBottomRight(b), offsetMoreOrLessEquals(const Offset(778.2, 736), epsilon: 1.0)); + expect(tester.getTopLeft(sBody), offsetMoreOrLessEquals(const Offset(778.2, 0), epsilon: 1.0)); + expect(tester.getBottomRight(sBody), offsetMoreOrLessEquals(const Offset(1178.2, 736), epsilon: 1.0)); await tester.pump(); await tester.pump(const Duration(milliseconds: 600)); expect(tester.getTopLeft(b), const Offset(70.4, 0)); - expect(tester.getBottomRight(b), - offsetMoreOrLessEquals(const Offset(416.0, 788.8), epsilon: 1.0)); - expect(tester.getTopLeft(sBody), - offsetMoreOrLessEquals(const Offset(416, 0), epsilon: 1.0)); - expect(tester.getBottomRight(sBody), - offsetMoreOrLessEquals(const Offset(816, 788.8), epsilon: 1.0)); + expect(tester.getBottomRight(b), offsetMoreOrLessEquals(const Offset(416.0, 784), epsilon: 1.0)); + expect(tester.getTopLeft(sBody), offsetMoreOrLessEquals(const Offset(416, 0), epsilon: 1.0)); + expect(tester.getBottomRight(sBody), offsetMoreOrLessEquals(const Offset(816, 784), epsilon: 1.0)); await tester.pump(); await tester.pump(const Duration(milliseconds: 200)); From f7f8d3f4bd72e7d15b05f3b67701e7e04a0b72a8 Mon Sep 17 00:00:00 2001 From: Matthias Koch Date: Mon, 17 Apr 2023 20:55:23 +0200 Subject: [PATCH 06/14] fixed formatting in example unit test --- .../test/adaptive_scaffold_demo_test.dart | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/packages/flutter_adaptive_scaffold/example/test/adaptive_scaffold_demo_test.dart b/packages/flutter_adaptive_scaffold/example/test/adaptive_scaffold_demo_test.dart index 2415abd0bbf..1296528aea7 100644 --- a/packages/flutter_adaptive_scaffold/example/test/adaptive_scaffold_demo_test.dart +++ b/packages/flutter_adaptive_scaffold/example/test/adaptive_scaffold_demo_test.dart @@ -3,7 +3,8 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import 'package:flutter_adaptive_scaffold_example/adaptive_scaffold_demo.dart' as example; +import 'package:flutter_adaptive_scaffold_example/adaptive_scaffold_demo.dart' + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -18,12 +19,15 @@ void main() { await tester.binding.setSurfaceSize(Size(width, 800)); await tester.pumpWidget( MaterialApp( - home: MediaQuery(data: MediaQueryData(size: Size(width, 800)), child: const example.MyHomePage()), + home: MediaQuery( + data: MediaQueryData(size: Size(width, 800)), + child: const example.MyHomePage()), ), ); } - testWidgets('dislays correct item of config based on screen width', (WidgetTester tester) async { + testWidgets('dislays correct item of config based on screen width', + (WidgetTester tester) async { await updateScreen(300, tester); await tester.pumpAndSettle(); expect(smallBody, findsOneWidget); @@ -56,7 +60,8 @@ void main() { expect(tester.getBottomRight(pnav1), const Offset(208, 800)); }); - testWidgets('adaptive scaffold animations work correctly', (WidgetTester tester) async { + testWidgets('adaptive scaffold animations work correctly', + (WidgetTester tester) async { final Finder b = find.byKey(const Key('body')); final Finder sBody = find.byKey(const Key('sBody')); @@ -67,17 +72,23 @@ void main() { await tester.pump(const Duration(milliseconds: 200)); expect(tester.getTopLeft(b), const Offset(17.6, 0)); - expect(tester.getBottomRight(b), offsetMoreOrLessEquals(const Offset(778.2, 736), epsilon: 1.0)); - expect(tester.getTopLeft(sBody), offsetMoreOrLessEquals(const Offset(778.2, 0), epsilon: 1.0)); - expect(tester.getBottomRight(sBody), offsetMoreOrLessEquals(const Offset(1178.2, 736), epsilon: 1.0)); + expect(tester.getBottomRight(b), + offsetMoreOrLessEquals(const Offset(778.2, 736), epsilon: 1.0)); + expect(tester.getTopLeft(sBody), + offsetMoreOrLessEquals(const Offset(778.2, 0), epsilon: 1.0)); + expect(tester.getBottomRight(sBody), + offsetMoreOrLessEquals(const Offset(1178.2, 736), epsilon: 1.0)); await tester.pump(); await tester.pump(const Duration(milliseconds: 600)); expect(tester.getTopLeft(b), const Offset(70.4, 0)); - expect(tester.getBottomRight(b), offsetMoreOrLessEquals(const Offset(416.0, 784), epsilon: 1.0)); - expect(tester.getTopLeft(sBody), offsetMoreOrLessEquals(const Offset(416, 0), epsilon: 1.0)); - expect(tester.getBottomRight(sBody), offsetMoreOrLessEquals(const Offset(816, 784), epsilon: 1.0)); + expect(tester.getBottomRight(b), + offsetMoreOrLessEquals(const Offset(416.0, 784), epsilon: 1.0)); + expect(tester.getTopLeft(sBody), + offsetMoreOrLessEquals(const Offset(416, 0), epsilon: 1.0)); + expect(tester.getBottomRight(sBody), + offsetMoreOrLessEquals(const Offset(816, 784), epsilon: 1.0)); await tester.pump(); await tester.pump(const Duration(milliseconds: 200)); From 7584b58d237f58b26838b1ccdc10defc0dbca9d2 Mon Sep 17 00:00:00 2001 From: Matthias Koch Date: Mon, 17 Apr 2023 21:02:17 +0200 Subject: [PATCH 07/14] fixed formatting in example unit test --- .../example/test/adaptive_scaffold_demo_test.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/flutter_adaptive_scaffold/example/test/adaptive_scaffold_demo_test.dart b/packages/flutter_adaptive_scaffold/example/test/adaptive_scaffold_demo_test.dart index 1296528aea7..c22f9ebab73 100644 --- a/packages/flutter_adaptive_scaffold/example/test/adaptive_scaffold_demo_test.dart +++ b/packages/flutter_adaptive_scaffold/example/test/adaptive_scaffold_demo_test.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_adaptive_scaffold_example/adaptive_scaffold_demo.dart' - as example; + as example; import 'package:flutter_test/flutter_test.dart'; void main() { @@ -27,7 +27,7 @@ void main() { } testWidgets('dislays correct item of config based on screen width', - (WidgetTester tester) async { + (WidgetTester tester) async { await updateScreen(300, tester); await tester.pumpAndSettle(); expect(smallBody, findsOneWidget); @@ -61,7 +61,7 @@ void main() { }); testWidgets('adaptive scaffold animations work correctly', - (WidgetTester tester) async { + (WidgetTester tester) async { final Finder b = find.byKey(const Key('body')); final Finder sBody = find.byKey(const Key('sBody')); From 9249a60096197bace883cac004961b57287d24bd Mon Sep 17 00:00:00 2001 From: Matthias Koch Date: Sat, 6 May 2023 15:06:03 +0200 Subject: [PATCH 08/14] fixed new line at end of file --- packages/flutter_adaptive_scaffold/CHANGELOG.md | 2 +- packages/flutter_adaptive_scaffold/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/flutter_adaptive_scaffold/CHANGELOG.md b/packages/flutter_adaptive_scaffold/CHANGELOG.md index 0ab08a1101b..6ff69f593d3 100644 --- a/packages/flutter_adaptive_scaffold/CHANGELOG.md +++ b/packages/flutter_adaptive_scaffold/CHANGELOG.md @@ -62,4 +62,4 @@ Make fuchsia a mobile platform. ## 0.0.1 -* Initial release \ No newline at end of file +* Initial release diff --git a/packages/flutter_adaptive_scaffold/pubspec.yaml b/packages/flutter_adaptive_scaffold/pubspec.yaml index 612ccdf4796..d988420a222 100644 --- a/packages/flutter_adaptive_scaffold/pubspec.yaml +++ b/packages/flutter_adaptive_scaffold/pubspec.yaml @@ -14,4 +14,4 @@ dependencies: dev_dependencies: flutter_test: - sdk: flutter \ No newline at end of file + sdk: flutter From 385690d461c04574908425883d42064e78624f4e Mon Sep 17 00:00:00 2001 From: Matthias Koch Date: Sat, 6 May 2023 15:06:51 +0200 Subject: [PATCH 09/14] fixed, use iconSize property for NavigationBar --- .../lib/src/adaptive_scaffold.dart | 187 ++++++++---------- 1 file changed, 83 insertions(+), 104 deletions(-) diff --git a/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart b/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart index 52b9abea483..96b664a666b 100644 --- a/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart +++ b/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart @@ -317,11 +317,17 @@ class AdaptiveScaffold extends StatefulWidget { }) { return Builder( builder: (_) { - return NavigationBar( - selectedIndex: currentIndex ?? 0, - destinations: destinations, - onDestinationSelected: onDestinationSelected, - ); + return NavigationBarTheme( + data: NavigationBarThemeData( + iconTheme: MaterialStateProperty.resolveWith((Set states) { + return IconThemeData(size: iconSize); + }), + ), + child: NavigationBar( + selectedIndex: currentIndex ?? 0, + destinations: destinations, + onDestinationSelected: onDestinationSelected, + )); }, ); } @@ -373,8 +379,7 @@ class AdaptiveScaffold extends StatefulWidget { child: _BrickLayout( columns: itemColumns, columnSpacing: kMaterialGutterValue, - itemPadding: - const EdgeInsets.only(bottom: kMaterialGutterValue), + itemPadding: const EdgeInsets.only(bottom: kMaterialGutterValue), children: thisWidgets, ), ), @@ -473,15 +478,12 @@ class AdaptiveScaffold extends StatefulWidget { class _AdaptiveScaffoldState extends State { @override Widget build(BuildContext context) { - final NavigationRailThemeData navRailTheme = - Theme.of(context).navigationRailTheme; + final NavigationRailThemeData navRailTheme = Theme.of(context).navigationRailTheme; return Directionality( textDirection: TextDirection.ltr, child: Scaffold( - appBar: widget.drawerBreakpoint.isActive(context) && widget.useDrawer - ? widget.appBar ?? AppBar() - : null, + appBar: widget.drawerBreakpoint.isActive(context) && widget.useDrawer ? widget.appBar ?? AppBar() : null, drawer: widget.drawerBreakpoint.isActive(context) && widget.useDrawer ? Drawer( child: NavigationRail( @@ -489,9 +491,7 @@ class _AdaptiveScaffoldState extends State { leading: widget.leadingExtendedNavRail, trailing: widget.trailingNavRail, selectedIndex: widget.selectedIndex, - destinations: widget.destinations - .map((_) => AdaptiveScaffold.toRailDestination(_)) - .toList(), + destinations: widget.destinations.map((_) => AdaptiveScaffold.toRailDestination(_)).toList(), onDestinationSelected: widget.onSelectedIndexChange, ), ) @@ -509,16 +509,13 @@ class _AdaptiveScaffoldState extends State { leading: widget.leadingUnextendedNavRail, trailing: widget.trailingNavRail, selectedIndex: widget.selectedIndex, - destinations: widget.destinations - .map((_) => AdaptiveScaffold.toRailDestination(_)) - .toList(), + destinations: widget.destinations.map((_) => AdaptiveScaffold.toRailDestination(_)).toList(), onDestinationSelected: widget.onSelectedIndexChange, backgroundColor: navRailTheme.backgroundColor, selectedIconTheme: navRailTheme.selectedIconTheme, unselectedIconTheme: navRailTheme.unselectedIconTheme, selectedLabelTextStyle: navRailTheme.selectedLabelTextStyle, - unSelectedLabelTextStyle: - navRailTheme.unselectedLabelTextStyle, + unSelectedLabelTextStyle: navRailTheme.unselectedLabelTextStyle, ), ), widget.largeBreakpoint: SlotLayout.from( @@ -529,36 +526,31 @@ class _AdaptiveScaffoldState extends State { leading: widget.leadingExtendedNavRail, trailing: widget.trailingNavRail, selectedIndex: widget.selectedIndex, - destinations: widget.destinations - .map((_) => AdaptiveScaffold.toRailDestination(_)) - .toList(), + destinations: widget.destinations.map((_) => AdaptiveScaffold.toRailDestination(_)).toList(), onDestinationSelected: widget.onSelectedIndexChange, backgroundColor: navRailTheme.backgroundColor, selectedIconTheme: navRailTheme.selectedIconTheme, unselectedIconTheme: navRailTheme.unselectedIconTheme, selectedLabelTextStyle: navRailTheme.selectedLabelTextStyle, - unSelectedLabelTextStyle: - navRailTheme.unselectedLabelTextStyle, + unSelectedLabelTextStyle: navRailTheme.unselectedLabelTextStyle, ), ), }, ), - bottomNavigation: - !widget.drawerBreakpoint.isActive(context) || !widget.useDrawer - ? SlotLayout( - config: { - widget.smallBreakpoint: SlotLayout.from( - key: const Key('bottomNavigation'), - builder: (_) => - AdaptiveScaffold.standardBottomNavigationBar( - currentIndex: widget.selectedIndex, - destinations: widget.destinations, - onDestinationSelected: widget.onSelectedIndexChange, - ), - ), - }, - ) - : null, + bottomNavigation: !widget.drawerBreakpoint.isActive(context) || !widget.useDrawer + ? SlotLayout( + config: { + widget.smallBreakpoint: SlotLayout.from( + key: const Key('bottomNavigation'), + builder: (_) => AdaptiveScaffold.standardBottomNavigationBar( + currentIndex: widget.selectedIndex, + destinations: widget.destinations, + onDestinationSelected: widget.onSelectedIndexChange, + ), + ), + }, + ) + : null, body: SlotLayout( config: { Breakpoints.standard: SlotLayout.from( @@ -568,35 +560,32 @@ class _AdaptiveScaffoldState extends State { builder: widget.body, ), if (widget.smallBody != null) - widget.smallBreakpoint: - (widget.smallBody != AdaptiveScaffold.emptyBuilder) - ? SlotLayout.from( - key: const Key('smallBody'), - inAnimation: AdaptiveScaffold.fadeIn, - outAnimation: AdaptiveScaffold.fadeOut, - builder: widget.smallBody, - ) - : null, + widget.smallBreakpoint: (widget.smallBody != AdaptiveScaffold.emptyBuilder) + ? SlotLayout.from( + key: const Key('smallBody'), + inAnimation: AdaptiveScaffold.fadeIn, + outAnimation: AdaptiveScaffold.fadeOut, + builder: widget.smallBody, + ) + : null, if (widget.body != null) - widget.mediumBreakpoint: - (widget.body != AdaptiveScaffold.emptyBuilder) - ? SlotLayout.from( - key: const Key('body'), - inAnimation: AdaptiveScaffold.fadeIn, - outAnimation: AdaptiveScaffold.fadeOut, - builder: widget.body, - ) - : null, + widget.mediumBreakpoint: (widget.body != AdaptiveScaffold.emptyBuilder) + ? SlotLayout.from( + key: const Key('body'), + inAnimation: AdaptiveScaffold.fadeIn, + outAnimation: AdaptiveScaffold.fadeOut, + builder: widget.body, + ) + : null, if (widget.largeBody != null) - widget.largeBreakpoint: - (widget.largeBody != AdaptiveScaffold.emptyBuilder) - ? SlotLayout.from( - key: const Key('largeBody'), - inAnimation: AdaptiveScaffold.fadeIn, - outAnimation: AdaptiveScaffold.fadeOut, - builder: widget.largeBody, - ) - : null, + widget.largeBreakpoint: (widget.largeBody != AdaptiveScaffold.emptyBuilder) + ? SlotLayout.from( + key: const Key('largeBody'), + inAnimation: AdaptiveScaffold.fadeIn, + outAnimation: AdaptiveScaffold.fadeOut, + builder: widget.largeBody, + ) + : null, }, ), secondaryBody: SlotLayout( @@ -607,32 +596,29 @@ class _AdaptiveScaffoldState extends State { builder: widget.secondaryBody, ), if (widget.smallSecondaryBody != null) - widget.smallBreakpoint: - (widget.smallSecondaryBody != AdaptiveScaffold.emptyBuilder) - ? SlotLayout.from( - key: const Key('smallSBody'), - outAnimation: AdaptiveScaffold.stayOnScreen, - builder: widget.smallSecondaryBody, - ) - : null, + widget.smallBreakpoint: (widget.smallSecondaryBody != AdaptiveScaffold.emptyBuilder) + ? SlotLayout.from( + key: const Key('smallSBody'), + outAnimation: AdaptiveScaffold.stayOnScreen, + builder: widget.smallSecondaryBody, + ) + : null, if (widget.secondaryBody != null) - widget.mediumBreakpoint: - (widget.secondaryBody != AdaptiveScaffold.emptyBuilder) - ? SlotLayout.from( - key: const Key('sBody'), - outAnimation: AdaptiveScaffold.stayOnScreen, - builder: widget.secondaryBody, - ) - : null, + widget.mediumBreakpoint: (widget.secondaryBody != AdaptiveScaffold.emptyBuilder) + ? SlotLayout.from( + key: const Key('sBody'), + outAnimation: AdaptiveScaffold.stayOnScreen, + builder: widget.secondaryBody, + ) + : null, if (widget.largeSecondaryBody != null) - widget.largeBreakpoint: - (widget.largeSecondaryBody != AdaptiveScaffold.emptyBuilder) - ? SlotLayout.from( - key: const Key('largeSBody'), - outAnimation: AdaptiveScaffold.stayOnScreen, - builder: widget.largeSecondaryBody, - ) - : null, + widget.largeBreakpoint: (widget.largeSecondaryBody != AdaptiveScaffold.emptyBuilder) + ? SlotLayout.from( + key: const Key('largeSBody'), + outAnimation: AdaptiveScaffold.stayOnScreen, + builder: widget.largeSecondaryBody, + ) + : null, }, ), ), @@ -693,17 +679,14 @@ class _BrickLayoutDelegate extends MultiChildLayoutDelegate { @override void performLayout(Size size) { final BoxConstraints looseConstraints = BoxConstraints.loose(size); - final BoxConstraints fullWidthConstraints = - looseConstraints.tighten(width: size.width); + final BoxConstraints fullWidthConstraints = looseConstraints.tighten(width: size.width); final List childSizes = []; int childCount = 0; // Count how many children we have. for (; hasChild(childCount); childCount += 1) {} final BoxConstraints itemConstraints = BoxConstraints( - maxWidth: fullWidthConstraints.maxWidth / columns - - columnSpacing / 2 - - itemPadding.horizontal, + maxWidth: fullWidthConstraints.maxWidth / columns - columnSpacing / 2 - itemPadding.horizontal, ); for (int i = 0; i < childCount; i += 1) { @@ -715,15 +698,12 @@ class _BrickLayoutDelegate extends MultiChildLayoutDelegate { final double totalColumnSpacing = columnSpacing * (columns - 1); final double columnWidth = (size.width - totalColumnSpacing) / columns; final double topPadding = itemPadding.resolve(TextDirection.ltr).top; - final List columnUsage = - List.generate(columns, (int index) => topPadding); + final List columnUsage = List.generate(columns, (int index) => topPadding); for (final Size childSize in childSizes) { positionChild( childId, Offset( - columnSpacing * columnIndex + - columnWidth * columnIndex + - (columnWidth - childSize.width) / 2, + columnSpacing * columnIndex + columnWidth * columnIndex + (columnWidth - childSize.width) / 2, columnUsage[columnIndex], ), ); @@ -735,7 +715,6 @@ class _BrickLayoutDelegate extends MultiChildLayoutDelegate { @override bool shouldRelayout(_BrickLayoutDelegate oldDelegate) { - return itemPadding != oldDelegate.itemPadding || - columnSpacing != oldDelegate.columnSpacing; + return itemPadding != oldDelegate.itemPadding || columnSpacing != oldDelegate.columnSpacing; } } From 8d69ac345215bac9707048669b88c81feca7631e Mon Sep 17 00:00:00 2001 From: Matthias Koch Date: Sat, 6 May 2023 15:29:32 +0200 Subject: [PATCH 10/14] fixed formating --- .../lib/src/adaptive_scaffold.dart | 174 ++++++++++-------- 1 file changed, 101 insertions(+), 73 deletions(-) diff --git a/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart b/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart index 96b664a666b..810fc36b3a6 100644 --- a/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart +++ b/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart @@ -319,7 +319,8 @@ class AdaptiveScaffold extends StatefulWidget { builder: (_) { return NavigationBarTheme( data: NavigationBarThemeData( - iconTheme: MaterialStateProperty.resolveWith((Set states) { + iconTheme: MaterialStateProperty.resolveWith( + (Set states) { return IconThemeData(size: iconSize); }), ), @@ -379,7 +380,8 @@ class AdaptiveScaffold extends StatefulWidget { child: _BrickLayout( columns: itemColumns, columnSpacing: kMaterialGutterValue, - itemPadding: const EdgeInsets.only(bottom: kMaterialGutterValue), + itemPadding: + const EdgeInsets.only(bottom: kMaterialGutterValue), children: thisWidgets, ), ), @@ -478,12 +480,15 @@ class AdaptiveScaffold extends StatefulWidget { class _AdaptiveScaffoldState extends State { @override Widget build(BuildContext context) { - final NavigationRailThemeData navRailTheme = Theme.of(context).navigationRailTheme; + final NavigationRailThemeData navRailTheme = + Theme.of(context).navigationRailTheme; return Directionality( textDirection: TextDirection.ltr, child: Scaffold( - appBar: widget.drawerBreakpoint.isActive(context) && widget.useDrawer ? widget.appBar ?? AppBar() : null, + appBar: widget.drawerBreakpoint.isActive(context) && widget.useDrawer + ? widget.appBar ?? AppBar() + : null, drawer: widget.drawerBreakpoint.isActive(context) && widget.useDrawer ? Drawer( child: NavigationRail( @@ -491,7 +496,9 @@ class _AdaptiveScaffoldState extends State { leading: widget.leadingExtendedNavRail, trailing: widget.trailingNavRail, selectedIndex: widget.selectedIndex, - destinations: widget.destinations.map((_) => AdaptiveScaffold.toRailDestination(_)).toList(), + destinations: widget.destinations + .map((_) => AdaptiveScaffold.toRailDestination(_)) + .toList(), onDestinationSelected: widget.onSelectedIndexChange, ), ) @@ -509,13 +516,16 @@ class _AdaptiveScaffoldState extends State { leading: widget.leadingUnextendedNavRail, trailing: widget.trailingNavRail, selectedIndex: widget.selectedIndex, - destinations: widget.destinations.map((_) => AdaptiveScaffold.toRailDestination(_)).toList(), + destinations: widget.destinations + .map((_) => AdaptiveScaffold.toRailDestination(_)) + .toList(), onDestinationSelected: widget.onSelectedIndexChange, backgroundColor: navRailTheme.backgroundColor, selectedIconTheme: navRailTheme.selectedIconTheme, unselectedIconTheme: navRailTheme.unselectedIconTheme, selectedLabelTextStyle: navRailTheme.selectedLabelTextStyle, - unSelectedLabelTextStyle: navRailTheme.unselectedLabelTextStyle, + unSelectedLabelTextStyle: + navRailTheme.unselectedLabelTextStyle, ), ), widget.largeBreakpoint: SlotLayout.from( @@ -526,31 +536,36 @@ class _AdaptiveScaffoldState extends State { leading: widget.leadingExtendedNavRail, trailing: widget.trailingNavRail, selectedIndex: widget.selectedIndex, - destinations: widget.destinations.map((_) => AdaptiveScaffold.toRailDestination(_)).toList(), + destinations: widget.destinations + .map((_) => AdaptiveScaffold.toRailDestination(_)) + .toList(), onDestinationSelected: widget.onSelectedIndexChange, backgroundColor: navRailTheme.backgroundColor, selectedIconTheme: navRailTheme.selectedIconTheme, unselectedIconTheme: navRailTheme.unselectedIconTheme, selectedLabelTextStyle: navRailTheme.selectedLabelTextStyle, - unSelectedLabelTextStyle: navRailTheme.unselectedLabelTextStyle, + unSelectedLabelTextStyle: + navRailTheme.unselectedLabelTextStyle, ), ), }, ), - bottomNavigation: !widget.drawerBreakpoint.isActive(context) || !widget.useDrawer - ? SlotLayout( - config: { - widget.smallBreakpoint: SlotLayout.from( - key: const Key('bottomNavigation'), - builder: (_) => AdaptiveScaffold.standardBottomNavigationBar( - currentIndex: widget.selectedIndex, - destinations: widget.destinations, - onDestinationSelected: widget.onSelectedIndexChange, - ), - ), - }, - ) - : null, + bottomNavigation: + !widget.drawerBreakpoint.isActive(context) || !widget.useDrawer + ? SlotLayout( + config: { + widget.smallBreakpoint: SlotLayout.from( + key: const Key('bottomNavigation'), + builder: (_) => + AdaptiveScaffold.standardBottomNavigationBar( + currentIndex: widget.selectedIndex, + destinations: widget.destinations, + onDestinationSelected: widget.onSelectedIndexChange, + ), + ), + }, + ) + : null, body: SlotLayout( config: { Breakpoints.standard: SlotLayout.from( @@ -560,32 +575,35 @@ class _AdaptiveScaffoldState extends State { builder: widget.body, ), if (widget.smallBody != null) - widget.smallBreakpoint: (widget.smallBody != AdaptiveScaffold.emptyBuilder) - ? SlotLayout.from( - key: const Key('smallBody'), - inAnimation: AdaptiveScaffold.fadeIn, - outAnimation: AdaptiveScaffold.fadeOut, - builder: widget.smallBody, - ) - : null, + widget.smallBreakpoint: + (widget.smallBody != AdaptiveScaffold.emptyBuilder) + ? SlotLayout.from( + key: const Key('smallBody'), + inAnimation: AdaptiveScaffold.fadeIn, + outAnimation: AdaptiveScaffold.fadeOut, + builder: widget.smallBody, + ) + : null, if (widget.body != null) - widget.mediumBreakpoint: (widget.body != AdaptiveScaffold.emptyBuilder) - ? SlotLayout.from( - key: const Key('body'), - inAnimation: AdaptiveScaffold.fadeIn, - outAnimation: AdaptiveScaffold.fadeOut, - builder: widget.body, - ) - : null, + widget.mediumBreakpoint: + (widget.body != AdaptiveScaffold.emptyBuilder) + ? SlotLayout.from( + key: const Key('body'), + inAnimation: AdaptiveScaffold.fadeIn, + outAnimation: AdaptiveScaffold.fadeOut, + builder: widget.body, + ) + : null, if (widget.largeBody != null) - widget.largeBreakpoint: (widget.largeBody != AdaptiveScaffold.emptyBuilder) - ? SlotLayout.from( - key: const Key('largeBody'), - inAnimation: AdaptiveScaffold.fadeIn, - outAnimation: AdaptiveScaffold.fadeOut, - builder: widget.largeBody, - ) - : null, + widget.largeBreakpoint: + (widget.largeBody != AdaptiveScaffold.emptyBuilder) + ? SlotLayout.from( + key: const Key('largeBody'), + inAnimation: AdaptiveScaffold.fadeIn, + outAnimation: AdaptiveScaffold.fadeOut, + builder: widget.largeBody, + ) + : null, }, ), secondaryBody: SlotLayout( @@ -596,29 +614,32 @@ class _AdaptiveScaffoldState extends State { builder: widget.secondaryBody, ), if (widget.smallSecondaryBody != null) - widget.smallBreakpoint: (widget.smallSecondaryBody != AdaptiveScaffold.emptyBuilder) - ? SlotLayout.from( - key: const Key('smallSBody'), - outAnimation: AdaptiveScaffold.stayOnScreen, - builder: widget.smallSecondaryBody, - ) - : null, + widget.smallBreakpoint: + (widget.smallSecondaryBody != AdaptiveScaffold.emptyBuilder) + ? SlotLayout.from( + key: const Key('smallSBody'), + outAnimation: AdaptiveScaffold.stayOnScreen, + builder: widget.smallSecondaryBody, + ) + : null, if (widget.secondaryBody != null) - widget.mediumBreakpoint: (widget.secondaryBody != AdaptiveScaffold.emptyBuilder) - ? SlotLayout.from( - key: const Key('sBody'), - outAnimation: AdaptiveScaffold.stayOnScreen, - builder: widget.secondaryBody, - ) - : null, + widget.mediumBreakpoint: + (widget.secondaryBody != AdaptiveScaffold.emptyBuilder) + ? SlotLayout.from( + key: const Key('sBody'), + outAnimation: AdaptiveScaffold.stayOnScreen, + builder: widget.secondaryBody, + ) + : null, if (widget.largeSecondaryBody != null) - widget.largeBreakpoint: (widget.largeSecondaryBody != AdaptiveScaffold.emptyBuilder) - ? SlotLayout.from( - key: const Key('largeSBody'), - outAnimation: AdaptiveScaffold.stayOnScreen, - builder: widget.largeSecondaryBody, - ) - : null, + widget.largeBreakpoint: + (widget.largeSecondaryBody != AdaptiveScaffold.emptyBuilder) + ? SlotLayout.from( + key: const Key('largeSBody'), + outAnimation: AdaptiveScaffold.stayOnScreen, + builder: widget.largeSecondaryBody, + ) + : null, }, ), ), @@ -679,14 +700,17 @@ class _BrickLayoutDelegate extends MultiChildLayoutDelegate { @override void performLayout(Size size) { final BoxConstraints looseConstraints = BoxConstraints.loose(size); - final BoxConstraints fullWidthConstraints = looseConstraints.tighten(width: size.width); + final BoxConstraints fullWidthConstraints = + looseConstraints.tighten(width: size.width); final List childSizes = []; int childCount = 0; // Count how many children we have. for (; hasChild(childCount); childCount += 1) {} final BoxConstraints itemConstraints = BoxConstraints( - maxWidth: fullWidthConstraints.maxWidth / columns - columnSpacing / 2 - itemPadding.horizontal, + maxWidth: fullWidthConstraints.maxWidth / columns - + columnSpacing / 2 - + itemPadding.horizontal, ); for (int i = 0; i < childCount; i += 1) { @@ -698,12 +722,15 @@ class _BrickLayoutDelegate extends MultiChildLayoutDelegate { final double totalColumnSpacing = columnSpacing * (columns - 1); final double columnWidth = (size.width - totalColumnSpacing) / columns; final double topPadding = itemPadding.resolve(TextDirection.ltr).top; - final List columnUsage = List.generate(columns, (int index) => topPadding); + final List columnUsage = + List.generate(columns, (int index) => topPadding); for (final Size childSize in childSizes) { positionChild( childId, Offset( - columnSpacing * columnIndex + columnWidth * columnIndex + (columnWidth - childSize.width) / 2, + columnSpacing * columnIndex + + columnWidth * columnIndex + + (columnWidth - childSize.width) / 2, columnUsage[columnIndex], ), ); @@ -715,6 +742,7 @@ class _BrickLayoutDelegate extends MultiChildLayoutDelegate { @override bool shouldRelayout(_BrickLayoutDelegate oldDelegate) { - return itemPadding != oldDelegate.itemPadding || columnSpacing != oldDelegate.columnSpacing; + return itemPadding != oldDelegate.itemPadding || + columnSpacing != oldDelegate.columnSpacing; } } From d7245c820eb7584a3aada6011017aaf2efa1a033 Mon Sep 17 00:00:00 2001 From: Matthias Koch Date: Tue, 9 May 2023 20:29:23 +0200 Subject: [PATCH 11/14] fixed NavBarThemeData as base for new iconSize --- .../lib/src/adaptive_scaffold.dart | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart b/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart index 810fc36b3a6..a5b4d7a637f 100644 --- a/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart +++ b/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart @@ -316,14 +316,17 @@ class AdaptiveScaffold extends StatefulWidget { ValueChanged? onDestinationSelected, }) { return Builder( - builder: (_) { + builder: (context) { + final NavigationBarThemeData currentNavBarTheme = + NavigationBarTheme.of(context); return NavigationBarTheme( - data: NavigationBarThemeData( - iconTheme: MaterialStateProperty.resolveWith( - (Set states) { - return IconThemeData(size: iconSize); - }), - ), + data: currentNavBarTheme.copyWith(iconTheme: + MaterialStateProperty.resolveWith((Set states) { + return currentNavBarTheme.iconTheme + ?.resolve(states) + ?.copyWith(size: iconSize) ?? + IconTheme.of(context).copyWith(size: iconSize); + })), child: NavigationBar( selectedIndex: currentIndex ?? 0, destinations: destinations, From 591ce3f9c78c039f0b3b645553951c28a38d5f2d Mon Sep 17 00:00:00 2001 From: Matthias Koch Date: Tue, 9 May 2023 20:33:11 +0200 Subject: [PATCH 12/14] fixed, added BuildContext type --- .../flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart b/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart index a5b4d7a637f..885eea9dfa2 100644 --- a/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart +++ b/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart @@ -316,7 +316,7 @@ class AdaptiveScaffold extends StatefulWidget { ValueChanged? onDestinationSelected, }) { return Builder( - builder: (context) { + builder: (BuildContext context) { final NavigationBarThemeData currentNavBarTheme = NavigationBarTheme.of(context); return NavigationBarTheme( From 35a1361d525cb3bc06a472c8522ea11eefa8e146 Mon Sep 17 00:00:00 2001 From: Matthias Koch <4195507+fmt-Println-MKO@users.noreply.github.com> Date: Tue, 16 May 2023 22:25:49 +0200 Subject: [PATCH 13/14] Update packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart Co-authored-by: Justin McCandless --- .../lib/src/adaptive_scaffold.dart | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart b/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart index 885eea9dfa2..a8bd3c871bc 100644 --- a/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart +++ b/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart @@ -320,18 +320,20 @@ class AdaptiveScaffold extends StatefulWidget { final NavigationBarThemeData currentNavBarTheme = NavigationBarTheme.of(context); return NavigationBarTheme( - data: currentNavBarTheme.copyWith(iconTheme: - MaterialStateProperty.resolveWith((Set states) { + data: currentNavBarTheme.copyWith( + iconTheme: MaterialStateProperty.resolveWith((Set states) { return currentNavBarTheme.iconTheme - ?.resolve(states) - ?.copyWith(size: iconSize) ?? - IconTheme.of(context).copyWith(size: iconSize); - })), - child: NavigationBar( - selectedIndex: currentIndex ?? 0, - destinations: destinations, - onDestinationSelected: onDestinationSelected, - )); + ?.resolve(states) + ?.copyWith(size: iconSize) ?? + IconTheme.of(context).copyWith(size: iconSize); + }), + ), + child: NavigationBar( + selectedIndex: currentIndex ?? 0, + destinations: destinations, + onDestinationSelected: onDestinationSelected, + ), + ); }, ); } From d404401778c3fc8fe845b3d3fff94078db53d0c5 Mon Sep 17 00:00:00 2001 From: Matthias Koch Date: Wed, 17 May 2023 21:12:09 +0200 Subject: [PATCH 14/14] fixed formatting --- .../lib/src/adaptive_scaffold.dart | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart b/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart index a8bd3c871bc..028f47e7cad 100644 --- a/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart +++ b/packages/flutter_adaptive_scaffold/lib/src/adaptive_scaffold.dart @@ -320,20 +320,20 @@ class AdaptiveScaffold extends StatefulWidget { final NavigationBarThemeData currentNavBarTheme = NavigationBarTheme.of(context); return NavigationBarTheme( - data: currentNavBarTheme.copyWith( - iconTheme: MaterialStateProperty.resolveWith((Set states) { - return currentNavBarTheme.iconTheme - ?.resolve(states) - ?.copyWith(size: iconSize) ?? - IconTheme.of(context).copyWith(size: iconSize); - }), - ), - child: NavigationBar( - selectedIndex: currentIndex ?? 0, - destinations: destinations, - onDestinationSelected: onDestinationSelected, - ), - ); + data: currentNavBarTheme.copyWith( + iconTheme: MaterialStateProperty.resolveWith( + (Set states) { + return currentNavBarTheme.iconTheme + ?.resolve(states) + ?.copyWith(size: iconSize) ?? + IconTheme.of(context).copyWith(size: iconSize); + }), + ), + child: NavigationBar( + selectedIndex: currentIndex ?? 0, + destinations: destinations, + onDestinationSelected: onDestinationSelected, + )); }, ); }