Coder Social home page Coder Social logo

devsonflutter / draggable_home Goto Github PK

View Code? Open in Web Editor NEW
152.0 2.0 38.0 3.48 MB

A draggable Flutter widget that makes implementing a sliding up and fully-stretchable much easier.

Home Page: https://pub.dev/packages/draggable_home

License: BSD 3-Clause "New" or "Revised" License

Dart 30.15% Kotlin 0.20% Swift 1.91% Objective-C 0.06% CMake 27.87% C++ 34.46% C 2.35% HTML 3.00%
flutter appbar sliver listview widget draggable scaffold hacktoberfest hacktoberfest2021

draggable_home's Introduction

Draggable Home

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


Example Example Example


Usage

Make sure to check out examples for more details.

Installation

Add the following line to pubspec.yaml:

dependencies:
  draggable_home: ^1.0.5

Basic setup

The complete example is available here.

DraggableHome requires you to provide title, headerWidget and body:

  • title widget is basically for a title in the AppBar. For no title in AppBar, simply pass an empty Container.
  • headerWidget is the expanded widget just above the body when not fully expanded.
  • body is in the form of Column which requires a list of widget or a widget. Do not add any vertically scrollable widget or you may just disable the scroll.
  physics: const NeverScrollableScrollPhysics()

Sample code

DraggableHome(
  title: Text("Title"),
  headerWidget: headerWidget(),
  body: [
    Container(...),
    (...),
  ]
);

Arguments

There are several options that allow for more control:

Properties Description
leading A widget to display before the toolbar's title.
action A list of Widgets to display in a row after the title widget.
drawer Drawers are typically used with the Scaffold.drawer property.
centerTitle Allows toggling of title from the center. By default, title is in the center.
headerExpandedHeight Height of the header widget. The height is a double between 0.0 and 1.0. The default value of height is 0.35 and should be less than stretchMaxHeight
headerWidget A widget to display Header above the body.
alwaysShowLeadingAndAction This makes Leading and Action always visible. Default value is false.
headerBottomBar AppBar or toolBar like widget just above the body.
backgroundColor The color of the Material widget that underlies the entire DraggableHome body.
physics The physics property determines how the scroll view responds to user input, such as how it continues to animate after the user stops dragging the scroll view.
scrollController Used to control the position to which this scroll view is scrolled
curvedBodyRadius Creates a border top-left and top-right radius of body, Default radius of the body is 20.0. For no radius simply set the value to 0.
fullyStretchable Allows toggling of fully expand draggability of the DraggableHome. Set this to true to allow the user to fully expand the header.
stretchTriggerOffset The offset of overscroll required to fully expand the header.
expandedBody A widget to display when fully expanded as header or expandedBody above the body.
stretchMaxHeight Height of the expandedBody widget. The height is a double between 0.0 and 0.95. The default value of height is 0.9 and should be greater than headerExpandedHeight
bottomSheet A persistent bottom sheet shows information that supplements the primary content of the app. A persistent bottom sheet remains visible even when the user interacts with other parts of the app.
bottomNavigationBarHeight This is required when using custom height to adjust body height. This makes no effect on bottomNavigationBar.
bottomNavigationBar Snack bars slide from underneath the bottom navigation bar while bottom sheets are stacked on top.
floatingActionButton A floating action button is a circular icon button that hovers over content to promote a primary action in the application.
floatingActionButtonLocation An object that defines a position for the FloatingActionButton based on the Scaffold's ScaffoldPrelayoutGeometry.
floatingActionButtonAnimator Provider of animations to move the FloatingActionButton between FloatingActionButtonLocations.


Sample code for ListView.builder

DraggableHome(
  title: Text("Title"),
  headerWidget: headerWidget(),
  body: [
    Container(...),

    // shrinkWrap true required for ListView.builder()
    // disable the scroll for any vertically scrollable widget
    // provide top padding 0 to fix extra space in listView
    ListView.builder(
      padding: EdgeInsets.only(top: 0),
      physics: NeverScrollableScrollPhysics(),
      shrinkWrap: true,
      itemCount: list.length,
      itemBuilder: (context, index) => Card(
        child: ListTile(
          title: Text("$index"),
        ),
      ),
    ),

    (...),
  ]
);


Example Example Example


Show some ❤️ and ⭐ the repo

GitHub followers GitHub followers

Contributions

Contributions are welcome!

If you feel that a hook is missing, feel free to open a Pull Request.

For a custom hook to be merged, you will need to do the following:

  • Describe the use case.

  • Open an issue explaining why we need this hook, how to use it, ... This is important as a hook will not get merged if the hook doesn't appeal to a large number of people.

  • If your hook is rejected, don't worry! A rejection doesn't mean that it won't be merged later in the future if more people show an interest in it. In the meantime, feel free to publish your hook as a package on https://pub.dev.

  • A hook will not be merged unless fully tested, to avoid breaking it inadvertently in the future.

draggable_home's People

Contributors

4-alok avatar ahed200 avatar divshekhar avatar dungngminh avatar ghpranav avatar horoshev36 avatar michalsrutek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

draggable_home's Issues

default hidden headerWidget

When the app is opened, the headerWidget is by default in expanded state. I need it to be in a hidden state by default, and users should be able to expand the headerWidget by pulling it down. How can I achieve this?

Loading more....

Hello,

Is it possible to implement a "Loading more" with your package ?
If we scroll at the end of the body, the app can load more items ...

Thanks

Appbar header Color

It there's a way to change the color for the app bar title from the default blue.

Is it possible to add an 'endDrawer' parameter?

Is it possible to add an 'endDrawer' parameter?

I would like to hide the Drawer icon and control the display and hiding of the Drawer using a custom button.

When using the Scaffold, I pass the 'endDrawer' and specify a Key so that I can call scaffoldKey.currentState?.openEndDrawer().

Open extended body

Does have any way to open extended body with controller?
I need to open it with button in desktop app.

leadingWidth Parameter

Is your feature request related to a problem? Please describe.
Problem lies when I want to add a TextButton with a width greater than the standard 56 set to leadingWidth parameter in AppBar.

Describe the solution you'd like
Add final double leadingWidth; parameter for user to change.

Additional context
image
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.