Giter VIP home page Giter VIP logo

flutter_ss_placeholder_view's Introduction

SSPlaceholderView

Build ssplaceholderview

A Flutter package allows you to add placeholder content while loading or empty items.

Preview

Installing

  1. Add dependencies to pubspec.yaml

    Get the latest version in the 'Installing' tab on pub.dev

    dependencies:
        ss_placeholder_view: <latest-version>
  2. Run pub get.

    flutter pub get
  3. Import package.

    import 'package:ss_placeholder_view/ssplaceholderview.dart';

Implementation

  1. SSPlaceholder.

    SSPlaceholder(
          state: placeholderState,
          child: Widget,
          showPlaceHolder: true,
          placeHolderImageConfig: PlaceHolderImageConfig(
            extraPadding: const EdgeInsets.only(bottom: 10),
            placeholderImage: placeholderImage,
            placeholderWidget: placeholderWidget,
            animationName: 'walk',
          ),
          loadingConfig: LoadingConfig(
            loadingTitle: 'Loading Title',
            loadingSubtitle: 'Loading subtitle',
            loadingWidgetName: LoaderName.hourGlass,
            loadingWidget: LoadingWidget,
            loadingColor: const Color(0xffee5366),
            loadingSize: 40,
            isLoadingOnTop: false,
          ),
          emptyErrorConfig: EmptyErrorConfig(
            emptyTitle: 'No Data Found',
            emptySubtitle: 'Try again..!',
            errorTitle: 'Error...',
            errorSubtitle:
                'An error occurred while loading data. Please retry.',
          ),
          buttonConfig: ButtonConfig(
            buttonColor: const Color(0xffee5366),
            buttonText: 'Refresh',
            buttonWidth: 120,
            buttonHeight: 64,
            hideButton: false,
            buttonTextStyle: const TextStyle(
              fontSize: 18,
              fontFamily: 'RobotoMono',
              color: Colors.white,
            ),
          ),
          titleTextStyle: const TextStyle(
            fontSize: 25,
            fontFamily: 'BebasNeue',
          ),
          subTitleTextStyle: const TextStyle(
            fontSize: 20,
            fontFamily: 'BebasNeue',
          ),                    
          onButtonClick: VoidCallback,
    )
  2. For loader change :

    • Use SpinKit loader name: e.g LoaderName.hourGlass
    • LoaderName is Enum in which all SpinKit Loader name added.

How to use

Check out the example app in the example directory or the 'Example' tab on pub.dartlang.org for a more complete example.

Methods defined by SSPlaceholder class:

Config class Name Parameters Description Default Value
PlaceHolderState
state PlaceHolder state (idle,loading,success,error) none
PlaceHolderImageConfig
placeholderImage String placeholder Image none
placeholderWidget Widget custom placeholder none
darkPlaceholderImage String dark placeholder Image none
extraPadding EdgeInsets dark placeholder Image none
animationName String if flare animation used then animation name none
ButtonConfig
buttonText String refresh button text none
buttonWidth double refresh button width 120
buttonHeight double refresh button width 64
buttonColor Color refresh button color Colors.blueGrey
buttonTextColor Color refresh button text color Colors.white
hideButton bool refresh button should visible or not false
buttonTextStyle TextStyle button text style false
LoadingConfig
loadingTitle String loading title when state is loading Hold On!
loadingSubtitle String loading sub title when state is loading This could take a while to load
loadingWidgetName LoaderName loadingWidgetName based on LoaderName enum LoaderName.threeBounce
loadingWidget Widget loadingWidget e.g.CircularProgressIndicator() none
loadingColor Color loadingColor for SpinKit indicators none
loadingSize double loadingSize for SpinKit indicators 32
isLoadingOnTop bool loadingWidget is on top of title or below title false
ErrorConfig
errorTitle String error title when state is error Oops
errorSubtitle String error sub title when state is error Something went wrong!
emptyTitle String empty title when state is success Unavailable
emptySubtitle String empty sub title when state is success No Data Found
common
child Widget Replace PlaceHolder with your widget none
showPlaceHolder bool PlaceHolder visibility none
titleTextStyle TextStyle Title textStyle TextStyle(fontSize: 20, letterSpacing: 0.4, fontWeight: FontWeight.bold)
subTitleTextStyle TextStyle Subtitle textStyle TextStyle(fontSize: 14, letterSpacing: 0.4)
onButtonClick VoidCallback On click of button none

Other Library used:

Awesome Mobile Libraries

License

MIT License

Copyright (c) 2021 Simform Solutions

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

flutter_ss_placeholder_view's People

Contributors

mobile-simformsolutions avatar shwetachauhan-simform avatar shwetachauhan18 avatar vatsaltanna avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.