otp_pin_field_custom 1.4.2 copy "otp_pin_field_custom: ^1.4.2" to clipboard
otp_pin_field_custom: ^1.4.2 copied to clipboard

A flutter package which will help you to generate pin code fields with beautiful design and animations. Can be useful for OTP or pin code inputs.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:otp_pin_field/otp_pin_field.dart';

import 'next_page.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

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

  final String title;

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

void _hideKeyboard() {
  SystemChannels.textInput.invokeMethod('TextInput.hide');
}

class _MyHomePageState extends State<MyHomePage> {
  ///  Otp pin Controller
  final _otpPinFieldController = GlobalKey<OtpPinFieldState>();

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () => _hideKeyboard(),
      child: Scaffold(
        appBar: AppBar(title: Text(widget.title)),
        body: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            OtpPinField(
                          key: _otpPinFieldController,
                          autoFillEnable: false,
                          textInputAction: TextInputAction.done,
                          onSubmit: (text) {
                            
                          },
                          onChange: (text) {
                            
                          },
                          onCodeChanged: (code) {},
                          otpPinFieldInputType: OtpPinFieldInputType.custom,
                          otpPinInputCustom: "•",
                          otpPinFieldStyle: OtpPinFieldStyle(
                            // showHintText: false,
                            fieldBorderRadius: 0,
                            activeFieldBorderRadius: 4.0, // Rounded corners when highlighted
                            fieldPadding: 0,
                            textStyle: TextStyle(
                              fontSize: 30,
                              color: Color(0xFFB8B8B8),
                            ),
                            filledFieldBorderColor: Color(0xFF313131),
                            activeFieldBorderColor:  Color(0xFFF25700),
                            defaultFieldBorderColor:Color(0xFF313131),
                            fieldBorderWidth: 1,
                           defaultFieldRightBorderWidth: 0
                          ),
                          fieldWidth: MediaQuery.of(context).size.width / 6,
                          maxLength: 6,
                          fieldHeight: 60,
                          showCursor: true,
                          cursorColor: Color(0xFF6E6E6E),
                          cursorWidth: 2,
                          mainAxisAlignment: MainAxisAlignment.center,
                          otpPinFieldDecoration: OtpPinFieldDecoration.defaultPinBoxDecoration,
                        )
          ],
        ),
      ),
    );
  }
}
0
likes
0
points
37
downloads

Publisher

unverified uploader

Weekly Downloads

A flutter package which will help you to generate pin code fields with beautiful design and animations. Can be useful for OTP or pin code inputs.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface, universal_html

More

Packages that depend on otp_pin_field_custom

Packages that implement otp_pin_field_custom