0 purchases
whale
whale #
a whale is navigator developed using navigation 2.0.
Contents #
1.Navigation
2.Dialog
3.Global
Navigation Usage #
Push #
You can push new page on specific page with Whale.go() method. It needs on argument and to argument which you want to push on page stack.
// These three method's exactly same operation
Whale.goByContext(from: context, to: AlarmView());
Whale.goByView(from: this or this.widget, to: AlarmView());
copied to clipboard
####Q. Why to argument type is Widget?
because of some projects which communicate with each page with callback function see below:
Whale.goByView(
from: this,
to: PostAddview(
onPostAdded: (post){
// some projects use callback to communicate with each page
_addPost(post);
}
),
toName: '/post-add',
);
copied to clipboard
Pop #
Like push operation, you can pop specific page by key or context.
Whale.backByContext(context);
Whale.backByView(this or this.widget);
copied to clipboard
Replace #
If you want to replace specific page to other, do below:
Whale.replaceByContext(from: context, to: AlarmView());
Whale.replaceByView(from: this or this.widget, to: AlarmView());
copied to clipboard
Dialog Example #
Whale manages dialog stack per page.
So, If you want to show dialog, you should select a page which will present it.
Show Dialog #
Whale.showDialogWithContext(
context,
CustomDialog(
title: 'Hi, there!',
subTitle: 'Welcome to my app.',
onCloseButtonPressed: () {
}
),
key: 'IntroDialog',
);
copied to clipboard
Util Function #
For convenience, Whale gives you some streams and methods.
Get current page stack #
You can get current page stack
String url = Whale.getCurrentUrl();
print(url);
// '/TreatmentHomeView/AlarmListView/AlarmDetailView
copied to clipboard
Listening back button press event (Android) #
You can listen back button press event stream anywhere like below :
var subscription = Whale.backButtonStream((event){
PageConfig pageConfig = event.onPageConfig;
print(pageConfig.pageName);
});
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.