covid_puncher 0.0.2+1 copy "covid_puncher: ^0.0.2+1" to clipboard
covid_puncher: ^0.0.2+1 copied to clipboard

An interactive loader which can be shown instead of boring spinners

example/lib/main.dart

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

import 'package:covid_puncher/covid_puncher.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  bool isLoading = false;

  loadInformation() {
    setState(() {
      isLoading = true;

      // Make a 10-seconds delay to mock real data loading
      Future.delayed(Duration(seconds: 10)).then((_) {
        setState(() {
          isLoading = false;
        });
      });
    });
  }

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          // Display loader depending on isLoading property
          child: isLoading ? CovidPuncherLoader() : ElevatedButton(
            onPressed: (){
              // Load mock data
              loadInformation();
            },
            child: Text("Load a lot of information")
          )
        ),
      ),
    );
  }
}
2
likes
70
points
11
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

An interactive loader which can be shown instead of boring spinners

Homepage

License

MIT (license)

Dependencies

flutter, flutter_web_plugins

More

Packages that depend on covid_puncher

Packages that implement covid_puncher