Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIREBASE_AUTHENTICATION ] doesn't receive any OTP, error or warning #2193

Closed
motorahul opened this issue Mar 18, 2020 · 6 comments
Closed
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. platform: web Issues / PRs which are specifically for web. plugin: auth resolution: needs-repro This issue could not be reproduced or needs an up to date reproduction on latest FlutterFire plugin. type: bug Something isn't working

Comments

@motorahul
Copy link

motorahul commented Mar 18, 2020

i have tried firebase authentication for flutter web authenticaton using mobile number but didnot receive any Otp .and recieve any error or warning
thanks

@motorahul motorahul added the type: bug Something isn't working label Mar 18, 2020
@motorahul

This comment has been minimized.

@iapicca
Copy link

iapicca commented Mar 20, 2020

Hi @motorahul
can you please provide your flutter doctor -v ,
your flutter run --verbose,
your pubspec.yaml
and if possible a reproducible minimal code sample.
Thank you

@iapicca iapicca changed the title [<FIREBASE_AUTHENTICATION >] <MOBILE NUMBER> [FIREBASE_AUTHENTICATION ] doesn't receive any OTP, error or warning Mar 20, 2020
@iapicca iapicca added the blocked: customer-response Waiting for customer response, e.g. more information was requested. label Mar 20, 2020
@motorahul
Copy link
Author

motorahul commented Mar 20, 2020

flutter run --verbose

