import 'package:zhiying_base_widget/pages/home_page/home_page.dart';
import 'package:zhiying_base_widget/pages/login_page/login_page.dart';
import 'package:zhiying_base_widget/pages/login_page/quick/login_quick_page.dart';
import 'package:zhiying_base_widget/pages/main_page/main_page.dart';
import 'package:zhiying_base_widget/pages/wallet_page/wallet_page.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_quick_entry/home_quick_entry_creater.dart';
import 'package:zhiying_base_widget/widgets/home/home_slide_banner/home_slide_banner_creater.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/zhiying_comm.dart';

import 'pages/login_page/account/login_account_page.dart';
import 'pages/login_page/invite/login_invite_page.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('login', (model) => LoginPage(model));
    PageFactory.regist('login_quick', (model) => LoginQuickPage(model));
    PageFactory.regist('login_account', (model) => LoginAccountPage(model));
    PageFactory.regist('login_invite', (model) => LoginInvitePage());
  }

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

    // ==================== 首页
    /// 可滚动banner
    WidgetFactory.regist('index_carousel', HomeSlideBannerCreater());
    WidgetFactory.regist('index_recommend_list', GoodsListCreater());
    // 首页快速入口
    WidgetFactory.regist('home_quick_entry', HomeQuickEntryCreater());

    /// 首页快速入口
    WidgetFactory.regist('multi_nav', HomeQuickEntryCreater());

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

    // ==================== 个人中心
    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()));
    WidgetFactory.regist(
        'profile_functions', DefaultWidgetCreater((model) => MineQuickEntry()));
    WidgetFactory.regist('profile_my_functions',
        DefaultWidgetCreater((model) => MineQuickEntry()));
    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_income', DefaultWidgetCreater((model) => WalletIncome()));
  }
}
