flutter_otp_input 1.0.0 copy "flutter_otp_input: ^1.0.0" to clipboard
flutter_otp_input: ^1.0.0 copied to clipboard

The OTPInput widget is a customizable Flutter widget that allows users to input a one-time password (OTP) through a series of individual text fields

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: 'Flutter Demo',
      home: MyHomePage(title: ''),
    );
  }
}

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(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: OTPInput(
        length: 6,
        onCompleted: (value) => print('OTP Completed: $value'),
        onChanged: (value) => print('OTP Changed: $value'),
        textStyle: const TextStyle(fontSize: 18, color: Colors.black),
        borderFieldColor: Colors.blue,
        phoneNumber: "+33767567658",
        resendStyle: const TextStyle(
          fontSize: 14,
          color: Colors.black,
          fontWeight: FontWeight.bold,
        ),
        onResend: () {
          print("Renvoi du code...");
        },
        verifyButtonColor: Colors.blue,
        errorMessage: "Code OTP invalide",
        resendTextStyle: const TextStyle(
          color: Colors.blue,
          fontSize: 16,
          fontWeight: FontWeight.bold,
          decoration: TextDecoration.underline,
        ),
      ),
    );
  }
}
0
likes
0
points
38
downloads

Publisher

unverified uploader

Weekly Downloads

The OTPInput widget is a customizable Flutter widget that allows users to input a one-time password (OTP) through a series of individual text fields

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

cupertino_icons, flutter

More

Packages that depend on flutter_otp_input