pin_dot 1.0.4 copy "pin_dot: ^1.0.4" to clipboard
pin_dot: ^1.0.4 copied to clipboard

A Pin Dot Flutter package. Make it easy to use and minimal code.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:pin_dot/pin_dot.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'PIN DOT',
      theme: ThemeData(primarySwatch: Colors.blue),
      home: HomePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  final int _length = 4;
  final TextEditingController _pinController = TextEditingController();

  @override
  void initState() {
    _pinController.text = '';
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('PIN DOT')),
      body: Center(
        child: Column(
          children: [
            SizedBox(height: 100),
            PinDot(
              size: 16,
              length: _length,
              controller: _pinController,
              activeColor: Colors.blue.shade700,
              borderColor: Colors.yellow.shade700,
            ),
            SizedBox(height: 20),
            Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                TextButton(
                  onPressed: () {
                    if (_pinController.text.length < _length) {
                      _pinController.text += '1';
                    }
                  },
                  child: Text('ADD'),
                ),
                TextButton(
                  onPressed: () {
                    if (_pinController.text.length > 0) {
                      final x = _pinController.text;
                      _pinController.text = x.substring(0, x.length - 1);
                    }
                  },
                  child: Text('DEL'),
                ),
              ],
            ),
          ],
        ),
      ),
    );
  }
}
2
likes
130
pub points
71%
popularity

Publisher

verified publisherwachasit.com

A Pin Dot Flutter package. Make it easy to use and minimal code.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on pin_dot