Flutter: Text animation is not playing - flutter

I want to play a text animation only once in my flutter app. For this purpose, I am using this package:
animated_text_kit: ^4.2.2
This is my code:
TableRow( children: [
Column(children:const [Text('Message',style:TextStyle(fontSize: 16))]),
Column(children:[AnimatedTextKit(
animatedTexts: [
TypewriterAnimatedText(
'Hey, sup!',
textStyle: const TextStyle(
fontSize: 16.0,
),
),
],
totalRepeatCount: 1,
)]),
]),
I expect the animation to be played only once. But when I execute the code, the animation doesn't play. It just stays on as a normal text.
How do I fix this issue?

the text is animating but the speed is high therefore you are not able to see it, you can add speed manually,
Here's the code snippet you can try:
TypewriterAnimatedText(
'Hey, sup!',
textStyle: const TextStyle(
fontSize: 16.0,
color: Colors.black,
),
speed: Duration(milliseconds: 500),
)
Hope it helps 😄

Related

Flutter loading text animation

How to achieve this effect with Flutter? Preferably with something like animatedContainer, but not necessarily.
Solution 1:
Look at this package: animated_text_kit
https://pub.dev/packages/animated_text_kit
See the Wavy pattern...
return DefaultTextStyle(
style: const TextStyle(
fontSize: 20.0,
),
child: AnimatedTextKit(
animatedTexts: [
WavyAnimatedText('Hello World'),
WavyAnimatedText('Look at the waves'),
],
isRepeatingAnimation: true,
onTap: () {
print("Tap Event");
},
),
);
Solution 2:
There are several more general packages that provide out of the box and ready to use Loading animations... (but not necessarily the exact same animation from your link)
Links:
https://pub.dev/packages/flutter_easyloading
Flutter loading text animation
Flutter loading text animation

How to animate TextSpan or part of a text in Flutter like in this game screenshot?

Do you have any pointers on how to animate TextSpan or part of a text in Flutter to achieve the same effect than in this game screenshot?
I know how to animate a whole text with typewriter effect but not how to animate only part of the text.
Any help will be appreciated. Thanks so much!
There are packages that can do that, for example https://www.geeksforgeeks.org/animated-text-in-flutter/ using the animated_text_kit
AnimatedTextKit(
animatedTexts: [
TyperAnimatedText('This is Animated text,',
textStyle: const TextStyle(
color: Colors.white,
fontSize: 30,
backgroundColor: Colors.purple)),
TyperAnimatedText('You are viewing it here.',
textStyle: const TextStyle(
fontSize: 20, fontWeight: FontWeight.bold)),
],
onTap: () {
print("I am executing");
},
),

how to create animations with 3 container

I want to create a simple animation.
When I click one of this elements, the selected item must grow larger maybe with an animation, and the others they will have to decrease.
I use a GestureDetector()
GestureDetector(
onTap: () => {},
child: Column(children: <Widget>[
Image(
image: AssetImage('images/one.png'),
height: 80,
),
Text(
"One",
textAlign: TextAlign.center,
style: TextStyle(
color: kBlueColor,
fontWeight: FontWeight.bold,
fontSize: 30),
),
]),
),
Check out this tutorial on animation.
You are going to want to create an animation controller. The animation controller will let you play an animation. You will also want to use the transform widget. This will allow the picture that you are using to expand or move when the animation controller is activated. Also check out this tutorial. It's from flutter Europe and it goes in depth on animations.

Is there a way to paint inside the text in Flutter?

I am currently working on the Flutter package and want to add an outlined wavy liquid text as below.
Is there any feature to add this in the Text widget?
there is this flutter package animated_text_kit 2.2.0. Which could be used to give a wavy animation to the text. I am leaving the link down below
https://pub.dev/packages/animated_text_kit
width: 250.0,
child: TextLiquidFill(
text: 'LIQUIDY',
waveColor: Colors.blueAccent,
boxBackgroundColor: Colors.redAccent,
textStyle: TextStyle(
fontSize: 80.0,
fontWeight: FontWeight.bold,
),
boxHeight: 300.0,
),
);

How to make text responsive in Flutter?

I'm struggling to make my text responsive in my application I'm re-writing from Kotlin to Flutter.
The point is that I have a text widget, which needs to be responsive. When I open it on a phone with 16:9 screen ratio, it's quite ok, but when I open my application on a phone with 18:9 screen ratio, the text doesn't fill the remaining space.
In Kotlin I had Contraint layout with guidelines which made the job very easy, but i don't know how to do it in Flutter.
I'm using AutoTextSize package, but it doesn't work which I intend it to work.
In my Kotlin app, it looks like this
In Flutter on my Samsung Note 9 with screen ratio 18:9 looks like this:
My code:
import 'package:flutter/material.dart';
import 'package:auto_size_text/auto_size_text.dart';
import '../../helpers/makdolan.dart';
class GeneratedCouponScreen extends StatelessWidget {
final String couponImage;
GeneratedCouponScreen({Key key, #required this.couponImage}) : super(key: key);
#override
Widget build(BuildContext context) {
var _makdolan = Makdolan();
var now = _makdolan.calculateDate();
return Scaffold(
backgroundColor: Colors.white,
body: SafeArea(
child: Container(
padding: EdgeInsets.all(16.0),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('DATA WYDANIA:', style: TextStyle(color: Colors.black, fontSize: 16.0, fontWeight: FontWeight.bold)),
Text(now, style: TextStyle(color: Colors.black, fontSize: 16.0))
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('UNIKALNY KOD:', style: TextStyle(color: Colors.black, fontSize: 16.0, fontWeight: FontWeight.bold)),
Text(_makdolan.calculateUniqueCode(), style: TextStyle(color: Colors.black, fontSize: 16.0))
],
)
],
),
SizedBox(height: 8.0),
Image.asset(couponImage),
SizedBox(height: 8.0),
AutoSizeText.rich(
TextSpan(
text: 'Kupon ten upoważnia do jednokrotnego odbioru produktu gratis przy kolejnym dowolnym zakupie z oferty klasycznej. Kupon ten ważny jest przez 7 dni od czasu jego wygenerowania i może być zrealizowany w dowolnej restauracji McDonald\'s w Polsce z wyłączeniem restauracji znajdyujących się na terenie Portu Lotniczego im. Fryderyka Chopina w Warszawie oraz Portu Lotniczego im. Lecha Wałęsy w Gdańsku. Szczegółowy regulamin ankiety „Opinia Gości" znajduje się na stronie ',
style: TextStyle(color: Colors.black),
children: [
TextSpan(
text: 'www.mcdonalds.pl ',
style: TextStyle(color: Color(0xffffc300), decoration: TextDecoration.underline)
),
TextSpan(
text: 'w sekcji ',
style: TextStyle(color: Colors.black)
),
TextSpan(
text: 'Regulaminy',
style: TextStyle(color: Color(0xffffc300), decoration: TextDecoration.underline)
)
]
),
maxLines: 12,
),
Spacer(),
Card(
child: Container(
height: 95.0,
color: Color(0xffffc300),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('DRUKUJ /', style: TextStyle(fontSize: 28.0)),
Text('ZAPISZ JAKO PDF', style: TextStyle(fontSize: 28.0),)
],
),
)
),
),
Card(
child: Container(
height: 95.0,
color: Color(0xffffc300),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('PRZEŚLIJ KUPON', style: TextStyle(fontSize: 28.0)),
Text('(WYSYŁKA W CIĄGU 24 GODZIN)', style: TextStyle(fontSize: 17.0),)
],
),
)
),
)
],
),
),
)
);
}
}
You might try screenutil package.
The approach is basically getting a ratio based on screen width/height/dpi. So you can adjust any UI element (like fontsize) accordingly. So the idea is more or less to match the size of fonts on ur original tested device (where you have the design) and adapt it to other resolutions.
The idea is basic equation:
DesignScreenWidth -> 24pt(current font size)
Note9ScreenWidth -> x (adjusted font size for note9)
x = Note9ScreenWidth * 24 / DesignScreenWidth
So, that's how you get any ratio to adjust content based on width, height, screen PPI, or whatever. You basically treat the values as proportions and multiply by that normalization factor
currentFactor=currentValue/designedValue.
Hope it clarifies a little the concept for “multiresolution awareness”
Best easiest way to to make responsive Text for different screen size is Sizer plugin.
Check it this plugin ⬇️
https://pub.dev/packages/sizer
.sp - for font size
If you want to set responsive text size in any screen size device also tablet then use .sp after value.
Example:
Text('Sizer', style: TextStyle(fontSize: 12.0.sp)) //use SomeValue.sp in fonsize for responsive text
Also you can use this plugin for responsive widget
.h  - for widget height
.w  - for widget width
Example:
Container(
height: 10.0.h, //10% height of screen
width: 80.0.w, //80% width of screen
child: Text('Sizer', style: TextStyle(fontSize: 12.0.sp)),
);
hi you some one else mention it in the above answer that you can use the screenutil package for text resizing which is kind of good . but I would also like to recommend to try FittedBox widgets in flutter it is also helpul some time you need fitted box with screen util in some situation screen util does not help a lot. although it is a good package for make your design responsive . or you can also try to use different text size size for different screen size .
The is a Flutter package called auto_size_text 2.1.0 which may well address your problem.
https://pub.dev/packages/auto_size_text/versions/2.1.0#-readme-tab-