larryaasen / upgrader

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

How can I change the message texts. I tried I don't see any option for that #240

Closed arammarm closed 6 months ago

arammarm commented 1 year ago
DanilKarasev commented 1 year ago

class MyUpgraderMessages extends UpgraderMessages { @override String get buttonTitleIgnore => 'My Ignore'; }

UpgradeAlert(Upgrader(messages: MyUpgraderMessages()));

raphaeldivine3028 commented 1 year ago

This is simple, just like @DanilKarasev said, create a custom class, say MyOwnUpgraderMessage name it whatever you want to and extend it from UpgraderMessages, then override the texts you want to change.

You can currently override the following texts: body, buttonTitleIgnore, buttonTitleLater, buttonTitleUpdate, prompt, releaseNotes, and title;

Sample:

 @override
  String get releaseNotes => "What's New?";

So our class will now be:

class MyOwnUpgraderMessage  extends {
 @override
  String get releaseNotes => "What's New?";
}
  1. Then in your widget, your "messages" will now be the name of your new class, MyOwnUpgraderMessage.

Viola!