A Flutter package for building custom skeleton widgets to mimic the page's layout while loading.

Overview

Skeletons

A Flutter package for building custom skeleton widgets to mimic the page's layout while loading.

Examples

Items ListView (Default)
items paragraphs listview_default
ListView (Custom) ListView (Complex Cards) SkeletonTheme
listview_custom listview_cards skeleton_theme
Light/Dark modes Right-To-Left Custom Shimmer
light_dark_modes rtl custom_shimmer

All examples can be found here examples.

How To Use

Can be used by encapsulating the child widget in a Skeleton widget:

import 'package:skeletons/skeletons.dart';

Skeleton(
        isLoading: _isLoading,
        skeleton: SkeletonListView(),
        child: Container(child: Center(child: Text("Content"))),
      )

or directly:

Container(
    child: _isLoading 
    ? SkeletonListView() 
    : Container(child: Center(
                       child: Text("Content"))),
)

a SkeletonTheme can be used to set the default configs for all skeleton descendants in the tree.

SkeletonTheme(
    // themeMode: ThemeMode.light,
    shimmerGradient: LinearGradient(
        colors: [
          Color(0xFFD8E3E7),
          Color(0xFFC8D5DA),
          Color(0xFFD8E3E7),
        ],
        stops: [
          0.1,
          0.5,
          0.9,
        ],
      ),
      darkShimmerGradient: LinearGradient(
        colors: [
          Color(0xFF222222),
          Color(0xFF242424),
          Color(0xFF2B2B2B),
          Color(0xFF242424),
          Color(0xFF222222),
        ],
        stops: [
          0.0,
          0.2,
          0.5,
          0.8,
          1,
        ],
        begin: Alignment(-2.4, -0.2),
        end: Alignment(2.4, 0.2),
        tileMode: TileMode.clamp,
      ),
        child: MateriaApp(
            ...
        ),
      ),

More Customization:

ListView (Complex Cards)
listview_cards

for more complex shapes you can build your skeleton inside a SkeletonItem widget:

ListView.builder(
  physics: NeverScrollableScrollPhysics(),
  itemCount: 5,
  itemBuilder: (context, index) => Padding(
    padding: const EdgeInsets.all(8.0),
    child: Container(
      padding: const EdgeInsets.all(8.0),
      decoration: BoxDecoration(color: Colors.white),
      child: SkeletonItem(
          child: Column(
        children: [
          Row(
            children: [
              SkeletonAvatar(
                style: SkeletonAvatarStyle(
                    shape: BoxShape.circle, width: 50, height: 50),
              ),
              SizedBox(width: 8),
              Expanded(
                child: SkeletonParagraph(
                  style: SkeletonParagraphStyle(
                      lines: 3,
                      spacing: 6,
                      lineStyle: SkeletonLineStyle(
                        randomLength: true,
                        height: 10,
                        borderRadius: BorderRadius.circular(8),
                        minLength: MediaQuery.of(context).size.width / 6,
                        maxLength: MediaQuery.of(context).size.width / 3,
                      )),
                ),
              )
            ],
          ),
          SizedBox(height: 12),
          SkeletonParagraph(
            style: SkeletonParagraphStyle(
                lines: 3,
                spacing: 6,
                lineStyle: SkeletonLineStyle(
                  randomLength: true,
                  height: 10,
                  borderRadius: BorderRadius.circular(8),
                  minLength: MediaQuery.of(context).size.width / 2,
                )),
          ),
          SizedBox(height: 12),
          SkeletonAvatar(
            style: SkeletonAvatarStyle(
              width: double.infinity,
              minHeight: MediaQuery.of(context).size.height / 8,
              maxHeight: MediaQuery.of(context).size.height / 3,
            ),
          ),
          SizedBox(height: 8),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Row(
                children: [
                  SkeletonAvatar(
                      style: SkeletonAvatarStyle(width: 20, height: 20)),
                  SizedBox(width: 8),
                  SkeletonAvatar(
                      style: SkeletonAvatarStyle(width: 20, height: 20)),
                  SizedBox(width: 8),
                  SkeletonAvatar(
                      style: SkeletonAvatarStyle(width: 20, height: 20)),
                ],
              ),
              SkeletonLine(
                style: SkeletonLineStyle(
                    height: 16,
                    width: 64,
                    borderRadius: BorderRadius.circular(8)),
              )
            ],
          )
        ],
      )),
    ),
  ),
);

Issues and feedback

For issues, please report here. Contributions are welcome.

You might also like...

A Flutter package with custom implementation of Drawer

A Flutter package with custom implementation of Drawer

Flutter Zoom Drawer A Flutter package with custom implementation of the Side Menu (Drawer) Getting Started To start using this package, add flutter_zo

Dec 22, 2022

A guideline for building scalable Flutter applications.

Scalable flutter app You probably need to read this article before inspecting the repo's code. Building scalable Flutter apps (Architecture, Styling,

Nov 23, 2022

A Dice App for flutter beginners when building with State

dicee A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this is

Nov 15, 2021

