Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Auto Adjust Width missing #39

Open
OliverNarramore opened this issue Jan 22, 2020 · 1 comment · Fixed by #46
Open

Auto Adjust Width missing #39

OliverNarramore opened this issue Jan 22, 2020 · 1 comment · Fixed by #46

Comments

@OliverNarramore
Copy link

I have been using "auto adjust width" but this seems to have disappeared in the latest version. What is the alternative?

pinCodeTextFieldLayoutType: pinCodeTextFieldLayoutType.AUTO_ADJUST_WIDTH,

@SergeShkurko
Copy link
Contributor

hot solution

    final maxLength = 4;
    final pinBoxWidth = 60.0;
    final pinBoxBorderWidth = 2.0;
    final pinBoxOuterPadding = EdgeInsets.symmetric(horizontal: 4.0);
    var width = 0.0;
    for (var i = 0; i < maxLength; i++) {
      width += pinBoxWidth;
      if (i == 0) {
        width += pinBoxOuterPadding.left;
      } else if (i + 1 == maxLength) {
        width += pinBoxOuterPadding.right;
      } else {
        width += pinBoxOuterPadding.left + pinBoxOuterPadding.right;
      }
    }

    final confirmationCodeInput = SizedBox(
      width: width,
      child: PinCodeTextField(
        isCupertino: true,
        autofocus: true,
        maxLength: maxLength,
        pinBoxOuterPadding: pinBoxOuterPadding,
        pinBoxWidth: pinBoxWidth,
        pinBoxHeight: 85,
        pinBoxColor: Colors.grey[100],
        pinBoxRadius: 8,
        defaultBorderColor: Colors.grey[100],
        hasTextBorderColor: Colors.grey[100],
        errorBorderColor: Colors.red[200],
        pinBoxBorderWidth: pinBoxBorderWidth,
      ),
    );

LiewJunTung added a commit that referenced this issue May 26, 2020
Fixed cursor in cupertino, fixed #39, fixed textarea for paste code
LiewJunTung added a commit that referenced this issue May 26, 2020
* Fixed cursor in cupertino, fixed #39, fixed textarea for paste code by [SergeShkurko](https://github.com/LiewJunTung/pin_code_text_field/issues?q=is%3Apr+author%3ASergeShkurko)
* Added highlighted pinBox backgroundColor by [heymars](https://github.com/LiewJunTung/pin_code_text_field/issues?q=is%3Apr+author%3Aheymars)
* Implementation hide default keyboard by [luffynas](https://github.com/LiewJunTung/pin_code_text_field/issues?q=is%3Apr+author%3Aluffynas)
@LiewJunTung LiewJunTung reopened this May 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants