animated_typing 0.2.1 copy "animated_typing: ^0.2.1" to clipboard
animated_typing: ^0.2.1 copied to clipboard

A package to Animate the writing of the text.

example/lib/main.dart

import 'package:animated_typing/animated_typing.dart';
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,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  Color _color = Colors.primaries[0];
  TextEditingController _controller = TextEditingController();
  double _seconds = 3;
  String _text = '';
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          children: [
            Container(
              padding: EdgeInsets.all(20),
              child: TextFormField(
                controller: _controller,
                onChanged: (_) {
                  setState(() {});
                },
                decoration: InputDecoration(
                  labelText: 'text',
                ),
              ),
            ),
            Row(
              mainAxisSize: MainAxisSize.min,
              children: [
                DropdownButton<Color>(
                  underline: Container(),
                  iconSize: 0.0,
                  items: Colors.primaries
                      .map((color) => DropdownMenuItem<Color>(
                            value: color,
                            child: Container(
                              width: 40,
                              height: 40,
                              decoration: BoxDecoration(
                                color: color,
                                shape: BoxShape.circle,
                              ),
                            ),
                          ))
                      .toList(),
                  onChanged: (v) {
                    setState(() {
                      _color = v!;
                    });
                  },
                  value: _color,
                ),
                Slider(
                  value: _seconds,
                  onChanged: (newValue) {
                    setState(() {
                      _seconds = newValue;
                    });
                  },
                  min: 1,
                  max: 40,
                  divisions: 39,
                  label: '$_seconds seconds',
                )
              ],
            ),
            ElevatedButton(
              child: Text('Start'),
              onPressed: () {
                _text = _controller.text;
                setState(() {});
              },
            ),
            AnimatedTyping(
              text: _text,
              duration: Duration(
                seconds: _seconds.toInt(),
              ),
              style: TextStyle(
                color: _color,
                fontSize: 22,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
4
likes
120
pub points
57%
popularity

Publisher

unverified uploader

A package to Animate the writing of the text.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on animated_typing