Comments (11)
@pedromassango Is it not a problem that TitledBottomNavigationBar
does both super(key: key)
and SafeArea(child: Container(key: widget.key,
? Seems like that might be a bad thing to do with a GlobalKey
?
from titled_navigation_bar.
it seems that you are tying to reuse a key. Keys must be unique across the app.
See the last line's cooment:
" A GlobalKey can only be specified on one widget at a time in the widget tree"
from titled_navigation_bar.
@pedromassango no, i am creating key in stateful widget and using it only inside navigation bar. Still i'm out of clue why it is showing error.
from titled_navigation_bar.
As the message says, you are using it more than once
from titled_navigation_bar.
@pedromassango Here's my code please have a look:
import 'package:flutter/material.dart';
import 'package:titled_navigation_bar/titled_navigation_bar.dart';
class TesterPage extends StatefulWidget {
@override
_TesterPageState createState() => _TesterPageState();
}
class _TesterPageState extends State<TesterPage> {
final GlobalKey _navigationBarKey = GlobalKey();
@override
Widget build(BuildContext context) {
return Scaffold(
bottomNavigationBar: TitledBottomNavigationBar(
key: _navigationBarKey,
onTap: (int index) {
print(index.toString());
},
items: [
TitledNavigationBarItem(title: 'Home', icon: Icons.home),
TitledNavigationBarItem(title: 'Help', icon: Icons.help),
TitledNavigationBarItem(title: 'Account', icon: Icons.person),
],
),
body: Center(
child: RaisedButton(
child: Text("Test"),
onPressed: () {
final TitledBottomNavigationBar navigationBar = _navigationBarKey.currentWidget;
navigationBar.onTap(1);
},
),
),
);
}
}
from titled_navigation_bar.
@jamesderlin any possible solution for my issue? I want to navigate to other tab of navigation bar programmatically. i used global key because i of .currentWidget
property
from titled_navigation_bar.
@pedromassango Please do something for this. I want to achieve this:
from titled_navigation_bar.
Thanks @jamesderlin. I fixed it on the latest version
from titled_navigation_bar.
@sukhcha-in are you using any state management pattern like Bloc or Redux?
from titled_navigation_bar.
@pedromassango no, i am just using in built state functions.
from titled_navigation_bar.
@pedromassango Thanks for recent update :) solved this without even using a key.
from titled_navigation_bar.
Related Issues (20)
- Dark Mode, Tab has White Line above. HOT 2
- Notch support HOT 2
- issues to change currentIndex and change animation ! HOT 9
- ! HOT 1
- Ability to use a widget rather than a TitledNavBarItem? HOT 2
- Problem while making rounded corners. HOT 1
- Internal SafeArea is generating unexpected bottom space HOT 2
- wrong indicator position in rtl mode
- Title Text Size HOT 2
- support for change height of indicator and bottom bar
- Navigation bar doesn't account for bottom view padding
- Change icon type
- caching the page HOT 1
- Migrate to null safety
- Badge Notifications on Icons? HOT 2
- Cant remove the bottom bar even though I intend to disposing it. HOT 1
- Does not support dark mode
- nullsafety prerelease not working :(
- Add Widget
- Only Icons
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 titled_navigation_bar.