dxvid-pts / miniplayer

A lightweight flutter package to simplify the creation of a miniplayer.
https://pub.dev/packages/miniplayer
MIT License
106 stars 79 forks source link

Do you have an example code to use the MiniplayerController? #7

Closed hatsadin09 closed 3 years ago

hatsadin09 commented 3 years ago

Do you have an example code to use the MiniplayerController? I saw your update in the repository but it was called on null when I use likes this

            Miniplayer(
              minHeight: 70,
              maxHeight: 370,
              builder: (height, percentage) {
                return Center(
                  child: Text('$height, $percentage'),
                );
              },
              onDismiss: () {
                //Handle onDismissed here
              },
              controller: controller,
            ),

            RaisedButton(
              onPressed: () {
                // print(controller);
                controller.animateToHeight(state: PanelState.MAX); // **when i click this**
              },
              child: const Text('1', style: TextStyle(fontSize: 20)),
            )
The method 'animateToHeight' was called on null.
Receiver: null
Tried calling: animateToHeight(state: Instance of 'PanelState')
dxvid-pts commented 3 years ago

Did you declare the controller variable? final MiniplayerController controller = MiniplayerController();

hatsadin09 commented 3 years ago

Did you declare the controller variable? final MiniplayerController controller = MiniplayerController();

Oh, thanks a lot, I forgot = MiniplayerController();

I have one more question, the controller does not available in 0.5.0+5 right? I can not use the controller when import from Pub but I saw in git then I clone it

dxvid-pts commented 3 years ago

I have one more question, the controller does not available in 0.5.0+5 right? I can not use the controller when import from Pub but I saw in git then I clone it

Yes, that's true. The new features will be available in 0.6.0, which I plan to release later this month. Feel free to ask if there're any questions open!