GithubHelp home page GithubHelp logo

david-legend / otp_textfield Goto Github PK

View Code? Open in Web Editor NEW
54.0 54.0 33.0 6.79 MB

License: BSD 3-Clause "New" or "Revised" License

Dart 84.59% Kotlin 0.45% Swift 1.46% Objective-C 0.14% HTML 13.37%

otp_textfield's Introduction

Hi ๐Ÿ‘‹, I'm David Cobbina

I am full stack software engineer with great passion for building high quality applications. I have an extensive experience building frontend (mobile & web) and backend applications.

otp_textfield's People

Contributors

david-legend avatar ii11ii avatar k1ycee avatar prkhrv avatar rbnxytt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

otp_textfield's Issues

Failed assertion: line 69 pos 15: 'color != null': is not true.

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

class OtpScreen extends StatefulWidget {
@OverRide
_OtpState createState() => _OtpState();
}

class _OtpState extends State {
@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
automaticallyImplyLeading: false,
// leading: IconButton(
// icon: Icon(
// Icons.keyboard_backspace,
// ),
// onPressed: ()=>Navigator.pop(context),
// ),
centerTitle: true,
title: Text(
"OTP",
),
elevation: 0.0,
),

  body: Container(
    child: Padding(
      padding: EdgeInsets.all(8.0),
      child: OtpTextField(
        numberOfFields: 5,
        borderColor: Color(0xFF512DA8),
        showFieldAsBox: true,
        onCodeChanged: (String value) {

        },
        onSubmit: (String verificationCode){
          //navigate to different screen code goes here
          showDialog(
              context: context,
              builder: (context){
                return AlertDialog(
                  title: Text("Verification Code"),
                  content: Text('Code entered is $verificationCode'),
                );
              }
          );
        }, // end onSubmit
      ), // end PinEntryTextField()
    ), // end Padding()
  ), 
);

}
}

My code

Unable to set field height

Am unable to set field height. I have checked all the parameters there is only setWidth parameter. How do I go about it?

Cannot clear textfields

You may want to clear the text fields in case the user entered a wrong verification code.

handleControllers not called when styles added

handleControllers method is called during building of textfields and it is called inside the loop, as you can see in the code (flutter_otp_text_field version 1.1.1). This still works, however, I don't understand why you are calling it inside the loop. This however results in the following behaviour.

styles added: handleControllers not called.
styles not added: handleControllers called.

Expected behaviour:
handleControllers should be called irrespective of whether styles added.

  Widget generateTextFields(BuildContext context) {
    List<Widget> textFields = List.generate(widget.numberOfFields, (int i) {
      addFocusNodeToEachTextField(index: i);
      addTextEditingControllerToEachTextField(index: i);

      if (widget.styles.length > 0) {
        return _buildTextField(
          context: context,
          index: i,
          style: widget.styles[i],
        );
      }
      if (widget.handleControllers != null) {
        widget.handleControllers!(_textControllers);
      }
      return _buildTextField(context: context, index: i);
    });

    return Row(
      mainAxisAlignment: widget.mainAxisAlignment,
      crossAxisAlignment: widget.crossAxisAlignment,
      children: textFields,
    );
  }

EnabledBorderColor is not set as required and no default value is set for it

EnabledBorderColor is not set as required and no default value is set for it,
So if not enabled border color is set, it crashes the app because there's is an assertion that states that enabled border color must not be null.
To reproduce the error, use the otp_textfield widget with passing the enabled border color

Change Focus manually

I have added two OTP Text field for Email and Mobile number in single screen

want to set focus on Email OTP text filed first character OR Mobile OTP text filed first Character based on API Response so how can i do this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.