loading_skeleton_niu 0.0.1 copy "loading_skeleton_niu: ^0.0.1" to clipboard
loading_skeleton_niu: ^0.0.1 copied to clipboard

This is a flutter package for easy use when someone need to add some loading state widget.

example/example.dart

import 'package:flutter/material.dart';
import 'package:loading_skeleton/loading_skeleton.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Loading Skeleton',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Loading Skeleton Example'),
    );
  }
}

class MyHomePage extends StatelessWidget {
  MyHomePage({Key? key, required this.title}) : super(key: key);
  final String title;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(title),
      ),
      body: SafeArea(
        child: Column(
          children: [
            LoadingSkeleton(
              width: 400,
              height: 250,
              margin: EdgeInsets.all(16),
            ),
            ListView.builder(
              shrinkWrap: true,
              itemBuilder: (context, i) => ListItem(),
              itemCount: 4,
            ),
          ],
        ),
      ),
    );
  }
}

class ListItem extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Row(
      mainAxisAlignment: MainAxisAlignment.start,
      crossAxisAlignment: CrossAxisAlignment.center,
      children: [
        LoadingSkeleton(
          width: 100,
          height: 100,
          margin: EdgeInsets.only(left: 16, top: 16),
          animationDuration: 3300,
          animationEnd: AnimationEnd.MODERATELY_ON_TOP,
          colors: [Colors.amber, Colors.purpleAccent, Colors.amber],
        ),
        LoadingSkeleton(
          width: 280,
          height: 100,
          margin: EdgeInsets.only(left: 16, top: 16, right: 16),
          colors: [
            Colors.blueAccent,
            Colors.deepOrangeAccent,
            Colors.blueAccent,
          ],
        ),
      ],
    );
  }
}
8
likes
140
pub points
84%
popularity

Publisher

unverified uploader

This is a flutter package for easy use when someone need to add some loading state widget.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on loading_skeleton_niu