Comments (6)
I almost forget, I'm using go router
for routes and navigation stuff
from animated_notch_bottom_bar.
Full log
══╡ EXCEPTION CAUGHT BY FOUNDATION LIBRARY ╞════════════════════════════════════════════════════════
The following assertion was thrown while dispatching notifications for NotchBottomBarController:
AnimationController.stop() called after AnimationController.dispose()
AnimationController methods should not be used after calling dispose.
'package:flutter/src/animation/animation_controller.dart':
Failed assertion: line 772 pos 7: '_ticker != null'
Either the assertion indicates an error in the framework itself, or we should provide substantially
more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=2_bug.yml
When the exception was thrown, this was the stack:
#2 AnimationController.stop (package:flutter/src/animation/animation_controller.dart:772:7)
#3 AnimationController.value= (package:flutter/src/animation/animation_controller.dart:361:5)
#4 AnimationController.reset (package:flutter/src/animation/animation_controller.dart:382:5)
#5 _AnimatedNotchBottomBarState.initState.<anonymous closure> (package:animated_notch_bottom_bar/src/notch_bottom_bar.dart:106:28)
#6 ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:403:24)
#7 NotchBottomBarController.jumpTo (package:animated_notch_bottom_bar/src/notch_bottom_bar_controller.dart:12:5)
#8 _AnimatedNotchBottomBarState.build.<anonymous closure>.<anonymous closure> (package:animated_notch_bottom_bar/src/notch_bottom_bar.dart:218:38)
#9 BottomBarInActiveItem.build.<anonymous closure> (package:animated_notch_bottom_bar/src/bottom_bar_inactive_item.dart:35:25)
#10 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:275:24)
#11 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:654:11)
#12 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:311:5)
#13 BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:244:7)
#14 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:630:9)
#15 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:98:12)
#16 PointerRouter._dispatchEventToRoutes.<anonymous closure> (package:flutter/src/gestures/pointer_router.dart:143:9)
#17 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:625:13)
#18 PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:141:18)
#19 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:127:7)
#20 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:488:19)
#21 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:468:22)
#22 RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:333:11)
#23 GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:413:7)
#24 GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:376:5)
#25 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:323:7)
#26 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:292:9)
#27 _invoke1 (dart:ui/hooks.dart:186:13)
#28 PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:424:7)
#29 _dispatchPointerDataPacket (dart:ui/hooks.dart:119:31)
(elided 2 frames from class _AssertionError)
The NotchBottomBarController sending notification was:
Instance of 'NotchBottomBarController'
═══════════════════════════════════════════════════════════════════════════════════════════════════
from animated_notch_bottom_bar.
import 'dart:developer';
import 'package:animated_notch_bottom_bar/animated_notch_bottom_bar/animated_notch_bottom_bar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:go_router/go_router.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
MyApp({Key? key}) : super(key: key);
final GoRouter _router = GoRouter(
routes: <RouteBase>[
GoRoute(
path: '/',
builder: (BuildContext context, GoRouterState state) {
return const MyHomePage();
},
),
],
);
@override
Widget build(BuildContext context) {
return MaterialApp.router(
routerConfig: _router,
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
/// Controller to handle PageView and also handles initial page
final List<Widget> _items = const <Widget>[
Page2(),
Page3(),
Page1(),
];
late PageController _pageController;
late NotchBottomBarController _notchBottomBarController;
@override
void initState() {
_pageController = PageController();
_notchBottomBarController = NotchBottomBarController();
super.initState();
}
@override
void dispose() {
_pageController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: PageView(
scrollDirection: Axis.vertical,
controller: _pageController,
physics: const NeverScrollableScrollPhysics(),
children: List<Widget>.generate(
_items.length,
(int index) => Container(
margin: const EdgeInsets.only(),
child: _items[index],
),
),
),
extendBody: true,
bottomNavigationBar: AnimatedNotchBottomBar(
durationInMilliSeconds: 400,
notchBottomBarController: _notchBottomBarController,
showLabel: false,
bottomBarItems: <BottomBarItem>[
const BottomBarItem(
inActiveItem: Icon(
Icons.home_filled,
color: Colors.blueGrey,
),
activeItem: Icon(
Icons.home_filled,
color: Colors.blueAccent,
),
itemLabel: 'Page 1',
),
const BottomBarItem(
inActiveItem: Icon(
Icons.star,
color: Colors.blueGrey,
),
activeItem: Icon(
Icons.star,
color: Colors.blueAccent,
),
itemLabel: 'Page 2',
),
///svg example
BottomBarItem(
inActiveItem: SvgPicture.asset(
'assets/search_icon.svg',
color: Colors.blueGrey,
),
activeItem: SvgPicture.asset(
'assets/search_icon.svg',
color: Colors.white,
),
itemLabel: 'Page 3',
),
],
onTap: (index) {
/// perform action on tab change and to update pages you can update pages without pages
log('current selected index $index');
_pageController.jumpToPage(index);
},
),
);
Future<void> _changeBottomBarItem(int index) async {
_pageController.animateToPage(index, duration: const Duration(milliseconds: 400), curve: Curves.easeInOut);
}
}
}
class Page1 extends StatelessWidget {
const Page1({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(color: Colors.yellow, child: const Center(child: Text('Page 1')));
}
}
class Page2 extends StatelessWidget {
const Page2({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(color: Colors.green, child: const Center(child: Text('Page 2')));
}
}
class Page3 extends StatelessWidget {
const Page3({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(color: Colors.red, child: const Center(child: Text('Page 3')));
}
}
// class Page4 extends StatelessWidget {
// const Page4({Key? key}) : super(key: key);
//
// @override
// Widget build(BuildContext context) {
// return Container(color: Colors.blue, child: const Center(child: Text('Page 4')));
// }
// }
//
// class Page5 extends StatelessWidget {
// const Page5({Key? key}) : super(key: key);
//
// @override
// Widget build(BuildContext context) {
// return Container(color: Colors.lightGreenAccent, child: const Center(child: Text('Page 5')));
// }
// }
@FilyMSakine using your code i create demo and its work fine you can try above code and if found any issue please give me more details so i can regenerate that issues and find solutions for you
from animated_notch_bottom_bar.
@mi-raj04 alright
// my custom go_router
import ...
class CustomGoRouter {
static bool redirected = false;
static GoRouter configuration() => GoRouter(
routes: <RouteBase>[...],
redirect: (context, state) {
if (getIt<SharedPreferencesClient>()
.restoreUserAuthenticationFields() !=
null &&
!redirected) {
redirected = true;
return RouterPath.rootLocation;
}
return state.fullPath;
},
);
static void go(BuildContext context, String routerPath) {
GoRouter.of(context).go(routerPath);
}
static Future<void> push(BuildContext context, String routerPath) async {
GoRouter.of(context).push(routerPath);
}
static void pop(BuildContext context) {
GoRouter.of(context).pop();
}
}
My material page definition
import ...
class App extends StatefulWidget {
const App({super.key});
@override
State<StatefulWidget> createState() => _AppState();
}
class _AppState extends State<App> {
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return Sizer(
builder: (BuildContext context, Orientation orientation,
DeviceType deviceType) =>
MaterialApp.router(
routerConfig: CustomGoRouter.configuration(),
theme: ThemeData(...),
localizationsDelegates: const <LocalizationsDelegate<dynamic>>[...],
supportedLocales: const <Locale>[...],
debugShowCheckedModeBanner: false,
),
);
}
}
from animated_notch_bottom_bar.
@mi-raj04 I have the same pageview definition and I'm using jumpToPage(index)
method on onTap
event
Also I have updated my flutter SDK and the package but I'm still getting the same issue
Flutter log
Flutter 3.16.7 • channel stable • https://github.com/flutter/flutter.git
Framework • revision ef1af02aea (12 days ago) • 2024-01-11 15:19:26 -0600
Engine • revision 4a585b7929
Tools • Dart 3.2.4 • DevTools 2.28.5
Packager animated_notch_bottom_bar: ^1.0.1
from animated_notch_bottom_bar.
@FilyMSakine Thank you for expressing your confidence in our team. Unfortunately, after thorough investigation, we were unable to reproduce the issue you mentioned. We explored various approaches to address the issue but encountered no success. Your assistance in providing further details regarding the issue would be greatly appreciated. Additionally, we welcome any contributions or insights you may have to improve our package.
from animated_notch_bottom_bar.
Related Issues (20)
- can't find margin field and borderRadius field. HOT 1
- Functionality to use the widget without the dependency of the pageview HOT 1
- right to left align dosent work when use locale: const Locale('fa', 'IR'), HOT 1
- Functionality to limit the width of AnimatedNotchBottomBar for wider screens like macOS, web, tabs, etc HOT 1
- Functionality to use it upside down for tabbar HOT 3
- Default first BottomBarItem HOT 1
- Elevation HOT 1
- Expected a value of type 'JavaScriptObject', but got one of type 'Null' Error for web? HOT 1
- [Feature Request] Gradient "notchColor" HOT 1
- Change icon size HOT 2
- remove right-bottom and left bottom radius HOT 3
- Can showShadow be separated from roundedEdges? HOT 1
- Is there a way to set height of bottom bar HOT 2
- Can i remove the navbar from another page that's not listed in the bottomBarPages list HOT 2
- Layout goes up too far when keypad showing HOT 4
- Safe Area! HOT 1
- Make BottomBarItem.itemLabel of type Text
- NotchBottomBarController jumpTo cause of no animation HOT 2
- No arguments to set bar item margin(or padding)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from animated_notch_bottom_bar.