pedromassango / bottom_navy_bar

A beautiful and animated bottom navigation
https://youtu.be/jJPSKEEiN-E
Apache License 2.0
1.04k stars 219 forks source link

Too laggy #49

Closed mhbdev closed 4 years ago

mhbdev commented 4 years ago

This is so Laggy!!! Is there any way to solve this problem?

pedromassango commented 4 years ago

Thanks for your feedback. Can you explain what is going wrong?

djaygit commented 4 years ago

yes its laggy for me too, i thought flutter is slow lol (new to flutter)

https://im7.ezgif.com/tmp/ezgif-7-a146cff81d9a.gif

pedromassango commented 4 years ago

Can you show me your implementation?

djaygit commented 4 years ago
class _MainTabScreenState extends State<MainTabScreen> {

  int _currentIndex = 0;
  PageController _pageController;

  @override
  void initState() {
    super.initState();
    _pageController = PageController();
  }

  @override
  void dispose() {
    _pageController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SizedBox.expand(
        child: PageView(
          controller: _pageController,
          onPageChanged: (index) {
            setState(() => _currentIndex = index);
          },
          children: <Widget>[
            Profile(),
            SwipeFeedPage(),
            ChatList(),
          ],
        ),
      ),
      bottomNavigationBar: BottomNavyBar(
        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
        backgroundColor: Colors.white,
        selectedIndex: _currentIndex,
        onItemSelected: (index) {
          setState(() => _currentIndex = index);
          _pageController.jumpToPage(index);
        },
        items: <BottomNavyBarItem>[
          BottomNavyBarItem(
            title: Text('Profile'),
            icon: Icon(Icons.supervised_user_circle),
            activeColor: Colors.red,
            textAlign: TextAlign.center,
          ),
          BottomNavyBarItem(
            title: Text('MatchBox'),
            icon: Icon(Icons.apps),
            textAlign: TextAlign.center,
          ),
          BottomNavyBarItem(
            title: Text('Message'),
            icon: Icon(Icons.chat_bubble),
            textAlign: TextAlign.center,
          ),
        ],
      ),
    );
  }
}
djaygit commented 4 years ago

what do you think?

pedromassango commented 4 years ago

Sorry I tested your code but didn't come to give you a feedback. Your code is working fine here. Have you any other piece of code that can cause this behaviour?

aresares commented 4 years ago

what do you think?

it's lag also to me but only when the widget that is going to open is to complex, heavy

pedromassango commented 4 years ago

it's lag also to me but only when the widget that is going to open is to complex, heavy

What type of heavy complexity/operations are you doing there?

Maybe the problem is not related to this package

aresares commented 4 years ago

it's lag also to me but only when the widget that is going to open is to complex, heavy

What type of heavy complexity/operations are you doing there?

Maybe the problem is not related to this package

I don't think it's related to your library. It lags to me when it's going to open a widget with a lot of lines (complex, many other widgetsh inside). With light layouts it's not lagging

mhbdev commented 4 years ago

Hey guys try running your apps in profile mode using --profile argument! That's not laggy that much in release mode or profile mode!!!

pedromassango commented 4 years ago

it's lag also to me but only when the widget that is going to open is to complex, heavy

What type of heavy complexity/operations are you doing there? Maybe the problem is not related to this package

I don't think it's related to your library. It lags to me when it's going to open a widget with a lot of lines (complex, many other widgetsh inside). With light layouts it's not lagging

Good. So I will close this for now, But the chat can continue here...