larryaasen / upgrader

A Flutter package for prompting users to upgrade when there is a newer version of the app in the store.
MIT License
547 stars 268 forks source link

Upgrader causes lag on TextField #233

Closed ahndwon closed 1 year ago

ahndwon commented 1 year ago

When using upgrader, inputting letters fast by soft keyboard causes lag on TextField widget. It is more noticeable on Android phones than iPhones. And if the phone's hardware performance is low, more noticeable.

I found out that only projects that are released on store gets this lag. Projects that are not released doesn't have this issue.

I tried upgrader: ^4.8.1 and ^4.10.0 all have same problem

I used upgrader as below, with no parameters.

UpgradeAlert(
      upgrader: Upgrader(),
     child: TextField()
)
larryaasen commented 1 year ago

Don't create the Upgrader() instance more than once. You don't even need to create it at all. Just use this: UpgradeAlert(child: TextField())

ahndwon commented 1 year ago

Thanks, that solved the issue!

I am now using the sharedInstance. I have a suggestion. I think sharedInstance method should have explicit return type. If not, it has to be type casted whenever it's used, as below.

    (Upgrader.sharedInstance as Upgrader).debugDisplayOnce = true;

Again, thanks for the help! I'll close this issue.

larryaasen commented 1 year ago

Glad that worked for you.

For the shared instance, are you talking about this line? https://github.com/larryaasen/upgrader/blob/1ca48d2ad485dc02e47f74b704ef121e85ccb982/lib/src/upgrader.dart#L184

ahndwon commented 1 year ago

Yes, that getter is what I was talking about.

larryaasen commented 1 year ago

That getter is already typed.