How to blink text in flutter?

This Article is posted by seven.srikanth at 10/1/2021 5:45:40 PM



Here is an example on how to blink text in flutter. 

import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@ override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyAnimation(title: 'FadeTransition Demo'),
);
}
}
class MyAnimation extends StatefulWidget {
final String? title;
const MyAnimation({Key? key, this.title}) : super(key: key);
@ override
_MyAnimationState createState() => _MyAnimationState();
}
class _MyAnimationState extends State<MyAnimation>
with SingleTickerProviderStateMixin {
late AnimationController _controller;
@ override
void initState() {
super.initState();
_controller =
AnimationController(vsync: this, duration: Duration(seconds: 1))
..repeat();
}
@ override
void dispose() {
super.dispose();
_controller.dispose();
}
@ override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title as String),
),
body: Center(
child: FadeTransition(
opacity: _controller,
child: Text(
'Blinking Text',
style: TextStyle(fontSize: 30),
),
),
),
);
}
}
Thanks,
Srikanth

Tags: Blink text;








0 Comments
Login to comment.
Recent Comments












© 2018 - Fluttercentral | Email to me - seven.srikanth@gmail.com