natintosh / intl_phone_number_input

MIT License
166 stars 510 forks source link

onInputChanged logic #252

Open CripyIce opened 3 years ago

CripyIce commented 3 years ago

Describe the bug Hi there, I've noticed that onInputChanged is called when setting initialValue and also when focusing out from the textfield. Any way of changing or controlling this behaviour? It's very problematic in a project I have. Thanks!

Package version 0.7.0+2

Flutter version 2.2.3

To Reproduce Steps to reproduce the behavior:

  1. WrapScaffold with:
    GestureDetector(
      onTap: () => FocusScope.of(context).unfocus(),
      child: Scaffold(...)
    )
  2. Add initialValue and onInputChanged to the textfield.
  3. You can see that onInputChanged is called on initialValue and when tapping around the screen to dismiss the keyboard (even when giving unique keys to the textfield).

Expected behavior onInputChanged should be called only when user typed himself in the textfield, or maybe getting a bool whether it's a user change or code change.

Targeted platforms (please complete the following information):