基础库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

router_util.dart 730 B

4 vuotta sitten
12345678910111213141516171819202122
  1. import 'package:flutter/material.dart';
  2. import 'package:zhiying_comm/zhiying_comm.dart';
  3. class RouterUtil {
  4. /**
  5. * @description: 公共方法页面跳转,如果flutter端已经注册,直接跳转,否则转交原生处理
  6. * @param {BasePageModel} 页面数据
  7. * @param {BuildContext} context
  8. * @return:
  9. */
  10. static void route(Map<String, dynamic> model, BuildContext context) {
  11. String name = model.containsKey('name') ? model['name'] : '';
  12. if (PageFactory.hasRegisted(name)) {
  13. Widget page = PageFactory.create(name, model);
  14. Navigator.push(context, MaterialPageRoute(builder: (context) {
  15. return page;
  16. }));
  17. } else {
  18. NativeUtil.openPage(context, model);
  19. }
  20. }
  21. }