一个包含很多炫酷字体动画的Flutter软件包。
安装1.添加依赖把软件包添加到pubspec.yaml文件中:
dependencies: animated\_text\_kit: ^1.2.02.安装你可以通过下列的命令行来安装:
通过pub:
$ pub get通过Flutter:
$ flutter packages get3.引用把软件包引入到dart文件
import 'package:animated\_text\_kit/animated\_text\_kit.dart';用例:你可以在AnimatedTextKit类中重写并设置duration的时间。如果动画不需要重复播放,你可以改变isRepeatingAnimation为Flase:
FadeAnimatedTextKit( duration: Duration(milliseconds: 5000), isRepeatingAnimation: false, text: \["do IT!", "do it RIGHT!!", "do it RIGHT NOW!!!"\], textStyle: TextStyle(fontSize: 32.0, fontWeight: FontWeight.bold),);RotateRow( mainAxisSize: MainAxisSize.min, children: <Widget>\[ SizedBox(width: 20.0, height: 100.0), Text( "Be", style: TextStyle(fontSize: 43.0), ), SizedBox(width: 20.0, height: 100.0), RotateAnimatedTextKit( onTap: () { print("Tap Event"); }, text: \["AWESOME", "OPTIMISTIC", "DIFFERENT"\], textStyle: TextStyle(fontSize: 40.0, fontFamily: "Horizon"), ), \],);Note: 你可以通过在RotateAnimatedTextKit类中设置transitionHeight的值来改变文字变化的高度。
FadeSizedBox( width: 250.0, child: FadeAnimatedTextKit( onTap: () { print("Tap Event"); }, text: \[ "do IT!", "do it RIGHT!!", "do it RIGHT NOW!!!" \], textStyle: TextStyle( fontSize: 32.0, fontWeight: FontWeight.bold ), ),);TyperSizedBox( width: 250.0, child: TyperAnimatedTextKit( onTap: () { print("Tap Event"); }, text: \[ "It is not enough to do your best,", "you must know what to do,", "and then do your best", "\- W.Edwards Deming", \], textStyle: TextStyle( fontSize: 30.0, fontFamily: "Bobbers" ), ),);TypewriterSizedBox( width: 250.0, child: TypewriterAnimatedTextKit( onTap: () { print("Tap Event"); }, text: \[ "Discipline is the best tool", "Design first, then code", "Do not patch bugs out, rewrite them", "Do not test bugs out, design them out", \], textStyle: TextStyle( fontSize: 30.0, fontFamily: "Agne" ), ),);ScaleSizedBox( width: 250.0, child: ScaleAnimatedTextKit( onTap: () { print("Tap Event"); }, text: \[ "Think", "Build", "Ship" \], textStyle: TextStyle( fontSize: 70.0, fontFamily: "Canterbury" ), ),);ColorizeSizedBox( width: 250.0, child: ColorizeAnimatedTextKit( onTap: () { print("Tap Event"); }, text: \[ "Larry Page", "Bill Gates", "Steve Jobs", \], textStyle: TextStyle( fontSize: 50.0, fontFamily: "Horizon" ), colors: \[ Colors.purple, Colors.blue, Colors.yellow, Colors.red, \], ),);Note: colors listshouldcontainsatleasttwovalues.
BugsorRequests如果你有任何问题欢迎提issue.如果你感觉这个库还需要完善欢迎提 ticket 。
LicenseAnimated-Text-Kitislicensedunder MITlicense.View license.
评论