A sliding up panel widget which can be used to show or hide content, beautiful and simple.

Overview

flutter_sliding_up_panel

A sliding up panel widget which can be used to show or hide content, beautiful and simple.

demo

Getting Started

dependencies:
  flutter_sliding_up_panel: ^1.2.1
import 'package:flutter_sliding_up_panel/flutter_sliding_up_panel.dart';
Stack(
  children: <Widget>[
    Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
        actions: <Widget>[
          IconButton(
            icon: Icon(Icons.settings),
            onPressed: () {
              widget.onSetting?.call();
            },
          )
        ],
      ),
      body: Container(
        child:Center(
          child:Text('This is content'),
        ),
      ),
    ),
    SlidingUpPanelWidget(
      child: Container(
        margin: EdgeInsets.symmetric(horizontal: 15.0),
        decoration: ShapeDecoration(
          color: Colors.white,
          shadows: [BoxShadow(blurRadius: 5.0,spreadRadius: 2.0,color: const Color(0x11000000))],
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.only(
              topLeft: Radius.circular(10.0),
              topRight: Radius.circular(10.0),
            ),
          ),
        ),
        child: Column(
          children: <Widget>[
            Container(
              color: Colors.white,
              alignment: Alignment.center,
              height: 50.0,
              child: Row(
                children: <Widget>[
                  Icon(Icons.menu,size: 30,),
                  Padding(
                    padding: EdgeInsets.only(left: 8.0,),
                  ),
                  Text(
                    'click or drag',
                  )
                ],
                mainAxisAlignment: MainAxisAlignment.center,
              ),
            ),
            Divider(
              height: 0.5,
              color: Colors.grey[300],
            ),
            Flexible(
              child: Container(
                child: ListView.separated(
                  controller: scrollController,
                  physics: ClampingScrollPhysics(),
                  itemBuilder: (context, index) {
                    return ListTile(
                      title: Text('list item $index'),
                    );
                  },
                  separatorBuilder: (context, index) {
                    return Divider(
                      height: 0.5,
                    );
                  },
                  shrinkWrap: true,
                  itemCount: 20,
                ),
                color: Colors.white,
              ),
            ),
          ],
          mainAxisSize: MainAxisSize.min,
        ),
      ),
      controlHeight: 50.0,
      anchor: 0.4,
      panelController: panelController,
      onTap: (){
         ///Customize the processing logic
         if(SlidingUpPanelStatus.expanded==panelController.status){
            panelController.collapse();
         }else{
            panelController.expand();
         }
      },  //Pass a onTap callback to customize the processing logic when user click control bar.
      enableOnTap: true,//Enable the onTap callback for control bar.
      dragDown: (details){
         print('dragDown');
      },
      dragStart: (details){
         print('dragStart');
      },
      dragCancel: (){
         print('dragCancel');
      },
      dragUpdate: (details){
         print('dragUpdate,${panelController.status==SlidingUpPanelStatus.dragging?'dragging':''}');
      },
      dragEnd: (details){
         print('dragEnd');
      },
    ),
  ],
);

SlidingUpPanelWidget param