A declarative library with an easy-to-use interface for building Flutter applications on AWS.

A declarative library with an easy-to-use interface for building Flutter applications on AWS.

Amplify Flutter AWS Amplify provides a declarative and easy-to-use interface across different categories of cloud operations. Our default implementati

Jan 5, 2023

Ready for Building Production-Ready Healthcare/ Doctor Consult Android and iOS app UI using Flutter.

Ready for Building Production-Ready Healthcare/ Doctor Consult Android and iOS app UI using Flutter.

Production-Ready Doctor Consultant App - Flutter UI Packages we are using: flutter_svg: link In this full series, we will show you how to Building Pro

Nov 28, 2022

An application of learning outcomes from the Mastering Flutter 2.0 class: Building Travel and Aircraft Applications Buildwithangga

An application of learning outcomes from the Mastering Flutter 2.0 class: Building Travel and Aircraft Applications Buildwithangga

An application of learning outcomes from the Mastering Flutter 2.0 class: Building Travel and Aircraft Applications Buildwithangga

Aug 29, 2022

Flutter SDK for building a realtime broadcaster using the Millicast platform

Flutter SDK for building a realtime broadcaster using the Millicast platform. This Software Development Kit (SDK) for Flutter allows developers to simplify Millicast services integration into their own Android and iOS apps.

Oct 29, 2022

building a timer application using the bloc library

flutter_timer A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if

Nov 4, 2021

Building a Chat App with Firebase, Image Upload, Push Notifications

chat_app A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this

Nov 15, 2021
Comments
  • Issue in given example

    Issue in given example

    Skeleton( 
                  isLoading: controller.isDataLoading.value, 
                  // shimmerGradient: SkeletonTheme,
                  skeleton: ListView.builder(
      physics: NeverScrollableScrollPhysics(),
      itemCount: 5,
      itemBuilder: (context, index) => Padding(
        padding: const EdgeInsets.all(8.0),
        child:  SkeletonAvatar(
                    style: SkeletonAvatarStyle(
                        shape: BoxShape.circle, width: 50, height: 50),
                  ),
      ),
    ),
    ), 
    

    in SkeletonAvatar widget is wrapped with container in the given example so it can't get the actual result of circular avatar.

    opened by sayyedmuzammil 0
Owner
Moh Badjah
Moh Badjah
This is an app created by me while undertaking an android app development in flutter course on Udemy.

Expense Planner App A Flutter project created by Mithilesh Ghadge in a Fluttter Android app development course on Udemy. Create a new Flutter project

Mithilesh Ghadge 2 Oct 14, 2021
Modern UI for Messaging/Chatting App, with Signup/Login Pages and Awesome animation, built with flutter v2.5.2.

instantChat_app_ui Modern UI for Messaging/Chatting App, with Signup/Login Pages and Awesome animation, built with flutter v2.5.2. The package/plugin

Kamran Jalil 1 Oct 25, 2021
Caching with flutter riverpod and looking into future providers. Example to demonstrate stale while revalidate pattern.

FLUTTER SWR EXAMPLE Test stale-while-revalidate pattern with riverpod. Look; query_provider package Backend calls are made with ghibli-api Tested Prov

Dipesh Dulal 7 Jun 30, 2022
Beginner level chat app I built while learning Flutter

Chat App Chat with your friends, family, and anyone else you want to chat with! Live Coding Video on YouTube (Part 1) Live Coding Video on YouTube (Pa

Rohan Kadkol 4 Aug 4, 2021
Concepts used Flutter layout,State management, Blockchain integration, Http api integration, Smart contracts

HS_CryptoCoin_Wallet First project using Flutter with Blockchain Getting Started This project is a starting point for a Flutter application. A few res

Harsh Saxena 1 Dec 23, 2021
App de estudo para treino de layout e requisição de APIs. Faz conversão de real para 5 tipos de criptomoedas, exibe gráfico de evolução e as últimas notícias do mercado. Em construção.

cryptonight A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if t

Ana Carol Cortez 1 Sep 25, 2022
Custom Gesture Detector for Flutter. Empower your users with custom gestures.

Gestures Custom Gesture Detector for Flutter. Empower your users with custom gestures. How to use In your pubspec.yaml: dependencies: gestures: ^1.0

André Baltazar 11 Nov 4, 2022
Utilities for loading and running WASM modules from Dart code

Provides utilities for loading and running WASM modules Built on top of the Wasmer runtime. Setup Run dart run wasm:setup to build the Wasmer runtime.

Dart 284 Dec 23, 2022
The FlexGrid control provides a powerful and quickly way to display data in a tabular format. It is including that frozened column/row,loading more, high performance and better experience in TabBarView/PageView.

flex_grid Language: English| 中文简体 The FlexGrid control provides a powerful and quickly way to display data in a tabular format. It is including that f

FlutterCandies 39 Nov 8, 2022
A Flutter package for show custom in-app notification.

?? in_app_notification A Flutter package to show custom in-app notification with any Widgets. ✍️ Usage Import it. dependencies: in_app_notificatio

CBcloud 18 Oct 27, 2022