基础组件库
 
 
 
 
 

203 wiersze
10 KiB

  1. import 'package:zhiying_base_widget/pages/goods_details_page/goods_details_page.dart';
  2. import 'package:zhiying_base_widget/pages/launch_page/launch_page.dart';
  3. import 'package:zhiying_base_widget/pages/main_page/main_page.dart';
  4. import 'package:zhiying_base_widget/pages/mine_detail_page/mine_detail_page.dart';
  5. import 'package:zhiying_base_widget/pages/orders_page/orders_page.dart';
  6. import 'package:zhiying_base_widget/pages/security_page/security_bind_alipay/security_bind_alipay_page.dart';
  7. import 'package:zhiying_base_widget/pages/security_page/security_mobile/security_mobile.dart';
  8. import 'package:zhiying_base_widget/pages/security_page/security_page.dart';
  9. import 'package:zhiying_base_widget/pages/security_page/security_password/security_password.dart';
  10. import 'package:zhiying_base_widget/pages/setting_page/setting_page.dart';
  11. import 'package:zhiying_base_widget/pages/sreach_result_page/sreach_result_page.dart';
  12. import 'package:zhiying_base_widget/pages/wallet_page/wallet_page.dart';
  13. import 'package:zhiying_base_widget/pages/webview/base_webview.dart';
  14. import 'package:zhiying_base_widget/widgets/goods_details/footer/goods_details_footer_widget.dart';
  15. import 'package:zhiying_base_widget/widgets/goods_details/price/goods_details_price_widget.dart';
  16. import 'package:zhiying_base_widget/widgets/goods_details/slide_banner/goods_details_slide_banner_widget.dart';
  17. import 'package:zhiying_base_widget/widgets/goods_details/store/store_widget.dart';
  18. import 'package:zhiying_base_widget/widgets/goods_details/upgrade_tip/upgrade_tip_widget.dart';
  19. import 'package:zhiying_base_widget/widgets/home/home_banner/home_banner_creater.dart';
  20. import 'package:zhiying_base_widget/widgets/home/home_banner/home_banner_widget.dart';
  21. import 'package:zhiying_base_widget/widgets/home/home_goods/home_goods_creater.dart';
  22. import 'package:zhiying_base_widget/widgets/home/home_notice/home_notice_widget.dart';
  23. import 'package:zhiying_base_widget/widgets/home/home_slide_banner/home_slide_banner_creater.dart';
  24. import 'package:zhiying_base_widget/widgets/home/home_sreach/home_sreach_creater.dart';
  25. import 'package:zhiying_base_widget/widgets/mine/mine_data/mine_data.dart';
  26. import 'package:zhiying_base_widget/widgets/mine/mine_header/mine_header.dart';
  27. import 'package:zhiying_base_widget/widgets/mine/mine_nav/mine_nav_bg.dart';
  28. import 'package:zhiying_base_widget/widgets/mine/mine_nav/mine_nav_creater.dart';
  29. import 'package:zhiying_base_widget/widgets/mine/mine_quick_entry/mine_quick_entry.dart';
  30. import 'package:zhiying_base_widget/widgets/others/normal_nav/normal_nav_creater.dart';
  31. import 'package:zhiying_base_widget/widgets/search/appbar/search_appbar_creater.dart';
  32. import 'package:zhiying_base_widget/widgets/search/input/search_input_creater.dart';
  33. import 'package:zhiying_base_widget/widgets/search/tabbar/search_tab_creater.dart';
  34. import 'package:zhiying_base_widget/widgets/wallet/wallet_data/wallet_data.dart';
  35. import 'package:zhiying_base_widget/widgets/wallet/wallet_detail/wallet_detail.dart';
  36. import 'package:zhiying_base_widget/widgets/wallet/wallet_income/wallet_income.dart';
  37. import 'package:zhiying_comm/util/defalut_widget_creater.dart';
  38. import 'package:zhiying_comm/zhiying_comm.dart';
  39. import 'pages/search_page/search_page.dart';
  40. import 'widgets/goods_details/coupon/counpon_widget.dart';
  41. import 'widgets/goods_details/detail_img/goods_details_img.dart';
  42. import 'widgets/goods_details/evaluate/goods_details_evaluate_widget.dart';
  43. import 'widgets/goods_details/recommend/goods_detail_commend_creater.dart';
  44. import 'widgets/goods_details/title/goods_details_title_widget.dart';
  45. import 'widgets/home/home_quick_entry/home_quick_entry.dart';
  46. class BaseWidgetRegister {
  47. /// 初始化方法
  48. static void init() {
  49. BaseWidgetRegister.registPage();
  50. BaseWidgetRegister.registWidgets();
  51. BaseWidgetRegister.registInit();
  52. }
  53. static void registInit() {
  54. Application.addMethod(() {
  55. return BaseSettingModel.init();
  56. });
  57. }
  58. // 注册页面
  59. static void registPage() {
  60. PageFactory.regist('homePage', (model) => LaunchPage());
  61. PageFactory.regist('pub.flutter.index', (model) => MainPage(model));
  62. PageFactory.regist('pub.flutter.profile', (model) => MainPage(model));
  63. PageFactory.regist('pub.flutter.my_wallet', (model) => WalletPage());
  64. PageFactory.regist('goods_details', (model) => GoodsDetailsPage(model));
  65. PageFactory.regist('sreach', (model) => SearchPage(model));
  66. PageFactory.regist('sreach_result', (model) => SreachResultPage());
  67. // PageFactory.regist('login', (model) => LoginPage(model));
  68. // PageFactory.regist('login_quick', (model) => LoginQuickPage(model));
  69. // PageFactory.regist('login_account', (model) => LoginAccountPage(model));
  70. // PageFactory.regist('login_invite', (model) => LoginInvitePage());
  71. // webview
  72. PageFactory.regist('pub.flutter.url', (model) => BaseWebview(model));
  73. PageFactory.regist(
  74. 'pub.flutter.profile_settings', (model) => MineDetailPage());
  75. PageFactory.regist('pub.flutter.settings', (model) => SettingPage(model));
  76. PageFactory.regist('pub.flutter.my_orders', (model) => OrdersPage(model));
  77. PageFactory.regist(
  78. 'pub.flutter.account_security', (model) => SecurityPage(model));
  79. PageFactory.regist('pub.flutter.account_security_alipay',
  80. (model) => SecurityBindAlipayPage(model));
  81. // 登录密码
  82. PageFactory.regist('pub.flutter.account_security_password',
  83. (model) => SecurityPassword(model));
  84. // 修改手机号
  85. PageFactory.regist('pub.flutter.account_security_mobile',
  86. (model) => SecurityMobile(model));
  87. }
  88. // 注册控件
  89. static void registWidgets() {
  90. // ==================== 通用组件
  91. // 导航栏
  92. WidgetFactory.regist('normal_nav', NormalNavCreater());
  93. // ==================== 首页
  94. // WidgetFactory.regist('index_title', NormalNavCreater());
  95. /// 首页搜索栏
  96. WidgetFactory.regist('index_search', HomeSreachCreater());
  97. // WidgetFactory.regist('index_search',
  98. // DefaultWidgetCreater((model) => HomeSreachWidget(model)));
  99. /// 可滚动banner
  100. WidgetFactory.regist('index_carousel', HomeSlideBannerCreater());
  101. WidgetFactory.regist('index_recommend_list', GoodsListCreater());
  102. /// 首页快速入口
  103. WidgetFactory.regist(
  104. 'multi_nav', DefaultWidgetCreater((model) => HomeQuickEntry(model)));
  105. /// 滚动公告
  106. WidgetFactory.regist('index_placard',
  107. DefaultWidgetCreater((model) => HomeNoticeWidget(model)));
  108. /// 不可以滚动banner
  109. WidgetFactory.regist('index_banner_one', HomeBannerCreater());
  110. WidgetFactory.regist('index_banner_two', HomeBannerCreater());
  111. // WidgetFactory.regist('index_taobao_auth_tip', HomeAuthCreater());
  112. /// ==================== 搜索页面 ==================== ///
  113. // 搜索标题
  114. // WidgetFactory.regist('search_index_app_bar', DefaultWidgetCreater((model) => SearchAppbarWidget(model)));
  115. WidgetFactory.regist('search_index_app_bar', SearchAppbarCreater());
  116. // 搜索输入框
  117. WidgetFactory.regist('search_index_input', SearchInputCreater());
  118. // WidgetFactory.regist('search_index_input', DefaultWidgetCreater((model) => SearchInputWidget(model)));
  119. // // 搜索tabBar
  120. WidgetFactory.regist('search_index_icon_list', SearcchTabCreater());
  121. // WidgetFactory.regist('search_index_icon_list', DefaultWidgetCreater((model) => SearchTabWidget(model)));
  122. // // 热门搜索标签
  123. // WidgetFactory.regist('search_index', null);
  124. // // 历史搜索标签
  125. // WidgetFactory.regist('search_index_history', null);
  126. /// ==================== 商品详情 ==================== ///
  127. // 商品详情轮播图
  128. WidgetFactory.regist('product_detail_carousel',
  129. DefaultWidgetCreater((model) => GoodsDetailsSlideBannerWidget(model)));
  130. // 商品详情下载APP提示
  131. WidgetFactory.regist('product_detail_download_tips',
  132. DefaultWidgetCreater((model) => UpgradeTipWidget(model)));
  133. // 商品详情价格显示
  134. WidgetFactory.regist('product_detail_price',
  135. DefaultWidgetCreater((model) => GoodsDetailsPriceWidget(model)));
  136. // 商品详情标题
  137. WidgetFactory.regist('product_detail_title',
  138. DefaultWidgetCreater((model) => GoodsDetailsTitleWidget(model)));
  139. // 商品详情优惠劵
  140. WidgetFactory.regist('product_detail_coupon',
  141. DefaultWidgetCreater((model) => CounponWidget(model)));
  142. // 商品详情店铺
  143. WidgetFactory.regist('product_detail_shop',
  144. DefaultWidgetCreater((model) => StoreWidget(model)));
  145. // 商品详情宝贝评价
  146. WidgetFactory.regist('product_detail_comment',
  147. DefaultWidgetCreater((model) => GoodsDetailsEvaluateWidget(model)));
  148. // 商品详情图片
  149. WidgetFactory.regist('product_detail_img_list',
  150. DefaultWidgetCreater((model) => GoodsDetailsImgWidget(model)));
  151. // 商品详情底部推荐列表
  152. WidgetFactory.regist(
  153. 'product_detail_bottom_rec', GoodsDetailCommendCreater());
  154. // 商品详情底部
  155. WidgetFactory.regist('product_detail_bottom',
  156. DefaultWidgetCreater((model) => GoodsDetailsFooterWidget(model)));
  157. // ==================== 个人中心
  158. WidgetFactory.regist('profile_appbar', MineNavCreater());
  159. WidgetFactory.regist('profile_background',
  160. DefaultWidgetCreater((model) => MineNavBg(model)));
  161. WidgetFactory.regist(
  162. 'profile_header', DefaultWidgetCreater((model) => MineHeader(model)));
  163. WidgetFactory.regist(
  164. 'profile_earning', DefaultWidgetCreater((model) => MineData(model)));
  165. WidgetFactory.regist('profile_functions',
  166. DefaultWidgetCreater((model) => MineQuickEntry(model)));
  167. WidgetFactory.regist('profile_my_functions',
  168. DefaultWidgetCreater((model) => MineQuickEntry(model)));
  169. WidgetFactory.regist('profile_carousel',
  170. DefaultWidgetCreater((model) => HomeBannerWidget(model)));
  171. // ==================== 钱包
  172. WidgetFactory.regist(
  173. 'wallet_data', DefaultWidgetCreater((model) => WalletData()));
  174. // WidgetFactory.regist(
  175. // 'wallet_detail', DefaultWidgetCreater((model) => WalletDetail()));
  176. // WidgetFactory.regist('wallet_detail', HomeAuthCreater());
  177. WidgetFactory.regist(
  178. 'wallet_data', DefaultWidgetCreater((model) => WalletData()));
  179. WidgetFactory.regist(
  180. 'wallet_detail', DefaultWidgetCreater((model) => WalletDetail()));
  181. WidgetFactory.regist(
  182. 'wallet_income', DefaultWidgetCreater((model) => WalletIncome()));
  183. }
  184. }