property description
child Widget (Not Null)(required) (Child widget)
controlHeight double (Not Null)(required) (The height of the control bar which could be used to drag or click to control this panel)
animationController AnimationController (The animation that controls the bottom sheet's position.)
panelController SlidingUpPanelController (Not Null)(required) (The controller to control panel)
onStatusChanged OnSlidingUpPanelStatusChanged (Called when the this panel status changed)
elevation double (default 8.0) (Elevation of the panel)
panelStatus SlidingUpPanelStatus (default SlidingUpPanelStatus.collapsed) (Panel status)
anchor double (default 0.5) (The fraction of anchor position, which is from 0 to 1.0)
onTap VoidCallback (default is a build-in callback) (Void callback when click control bar)
enableOnTap bool (Not Null)(default is true) (Enable or disable the tap callback for control bar)
dragDown OnSlidingUpPanelDragDown (default is null) (Drag down listener)
dragStart OnSlidingUpPanelDragStart (default is null) (Drag start listener)
dragUpdate OnSlidingUpPanelDragUpdate (default is null) (Drag update listener)
dragCancel OnSlidingUpPanelDragCancel (default is null) (Drag cancel listener)
dragEnd OnSlidingUpPanelDragEnd (default is null) (Drag end listener)

Example

example

Comments
  • Feature : disable onTap detection

    Feature : disable onTap detection

    Hello,

    Very good work and the simplest to use ! Can you add a boolean to choose if we want to use or not the onTap ?

    onTap: () { if (SlidingUpPanelStatus.anchored == widget.panelController.status) { collapse(); } else if (SlidingUpPanelStatus.collapsed == widget.panelController.status) { anchor(); } else if (SlidingUpPanelStatus.expanded == widget.panelController.status) { collapse(); } else { collapse(); } },

    opened by QuentinSc 1
  • License does not contain year and name of copyright holder

    License does not contain year and name of copyright holder

    As stated in the title, the License is not really complete:

    https://github.com/JackJonson/flutter_sliding_up_panel/blob/ab5da022c67e45a821b2c925906c92673e486326/LICENSE#L189

    opened by geisterfurz007 0
  • Exception when sliding panel

    Exception when sliding panel

    The following assertion was thrown while dispatching notifications for SlidingUpPanelController:
    AnimationController.animateTo() called after AnimationController.dispose()
    AnimationController methods should not be used after calling dispose.
    'package:flutter/src/animation/animation_controller.dart':
    Failed assertion: line 533 pos 7: '_ticker != null'
    
    When the exception was thrown, this was the stack: 
    #2      AnimationController.animateTo (package:flutter/src/animation/animation_controller.dart:533:7)
    #3      _SlidingUpPanelWidgetState.expand (package:flutter_sliding_up_panel/sliding_up_panel_widget.dart:332:26)
    #4      _SlidingUpPanelWidgetState.handlePanelStatusChanged (package:flutter_sliding_up_panel/sliding_up_panel_widget.dart:365:9)
    #5      ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:351:24)
    #6      ValueNotifier.value= (package:flutter/src/foundation/change_notifier.dart:456:5)
    #7      _SlidingUpPanelWidgetState.expand (package:flutter_sliding_up_panel/sliding_up_panel_widget.dart:334:28)
    #8      _SlidingUpPanelWidgetState._handleDragEnd (package:flutter_sliding_up_panel/sliding_up_panel_widget.dart:297:9)
    #9      DragGestureRecognizer._checkEnd.<anonymous closure> (package:flutter/src/gestures/monodrag.dart:521:47)
    #10     GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:253:24)
    #11     DragGestureRecognizer._checkEnd (package:flutter/src/gestures/monodrag.dart:521:5)
    #12     DragGestureRecognizer.didStopTrackingLastPointer (package:flutter/src/gestures/monodrag.dart:426:9)
    #13     OneSequenceGestureRecognizer.stopTrackingPointer (package:flutter/src/gestures/recognizer.dart:446:9)
    #14     DragGestureRecognizer._giveUpPointer (package:flutter/src/gestures/monodrag.dart:435:5)
    #15     DragGestureRecognizer.handleEvent (package:flutter/src/gestures/monodrag.dart:354:7)
    #16     PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:98:12)
    #17     PointerRouter._dispatchEventToRoutes.<anonymous closure> (package:flutter/src/gestures/pointer_router.dart:143:9)
    #18     _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:617:13)
    #19     PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:141:18)
    #20     PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:127:7)
    #21     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:460:19)
    #22     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:440:22)
    #23     RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:337:11)
    #24     GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:395:7)
    #25     GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:357:5)
    #26     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:314:7)
    #27     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:295:7)
    #28     _invoke1 (dart:ui/hooks.dart:167:13)
    #29     PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:341:7)
    #30     _dispatchPointerDataPacket (dart:ui/hooks.dart:94:31)
    (elided 2 frames from class _AssertionError)
    The SlidingUpPanelController sending notification was: SlidingUpPanelController#6b6cf(SlidingUpPanelStatus.expanded)
    
    opened by hoiihop 1
  • Warning: Operand of null-aware operation '!'

    Warning: Operand of null-aware operation '!'

    I am using this package, and it is giving me the following error, when run my project:

    `: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null. ../…/lib/sliding_up_panel_widget.dart:174

    • 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../../Development/flutter/packages/flutter/lib/src/widgets/binding.dart'). package:flutter/…/widgets/binding.dart:1 WidgetsBinding.instance!.addPostFrameCallback((_) => _initData(context));`
    opened by vjose1903 0
  • Anchor value behave differently on different phones

    Anchor value behave differently on different phones

    Hello,

    I'me developing an app on a Xiaomi Mi 9T and using the anchor value of 0.3 for the panel. The positioning is perfect and the behavior is as expected.

    However, when tried run my app on a LG v30, the bottom part of the panel was partially hidden on the bottom of the screen, as if the "resolution" of the screen was misscalculated. So i've changed the anchor to 0.4; it solved the issue on the LG v30, but broke the visualization on my Xiaomi Mi 9T, making the panel got higher (and getting the element from the bottom of the panel away from the bottom of the screen).

    There is an issue related to this or some kind of elegant workaround?

    opened by leonardoayres 0
Owner
null
A draggable Flutter widget that makes implementing a Sliding up and fully-stretchable much easier.

Draggable Home A draggable Flutter widget that makes implementing a Sliding up and fully-stretchable much easier! Based on the Scaffold and Sliver. Us

Devs On Flutter 106 Dec 12, 2022
Global loading widget, which can be used through simple configuration.

load Global loading widget, which can be used through simple configuration. Pure flutter library, not use native code. It is similar to OKToast in use

Caijinglong 35 Nov 4, 2022
A simple zoomable image/content widget for Flutter.

?? Easy to use yet very customizable zoomable image widget for Flutter, Photo View provides a gesture sensitive zoomable widget. Photo View is largely used to show interacive images and other stuff such as SVG.

Blue Fire 1.7k Jan 1, 2023
A Flutter widget for inputting content with a fixed length, visually treating each character as a separate segment.

code_input A Flutter widget for inputting content with a fixed length, visually treating each character as a separate segment. Pub Package GitHub Repo

Raouf Rahiche 69 Mar 25, 2022
A simple Flutter widget to add in the widget tree when you want to show nothing, with minimal impact on performance.

nil A simple widget to add in the widget tree when you want to show nothing, with minimal impact on performance. Why? Sometimes, according to a condit

Romain Rastel 127 Dec 22, 2022
Flutter ScrollView Observer - a library of widget that can be used to listen for child widgets those are being displayed in the scroll view

Flutter ScrollView Observer - a library of widget that can be used to listen for child widgets those are being displayed in the scroll view

林洵锋 67 Jan 6, 2023
A Flutter package to show beautiful animated snackbars directly using overlay

Easily show beautiful snack bars directly using overlays. Create custom snack bars and show them with awesome animations.

Sajad Abdollahi 11 Dec 27, 2022
A Flutter plugin which makes it straightforward to show the native equivalent of a CupertinoAlertDialog or CupertinoActionSheet dialog

A Flutter plugin which makes it straightforward to show the native equivalent of a CupertinoAlertDialog or CupertinoActionSheet dialog

Christoph Krassnigg 9 Dec 9, 2022
Flutter Color Picker Wheel - an easy to use widget which can be heavily customized

Flutter Color Picker Wheel Flutter Color Picker Wheel is an easy to use widget which can be heavily customized. You can use the WheelColorPicker direc

Kexin Lu 35 Oct 4, 2022
A flutter package which provides most commonly used widgets with their normal and neon version

This is a flutter package which provides most commonly used widgets with their normal and neon version. There are multiple different types of widgets under this package, which can be used to create more neon theme widget

ojas 24 Oct 7, 2022
The public ui library is used with the openim demo, and you can directly use it for secondary development.

flutter_openim_widget The public ui library is used with the openim demo, and you can directly use it for secondary development. import 'package:flutt

null 28 Dec 27, 2022
Cupertino buttons which are used as radio buttons in order to select one value

Flutter Cupertino Radio Choice Cupertino buttons which are used as radio buttons in order to select one value. Tutorial A complete tutorial how to use

Christoph Rothermel 4 Sep 18, 2022
Flutter widget to show text in popup or overlay container

flutter_show_more_text_popup Flutter widget to show text in popup or overlay container Installation Add this to your package's pubspec.yaml file depen

Sanjay Sharma 44 Jul 5, 2022
A Flutter widget to show a text form field to display a date or clock dialog

A Flutter widget to show a text form field to display a date or clock dialog. This widget extend TextField and has a similar behavior as TextFormField.

m3uzz Soluções em TI 82 Jan 6, 2023
Main focus is to show dynamic operation not supported in Stateless Widget of Flutter

A new Flutter project. It will count the number of donut(Though increment doesnot take place Stateless Widget). Main focus is to show dynamic operation not supported in Stateless Widget of Flutter.

Avinandan Bose 2 Sep 9, 2022
Widget, that can make any static located widget hidable

Installing See the official installing guidline from hidable/install Usage & Overview To start using Hidable widget, we have to create a ScrollControl

Anon 18 Dec 16, 2022
A widget lib that the widget in this lib can react to flutter ScrollController's offset

Language: English | 中文简体 linked_scroll_widgets A lib full of widgets that can react to the scrollController's offset change,to custom your UI effect.

WenJingRui 8 Oct 16, 2022
React hooks for Flutter. Hooks are a new kind of object that manages a Widget life-cycles. They are used to increase code sharing between widgets and as a complete replacement for StatefulWidget.

English | Português Flutter Hooks A Flutter implementation of React hooks: https://medium.com/@dan_abramov/making-sense-of-react-hooks-fdbde8803889 Ho

Remi Rousselet 2.6k Dec 29, 2022
Flutter package: Define a theme (colors, text styles etc.) as static const values which can be changed dynamically.

Flutter package: Define a theme (colors, text styles etc.) as static const values which can be changed dynamically. Also comes with useful extensions to create text styles by composition.

Marcelo Glasberg 21 Jan 2, 2023