/Users/rahulrawat/.zprofile:export:1: not valid in this context: /Users/rahulrawat/sdkpath/flutter/bin”
rahulrawat@Rahuls-MacBook-Air pdt_pronewweb % flutter run --verbose
[  +34 ms] executing: [/Users/rahulrawat/sdkpath/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[  +63 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] fabeb2a16f1d008ab8230f450c49141d35669798
[        ] executing: [/Users/rahulrawat/sdkpath/flutter/] git describe --match v*.*.* --first-parent --long --tags
[  +27 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[        ] v1.14.6-0-gfabeb2a16
[  +13 ms] executing: [/Users/rahulrawat/sdkpath/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[  +19 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/beta
[        ] executing: [/Users/rahulrawat/sdkpath/flutter/] git ls-remote --get-url origin
[  +16 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[  +83 ms] executing: [/Users/rahulrawat/sdkpath/flutter/] git rev-parse --abbrev-ref HEAD
[  +19 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] beta
[  +13 ms] executing: sw_vers -productName
[  +33 ms] Exit code 0 from: sw_vers -productName
[        ] Mac OS X
[        ] executing: sw_vers -productVersion
[  +25 ms] Exit code 0 from: sw_vers -productVersion
[        ] 10.15.2
[        ] executing: sw_vers -buildVersion
[  +25 ms] Exit code 0 from: sw_vers -buildVersion
[        ] 19C57
[  +53 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +6 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +61 ms] executing: /Users/rahulrawat/Library/Android/sdk/platform-tools/adb devices -l
[  +10 ms] Exit code 0 from: /Users/rahulrawat/Library/Android/sdk/platform-tools/adb devices -l
[        ] List of devices attached
[  +33 ms] executing: /Users/rahulrawat/sdkpath/flutter/bin/cache/artifacts/libimobiledevice/idevice_id -h
[  +85 ms] executing: /usr/bin/xcode-select --print-path
[  +14 ms] Exit code 0 from: /usr/bin/xcode-select --print-path
[        ] /Applications/Xcode.app/Contents/Developer
[   +1 ms] executing: /usr/bin/xcodebuild -version
[+1090 ms] Exit code 0 from: /usr/bin/xcodebuild -version
[   +3 ms] Xcode 11.3.1
           Build version 11C504
[   +4 ms] /usr/bin/xcrun simctl list --json devices
[ +193 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[   +4 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +77 ms] More than one device connected; please specify a device with the '-d <deviceId>' flag, or use '-d all' to act on all devices.
[ +402 ms] Chrome     • chrome     • web-javascript • Google Chrome 80.0.3987.149
[   +1 ms] Web Server • web-server • web-javascript • Flutter Tools
[  +23 ms] "flutter run" took 2,187ms.

#0      throwToolExit (package:flutter_tools/src/base/common.dart:27:3)
#1      RunCommand.validateCommand (package:flutter_tools/src/commands/run.dart:325:7)
<asynchronous suspension>
#2      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:619:11)
<asynchronous suspension>
#3      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:537:33)
<asynchronous suspension>
#4      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:29)
#5      _rootRun (dart:async/zone.dart:1126:13)
#6      _CustomZone.run (dart:async/zone.dart:1023:19)
#7      _runZoned (dart:async/zone.dart:1518:10)
#8      runZoned (dart:async/zone.dart:1465:12)
#9      AppContext.run (package:flutter_tools/src/base/context.dart:149:18)
#10     FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:527:20)
#11     CommandRunner.runCommand (package:args/command_runner.dart:197:27)
#12     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:338:21)
<asynchronous suspension>
#13     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:29)
#14     _rootRun (dart:async/zone.dart:1126:13)
#15     _CustomZone.run (dart:async/zone.dart:1023:19)
#16     _runZoned (dart:async/zone.dart:1518:10)
#17     runZoned (dart:async/zone.dart:1465:12)
#18     AppContext.run (package:flutter_tools/src/base/context.dart:149:18)
#19     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:288:19)
#20     CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:112:25)
#21     new Future.sync (dart:async/future.dart:224:31)
#22     CommandRunner.run (package:args/command_runner.dart:112:14)
#23     FlutterCommandRunner.run (package:flutter_tools/src/runner/flutter_command_runner.dart:231:18)
#24     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:64:22)
#25     _rootRun (dart:async/zone.dart:1126:13)
#26     _CustomZone.run (dart:async/zone.dart:1023:19)
#27     _runZoned (dart:async/zone.dart:1518:10)
#28     runZoned (dart:async/zone.dart:1502:12)
#29     run.<anonymous closure> (package:flutter_tools/runner.dart:62:18)
<asynchronous suspension>
#30     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:29)
#31     _rootRun (dart:async/zone.dart:1126:13)
#32     _CustomZone.run (dart:async/zone.dart:1023:19)
#33     _runZoned (dart:async/zone.dart:1518:10)
#34     runZoned (dart:async/zone.dart:1465:12)
#35     AppContext.run (package:flutter_tools/src/base/context.dart:149:18)
#36     runInContext (package:flutter_tools/src/context_runner.dart:64:24)
#37     run (package:flutter_tools/runner.dart:51:10)
#38     main (package:flutter_tools/executable.dart:65:9)
#39     main (file:///Users/rahulrawat/sdkpath/flutter/packages/flutter_tools/bin/flutter_tools.dart:8:3)
#40     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#41     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)

@motorahul
Copy link
Author

motorahul commented Mar 20, 2020

pubspec.yml

cupertino_icons: ^0.1.2
  firebase_auth: 0.15.5+2
  cloud_firestore: 0.13.0+1
  responsive: ^0.2.3+4
  carousel_pro:
  image_picker:
  google_sign_in:
  flare_flutter: ^2.0.1
  video_player:
  chewie: ^0.9.7
  audioplayers: ^0.14.0






dev_dependencies:
  flutter_test:
    sdk: flutter


# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
    - Assets/Images/

flutter doctor -v

rahulrawat@Rahuls-MacBook-Air pdt_pronewweb % flutter doctor -v 
[✓] Flutter (Channel beta, v1.14.6, on Mac OS X 10.15.2 19C57, locale en-GB)
    • Flutter version 1.14.6 at /Users/rahulrawat/sdkpath/flutter
    • Framework revision fabeb2a16f (7 weeks ago), 2020-01-28 07:56:51 -0800
    • Engine revision c4229bfbba
    • Dart version 2.8.0 (build 2.8.0-dev.5.0 fc3af737c7)

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/rahulrawat/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[!] Xcode - develop for iOS and macOS (Xcode 11.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3.1, Build version 11C504
    ✗ CocoaPods installed but not working.
        You appear to have CocoaPods installed but it is not working.
        This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it.
        This can usually be fixed by re-installing CocoaPods. For more info, see https://github.com/flutter/flutter/issues/14293.
      To re-install CocoaPods, run:
        sudo gem install cocoapods

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 44.0.2
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] Connected device (2 available)
    • Chrome     • chrome     • web-javascript • Google Chrome 80.0.3987.149
    • Web Server • web-server • web-javascript • Flutter Tools

! Doctor found issues in 1 category.
rahulrawat@Rahuls-MacBook-Air pdt_pronewweb % 

@motorahul
Copy link
Author

motorahul commented Mar 20, 2020

firebase authenticaton code

import 'dart:async';

import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:pdtpronewweb/Screens/landingpage.dart';
import 'package:pdtpronewweb/Screens/responsive.dart';
import 'package:pdtpronewweb/Utils/colorUtils.dart';
import 'package:pdtpronewweb/Utils/customWidget.dart';
import 'package:pdtpronewweb/Utils/stringUtils.dart';
import 'package:pdtpronewweb/Utils/validationUtils.dart';
import 'package:pdtpronewweb/size_helpers/screenSize.dart';

class LoginPageWeb extends StatefulWidget {
  @override
  _LoginPageWebState createState() => _LoginPageWebState();
}

class _LoginPageWebState extends State<LoginPageWeb> {
  GlobalKey<FormState> _formKey = GlobalKey<FormState>();

  bool showOTPTextField = false;
  Timer _timer;
  int _start =30;
  String phoneNo;
  String smsCode;
  String verificationId;
  bool _validate = false;

  Future<void> verifyPhone() async {
    final PhoneCodeAutoRetrievalTimeout autoRetrieve =(String verId) {
      this.verificationId = verId;
    };
    final PhoneCodeSent smsCodeSent = (String verId, [int forceCodeResend]) {
      this.verificationId = verId;
      enableOtpTextField().then((value){
        print('Signed IN');
      })
      ;
    };
    final  PhoneVerificationCompleted verifiedSuccess = (AuthCredential user) {
      print('verified');
    };

    final PhoneVerificationFailed veriFailed = (AuthException exception) {
      print('${exception.message}');
    };

    await FirebaseAuth.instance.verifyPhoneNumber(
        phoneNumber: this.phoneNo,
        timeout: Duration(seconds: 5),
        verificationCompleted: verifiedSuccess,
        verificationFailed: veriFailed,
        codeSent: smsCodeSent,
        codeAutoRetrievalTimeout: autoRetrieve);
  }

  @override
  void initState() {
    // TODO: implement initState
    super.initState();

    startTimer();

  }
  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();
  }

  void startTimer()
  {
    const timeSecond =Duration(seconds: 1);
    _timer =Timer.periodic(timeSecond, (Timer time) => setState(
            (){
          if(_start < 1){
            time.cancel();
          }else if(showOTPTextField==true){
            _start = _start - 1;
          }
        }
    ));
  }

  @override
  Widget build(BuildContext context) {
    return ResponsiveWidget(
      largeScreen: Scaffold(
        body: Center(
          child: Container(
              width: displayWidth(context) * 0.3,

              padding: EdgeInsets.only(top: 25.0,right: 50.0,left:50.0 ,bottom: 20.0),
              child:ListView(
                children: <Widget>[
                  Form(
                    key: _formKey,

                    child: Center(
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.center,
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: <Widget>[
                          Container(
                              height: 150,
                              child: Image.asset('Assets/Images/Logo.png',scale: 0.2,)),
                          SizedBox(
                            height: 15.0,
                          ),
                          CustomWidget.getText(StringUtils.verifyWithPhoneNumber,
                              style: TextStyle(color: Colors.orange[500]),
                              fontSize: 25,
                              fontWeight: FontWeight.bold),
                          SizedBox(
                            height: 10.0,
                          ),
                          Column(
                            crossAxisAlignment: CrossAxisAlignment.stretch,
                            children: <Widget>[
                              TextFormField(
                                onChanged: (value) {
                                  this.phoneNo = value;
                                },
                                initialValue: "+91",
                                validator: ValidationUtils.validateMobile,
                                decoration: InputDecoration(
                                    hintText: '+91-9988776655',
                                    hintStyle: TextStyle(color: Colors.grey[300] , fontSize: 12.0),
                                    labelText: "Phone",
                                    labelStyle: TextStyle(color: Colors.grey[300],),
                                    enabledBorder: UnderlineInputBorder(
                                      borderSide: BorderSide(color: Colors.grey[400]),
                                    ),
                                    focusedBorder: UnderlineInputBorder(
                                      borderSide: BorderSide(color: Colors.grey[400]),
                                    )
                                ),
                                keyboardType: TextInputType.phone,
                              ),
                              showOTPTextField==false?disableOtpTextField():enableOtpTextField(),
                              SizedBox(height: 30.0,),
                              Container(
                                height: 50,
                                child: RaisedButton(
                                    onPressed: (){
                                      showOTPTextField==true?
                                      FirebaseAuth.instance.currentUser().then((user) {
                                        if(_formKey.currentState.validate()){
                                          if (user != null) {
                                            Navigator.pushReplacement(context, MaterialPageRoute(builder: (ctx)=>LandingPage()));
                                          } else {
                                            signIn();
                                          }
                                        }
                                      }):
                                      _validatorOTP();

                                      //otpVerificationDailog();
                                    },
                                    color: ColorUtils.buttonLightOrangeColor,
                                    child: showOTPTextField == false ?
                                    CustomWidget.getText(
                                      StringUtils.sendOtp,
                                      style: TextStyle(color: Colors.white),):
                                    CustomWidget.getText(
                                      StringUtils.verify,
                                      style: TextStyle(color: Colors.white),),

                                    shape: RoundedRectangleBorder(
                                      borderRadius: BorderRadius.circular(5.0),)
                                ),
                              ),
                            ],
                          ),
                          SizedBox(height: 30.0,),
                          Column(
                            children: <Widget>[
                              CustomWidget.getText(
                                  StringUtils.byContinuing,
                                  style: TextStyle(color: ColorUtils.frontLightGreyColor,fontSize: 13.0),
                                  textAlign: TextAlign.center
                              ),
                              RichText(
                                  text:
                                  TextSpan(
                                      children: [
                                        TextSpan(text: "I accept the  ",style: TextStyle(color: ColorUtils.frontLightGreyColor),),
                                        TextSpan(text: "terms and conditions" ,
                                          style: TextStyle(color: Colors.black54,fontSize: 13.0),
                                        )
                                      ]))
                            ],
                          ),
                          SizedBox(height: 30,),
                          Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: <Widget>[
                              // Text('00:00 sec',style: TextStyle(color: Colors.grey)),
                              showOTPTextField == true? Text("00.$_start sec", style:TextStyle(color: Colors.grey)):
                              Text('00:00 sec',style: TextStyle(color: Colors.grey,fontSize: 13.0)),
                              GestureDetector(
                                onTap: (){},
                                child: Text('Re-send OTP',style: TextStyle(color: Colors.grey,fontSize: 13.0)),
                              ),
                            ],
                          ),
                          SizedBox(height: 30.0,),
                          CustomWidget.getRichText(
                              "Don't have an account? "," Sign-up",
                              textColor:ColorUtils.frontLightGreyColor,
                              newTextColor: ColorUtils.pinkColor
                          ),
                        ],
                      ),
                    ),
                  ),
                ],
              )

          ),
        ),

      ),
      smallScreen: Material(
        child: Container(
            padding: EdgeInsets.only(top: 25.0,right: 50.0,left:50.0 ,bottom: 20.0),
            child:ListView(
              children: <Widget>[
                Form(
                  key: _formKey,

                  child: Center(
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: <Widget>[
                        Container(
                            height: 150,
                            child: Image.asset('Assets/Images/Logo.png',scale: 0.2,)),
                        SizedBox(
                          height: 15.0,
                        ),
                        CustomWidget.getText(StringUtils.verifyWithPhoneNumber,
                            style: TextStyle(color: Colors.orange[500]),
                            fontSize: 25,
                            fontWeight: FontWeight.bold),
                        SizedBox(
                          height: 10.0,
                        ),
                        Column(
                          crossAxisAlignment: CrossAxisAlignment.stretch,
                          children: <Widget>[
                            TextFormField(
                              onChanged: (value) {
                                this.phoneNo = value;
                              },
                              initialValue: "+91",
                              validator: ValidationUtils.validateMobile,
                              decoration: InputDecoration(
                                  hintText: '+91-9988776655',
                                  hintStyle: TextStyle(color: Colors.grey[300] , fontSize: 12.0),
                                  labelText: "Phone",
                                  labelStyle: TextStyle(color: Colors.grey[300],),
                                  enabledBorder: UnderlineInputBorder(
                                    borderSide: BorderSide(color: Colors.grey[400]),
                                  ),
                                  focusedBorder: UnderlineInputBorder(
                                    borderSide: BorderSide(color: Colors.grey[400]),
                                  )
                              ),
                              keyboardType: TextInputType.phone,
                            ),
                            showOTPTextField==false?disableOtpTextField():enableOtpTextField(),
                            SizedBox(height: 30.0,),
                            Container(
                              height: 50,
                              child: RaisedButton(
                                  onPressed: (){
                                    showOTPTextField==true?
                                    FirebaseAuth.instance.currentUser().then((user) {
                                      if(_formKey.currentState.validate()){
                                        if (user != null) {
                                          Navigator.pushReplacement(context, MaterialPageRoute(builder: (ctx)=>LandingPage()));
                                        } else {
                                          signIn();
                                        }
                                      }
                                    }):
                                    _validatorOTP();

                                    //otpVerificationDailog();
                                  },
                                  color: ColorUtils.buttonLightOrangeColor,
                                  child: showOTPTextField == false ?
                                  CustomWidget.getText(
                                    StringUtils.sendOtp,
                                    style: TextStyle(color: Colors.white),):
                                  CustomWidget.getText(
                                    StringUtils.verify,
                                    style: TextStyle(color: Colors.white),),

                                  shape: RoundedRectangleBorder(
                                    borderRadius: BorderRadius.circular(5.0),)
                              ),
                            ),
                          ],
                        ),
                        SizedBox(height: 30.0,),
                        Column(
                          children: <Widget>[
                            CustomWidget.getText(
                                StringUtils.byContinuing,
                                style: TextStyle(color: ColorUtils.frontLightGreyColor,fontSize: 13.0),
                                textAlign: TextAlign.center
                            ),
                            RichText(
                                text:
                                TextSpan(
                                    children: [
                                      TextSpan(text: "I accept the  ",style: TextStyle(color: ColorUtils.frontLightGreyColor),),
                                      TextSpan(text: "terms and conditions" ,
                                        style: TextStyle(color: Colors.black54,fontSize: 13.0),
                                      )
                                    ]))
                          ],
                        ),
                        SizedBox(height: 30,),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: <Widget>[
                            // Text('00:00 sec',style: TextStyle(color: Colors.grey)),
                            showOTPTextField == true? Text("00.$_start sec", style:TextStyle(color: Colors.grey)):
                            Text('00:00 sec',style: TextStyle(color: Colors.grey,fontSize: 13.0)),
                            GestureDetector(
                              onTap: (){},
                              child: Text('Re-send OTP',style: TextStyle(color: Colors.grey,fontSize: 13.0)),
                            ),
                          ],
                        ),
                        SizedBox(height: 30.0,),
                        CustomWidget.getRichText(
                            "Don't have an account? "," Sign-up",
                            textColor:ColorUtils.frontLightGreyColor,
                            newTextColor: ColorUtils.pinkColor
                        ),
                      ],
                    ),
                  ),
                ),
              ],
            )

        ),
      ),


    );
  }

  enableOtpTextField(){
    return TextFormField(
      onChanged: (value) {
        this.smsCode = value;
      },
      validator: ValidationUtils.validateOtp,

      decoration: InputDecoration(
        hintText: '.  .  .  .  .  .',
        hintStyle: TextStyle(color: ColorUtils.frontLightGreyColor , fontSize: 12.0),
        labelText: 'Enter OTP',
        labelStyle: TextStyle(color: ColorUtils.frontLightGreyColor,fontSize: 12.0
        ),

        enabledBorder: UnderlineInputBorder(
          borderSide: BorderSide(color: ColorUtils.frontLightGreyColor),
        ),

        focusedBorder:  UnderlineInputBorder(
          borderSide: BorderSide(color: ColorUtils.frontLightGreyColor),
        ),
      ),

      keyboardType: TextInputType.phone,
    );
  }

  disableOtpTextField(){
    return Container();
  }


  signIn(){
    final AuthCredential credential = PhoneAuthProvider.getCredential(verificationId: verificationId, smsCode: smsCode);
    FirebaseAuth.instance.signInWithCredential(credential).then((user) {
      Navigator.of(context).pushReplacement(MaterialPageRoute(builder: (ctx)=>LandingPage()));
    }).catchError((e) {
      print(e);
    });
  }

  otpVerificationDailog(){
    return showDialog(
        context: context,
        builder: (BuildContext context){
          return SimpleDialog(
            contentPadding: EdgeInsets.only(
                left: 20.0 ,
                top: 20.0 ,
                right: 20.0 ,
                bottom: 40.0),
            shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(10.0),
            ),
            title: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: <Widget>[
                CustomWidget.getText(StringUtils.otpVerification , style: TextStyle(
                  color: ColorUtils.buttonLightOrangeColor,fontSize: 15.0,
                )),
                GestureDetector(
                  onTap: (){
                    FirebaseAuth.instance.currentUser().then((user){
                      if (user !=null){
                        Navigator.of(context).pushReplacement(MaterialPageRoute(builder: (ctx)=>LandingPage()));
                      }else{
                        verifyPhone();
                      }

                    });
                    setState(() {
                      showOTPTextField= true;
                    });
                    Navigator.pop(context);
                  },

                  child: Icon(Icons.close,color: ColorUtils.frontDarkGreyColor,size: 16.0,),
                )
              ],
            ),

            children: <Widget>[
              Column(
                children: <Widget>[
                  CustomWidget.getText(
                      StringUtils.anOtpHasBeenSentToYourMobileNumber,
                      style: TextStyle(
                          fontSize: 15.0 ,
                          color: ColorUtils.frontLightGreyColor
                      )
                  ),
                ],
              ),
            ],
          );
        }

    );
  }

  _validatorOTP() {
    if (_formKey.currentState.validate()) {
      otpVerificationDailog();
      // No any error in validation
    } else {
      // validation error
      setState(() {
        _validate = true;
      });
    }
  }
}

@iapicca iapicca removed the blocked: customer-response Waiting for customer response, e.g. more information was requested. label Mar 21, 2020
@Ehesp Ehesp added platform: web Issues / PRs which are specifically for web. plugin: auth labels Apr 22, 2020
@Salakar Salakar added blocked: customer-response Waiting for customer response, e.g. more information was requested. resolution: needs-repro This issue could not be reproduced or needs an up to date reproduction on latest FlutterFire plugin. labels Aug 25, 2020
@Salakar
Copy link
Member

Salakar commented Aug 25, 2020

Hey 👋

Our rework of the firebase_auth plugin as part of the FlutterFire roadmap was published over a week ago with a ton of fixes and new features. Please could you try the new version and see if this is still an issue for you? If it is then please submit a new up to date GitHub issue.

For help migrating to the new plugins please see the new migration guide: https://firebase.flutter.dev/docs/migration

@Salakar Salakar closed this as completed Aug 25, 2020
@firebase firebase locked and limited conversation to collaborators Sep 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. platform: web Issues / PRs which are specifically for web. plugin: auth resolution: needs-repro This issue could not be reproduced or needs an up to date reproduction on latest FlutterFire plugin. type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants