flutter_once 1.0.4 flutter_once: ^1.0.4 copied to clipboard
Want to show a widget once periodically (Daily - Weekly - Monthly - Yearly - Any period)? We got your back.
flutter_once #
Built on once. #
Want to show a widget once periodically (Daily - Weekly - Monthly - Yearly - Any period)? We got you.
Some widgets should show OnceWidget.
- Users should only get the guided widget OnceWidget.
- Release notes widget should only pop up OnceWidget every new app version comes.
- Etc.. OnceWidget every (Whatever you want).
OnceWidgets
supports showOnce
, showOnEveryNewVersion
, showEvery12Hours
, showHourly
, showDaily
, showWeekly
, showMonthly
, showOnNewMonth
, showYearly
and Custom (Duration)
.
Usage #
Mainly builder functions consists of builders and fallbacks
builder
is the generic function that shows and returns aWidget
.fallback
is the same but only shows in case that callback future returns null (defaults toSizedBox.shrink()
).
Now you're ready to go. Say you wanted to view a banner widget when the app is updated:
OnceWidget.showOnEveryNewVersion(
builder: () {
return Container(...);
},
);
Or maybe you want to show the rate this app dialog every week for the user:
Once.showWeekly("ratingDialog",
builder: () {
return Text('Hello, New Week');
},
fallback: () {
return Text('Hello!');
},
);
Contributors #
inspired by the java library Once made by Jon Finerty