簡單的抖動動畫 widget,在輸入框的錯誤提示或是吸引使用者注意的時候蠻方便的一個 widget
安裝方式
pubspec.yaml 下面加入
1 2
| dependencies: shake_animation_widget: ^3.0.4
|
記得輸入完要 pub get 安裝過
使用方式
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ ShakeAnimationWidget( shakeAnimationController: _shakeAnimationController, shakeAnimationType: ShakeAnimationType.TopBottomShake, shakeRange: 0.1, shakeCount: 0, isForward: false, child: const Text('code for love, code for life') ), TextButton(onPressed: () => _shakeAnimationController.start(shakeCount: 0), child: const Text("Start")) ], ), )
|
1 2 3 4 5 6 7 8 9 10 11
| ShakeTextAnimationWidget( animationString: "Join the Dart side!!", space: 1.0, runSpace: 10, textStyle: const TextStyle( fontSize: 25, ), shakeCount: 0, )
|
1 2 3 4 5 6 7
| BottomRoundFlowMenu( defaultBackgroundColor: Colors.white, iconList: const [Icon(Icons.icecream), Icon(Icons.ac_unit), Icon(Icons.account_balance_wallet_rounded)], clickCallBack: (int index) { print("press on $index"); }, ),
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| AnimatedStatusButton( animatedStatusController: _animatedStatusController, width: 220.0, height: 40, milliseconds: 600, buttonText: 'Submit', backgroundNormalColor: Colors.white, borderNormalColor: Colors.green, textNormalCcolor: Colors.black54,
clickCallback: () async { await Future.delayed(const Duration(seconds: 3)); return true; }, )
|
1 2 3 4 5 6 7
| RoteFlowButtonMenu( defaultBackgroundColor: Colors.yellowAccent, iconList: const [Icon(Icons.plus_one), Icon(Icons.people), Icon(Icons.add)], clickCallBack: (int index) { print("on press $index"); }, )
|
- draggable floating action button
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| final GlobalKey _parentKey = GlobalKey();
Stack(key: _parentKey, children: [ Container(color: Colors.blueGrey), DraggableFloatingActionButton( initialOffset: const Offset(120, 70), parentKey: _parentKey, onPressed: () {}, child: Container( width: 60, height: 60, decoration: const ShapeDecoration( shape: CircleBorder(), color: Colors.white, ), child: const Icon(Icons.add), ), ), ])
|
相關連結
shake_animation_widget