flutter可定制的进度按钮

立即下载 ️⬇️

flutter progress按钮是一个免费的开源(MIT许可证)Material Flutter Button,支持各种按钮样式需求。

flutter_progress_button

GitHub repo size GitHub code size in bytes GitHub top language GitHub issues GitHub license

开始

这里添加依赖

Add this to your package’s pubspec.yaml file:

flutter_progress_button: '^0.6.4'

Install it

You can install packages from the command line:

$ flutter pub get

Alternatively, your editor might support flutter pub get.

Import it

Now in your Dart code, you can use:

import 'package:flutter_progress_button/flutter_progress_button.dart';

How to use

Add ProgressButton to your widget tree:

ProgressButton(
    normalWidget: const Text('I am a button'),
    progressWidget: const CircularProgressIndicator(),
    width: 196,
    height: 40,
    onPressed: () async {
        int score = await Future.delayed(
            const Duration(milliseconds: 3000), () => 42);
        // After [onPressed], it will trigger animation running backwards, from end to beginning
        return () {
        // Optional returns is returning a VoidCallback that will be called
        // after the animation is stopped at the beginning.
        // A best practice would be to do time-consuming task in [onPressed],
        // and do page navigation in the returned VoidCallback.
        // So that user won't missed out the reverse animation.
        };
    },
),

资源

可以在git中找到此库的源代码和示例:

$ git clone https://github.com/jiangyang5157/flutter_progress_button.git

Github主页 👉jiangyang5157/flutter_progress_button

0%