rIIh / expandable-bottom-bar

Expandable bottom app bar widget for Flutter SDK
MIT License
108 stars 27 forks source link

Dragging bottom bar does not work #13

Open Sun3 opened 4 years ago

Sun3 commented 4 years ago

Using the sample code provided by this repo when you try to drag the bottom bar up or down it does not move. Is there a setting to change?

Thanks

ederjavs commented 4 years ago

the secret is the controller

class _MyScreenState extends State<MyScreen> with SingleTickerProviderStateMixin { BottomBarController controlador;

......

@override void initState() { super.initState(); controlador = BottomBarController(vsync: this, dragLength: 450, snap: true); }

floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, floatingActionButton: GestureDetector( // Set onVerticalDrag event to drag handlers of controller for swipe effect onVerticalDragUpdate: controlador.onDrag, onVerticalDragEnd: controlador.onDragEnd, child: FloatingActionButton.extended( heroTag: null, label: Text("Pull up"), elevation: 2, backgroundColor: Colors.deepOrange, foregroundColor: Colors.white,

      //Set onPressed event to swap state of bottom bar
      onPressed: () {
        print("object");
        controlador.swap();
      },
    ),
  ),
  bottomNavigationBar: BottomExpandableAppBar(
    controller: controlador,
    expandedHeight: 550,
    horizontalMargin: 16,
    shape: AutomaticNotchedShape(
        RoundedRectangleBorder(), StadiumBorder(side: BorderSide())),
    expandedBackColor: Colors.white,
    expandedBody: Center(
      child: Text("Hello world!"),
    ),
    bottomAppBarBody: Padding(
      padding: const EdgeInsets.all(8.0),
      child: Row(
        mainAxisSize: MainAxisSize.max,
        children: <Widget>[
          Expanded(
            child: Text(
              "Tets",
              textAlign: TextAlign.center,
            ),
          ),
          Spacer(
            flex: 2,
          ),
          Expanded(
            child: Text(
              "Stet",
              textAlign: TextAlign.center,
            ),
          ),
        ],
      ),
    ),
  ),