Commit 7d66d8cd authored by yangwu.jia's avatar yangwu.jia

Page name update

parent e26225b4
...@@ -277,7 +277,6 @@ public class NewBoostFlutterActivity extends Activity ...@@ -277,7 +277,6 @@ public class NewBoostFlutterActivity extends Activity
protected void onStop() { protected void onStop() {
super.onStop(); super.onStop();
delegate.onStop(); delegate.onStop();
// lifecycle.handleLifecycleEvent(Lifecycle.Event.ON_STOP);
} }
@Override @Override
......
...@@ -12,14 +12,14 @@ import java.util.Map; ...@@ -12,14 +12,14 @@ import java.util.Map;
public class PageRouter { public class PageRouter {
public final static Map<String, String> pageName = new HashMap<String, String>() {{ public final static Map<String, String> pageName = new HashMap<String, String>() {{
put("sample://flutterPage1", "flutterPage1"); put("sample://first", "first");
put("sample://flutterPage2", "flutterPage2"); put("sample://second", "second");
put("sample://flutterPage3", "flutterPage3"); put("sample://tab", "tab");
put("sample://flutterMain", "flutterMain"); put("sample://flutterPage", "flutterPage");
}}; }};
public static final String NATIVE_PAGE_URL = "sample://nativePage"; public static final String NATIVE_PAGE_URL = "sample://nativePage";
public static final String FLUTTER_PAGE_URL = "sample://flutterMain"; public static final String FLUTTER_PAGE_URL = "sample://flutterPage";
public static final String FLUTTER_FRAGMENT_PAGE_URL = "sample://flutterFragmentPage"; public static final String FLUTTER_FRAGMENT_PAGE_URL = "sample://flutterFragmentPage";
public static boolean openPageByUrl(Context context, String url, Map params) { public static boolean openPageByUrl(Context context, String url, Map params) {
......
...@@ -17,12 +17,12 @@ class _MyAppState extends State<MyApp> { ...@@ -17,12 +17,12 @@ class _MyAppState extends State<MyApp> {
super.initState(); super.initState();
FlutterBoost.singleton.registerPageBuilders({ FlutterBoost.singleton.registerPageBuilders({
'flutterPage1': (pageName, params, _) => FirstRouteWidget(), 'first': (pageName, params, _) => FirstRouteWidget(),
'flutterPage2': (pageName, params, _) => SecondRouteWidget(), 'second': (pageName, params, _) => SecondRouteWidget(),
'flutterPage3': (pageName, params, _) => TabRouteWidget(), 'tab': (pageName, params, _) => TabRouteWidget(),
'flutterFragment': (pageName, params, _) => FragmentRouteWidget(params), 'flutterFragment': (pageName, params, _) => FragmentRouteWidget(params),
///可以在native层通过 getContainerParams 来传递参数 ///可以在native层通过 getContainerParams 来传递参数
'flutterMain': (pageName, params, _) { 'flutterPage': (pageName, params, _) {
print("flutterPage params:$params"); print("flutterPage params:$params");
return FlutterRouteWidget(params:params); return FlutterRouteWidget(params:params);
......
...@@ -14,7 +14,7 @@ class FirstRouteWidget extends StatelessWidget { ...@@ -14,7 +14,7 @@ class FirstRouteWidget extends StatelessWidget {
child: Text('Open second route'), child: Text('Open second route'),
onPressed: () { onPressed: () {
print("open second page!"); print("open second page!");
FlutterBoost.singleton.open("sample://flutterPage2").then((Map value) { FlutterBoost.singleton.open("sample://second").then((Map value) {
print( print(
"call me when page is finished. did recieve second route result $value"); "call me when page is finished. did recieve second route result $value");
}); });
...@@ -59,7 +59,7 @@ class TabRouteWidget extends StatelessWidget { ...@@ -59,7 +59,7 @@ class TabRouteWidget extends StatelessWidget {
body: Center( body: Center(
child: RaisedButton( child: RaisedButton(
onPressed: () { onPressed: () {
FlutterBoost.singleton.open("sample://flutterPage2"); FlutterBoost.singleton.open("sample://second");
}, },
child: Text('Open second route'), child: Text('Open second route'),
), ),
...@@ -140,14 +140,14 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> { ...@@ -140,14 +140,14 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
margin: const EdgeInsets.all(8.0), margin: const EdgeInsets.all(8.0),
color: Colors.yellow, color: Colors.yellow,
child: Text( child: Text(
'open flutterPage1', 'open first',
style: TextStyle(fontSize: 22.0, color: Colors.black), style: TextStyle(fontSize: 22.0, color: Colors.black),
)), )),
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。 ///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb ///例如:sample://nativePage?aaa=bbb
onTap: () => FlutterBoost.singleton onTap: () => FlutterBoost.singleton
.open("sample://flutterPage1", urlParams: { .open("sample://first", urlParams: {
"query": {"aaa": "bbb"} "query": {"aaa": "bbb"}
}), }),
), ),
...@@ -157,14 +157,14 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> { ...@@ -157,14 +157,14 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
margin: const EdgeInsets.all(8.0), margin: const EdgeInsets.all(8.0),
color: Colors.yellow, color: Colors.yellow,
child: Text( child: Text(
'open flutterPage2', 'open second',
style: TextStyle(fontSize: 22.0, color: Colors.black), style: TextStyle(fontSize: 22.0, color: Colors.black),
)), )),
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。 ///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb ///例如:sample://nativePage?aaa=bbb
onTap: () => FlutterBoost.singleton onTap: () => FlutterBoost.singleton
.open("sample://flutterPage2", urlParams: { .open("sample://second", urlParams: {
"query": {"aaa": "bbb"} "query": {"aaa": "bbb"}
}), }),
), ),
...@@ -174,14 +174,14 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> { ...@@ -174,14 +174,14 @@ class _FlutterRouteWidgetState extends State<FlutterRouteWidget> {
margin: const EdgeInsets.all(8.0), margin: const EdgeInsets.all(8.0),
color: Colors.yellow, color: Colors.yellow,
child: Text( child: Text(
'open flutterPage3', 'open tab',
style: TextStyle(fontSize: 22.0, color: Colors.black), style: TextStyle(fontSize: 22.0, color: Colors.black),
)), )),
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。 ///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb ///例如:sample://nativePage?aaa=bbb
onTap: () => FlutterBoost.singleton onTap: () => FlutterBoost.singleton
.open("sample://flutterPage3", urlParams: { .open("sample://tab", urlParams: {
"query": {"aaa": "bbb"} "query": {"aaa": "bbb"}
}), }),
), ),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment