import 'package:flutter/cupertino.dart';
import 'package:zhiying_base_widget/pages/goods_details_page/goods_details_page.dart';
import 'package:zhiying_base_widget/pages/home_page/home_page.dart';
import 'package:zhiying_base_widget/pages/main_page/main_page.dart';
import 'package:zhiying_base_widget/pages/mine_detail_page/mine_detail_page.dart';
import 'package:zhiying_base_widget/pages/orders_page/orders_page.dart';
import 'package:zhiying_base_widget/pages/setting_page/setting_page.dart';
import 'package:zhiying_base_widget/pages/wallet_page/wallet_page.dart';
import 'package:zhiying_base_widget/widgets/home/home_auth/home_auth_creater.dart';
import 'package:zhiying_base_widget/widgets/goods_details/footer/goods_details_footer_widget.dart';
import 'package:zhiying_base_widget/widgets/goods_details/price/goods_details_price_widget.dart';
import 'package:zhiying_base_widget/widgets/goods_details/slide_banner/goods_details_slide_banner_widget.dart';
import 'package:zhiying_base_widget/widgets/goods_details/store/store_widget.dart';
import 'package:zhiying_base_widget/widgets/goods_details/upgrade_tip/upgrade_tip_widget.dart';
import 'package:zhiying_base_widget/widgets/home/home_banner/home_banner_creater.dart';
import 'package:zhiying_base_widget/widgets/home/home_banner/home_banner_widget.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/home_goods_creater.dart';
import 'package:zhiying_base_widget/widgets/home/home_notice/home_notice_widget.dart';
import 'package:zhiying_base_widget/widgets/home/home_notice/model/home_notice_model.dart';
import 'package:zhiying_base_widget/widgets/home/home_slide_banner/home_slide_banner_creater.dart';
import 'package:zhiying_base_widget/widgets/home/home_sreach/home_sreach_creater.dart';
import 'package:zhiying_base_widget/widgets/home/home_sreach/home_sreach_widget.dart';
import 'package:zhiying_base_widget/widgets/mine/mine_data/mine_data.dart';
import 'package:zhiying_base_widget/widgets/mine/mine_header/mine_header.dart';
import 'package:zhiying_base_widget/widgets/mine/mine_nav/mine_nav_bg.dart';
import 'package:zhiying_base_widget/widgets/mine/mine_nav/mine_nav_creater.dart';
import 'package:zhiying_base_widget/widgets/mine/mine_quick_entry/mine_quick_entry.dart';
import 'package:zhiying_base_widget/widgets/others/normal_nav/normal_nav_creater.dart';
import 'package:zhiying_base_widget/widgets/wallet/wallet_data/wallet_data.dart';
import 'package:zhiying_base_widget/widgets/wallet/wallet_detail/wallet_detail.dart';
import 'package:zhiying_base_widget/widgets/wallet/wallet_income/wallet_income.dart';
import 'package:zhiying_comm/util/defalut_widget_creater.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

import 'widgets/goods_details/coupon/counpon_widget.dart';
import 'widgets/goods_details/evaluate/goods_details_evaluate_widget.dart';
import 'widgets/goods_details/title/goods_details_title_widget.dart';
import 'widgets/home/home_quick_entry/home_quick_entry.dart';

class BaseWidgetRegister {
  /// 初始化方法
  static void init() {
    BaseWidgetRegister.registPage();
    BaseWidgetRegister.registWidgets();
  }

  // 注册页面
  static void registPage() {
    PageFactory.regist('homePage', (model) => HomePage());
    PageFactory.regist('index', (model) => MainPage(model));
    PageFactory.regist('profile', (model) => MainPage(model));
    PageFactory.regist('category', (model) => WalletPage());
    PageFactory.regist('goods_details', (model) => GoodsDetailsPage(model));
    // PageFactory.regist('login', (model) => LoginPage(model));
    // PageFactory.regist('login_quick', (model) => LoginQuickPage(model));
    // PageFactory.regist('login_account', (model) => LoginAccountPage(model));
    // PageFactory.regist('login_invite', (model) => LoginInvitePage());

    PageFactory.regist('pub.flutter.profile_settings', (model) => MineDetailPage());
    PageFactory.regist('pub.flutter.settings', (model) => SettingPage(model));

    PageFactory.regist('pub.flutter.my_orders', (model) => OrdersPage(model));

  }

  // 注册控件
  static void registWidgets() {
    // ==================== 通用组件
    // 导航栏
    WidgetFactory.regist('normal_nav', NormalNavCreater());

    // ==================== 首页
    // WidgetFactory.regist('index_title', NormalNavCreater());
    /// 首页搜索栏
    // WidgetFactory.regist('index_search', HomeSreachCreater());
    // WidgetFactory.regist('index_search', DefaultWidgetCreater((model) => HomeSreachWidget(model)));
    /// 可滚动banner
    WidgetFactory.regist('index_carousel', HomeSlideBannerCreater());
    WidgetFactory.regist('index_recommend_list', GoodsListCreater());

    /// 首页快速入口
    WidgetFactory.regist('multi_nav', DefaultWidgetCreater((model) => HomeQuickEntry(model)));

    /// 滚动公告
    WidgetFactory.regist('index_placard', DefaultWidgetCreater((model) => HomeNoticeWidget(model)));

    /// 不可以滚动banner
    WidgetFactory.regist('index_banner_one', HomeBannerCreater());
    WidgetFactory.regist('index_banner_two', HomeBannerCreater());
    WidgetFactory.regist('index_taobao_auth_tip', HomeAuthCreater());

    /// ==================== 商品详情 ==================== ///
    // 商品详情轮播图
    WidgetFactory.regist('product_detail_carousel', DefaultWidgetCreater((model) => GoodsDetailsSlideBannerWidget(model)));
    // 商品详情下载APP提示
    WidgetFactory.regist('product_detail_download_tips', DefaultWidgetCreater((model) => UpgradeTipWidget(model)));
    // 商品详情价格显示
    WidgetFactory.regist('product_detail_price', DefaultWidgetCreater((model) => GoodsDetailsPriceWidget(model)));
    // 商品详情标题
    WidgetFactory.regist('product_detail_title', DefaultWidgetCreater((model) => GoodsDetailsTitleWidget(model)));
    // 商品详情优惠劵
    WidgetFactory.regist('product_detail_coupon', DefaultWidgetCreater((model) => CounponWidget(model)));
    // 商品详情店铺
    WidgetFactory.regist('product_detail_shop', DefaultWidgetCreater((model) => StoreWidget(model)));
    // 商品详情宝贝评价
    WidgetFactory.regist('product_detail_comment', DefaultWidgetCreater((model) => GoodsDetailsEvaluateWidget(model)));
    // 商品详情图片
    // WidgetFactory.regist('product_detail_img_list', MineNavCreater());
    // 商品详情底部推荐列表
    // WidgetFactory.regist('product_detail_bottom_rec', DefaultWidgetCreater((model) => GoodsDetailsEvaluateWidget(model)));
    // 商品详情底部
    WidgetFactory.regist('product_detail_bottom', DefaultWidgetCreater((model) => GoodsDetailsFooterWidget(model)));


    // ==================== 个人中心
    WidgetFactory.regist('profile_appbar', MineNavCreater());
    WidgetFactory.regist('profile_background', DefaultWidgetCreater((model) => MineNavBg(model)));
    WidgetFactory.regist('profile_header', DefaultWidgetCreater((model) => MineHeader(model)));
    WidgetFactory.regist('profile_earning', DefaultWidgetCreater((model) => MineData(model)));
    WidgetFactory.regist('profile_functions', DefaultWidgetCreater((model) => MineQuickEntry(model)));
    WidgetFactory.regist('profile_my_functions', DefaultWidgetCreater((model) => MineQuickEntry(model)));
    WidgetFactory.regist('profile_carousel', DefaultWidgetCreater((model) => HomeBannerWidget(model)));

    // ==================== 钱包
    WidgetFactory.regist(
        'wallet_data', DefaultWidgetCreater((model) => WalletData()));
//    WidgetFactory.regist(
//        'wallet_detail', DefaultWidgetCreater((model) => WalletDetail()));
    WidgetFactory.regist('wallet_detail', HomeAuthCreater());
    WidgetFactory.regist('wallet_data', DefaultWidgetCreater((model) => WalletData()));
    WidgetFactory.regist('wallet_detail', DefaultWidgetCreater((model) => WalletDetail()));

    WidgetFactory.regist('wallet_income', DefaultWidgetCreater((model) => WalletIncome()));
  }
}
