felangel / flow_builder

Flutter Flows made easy! A Flutter package which simplifies navigation flows with a flexible, declarative API.
https://pub.dev/packages/flow_builder
MIT License
389 stars 63 forks source link

feat: deep link support proposal #67

Open orestesgaolin opened 2 years ago

orestesgaolin commented 2 years ago

Status

IN DEVELOPMENT

Breaking Changes

Description

This PR shows potential way to introduce deep link support with usage of MaterialApp.router(). The main problem is that FlowBuilder does not expose a way to notify about popping the page. Thus, I used NavigatorObserver to check if the popped route is related to the deep link that was added to the state of NavigationCubit. If FlowBuilder would allow to pass callback to modify the state when the deep linked page is pushed, then it would be even simpler, e.g.:

    return FlowBuilder<NavigationState>(
      state: state,
      onGeneratePages: onGeneratePages,
      onPop: (page) {
        context.read<NavigationCubit>().clearRoute(page);
      },
      key: navigatorKey,
    );

How to test:

# iOS
xcrun simctl openurl booted com.example.example://myapp/room/999

# Android
adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "com.example.example://myapp/room/999" com.example.example

https://user-images.githubusercontent.com/16854239/137512664-67d375f7-3962-48a2-8dee-ea59daa491d2.mp4

Type of Change

filly82 commented 2 years ago

looks good. any ETA on this?