Skip to content

Commit 071ba78

Browse files
committed
## [6.2.1] - 2024-07-12
- Fixed `null` error around `routeAndNavigatorSettings`.
1 parent 25a982d commit 071ba78

7 files changed

Lines changed: 34 additions & 32 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [6.2.1] - 2024-07-12
9+
- Fixed `null` error around `routeAndNavigatorSettings`.
10+
811
## [6.2.0] - 2024-07-11
912
- **Breaking Changes**
1013
- For `PersistentTabView.custom`, `List<Widget> screens` has been replaced with `List<CustomNavBarScreen> screens`.

README.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -427,24 +427,23 @@ If you want to have your own style for the navigation bar, follow these steps:
427427
428428
Animated icons are now supported in `PersistentBottomNavBarItem`. You will need to define and use an `AnimationController` and `Animation<double>` for it to work. Following is an example.
429429
430-
```dart
431430
432-
final _animationController = AnimationController(vsync: this, duration: const Duration(milliseconds: 400));
433-
final _animationValue = Tween<double>(begin: 0.toDouble(), end: 1.toDouble()).animate(_animationController),
434431
435-
final item = PersistentBottomNavBarItem(
436-
icon: AnimatedIcon(
437-
icon: AnimatedIcons.home_menu,
438-
progress: _animationValue,
439-
),
440-
iconAnimationController: _animationController,
441-
title: "Home",
442-
activeColorPrimary: Colors.blue,
443-
activeColorSecondary: _navBarStyle == NavBarStyle.style7 || _navBarStyle == NavBarStyle.style10 ? Colors.white : null,
444-
inactiveColorPrimary: Colors.grey,
445-
);
432+
final _animationController = AnimationController(vsync: this, duration: const Duration(milliseconds: 400));
433+
final _animationValue = Tween<double>(begin: 0.toDouble(), end: 1.toDouble()).animate(_animationController),
434+
435+
final item = PersistentBottomNavBarItem(
436+
icon: AnimatedIcon(
437+
icon: AnimatedIcons.home_menu,
438+
progress: _animationValue,
439+
),
440+
iconAnimationController: _animationController,
441+
title: "Home",
442+
activeColorPrimary: Colors.blue,
443+
activeColorSecondary: _navBarStyle == NavBarStyle.style7 || _navBarStyle == NavBarStyle.style10 ? Colors.white : null,
444+
inactiveColorPrimary: Colors.grey,
445+
);
446446
447-
```
448447
449448
For better understanding, refer to the [example project](https://github.com/BilalShahid13/PersistentBottomNavBar/tree/master/example) in the official git repo.
450449

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
buildscript {
2-
ext.kotlin_version = '1.3.50'
2+
ext.kotlin_version = '1.9.20'
33
repositories {
44
google()
55
jcenter()

example/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
buildscript {
2-
ext.kotlin_version = '1.3.50'
2+
ext.kotlin_version = '1.9.20'
33
repositories {
44
google()
55
jcenter()

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ packages:
121121
path: ".."
122122
relative: true
123123
source: path
124-
version: "5.0.2"
124+
version: "6.2.1"
125125
sky_engine:
126126
dependency: transitive
127127
description: flutter

lib/models/tab_view.widget.dart

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,23 @@ class _CustomTabViewState extends State<_CustomTabView> {
2727
@override
2828
void didUpdateWidget(final _CustomTabView oldWidget) {
2929
super.didUpdateWidget(oldWidget);
30-
if (widget.routeAndNavigatorSettings!.navigatorKey !=
31-
oldWidget.routeAndNavigatorSettings!.navigatorKey ||
32-
widget.routeAndNavigatorSettings!.navigatorObservers !=
33-
oldWidget.routeAndNavigatorSettings!.navigatorObservers) {
30+
if (widget.routeAndNavigatorSettings?.navigatorKey !=
31+
oldWidget.routeAndNavigatorSettings?.navigatorKey ||
32+
widget.routeAndNavigatorSettings?.navigatorObservers !=
33+
oldWidget.routeAndNavigatorSettings?.navigatorObservers) {
3434
_updateObservers();
3535
}
3636
}
3737

3838
void _updateObservers() {
3939
_navigatorObservers = List<NavigatorObserver>.from(
40-
widget.routeAndNavigatorSettings!.navigatorObservers)
40+
widget.routeAndNavigatorSettings?.navigatorObservers ?? [])
4141
..add(_heroController);
4242
}
4343

4444
@override
4545
Widget build(final BuildContext context) => Navigator(
46-
key: widget.routeAndNavigatorSettings!.navigatorKey,
46+
key: widget.routeAndNavigatorSettings?.navigatorKey,
4747
onGenerateRoute: _onGenerateRoute,
4848
onUnknownRoute: _onUnknownRoute,
4949
observers: _navigatorObservers as List<NavigatorObserver>,
@@ -56,8 +56,8 @@ class _CustomTabViewState extends State<_CustomTabView> {
5656
if (name == Navigator.defaultRouteName && widget.builder != null) {
5757
routeBuilder = widget.builder;
5858
//title = widget.defaultTitle;
59-
} else if (widget.routeAndNavigatorSettings!.routes != null) {
60-
routeBuilder = widget.routeAndNavigatorSettings!.routes![name!];
59+
} else if (widget.routeAndNavigatorSettings?.routes != null) {
60+
routeBuilder = widget.routeAndNavigatorSettings?.routes![name!];
6161
}
6262
if (routeBuilder != null) {
6363
return PageRouteBuilder(
@@ -68,19 +68,19 @@ class _CustomTabViewState extends State<_CustomTabView> {
6868
final secondaryAnimation, final child) =>
6969
child,
7070
settings: RouteSettings(
71-
name: widget.routeAndNavigatorSettings!.initialRoute ??
71+
name: widget.routeAndNavigatorSettings?.initialRoute ??
7272
"/9f580fc5-c252-45d0-af25-9429992db112"),
7373
);
7474
}
75-
if (widget.routeAndNavigatorSettings!.onGenerateRoute != null) {
76-
return widget.routeAndNavigatorSettings!.onGenerateRoute!(settings);
75+
if (widget.routeAndNavigatorSettings?.onGenerateRoute != null) {
76+
return widget.routeAndNavigatorSettings?.onGenerateRoute!(settings);
7777
}
7878
return null;
7979
}
8080

8181
Route<dynamic>? _onUnknownRoute(final RouteSettings settings) {
8282
assert(() {
83-
if (widget.routeAndNavigatorSettings!.onUnknownRoute == null) {
83+
if (widget.routeAndNavigatorSettings?.onUnknownRoute == null) {
8484
throw FlutterError(
8585
"Could not find a generator for route $settings in the $runtimeType.\n"
8686
"Generators for routes are searched for in the following order:\n"
@@ -95,7 +95,7 @@ class _CustomTabViewState extends State<_CustomTabView> {
9595
return true;
9696
}(), "");
9797
final Route<dynamic>? result =
98-
widget.routeAndNavigatorSettings!.onUnknownRoute!(settings);
98+
widget.routeAndNavigatorSettings?.onUnknownRoute!(settings);
9999
assert(() {
100100
if (result == null) {
101101
throw FlutterError("The onUnknownRoute callback returned null.\n"

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: A highly customizable persistent/static bottom navigation bar for f
33

44
homepage: https://github.com/BilalShahid13/PersistentBottomNavBar
55
repository: https://github.com/BilalShahid13/PersistentBottomNavBar
6-
version: 6.2.0
6+
version: 6.2.1
77

88
environment:
99
sdk: '>=2.12.0 <4.0.0'

0 commit comments

Comments
 (0)