/* * @Author: Weller * @Date: 2020-05-16 17:26:40 * @LastEditTime: 2020-06-16 15:40:43 * @LastEditors: Please set LastEditors * @Description: In User Settings Edit * @FilePath: /hairuyi_flutter_comm/lib/router/page_factory.dart */ import 'package:flutter/material.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; typedef Widget CreatePage(Map model); /* 页面生成工厂, 用于生成flutter端公共跳转页面,native端页面生成PlatforView等等 */ class PageFactory { static Map pageCreater = Map(); /** * @description: 注册路由 * @param {name} SkipUIIdentifier * @return: */ static void regist(String name, CreatePage creater) { if (pageCreater.containsKey(name)) { return; } pageCreater[name] = creater; } /** * @description: 创建页面 * @param {String} name注册的SkipUIIdentifier * @return: */ static Widget create(String name, Map model) { if (pageCreater.containsKey(name)) { return pageCreater[name](model); } return EmptyPage(); } /** * @description: 是否注册页面 * @param {bool} * @return: */ static bool hasRegisted(String name) { return pageCreater.containsKey(name); } }