Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class textList extends StatefulWidget {
- @override
- State<StatefulWidget> createState() =>
- new _textListState();
- }
- class _textListState extends State<textList>
- with TickerProviderStateMixin {
- List<Widget> items = new List();
- Widget lorem = new textClass("Lorem");
- Timer timer;
- @override
- void initState() {
- super.initState();
- items.add(new textClass("test"));
- items.add(new textClass("test"));
- timer = new Timer.periodic(new Duration(seconds: 5), (Timer timer) {
- setState(() {
- items.removeAt(0);
- items.add(lorem);
- });
- });
- }
- @override
- void dispose() {
- super.dispose();
- timer.cancel();
- }
- @override
- Widget build(BuildContext context) {
- Iterable<Widget> content = ListTile.divideTiles(
- context: context, tiles: items).toList();
- return new Column(
- children: content,
- );
- }
- }
- class textClass extends StatefulWidget {
- textClass(this.word);
- final String word;
- @override
- State<StatefulWidget> createState() =>
- new _textClass(word);
- }
- class _textClass extends State<textClass>
- with TickerProviderStateMixin {
- _textClass(this.word);
- String word;
- Timer timer;
- @override
- void initState() {
- super.initState();
- timer = new Timer.periodic(new Duration(seconds: 2), (Timer timer) {
- setState(() {
- word += "t";
- });
- });
- }
- @override
- void dispose() {
- super.dispose();
- timer.cancel();
- }
- @override
- Widget build(BuildContext context) {
- return new Text(word);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement