LiewJunTung / pin_code_text_field

A highly customisable Flutter widget for entering pin code. Suitable for use cases such as login and OTP.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not work in cupertino app

SergeShkurko opened this issue · comments

Input does not work if the application is wrapped not in MaterialApp, but in CupertinoApp

For reproduce:

main() {
CupertinoApp(
    home: CupertinoPageScaffold(
       child: PinCodeTextField(
        autofocus: true,
        pinBoxWidth: 60,
        pinBoxHeight: 60,
        defaultBorderColor: Colors.grey,
        pinBoxDecoration: (borderColor) => BoxDecoration(
              border: Border(bottom: BorderSide(color: borderColor, width: 3)),
            ),
      )
    ),
  )
}

Inkedscreenshot-1553528924379_LI

Error log:

I/flutter (18572): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (18572): The following NoSuchMethodError was thrown building AnimatedBuilder(animation:
I/flutter (18572): Listenable.merge([FocusNode#06b6d, TextEditingController#59f4c(TextEditingValue(text: ┤├, selection:
I/flutter (18572): TextSelection(baseOffset: -1, extentOffset: -1, affinity: TextAffinity.downstream, isDirectional:
I/flutter (18572): false), composing: TextRange(start: -1, end: -1)))]), dirty, state: _AnimatedState#2fa75):
I/flutter (18572): The method 'remainingTextFieldCharacterCount' was called on null.
I/flutter (18572): Receiver: null
I/flutter (18572): Tried calling: remainingTextFieldCharacterCount(4)
I/flutter (18572): 
I/flutter (18572): When the exception was thrown, this was the stack:
I/flutter (18572): #0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
I/flutter (18572): #1      _TextFieldState._getEffectiveDecoration 
package:flutter/…/material/text_field.dart:518
I/flutter (18572): #2      _TextFieldState.build.<anonymous closure> 
package:flutter/…/material/text_field.dart:837
I/flutter (18572): #3      AnimatedBuilder.build 
package:flutter/…/widgets/transitions.dart:854
I/flutter (18572): #4      _AnimatedState.build 
package:flutter/…/widgets/transitions.dart:96
I/flutter (18572): #5      StatefulElement.build 
package:flutter/…/widgets/framework.dart:3825
I/flutter (18572): #6      ComponentElement.performRebuild 
....

Whabam, I admit I haven't tried it on Cupertino. Should be straightforward,
I'll add a CupertinoPinCodeTextField in the next release.