Dn-a / flutter_inner_drawer

Inner Drawer is an easy way to create an internal side section (left/right) where you can insert a list-menu or other.
https://pub.dartlang.org/packages/flutter_inner_drawer
MIT License
514 stars 129 forks source link

tapScaffoldEnabled: false, rebuilds whole page. #47

Closed watsmyname closed 4 years ago

watsmyname commented 4 years ago

I am using InnerDrawer with PageView. But I have observed two things -

  1. tapScaffoldEnabled: false, every slightest gesture to open close drawer rebuilds the page
  2. tapScaffoldEnabled: true, no rebuild. Works as aspected
return Material(
      child: InnerDrawer(
        key: _innerDrawerKey,
        tapScaffoldEnabled: false, //ISSUE HERE WHOLE PAGE GETS REBUILD
        onTapClose: true, // default false
        swipe: true, // default true
        colorTransitionChild: Colors.transparent,
        scale: IDOffset.horizontal(0.8), // set the offset in both directions
        proportionalChildArea: true, // default true
        borderRadius: 20, // default 0
        boxShadow: [BoxShadow(color: Colors.transparent, blurRadius: 0)],
        rightAnimationType: InnerDrawerAnimation.quadratic,
        backgroundDecoration: BoxDecoration(
          gradient: LinearGradient(
            begin: Alignment.topLeft,
            end: Alignment.bottomRight,
            colors: [
              Colors.green,
              Colors.blue
            ],
          ),
        ), // default  Theme.of(context).backgroundColor
        rightChild: appRightMenu(), // required if leftChild is not set
        scaffold: Scaffold(
          body: PageView(
            physics: NeverScrollableScrollPhysics(),
            controller: _pageController,
            onPageChanged: onPageChanged,
            children: <Widget>[
              PageOne(),
              PageTwo(),
              PageThree(),
              PageFour(),
            ],
          ),
          bottomNavigationBar: BottomNavigationBar(
                  // showUnselectedLabels: false,
                  backgroundColor: ConfigSettings.baseColor,
                  unselectedItemColor: Colors.white54,
                  items: <BottomNavigationBarItem>[
                    BottomNavigationBarItem(
                      icon: Icon(CustomIcons.home, size: 20),
                      title: Text(translate("START"),
                          style: TextStyle(fontSize: 12)),
                    ),
                    BottomNavigationBarItem(
                      icon: Icon(CustomIcons.realtime, size: 20),
                      title: Text(translate("REALTIME_TRACKING"),
                          style: TextStyle(fontSize: 12)),
                    ),
                    BottomNavigationBarItem(
                      icon: Icon(CustomIcons.triplog, size: 22),
                      title: Text(translate("TRIPLOG"),
                          style: TextStyle(fontSize: 12)),
                    ),
                    BottomNavigationBarItem(
                      icon: const Icon(CustomIcons.units, size: 22),
                      title: Text(translate("CHOOSE_UNIT"),
                          style: TextStyle(fontSize: 12)),
                    ),
                    BottomNavigationBarItem(
                      icon: const Icon(CustomIcons.menu, size: 22),
                      title: Text(translate("MENU"),
                          style: TextStyle(fontSize: 12)),
                    ),
                  ],
                  type: BottomNavigationBarType.fixed,
                  currentIndex: _page,
                  iconSize: 24,
                  selectedItemColor: Colors.white38,
                  /*showSelectedLabels: false,  
            showUnselectedLabels: false,*/
                  onTap: navigationTapped,
                ),
        ),
      ),
    )
doppio commented 4 years ago

@Dn-a Does the "Observation" label mean this isn't a bug to be fixed? The current behavior makes the package unusable for my app, since a rebuild is very expensive and also causes one-time animations in my scaffold to fire repeatedly.

Dn-a commented 4 years ago

@doppio @watsmyname try version 0.5.7+2