瀏覽代碼

修改京东初始化位置

tags/0.0.2+4^0
Weller 4 年之前
父節點
當前提交
f8ceeb6885
共有 2 個文件被更改,包括 148 次插入73 次删除
  1. +5
    -12
      example/lib/main.dart
  2. +143
    -61
      lib/register.dart

+ 5
- 12
example/lib/main.dart 查看文件

@@ -4,7 +4,6 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_alibc/flutter_alibc.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:jdsdk/jdsdk.dart';
import 'package:provider/provider.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:zhiying_base_widget/pages/home_page/home_page.dart';
@@ -35,7 +34,11 @@ class _MyAppState extends State<MyApp> {
child: Text(
"走神了~\n${error.exceptionAsString()}",
style:
Theme.of(context).textTheme.title.copyWith(color: Colors.redAccent),
Theme
.of(context)
.textTheme
.title
.copyWith(color: Colors.redAccent),
),
);
}
@@ -49,16 +52,6 @@ class _MyAppState extends State<MyApp> {
FlutterAlibc.initAlibc(version: "", appName: "").then((result) {
print("白川" + '${result.errorCode} ${result.errorMessage}');
});
print('初始化京东~');
if (Platform.isIOS) {
Jdsdk.init(
appKey: 'f17dcdf22df3bd440fac4c3cbcc76bff',
appSecret: 'a60bea3315794ae9bb9b7ea749be8506');
} else if (Platform.isAndroid) {
Jdsdk.init(
appKey: 'c0abbe1f201464ee139d613591a1be02',
appSecret: 'a0eeac7105bf4c7cb573972aa03ed95c');
}

// app更新插件
AppUpdateUtil.initXUpdate();


+ 143
- 61
lib/register.dart 查看文件

@@ -1,3 +1,4 @@
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:sharesdk_plugin/sharesdk_interface.dart';
import 'package:sharesdk_plugin/sharesdk_register.dart';
@@ -77,6 +78,8 @@ import 'widgets/search/tabbar/search_tab_creater.dart';
import 'widgets/search_result/goods_list/search_result_goods_list_creater.dart';
import 'widgets/search_result/search_input/search_result_input.dart';

import 'package:jdsdk/jdsdk.dart';

class BaseWidgetRegister {
/// 初始化方法
static void init() {
@@ -94,12 +97,28 @@ class BaseWidgetRegister {

Application.addMethod(() async {
ShareSDKRegister register = ShareSDKRegister();
register.setupWechat("wx617c77c82218ea2c", "c7253e5289986cf4c4c74d1ccc185fb1", "https://www.sandslee.com/");
register.setupSinaWeibo("568898243", "38a4f8204cc784f81f9f0daaf31e02e3", "http://www.sharesdk.cn");
register.setupWechat(
"wx617c77c82218ea2c", "c7253e5289986cf4c4c74d1ccc185fb1",
"https://www.sandslee.com/");
register.setupSinaWeibo("568898243", "38a4f8204cc784f81f9f0daaf31e02e3",
"http://www.sharesdk.cn");
register.setupQQ("1111030588", "XoHKlrBybXy7ORBt");
SharesdkPlugin.regist(register);
});

Application.addMethod(() async {
print('初始化京东~');
if (Platform.isIOS) {
Jdsdk.init(
appKey: 'f17dcdf22df3bd440fac4c3cbcc76bff',
appSecret: 'a60bea3315794ae9bb9b7ea749be8506');
} else if (Platform.isAndroid) {
Jdsdk.init(
appKey: 'c0abbe1f201464ee139d613591a1be02',
appSecret: 'a0eeac7105bf4c7cb573972aa03ed95c');
}
});

Application.addMethod(() async {
return Future.delayed(Duration(seconds: 1));
});
@@ -111,56 +130,78 @@ class BaseWidgetRegister {
PageFactory.regist('homePage', (model) => HomePage());
PageFactory.regist('pub.flutter.index', (model) => MainPage(model));
PageFactory.regist('pub.flutter.profile', (model) => MainPage(model));
PageFactory.regist('pub.flutter.hot_rank', (model) => HotRankingPage(model));
PageFactory.regist('pub.flutter.my_wallet', (model) => WalletPage(data: model));
PageFactory.regist(
'pub.flutter.hot_rank', (model) => HotRankingPage(model));
PageFactory.regist(
'pub.flutter.my_wallet', (model) => WalletPage(data: model));
PageFactory.regist('goods_details', (model) => GoodsDetailsPage(model));
PageFactory.regist('pub.flutter.search_index', (model) => SearchPage(model));
PageFactory.regist(
'pub.flutter.search_index', (model) => SearchPage(model));
PageFactory.regist('search_item_page', (model) => SearchItemPage(model));
PageFactory.regist('pub.flutter.search_index', (model) => SearchResultPage(model));
PageFactory.regist('search_result_item', (model) => SearchResultItemPage(model));
PageFactory.regist(
'pub.flutter.search_index', (model) => SearchResultPage(model));
PageFactory.regist(
'search_result_item', (model) => SearchResultItemPage(model));
PageFactory.regist('pub.flutter.feedback', (model) => FeedbackPage(model));
PageFactory.regist('pub.flutter.wechat_teacher', (model) => WechatTeacherPage());
PageFactory.regist(
'pub.flutter.wechat_teacher', (model) => WechatTeacherPage());
PageFactory.regist('pub.flutter.cash_out', (model) => WithdrawPage(model));

// webview
PageFactory.regist('pub.flutter.url', (model) => BaseWebview(model));

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

PageFactory.regist('pub.flutter.my_order', (model) => OrdersPage(model));
PageFactory.regist('pub.flutter.account_security', (model) => SecurityPage(model));
PageFactory.regist('pub.flutter.account_security_alipay', (model) => SecurityBindAlipayPage(model));
PageFactory.regist(
'pub.flutter.account_security', (model) => SecurityPage(model));
PageFactory.regist('pub.flutter.account_security_alipay', (model) =>
SecurityBindAlipayPage(model));
// 登录密码
PageFactory.regist('pub.flutter.account_security_password', (model) => SecurityPassword(model));
PageFactory.regist('pub.flutter.account_security_password', (model) =>
SecurityPassword(model));
// 修改手机号
PageFactory.regist('pub.flutter.account_security_mobile', (model) => SecurityMobile(model));
PageFactory.regist('pub.flutter.account_security_mobile', (model) =>
SecurityMobile(model));
// 邀请好友
PageFactory.regist('pub.flutter.invite_friends', (model) => InvitedFriendsPage(model));
PageFactory.regist(
'pub.flutter.invite_friends', (model) => InvitedFriendsPage(model));

/// 我的团队
PageFactory.regist('pub.flutter.my_team', (model) => TeamPage(model));

/// 用户详情
PageFactory.regist('pub.flutter.my_fan_detail', (model) => TeamDetailsPage(model));
PageFactory.regist(
'pub.flutter.my_fan_detail', (model) => TeamDetailsPage(model));

/// 消息中心
PageFactory.regist('pub.flutter.message_center', (model) => MessageNoticePage(model));
PageFactory.regist(
'pub.flutter.message_center', (model) => MessageNoticePage(model));

/// TODO 首页的消息中心标识和我的页面不一致,需要改
PageFactory.regist('pub.flutter.message', (model) => MessageNoticePage(model));
PageFactory.regist(
'pub.flutter.message', (model) => MessageNoticePage(model));

/// 我的收藏
PageFactory.regist('pub.flutter.my_fav', (model) => FavoritesPage(model));

/// 关于我们
PageFactory.regist('pub.flutter.about_us', (model) => AboutUsPage(model));

/// 隐私设置
PageFactory.regist('pub.flutter.privacy_settings', (model) => PrivacySettingsPage(model));
PageFactory.regist(
'pub.flutter.privacy_settings', (model) => PrivacySettingsPage(model));

/// 消息设置
PageFactory.regist('pub.flutter.message_settings', (model) => MessageSettingsPage(model));
PageFactory.regist(
'pub.flutter.message_settings', (model) => MessageSettingsPage(model));

/// 钱包明细
PageFactory.regist('pub.flutter.my_wallet_detail', (model) => BilDetailPage(model));
PageFactory.regist(
'pub.flutter.my_wallet_detail', (model) => BilDetailPage(model));

/// 通用模块
PageFactory.regist('pub.flutter.custom', (model) => CustomPage(model));
}
@@ -183,10 +224,12 @@ class BaseWidgetRegister {
WidgetFactory.regist('index_recommend_list', GoodsListCreater());

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

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

/// 不可以滚动banner
WidgetFactory.regist('index_banner_one', HomeBannerCreater());
@@ -197,80 +240,111 @@ class BaseWidgetRegister {
// 搜索标题
// WidgetFactory.regist('search_index_app_bar', DefaultWidgetCreater((model) => SearchAppbarWidget(model)));
// 搜索输入框
WidgetFactory.regist('search_index_input', DefaultWidgetCreater((model) => SearchInputWidget(model)));
WidgetFactory.regist('search_index_input',
DefaultWidgetCreater((model) => SearchInputWidget(model)));
// // 搜索tabBar
WidgetFactory.regist('search_index_icon_list', SearcchTabCreater());
// WidgetFactory.regist('search_index_icon_list', DefaultWidgetCreater((model) => SearchTabWidget(model)));
// // 热门搜索标签
WidgetFactory.regist('search_index_host_keyword', DefaultWidgetCreater((model) => SearchHotTagWidget(model)));
WidgetFactory.regist('search_index_host_keyword',
DefaultWidgetCreater((model) => SearchHotTagWidget(model)));
// // 历史搜索标签
WidgetFactory.regist('search_index_history', DefaultWidgetCreater((model) => SearchHistoryTagWidget(model)));
WidgetFactory.regist('search_index_history',
DefaultWidgetCreater((model) => SearchHistoryTagWidget(model)));

/// ==================== 搜索结果页面 ==================== ///
// 输入框
WidgetFactory.regist('search_result_input', DefaultWidgetCreater((model) => SearchResultInputWidget(model)));
WidgetFactory.regist('search_result_input',
DefaultWidgetCreater((model) => SearchResultInputWidget(model)));
// tabbar
WidgetFactory.regist('search_result_icon_list', SearchResultTabCreater());

// 搜索结果页筛选widget 淘宝
WidgetFactory.regist('search_result_taobao_sort', DefaultWidgetCreater((model) => SearchResultSortWidget(model)));
WidgetFactory.regist('search_result_taobao_sort',
DefaultWidgetCreater((model) => SearchResultSortWidget(model)));
// 搜索结果的商品列表 淘宝
WidgetFactory.regist('search_result_taobao_item', SearchResultGoodsListCreater());
WidgetFactory.regist(
'search_result_taobao_item', SearchResultGoodsListCreater());

// 搜索结果页筛选widget 京东
WidgetFactory.regist('search_result_jd_sort', DefaultWidgetCreater((model) => SearchResultSortWidget(model)));
WidgetFactory.regist('search_result_jd_sort',
DefaultWidgetCreater((model) => SearchResultSortWidget(model)));
// 搜索结果的商品列表 京东
WidgetFactory.regist('search_result_jd_item', SearchResultGoodsListCreater());
WidgetFactory.regist(
'search_result_jd_item', SearchResultGoodsListCreater());

// 搜索结果页筛选widget 苏宁
WidgetFactory.regist('search_result_suning_sort', DefaultWidgetCreater((model) => SearchResultSortWidget(model)));
WidgetFactory.regist('search_result_suning_sort',
DefaultWidgetCreater((model) => SearchResultSortWidget(model)));
// 搜索结果的商品列表 苏宁
WidgetFactory.regist('search_result_suning_item', SearchResultGoodsListCreater());
WidgetFactory.regist(
'search_result_suning_item', SearchResultGoodsListCreater());

// 搜索结果页筛选widget 拼多多
WidgetFactory.regist('search_result_pdd_sort', DefaultWidgetCreater((model) => SearchResultSortWidget(model)));
WidgetFactory.regist('search_result_pdd_sort',
DefaultWidgetCreater((model) => SearchResultSortWidget(model)));
// 搜索结果的商品列表 拼多多
WidgetFactory.regist('search_result_pdd_item', SearchResultGoodsListCreater());
WidgetFactory.regist(
'search_result_pdd_item', SearchResultGoodsListCreater());

// 搜索结果页筛选widget 唯品会
WidgetFactory.regist('search_result_vip_sort', DefaultWidgetCreater((model) => SearchResultSortWidget(model)));
WidgetFactory.regist('search_result_vip_sort',
DefaultWidgetCreater((model) => SearchResultSortWidget(model)));
// 搜索结果的商品列表 唯品会
WidgetFactory.regist('search_result_vip_item', SearchResultGoodsListCreater());
WidgetFactory.regist(
'search_result_vip_item', SearchResultGoodsListCreater());

// 搜索结果页筛选widget 考拉
WidgetFactory.regist('search_result_kaola_sort', DefaultWidgetCreater((model) => SearchResultSortWidget(model)));
WidgetFactory.regist('search_result_kaola_sort',
DefaultWidgetCreater((model) => SearchResultSortWidget(model)));
// 搜索结果的商品列表 考拉
WidgetFactory.regist('search_result_kaola_item', SearchResultGoodsListCreater());
WidgetFactory.regist(
'search_result_kaola_item', SearchResultGoodsListCreater());

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

@@ -282,25 +356,33 @@ class BaseWidgetRegister {
// )));
WidgetFactory.regist('my_wallet_appbar', NormalNavCreater());

WidgetFactory.regist('my_wallet_header', DefaultWidgetCreater((model) => WalletData(model)));
WidgetFactory.regist('my_wallet_bil', DefaultWidgetCreater((model) => WalletBil(model)));
WidgetFactory.regist(
'my_wallet_header', DefaultWidgetCreater((model) => WalletData(model)));
WidgetFactory.regist(
'my_wallet_bil', DefaultWidgetCreater((model) => WalletBil(model)));
// WidgetFactory.regist(
// 'wallet_detail', DefaultWidgetCreater((model) => WalletDetail()));
// WidgetFactory.regist('wallet_detail', HomeAuthCreater());
WidgetFactory.regist('my_wallet_providers', DefaultWidgetCreater((model) => WalletDetail(model)));
WidgetFactory.regist('my_wallet_providers',
DefaultWidgetCreater((model) => WalletDetail(model)));

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

//======================= 账单明细
WidgetFactory.regist(
'my_wallet_detail',
DefaultWidgetCreater((model) => WalletBilDetail(
DefaultWidgetCreater((model) =>
WalletBilDetail(
data: model,
)));

//======================== 热榜
WidgetFactory.regist('hot_rank_appbar', DefaultWidgetCreater((model) => HotRankingAppBar(model)));
WidgetFactory.regist('hot_rank_tabs', DefaultWidgetCreater((model) => HotRankTableBar(model)));
WidgetFactory.regist('hot_rank_tab_view', DefaultWidgetCreater((model) => HotRankingList(model)));
WidgetFactory.regist('hot_rank_appbar',
DefaultWidgetCreater((model) => HotRankingAppBar(model)));
WidgetFactory.regist('hot_rank_tabs',
DefaultWidgetCreater((model) => HotRankTableBar(model)));
WidgetFactory.regist('hot_rank_tab_view',
DefaultWidgetCreater((model) => HotRankingList(model)));
}
}

Loading…
取消
儲存