whale 1.1.13 copy "whale: ^1.1.13" to clipboard
whale: ^1.1.13 copied to clipboard

A flutter navigation 2.0 router for mobile app

whale #

a whale is navigator developed using navigation 2.0.

Contents #

1.Navigation

2.Dialog

3.Global

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());

####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',
);

Pop #

Like push operation, you can pop specific page by key or context.

Whale.backByContext(context);
Whale.backByView(this or this.widget);

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());

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', 
);

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

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);
});
0
likes
120
pub points
0%
popularity

Publisher

verified publisherbebe-soft.com

A flutter navigation 2.0 router for mobile app

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on whale