flutter_dynamic_otp 0.0.6 copy "flutter_dynamic_otp: ^0.0.6" to clipboard
flutter_dynamic_otp: ^0.0.6 copied to clipboard

Flutter package that provides a customizable OTP (One-Time Password)

example/lib/main.dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dynamic_otp/flutter_dynamic_otp.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'flutter dynamic otp',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'flutter dynamic otp'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: FlutterDynamicOTP(
          digitsLength: 4,
          textInputType: TextInputType.number,
          digitDecoration: InputDecoration(
            counter: const Offstage(),
            enabledBorder: OutlineInputBorder(
              borderSide: const BorderSide(
                width: 2,
                color: Colors.blueAccent,
              ),
              borderRadius: BorderRadius.circular(100),
            ),
            focusedBorder: OutlineInputBorder(
              borderSide: const BorderSide(
                width: 2,
                color: Colors.deepOrange,
              ),
              borderRadius: BorderRadius.circular(100),
            ),
          ),
          digitHeight: 100,
          digitWidth: 65,
          digitsPadding: 4,
          onChanged: (value) {
            // do something
          },
        ),
      ),
    );
  }
}
33
likes
140
points
30
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter package that provides a customizable OTP (One-Time Password)

Repository (GitLab)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_dynamic_otp