Comments (11)
from google_nav_bar.
could u provide a minimal reproducible code?
…
On Tue, 22 Mar 2022 at 9:46 PM, Pk @.> wrote: E/flutter ( 7192): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: setState() called after dispose(): _GNavState#fb094(lifecycle state: defunct, not mounted) E/flutter ( 7192): This error happens if you call setState() on a State object for a widget that no longer appears in the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error can occur when code calls setState() from a timer or an animation callback. E/flutter ( 7192): The preferred solution is to cancel the timer or stop listening to the animation in the dispose() callback. Another solution is to check the "mounted" property of this object before calling setState() to ensure the object is still in the tree. E/flutter ( 7192): This error might indicate a memory leak if setState() is being called because another object is retaining a reference to this State object after it has been removed from the tree. To avoid memory leaks, consider breaking the reference to this object during dispose(). — Reply to this email directly, view it on GitHub <#75>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGCEC7AHFHPEMJLAFM7D73VBHFJ7ANCNFSM5RK6EZ7A . You are receiving this because you are subscribed to this thread.Message ID: @.>
bottomNavigationBar: Container(
// height: kBottomNavigationBarHeight,
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
blurRadius: 20,
color: Colors.black.withOpacity(.1),
)
],
),
child: SafeArea(
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 24.0, vertical: 8),
child: GNav(
rippleColor: AppColor.surfaceDisabled1,
hoverColor: AppColor.surfaceDisabled1,
gap: 4,
activeColor: AppColor.splash,
iconSize: 24,
padding:
const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
tabBackgroundColor: AppColor.surfaceDisabled1,
color: AppColor.surfaceDisabled1,
tabs: [
GButton(
leading: Image.asset(
Images.tab1,
height: 24,
width: 24,
),
text: 'tab1'.tr,
textStyle: AppTextStyle.addBtnTxt
.copyWith(color: AppColor.primaryFontBlack),
icon: null,
),
GButton(
leading: Image.asset(
Images.tab2,
height: 24,
width: 24,
),
text: 'tab2'.tr,
textStyle: AppTextStyle.addBtnTxt
.copyWith(color: AppColor.primaryFontBlack),
icon: null,
),
GButton(
leading: Image.asset(
Images.tab3,
height: 24,
width: 24,
),
text: 'tab3'.tr,
textStyle: AppTextStyle.addBtnTxt
.copyWith(color: AppColor.primaryFontBlack),
icon: null,
),
GButton(
leading: Image.asset(
Images.tab4,
height: 24,
width: 24,
),
text: 'tab4'.tr,
textStyle: AppTextStyle.addBtnTxt
.copyWith(color: AppColor.primaryFontBlack),
icon: null,
),
],
selectedIndex: _selectedIndex,
onTabChange: (index) {
if (mounted)
setState(() {
_selectedIndex = index;
_onItemTapped(index);
});
},
),
),
),
),
from google_nav_bar.
from google_nav_bar.
I’m not able to run this, onItemTapped is missing
…
On Tue, 22 Mar 2022 at 9:59 PM, Pk @.***> wrote: could u provide a minimal reproducible code? … <#m_587440306533223400> On Tue, 22 Mar 2022 at 9:46 PM, Pk @.> wrote: E/flutter ( 7192): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: setState() called after dispose(): _GNavState#fb094(lifecycle state: defunct, not mounted) E/flutter ( 7192): This error happens if you call setState() on a State object for a widget that no longer appears in the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error can occur when code calls setState() from a timer or an animation callback. E/flutter ( 7192): The preferred solution is to cancel the timer or stop listening to the animation in the dispose() callback. Another solution is to check the "mounted" property of this object before calling setState() to ensure the object is still in the tree. E/flutter ( 7192): This error might indicate a memory leak if setState() is being called because another object is retaining a reference to this State object after it has been removed from the tree. To avoid memory leaks, consider breaking the reference to this object during dispose(). — Reply to this email directly, view it on GitHub <#75 <#75>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGCEC7AHFHPEMJLAFM7D73VBHFJ7ANCNFSM5RK6EZ7A https://github.com/notifications/unsubscribe-auth/ADGCEC7AHFHPEMJLAFM7D73VBHFJ7ANCNFSM5RK6EZ7A . You are receiving this because you are subscribed to this thread.Message ID: @.> bottomNavigationBar: Container( // height: kBottomNavigationBarHeight, decoration: BoxDecoration( color: Colors.white, boxShadow: [ BoxShadow( blurRadius: 20, color: Colors.black.withOpacity(.1), ) ], ), child: SafeArea( child: Padding( padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 8), child: GNav( rippleColor: AppColor.surfaceDisabled1, hoverColor: AppColor.surfaceDisabled1, gap: 4, activeColor: AppColor.splash, iconSize: 24, padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6), tabBackgroundColor: AppColor.surfaceDisabled1, color: AppColor.surfaceDisabled1, tabs: [ GButton( leading: Image.asset( Images.tab1, height: 24, width: 24, ), text: 'tab1'.tr, textStyle: AppTextStyle.addBtnTxt .copyWith(color: AppColor.primaryFontBlack), icon: null, ), GButton( leading: Image.asset( Images.tab2, height: 24, width: 24, ), text: 'tab2'.tr, textStyle: AppTextStyle.addBtnTxt .copyWith(color: AppColor.primaryFontBlack), icon: null, ), GButton( leading: Image.asset( Images.tab3, height: 24, width: 24, ), text: 'tab3'.tr, textStyle: AppTextStyle.addBtnTxt .copyWith(color: AppColor.primaryFontBlack), icon: null, ), GButton( leading: Image.asset( Images.tab4, height: 24, width: 24, ), text: 'tab4'.tr, textStyle: AppTextStyle.addBtnTxt .copyWith(color: AppColor.primaryFontBlack), icon: null, ), ], selectedIndex: _selectedIndex, onTabChange: (index) { if (mounted) setState(() { _selectedIndex = index; _onItemTapped(index); }); }, ), ), ), ), — Reply to this email directly, view it on GitHub <#75 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGCEC2CGGW3Q2OT544LPNTVBHG2NANCNFSM5RK6EZ7A . You are receiving this because you commented.Message ID: @.***>
List<Widget> _pages;
Widget _page1;
Widget _page2;
Widget _page3;
Widget _page4;
int _selectedIndex;
Widget _currentPage;
@override
void initState() {
super.initState();
_page1 = const Tab1();
_page2 = const Tab2();
_page3 = const Tab3();
_page4 = const Tab4();
_pages = [_page1, _page2, _page3, _page4];
_selectedIndex = 0;
_currentPage = _page1;
}
void _onItemTapped(int index) {
if (mounted)
setState(() {
_selectedIndex = index;
_currentPage = _pages[index];
});
}
from google_nav_bar.
from google_nav_bar.
Could you just send me a complete file that is runnable? currentPage Is missing
…
On Tue, 22 Mar 2022 at 10:06 PM, Pk @.> wrote: I’m not able to run this, onItemTapped is missing … <#m_3194987528613587962_> On Tue, 22 Mar 2022 at 9:59 PM, Pk @.> wrote: could u provide a minimal reproducible code? … <#m_587440306533223400> On Tue, 22 Mar 2022 at 9:46 PM, Pk @.> wrote: E/flutter ( 7192): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: setState() called after dispose(): _GNavState#fb094(lifecycle state: defunct, not mounted) E/flutter ( 7192): This error happens if you call setState() on a State object for a widget that no longer appears in the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error can occur when code calls setState() from a timer or an animation callback. E/flutter ( 7192): The preferred solution is to cancel the timer or stop listening to the animation in the dispose() callback. Another solution is to check the "mounted" property of this object before calling setState() to ensure the object is still in the tree. E/flutter ( 7192): This error might indicate a memory leak if setState() is being called because another object is retaining a reference to this State object after it has been removed from the tree. To avoid memory leaks, consider breaking the reference to this object during dispose(). — Reply to this email directly, view it on GitHub <#75 <#75> <#75 <#75>>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGCEC7AHFHPEMJLAFM7D73VBHFJ7ANCNFSM5RK6EZ7A https://github.com/notifications/unsubscribe-auth/ADGCEC7AHFHPEMJLAFM7D73VBHFJ7ANCNFSM5RK6EZ7A https://github.com/notifications/unsubscribe-auth/ADGCEC7AHFHPEMJLAFM7D73VBHFJ7ANCNFSM5RK6EZ7A https://github.com/notifications/unsubscribe-auth/ADGCEC7AHFHPEMJLAFM7D73VBHFJ7ANCNFSM5RK6EZ7A . You are receiving this because you are subscribed to this thread.Message ID: @.> bottomNavigationBar: Container( // height: kBottomNavigationBarHeight, decoration: BoxDecoration( color: Colors.white, boxShadow: [ BoxShadow( blurRadius: 20, color: Colors.black.withOpacity(.1), ) ], ), child: SafeArea( child: Padding( padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 8), child: GNav( rippleColor: AppColor.surfaceDisabled1, hoverColor: AppColor.surfaceDisabled1, gap: 4, activeColor: AppColor.splash, iconSize: 24, padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6), tabBackgroundColor: AppColor.surfaceDisabled1, color: AppColor.surfaceDisabled1, tabs: [ GButton( leading: Image.asset( Images.tab1, height: 24, width: 24, ), text: 'tab1'.tr, textStyle: AppTextStyle.addBtnTxt .copyWith(color: AppColor.primaryFontBlack), icon: null, ), GButton( leading: Image.asset( Images.tab2, height: 24, width: 24, ), text: 'tab2'.tr, textStyle: AppTextStyle.addBtnTxt .copyWith(color: AppColor.primaryFontBlack), icon: null, ), GButton( leading: Image.asset( Images.tab3, height: 24, width: 24, ), text: 'tab3'.tr, textStyle: AppTextStyle.addBtnTxt .copyWith(color: AppColor.primaryFontBlack), icon: null, ), GButton( leading: Image.asset( Images.tab4, height: 24, width: 24, ), text: 'tab4'.tr, textStyle: AppTextStyle.addBtnTxt .copyWith(color: AppColor.primaryFontBlack), icon: null, ), ], selectedIndex: _selectedIndex, onTabChange: (index) { if (mounted) setState(() { _selectedIndex = index; _onItemTapped(index); }); }, ), ), ), ), — Reply to this email directly, view it on GitHub <#75 (comment) <#75 (comment)>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGCEC2CGGW3Q2OT544LPNTVBHG2NANCNFSM5RK6EZ7A . You are receiving this because you commented.Message ID: @.> void _onItemTapped(int index) { if (mounted) setState(() { _selectedIndex = index; _currentPage = _pages[index]; }); } — Reply to this email directly, view it on GitHub <#75 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGCECZ6TAIFJT4VL642PZ3VBHHU3ANCNFSM5RK6EZ7A . You are receiving this because you commented.Message ID: @.>
https://gist.github.com/pradeep14598/b191d0bacd5ae9d67d1e6094152a4183
from google_nav_bar.
@pradeep14598 the DashboardController is missing, could you make it runnable first in one single file?
from google_nav_bar.
@pradeep14598 the DashboardController is missing, could you make it runnable first in one single file?
https://gist.github.com/pradeep14598/b191d0bacd5ae9d67d1e6094152a4183
from google_nav_bar.
@pradeep14598 you shouldnt put your final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
inside the build function
you should put at here
class Test extends StatefulWidget {
final String? title;
final GlobalKey<ScaffoldState> _scaffoldkey = new GlobalKey<ScaffoldState>();
Test({@required this.title});
@override
_TestState createState() => _TestState();
}
class _TestState extends State<Test> {
@override
Widget build(BuildContext context) {
}
}
from google_nav_bar.
@pradeep14598 you shouldnt put your
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
inside the build functionyou should put at here
class Test extends StatefulWidget { final String? title; final GlobalKey<ScaffoldState> _scaffoldkey = new GlobalKey<ScaffoldState>(); Test({@required this.title}); @override _TestState createState() => _TestState(); } class _TestState extends State<Test> { @override Widget build(BuildContext context) { } }
Hai @sooxt98 ,Thanks for your solution and your awesome plugin ,is there any feature for adding badges in tab
from google_nav_bar.
@pradeep14598 you could look into this badge example https://github.com/sooxt98/google_nav_bar/blob/master/example/lib/main_advance.dart
from google_nav_bar.
Related Issues (20)
- How to center the icon without text? HOT 5
- Set the height of the navigation bar
- Make the state class _GNavState public HOT 12
- how to remove elevation from the nav bar HOT 3
- how to make resize screen ? HOT 3
- Feature request : Add color/gradient for unselected tab background HOT 1
- Debug console shows this message "ensureControlAlpha: for ITYPE_NAVIGATION_BAR" when GNav does not show? HOT 1
- Change icon type; use Widget instead of IconData HOT 1
- How to stop clicking and changing status HOT 1
- How to me Floating action Button center docked with this Bottom AppBar HOT 2
- Could you add elevation for the selected tab? HOT 1
- The bar overflows on small screens and throws error HOT 3
- how to navigate between pages HOT 3
- Nothing Find For Implement for own coustom icon
- GNav
- How can I set the fixed length of the activated GButton? HOT 2
- How can i disable tabs? HOT 2
- Create Vertical nav bar using google_nav_bar
- Icon and text mis-allign HOT 1
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 google_nav_bar.