Code Monkey home page Code Monkey logo

pengyuanhong / flutter_easyhub Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ifgyong/flutter_easyhub

0.0 1.0 0.0 16.49 MB

🔥🔥🔥简单易用的toast动画,支持iOS和android,支持widget添加,纯flutter,现在有近30种动画可供选择。Simple and easy toast animation, supports iOS and android, supports widget addition, pure flutter, now there are nearly 30 kinds of animations to choose from。

Home Page: http://fgyong.cn

License: MIT License

Dart 99.72% Java 0.07% Swift 0.20% Objective-C 0.02%

flutter_easyhub's Introduction

flutter_easyhub

A pure flutter, supporting android and iOS, no native code, simpler loading animation, more than 20 existing animations, support for custom foreground and background colors.

中文文档 English documentation

easy use to use this package as a library

dependencies:
  flutter_easyhub: ^1.0.1

$ flutter pub get

import 'package:flutter_easyhub/flutter_easy_hub.dart';

how to use

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      builder: (ctx, child) =>
          FlutterEasyHub(child: MyHomePage(title: 'Flutter Demo Home Page')),
    );
  }
}

then, enjoy yourself:

EasyHub.show('loading');
EasyHub.show('loading', duration: Duration(seconds: 2));

///toast 2s later dismiss
EasyHub.showInfoHub('network miss');

///default 2s
EasyHub.showMsg('download success');

///default 2s
EasyHub.showErrorHub('An error occurred');

///default 2s
EasyHub.showCompleteHub('done');

/// only hub without msg
/// when you did call EasyHub.dismiss(),it is dismissed;
EasyHub.showHub();

///dismiss
EasyHub.dismiss();

/// custom your widget
EasyHub.showCustom(Container(
child: Text('my test'),
));
  

used just like it

how to chose style

light

  • style:light
  • maskStyle:dark

dark

  • style:dark
  • maskStyle:light

change Progress bar color when EasyHubIndicatorType.defaultType

EasyHub.instance.indicatorType = EasyHubIndicatorType.defaultType;
EasyHub.instance
  ..backgroundColor = Colors.white
  ..animationForegroundColor = AlwaysStoppedAnimation(Colors.red)
  ..style = EasyHubStyle.custom;
EasyHub.showHub();

other EasyHubIndicatorType,you only

EasyHub.instance
  ..backgroundColor = Colors.white
  ..animationForegroundColor = AlwaysStoppedAnimation(Colors.red);

when you want touch widget,then hiden it.

/// only used for maskStyle!= none.
  EasyHub.instance.onTap = () {
      EasyHub.dismiss();
    };

 

Renderings Provide more than 30 animations

default CircularProgress showErrorHub showComplateHub
LineProgress CircularProgressEasyOutEasyIn CircularProgressEasy singleFlipingRect
beattingCircle singlebeattingCircle beatingRects rotatingCircles
rotatingDeformedCircles rotatingTwoRect rotatingTwoCircles foldingRect

pendulumingBall

waves
spitBubbles movingCube
rotatingTwoColorBall dancingBall flashingBalls fallingBall

hourglass
dancingCube swingingBall creepingBug

rubberBand
rainCouplet flipDiamond
fragmentRect

Customize

/// just available when [EasyHubType] is [msg]

  String msg;

  /// msg of padding ,used for [EasyHubType.all] and [EasyHubType.msg]
  EdgeInsets msgPadding;

  /// msg of margin ,used for [EasyHubType.all] and [EasyHubType.msg]
  EdgeInsets msgMargin;

  ///  style of msg,used for [EasyHubStyle.custom]
  TextStyle textStyle;

  ///  color of msg font,used for [EasyHubStyle.custom]
  ///  if textStyle is not null, it is ignored
  Color fontColor;

  ///maskStyle. default [EasyHubMaskStyle.dark]
  EasyHubMaskStyle maskStyle;

  /// center view style
  /// default [EasyHubType.all]
  EasyHubStyle style;

  /// loading indicator type, default  [EasyHubType.all]
  EasyHubType _easyHubType;

  /// Animation type
  /// see detail in [EasyHubIndicatorType]
  /// when [EasyHubType] is [hub] or [all],it is available.

  EasyHubIndicatorType indicatorType;

  /// color of Mask,only used for [EasyHubMaskStyle.custom]
  Color maskColor;

  ///color of  main View background
  /// used  for [EasyHubStyle.custom]
  Color backgroundColor;

  ///color of main animation background
  ///used for most of  [EasyHubIndicatorType]
  ///when animationWidget colors more than [two], ignored.
  Color animationBackgroundColor;

  /// main animation foreground color,type is [Animation<Color>]
  /// like[AlwaysStoppedAnimation]
  /// used for most of  [EasyHubIndicatorType]
  ///  when animationWidget colors more than [two], ignored.
  Animation<Color> animationForegroundColor;

  /// animation progress value [bounds] is [0...1]
  /// used for   [EasyHubIndicatorType.lineProgress]
  /// TODO - [EasyHubIndicatorType.waves]
  double progress; //进度条
  /// display duration of [showSuccess] [showErrorHub] [showCompleteHub], default 2000ms.
  Duration displayDuration;

  /// touch action
  /// you can set dismissed when touch
  /// ```dark
  /// EasyHub.instance.onTap = () {
  ///        EasyHub.dismiss();
  ///      };
  /// ```
  GestureTapCallback onTap;

enjoy youself with animation if you only like animations;

any animation is widget,you can use it ,see detail

License

MIT LICENSE

CHANGELOG

CHANGELOG

推荐

flutter_easyhub's People

Contributors

ifgyong avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.