rive_loading 0.1.3 copy "rive_loading: ^0.1.3" to clipboard
rive_loading: ^0.1.3 copied to clipboard

Loading widget based on a custom Rive animation, allow you to create beautiful custom loading widgets or dialogs

example/lib/main.dart

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  bool _isLoading = true;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.grey,
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Column(
        mainAxisSize: MainAxisSize.max,
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          RiveLoading(
            name: 'loading.riv',
            loopAnimation: 'loading',
            endAnimation: 'success',
            width: 200,
            height: 200,
            fit: BoxFit.fill,
            until: () => Future.delayed(Duration(seconds: 5)),
            onSuccess: (_) {
              print('Finished');
            },
            onError: (err, stack) {
              print('error: $err');
            },
          ),
          Expanded(
            child: Row(
              children: <Widget>[
                Expanded(
                  child: RiveLoading(
                    name: 'loading.riv',
                    loopAnimation: 'loading',
                    endAnimation: 'success',
                    isLoading: _isLoading,
                    onSuccess: (_) {
                      print('Finished');
                    },
                    onError: (err, stack) {
                      print(err);
                    },
                  ),
                ),
                ElevatedButton(
                  child: Text('Toogle loading'),
                  onPressed: () => setState(
                    () {
                      _isLoading = !_isLoading;
                    },
                  ),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
7
likes
120
pub points
62%
popularity

Publisher

verified publisherjaumard.com

Loading widget based on a custom Rive animation, allow you to create beautiful custom loading widgets or dialogs

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

collection, flutter, rive

More

Packages that depend on rive_loading