Commit 46d2a8575728f3ee7852126bea12ecb01374a2e2

Authored by weixin_45529955
2 parents 30705b8a 6267611f

Merge branch 'v7.2.0+' into v6.1.0+

Showing 29 changed files with 1862 additions and 181 deletions
1 -  
2 class SellerVersionModel { 1 class SellerVersionModel {
3 int? ret; 2 int? ret;
4 List<SellerVersionSunModel>? data; 3 List<SellerVersionSunModel>? data;
@@ -37,6 +36,7 @@ class SellerVersionSunModel { @@ -37,6 +36,7 @@ class SellerVersionSunModel {
37 String? rdate; 36 String? rdate;
38 String? edate; 37 String? edate;
39 String? cdate; 38 String? cdate;
  39 + double? price;
40 40
41 SellerVersionSunModel( 41 SellerVersionSunModel(
42 {this.id, 42 {this.id,
@@ -46,9 +46,10 @@ class SellerVersionSunModel { @@ -46,9 +46,10 @@ class SellerVersionSunModel {
46 this.vname, 46 this.vname,
47 this.rdate, 47 this.rdate,
48 this.edate, 48 this.edate,
49 - this.cdate}); 49 + this.cdate,
  50 + this.price});
50 51
51 - SellerVersionSunModel.fromJson(Map<String, dynamic> json){ 52 + SellerVersionSunModel.fromJson(Map<String, dynamic> json) {
52 id = json['id']; 53 id = json['id'];
53 sid = json['sid']; 54 sid = json['sid'];
54 vid = json['vid']; 55 vid = json['vid'];
@@ -59,7 +60,10 @@ class SellerVersionSunModel { @@ -59,7 +60,10 @@ class SellerVersionSunModel {
59 // edate = json['vid'] == '4' ? '1695005146' : '1694832346'; 60 // edate = json['vid'] == '4' ? '1695005146' : '1694832346';
60 edate = json['edate']; 61 edate = json['edate'];
61 cdate = json['cdate']; 62 cdate = json['cdate'];
62 - } 63 + price = json['price'] is num
  64 + ? (json['price'] as num).toDouble()
  65 + : double.tryParse('${json['price']}');
  66 + }
63 67
64 Map<String, dynamic> toJson() { 68 Map<String, dynamic> toJson() {
65 final Map<String, dynamic> data = new Map<String, dynamic>(); 69 final Map<String, dynamic> data = new Map<String, dynamic>();
@@ -71,6 +75,7 @@ class SellerVersionSunModel { @@ -71,6 +75,7 @@ class SellerVersionSunModel {
71 data['rdate'] = this.rdate; 75 data['rdate'] = this.rdate;
72 data['edate'] = this.edate; 76 data['edate'] = this.edate;
73 data['cdate'] = this.cdate; 77 data['cdate'] = this.cdate;
  78 + data['price'] = this.price;
74 return data; 79 return data;
75 } 80 }
76 } 81 }
@@ -3,7 +3,7 @@ class HttpUrl { @@ -3,7 +3,7 @@ class HttpUrl {
3 static const String server_address = "http://xt04.colorcun.com/"; //服务端请求地址 3 static const String server_address = "http://xt04.colorcun.com/"; //服务端请求地址
4 4
5 // static const String server_address = "http://192.168.5.90:8000/public/"; //服务端请求地址 5 // static const String server_address = "http://192.168.5.90:8000/public/"; //服务端请求地址
6 - 6 +
7 static const String app_user_login = 7 static const String app_user_login =
8 "?service=Android.User.AppUserLogin"; //登录地址 8 "?service=Android.User.AppUserLogin"; //登录地址
9 static const String user_token_init = 9 static const String user_token_init =
@@ -480,6 +480,8 @@ class HttpUrl { @@ -480,6 +480,8 @@ class HttpUrl {
480 480
481 static const String get_seller_version = 481 static const String get_seller_version =
482 "?service=App.SellerVersion.GetSellerVersion"; // 获取商家的版本信息 482 "?service=App.SellerVersion.GetSellerVersion"; // 获取商家的版本信息
  483 + static const String get_version_list =
  484 + "?service=App.SellerVersion.GetVersionList"; // 获取所有版本列表
483 485
484 static const String get_seller_template_color_list = 486 static const String get_seller_template_color_list =
485 "?service=App.Seller.GetSellerTemplateColorList"; // 模板/颜色配置信息 487 "?service=App.Seller.GetSellerTemplateColorList"; // 模板/颜色配置信息
@@ -675,14 +677,9 @@ class HttpUrl { @@ -675,14 +677,9 @@ class HttpUrl {
675 677
676 static const get_free_meal_config_by_seller = 678 static const get_free_meal_config_by_seller =
677 "?service=App.Activity.GetFreeMealConfigBySeller"; // 获取当餐免费的配置信息 679 "?service=App.Activity.GetFreeMealConfigBySeller"; // 获取当餐免费的配置信息
678 -static const clear_seller_user_wechat_bind = 680 + static const clear_seller_user_wechat_bind =
679 "?service=App.Wechat.ClearSellerUserWechatBind"; // 解绑员工账号微信 681 "?service=App.Wechat.ClearSellerUserWechatBind"; // 解绑员工账号微信
680 682
681 -  
682 -  
683 -  
684 -  
685 -  
686 static const get_customer_target_group_list = 683 static const get_customer_target_group_list =
687 "?service=App.Activity.GetCustomerTargetGroupList"; // 获取客户目标群体列表 684 "?service=App.Activity.GetCustomerTargetGroupList"; // 获取客户目标群体列表
688 685
@@ -183,6 +183,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -183,6 +183,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
183 // } 183 // }
184 184
185 WidgetsBinding.instance.addObserver(this); 185 WidgetsBinding.instance.addObserver(this);
  186 + EventBus().on('refreshSellerVersion', (arg) {
  187 + getSellerVersion();
  188 + });
186 189
187 _currIndex = widget.initialIndex; 190 _currIndex = widget.initialIndex;
188 191
@@ -2118,6 +2121,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -2118,6 +2121,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
2118 LogUtil.v("home_dispose"); 2121 LogUtil.v("home_dispose");
2119 2122
2120 // bus.off('refresh_token'); 2123 // bus.off('refresh_token');
  2124 + EventBus().off('refreshSellerVersion');
2121 if (timer != null) { 2125 if (timer != null) {
2122 timer!.cancel(); 2126 timer!.cancel();
2123 } 2127 }
@@ -2130,4 +2134,4 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -2130,4 +2134,4 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
2130 // AzhonAppUpdate.dispose(); 2134 // AzhonAppUpdate.dispose();
2131 WidgetsBinding.instance.removeObserver(this); 2135 WidgetsBinding.instance.removeObserver(this);
2132 } 2136 }
2133 -}  
  2137 +}
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +import 'package:fluwx/fluwx.dart';
  4 +import 'package:one_key/models/seller_version_model.dart';
  5 +import 'package:one_key/models/wechat_pay_model.dart';
  6 +import 'package:one_key/provider/collect_store_provider.dart';
  7 +import 'package:one_key/provider/user_model.dart';
  8 +import 'package:one_key/res/colors.dart';
  9 +import 'package:one_key/utils/event_bus.dart';
  10 +import 'package:one_key/utils/utils.dart';
  11 +import 'package:one_key/widgets/system_app_bar.dart';
  12 +import 'package:provider/provider.dart';
  13 +
  14 +class FunctionUpgradePage extends StatefulWidget {
  15 + const FunctionUpgradePage({super.key, required this.collectStoreProvider});
  16 +
  17 + final CollectStoreProvider collectStoreProvider;
  18 +
  19 + @override
  20 + State<FunctionUpgradePage> createState() => _FunctionUpgradePageState();
  21 +}
  22 +
  23 +class _FunctionUpgradePageState extends State<FunctionUpgradePage> {
  24 + final List<_UpgradeModule> _modules = [];
  25 + bool _loading = true;
  26 + bool _loadFailed = false;
  27 +
  28 + late FluwxCancelable _wxPay;
  29 + final Fluwx _fluwx = Fluwx();
  30 +
  31 + _UpgradeModule? get _selectedModule {
  32 + for (final module in _modules) {
  33 + if (module.selected) {
  34 + return module;
  35 + }
  36 + }
  37 + return null;
  38 + }
  39 +
  40 + double get _total => _selectedModule?.price ?? 0;
  41 +
  42 + bool get _hasSelection => _selectedModule != null;
  43 +
  44 + @override
  45 + void initState() {
  46 + super.initState();
  47 + Utils.changeStatusColor(color: Colors.transparent);
  48 + _wxPay = _fluwx.addSubscriber((res) {
  49 + _wxPay.cancel();
  50 + if (res is WeChatPaymentResponse) {
  51 + if (res.errCode == 0) {
  52 + _handlePaySuccess();
  53 + } else if (res.errCode == -1) {
  54 + Utils.showToast('支付错误');
  55 + } else if (res.errCode == -2) {
  56 + Utils.showToast('您已取消支付');
  57 + }
  58 + }
  59 + });
  60 + WidgetsBinding.instance.addPostFrameCallback((_) {
  61 + _loadModules();
  62 + });
  63 + }
  64 +
  65 + Future<void> _loadModules() async {
  66 + setState(() {
  67 + _loading = true;
  68 + _loadFailed = false;
  69 + });
  70 +
  71 + final List<SellerVersionSunModel>? list =
  72 + await widget.collectStoreProvider.getFunctionUpgradeList(context);
  73 +
  74 + if (!mounted) {
  75 + return;
  76 + }
  77 +
  78 + setState(() {
  79 + _modules.clear();
  80 + if (list != null) {
  81 + for (final item in list) {
  82 + final _UpgradeModule? module = _mapModule(item);
  83 + if (module != null) {
  84 + module.selected = false;
  85 + _modules.add(module);
  86 + }
  87 + }
  88 + }
  89 + _loading = false;
  90 + _loadFailed = list == null;
  91 + });
  92 + }
  93 +
  94 + _UpgradeModule? _mapModule(SellerVersionSunModel item) {
  95 + final String? vid = item.vid;
  96 + final String? name = item.vname;
  97 + if (vid == null || name == null || name.trim().isEmpty) {
  98 + return null;
  99 + }
  100 +
  101 + final String vtype = item.vtype ?? '';
  102 + final String desc;
  103 + if (vtype == '1') {
  104 + desc = '包含现有全部功能组件模块以及未来扩展的功能模块。';
  105 + } else if (vtype == '3') {
  106 + desc = '$name为独立功能模块,开通后有效期一年。';
  107 + } else {
  108 + desc = '$name套餐,开通后有效期一年。';
  109 + }
  110 +
  111 + return _UpgradeModule(
  112 + vid: vid,
  113 + name: name,
  114 + desc: desc,
  115 + price: item.price ?? 0,
  116 + );
  117 + }
  118 +
  119 + void _toggleModule(int index) {
  120 + final bool selected = _modules[index].selected;
  121 + setState(() {
  122 + for (final module in _modules) {
  123 + module.selected = false;
  124 + }
  125 + _modules[index].selected = !selected;
  126 + });
  127 + }
  128 +
  129 + Future<void> _pay() async {
  130 + final _UpgradeModule? selected = _selectedModule;
  131 + if (selected == null) {
  132 + Utils.showToast('请先选择需要开通的模块');
  133 + return;
  134 + }
  135 + if (selected.price <= 0) {
  136 + Utils.showToast('当前模块暂不支持购买');
  137 + return;
  138 + }
  139 +
  140 + final bool isInstalled = await _fluwx.isWeChatInstalled;
  141 + if (!isInstalled) {
  142 + Utils.showToast('请先安装微信');
  143 + return;
  144 + }
  145 +
  146 + final String? sellerid =
  147 + Provider.of<UserModel>(context, listen: false).user?.sellerid;
  148 + if (sellerid == null || sellerid.isEmpty) {
  149 + Utils.showToast('商家信息异常');
  150 + return;
  151 + }
  152 +
  153 + final bool success = await widget.collectStoreProvider.appPayJiSuVersion(
  154 + context,
  155 + {'sellerid': sellerid, 'vid': selected.vid},
  156 + );
  157 +
  158 + if (!success || !mounted) {
  159 + return;
  160 + }
  161 +
  162 + final WechatPaySunModel? sunModel = widget.collectStoreProvider.sunModel;
  163 + if (sunModel == null ||
  164 + sunModel.appId == null ||
  165 + sunModel.package == null ||
  166 + sunModel.timeStamp == null ||
  167 + sunModel.nonceStr == null) {
  168 + Utils.showToast('支付参数异常');
  169 + return;
  170 + }
  171 +
  172 + final String prepayId = sunModel.package!.substring(10);
  173 + final Map<String, String?> signParams = {
  174 + 'appid': sunModel.appId,
  175 + 'partnerid': '1489752232',
  176 + 'prepayid': prepayId,
  177 + 'timestamp': sunModel.timeStamp,
  178 + 'noncestr': sunModel.nonceStr,
  179 + 'package': 'Sign=WXPay',
  180 + };
  181 + final String sign = Utils.keySort(signParams);
  182 +
  183 + _fluwx
  184 + .pay(
  185 + which: Payment(
  186 + appId: sunModel.appId!,
  187 + partnerId: '1489752232',
  188 + prepayId: prepayId,
  189 + packageValue: 'Sign=WXPay',
  190 + nonceStr: sunModel.nonceStr!,
  191 + timestamp: int.parse(sunModel.timeStamp!),
  192 + sign: sign,
  193 + ),
  194 + )
  195 + .then((data) {
  196 + print('version pay: $data');
  197 + }).catchError((error) {
  198 + print(error.toString());
  199 + Utils.showToast('支付调起失败');
  200 + });
  201 + }
  202 +
  203 + Future<void> _handlePaySuccess() async {
  204 + Utils.showToast('购买成功');
  205 + await widget.collectStoreProvider
  206 + .refreshSellerVersion(context, showLoading: false);
  207 + EventBus().emit('refreshSellerVersion');
  208 +
  209 + if (!mounted) {
  210 + return;
  211 + }
  212 + if (Navigator.canPop(context)) {
  213 + Navigator.pop(context);
  214 + }
  215 + }
  216 +
  217 + String _formatPrice(double price) {
  218 + if (price == price.roundToDouble()) {
  219 + return price.toInt().toString();
  220 + }
  221 + return price.toStringAsFixed(2);
  222 + }
  223 +
  224 + @override
  225 + void dispose() {
  226 + _wxPay.cancel();
  227 + EventBus().emit('changeStatusColor');
  228 + super.dispose();
  229 + }
  230 +
  231 + @override
  232 + Widget build(BuildContext context) {
  233 + return Scaffold(
  234 + backgroundColor: MyColours.color_F0F0F0,
  235 + appBar: SystemAppBar('功能升级'),
  236 + body: Column(
  237 + children: [
  238 + Expanded(child: _buildBody()),
  239 + _buildBottomBar(),
  240 + ],
  241 + ),
  242 + );
  243 + }
  244 +
  245 + Widget _buildBody() {
  246 + if (_loading) {
  247 + return const Center(
  248 + child: CircularProgressIndicator(color: MyColours.color_529EA4),
  249 + );
  250 + }
  251 +
  252 + return SingleChildScrollView(
  253 + padding: EdgeInsets.all(ScreenUtil().setWidth(24)),
  254 + child: Column(
  255 + crossAxisAlignment: CrossAxisAlignment.start,
  256 + children: [
  257 + Container(
  258 + width: double.infinity,
  259 + padding: EdgeInsets.symmetric(
  260 + horizontal: ScreenUtil().setWidth(24),
  261 + vertical: ScreenUtil().setWidth(18),
  262 + ),
  263 + decoration: BoxDecoration(
  264 + color: MyColours.color_529EA4,
  265 + borderRadius: BorderRadius.circular(
  266 + ScreenUtil().setWidth(10),
  267 + ),
  268 + ),
  269 + child: Text(
  270 + '请选择购买的组件模块,所有模块购买激活后均有一年有效期。',
  271 + style: TextStyle(
  272 + color: MyColours.color_ffffff,
  273 + fontSize: ScreenUtil().setSp(26),
  274 + height: 1.5,
  275 + ),
  276 + ),
  277 + ),
  278 + SizedBox(height: ScreenUtil().setWidth(24)),
  279 + if (_loadFailed)
  280 + _buildRetry()
  281 + else if (_modules.isEmpty)
  282 + _buildEmpty()
  283 + else
  284 + for (int index = 0; index < _modules.length; index++)
  285 + _buildModuleCard(index),
  286 + ],
  287 + ),
  288 + );
  289 + }
  290 +
  291 + Widget _buildRetry() {
  292 + return Container(
  293 + width: double.infinity,
  294 + padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(80)),
  295 + alignment: Alignment.center,
  296 + child: Column(
  297 + children: [
  298 + Text(
  299 + '加载失败,请稍后重试',
  300 + style: TextStyle(
  301 + color: MyColours.color_999999,
  302 + fontSize: ScreenUtil().setSp(26),
  303 + ),
  304 + ),
  305 + SizedBox(height: ScreenUtil().setWidth(24)),
  306 + GestureDetector(
  307 + onTap: _loadModules,
  308 + child: Container(
  309 + padding: EdgeInsets.symmetric(
  310 + horizontal: ScreenUtil().setWidth(40),
  311 + vertical: ScreenUtil().setWidth(16),
  312 + ),
  313 + decoration: BoxDecoration(
  314 + color: MyColours.color_529EA4,
  315 + borderRadius: BorderRadius.circular(
  316 + ScreenUtil().setWidth(8),
  317 + ),
  318 + ),
  319 + child: Text(
  320 + '重新加载',
  321 + style: TextStyle(
  322 + color: MyColours.color_ffffff,
  323 + fontSize: ScreenUtil().setSp(26),
  324 + ),
  325 + ),
  326 + ),
  327 + ),
  328 + ],
  329 + ),
  330 + );
  331 + }
  332 +
  333 + Widget _buildEmpty() {
  334 + return Container(
  335 + width: double.infinity,
  336 + padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(80)),
  337 + alignment: Alignment.center,
  338 + child: Text(
  339 + '暂无可升级的功能',
  340 + style: TextStyle(
  341 + color: MyColours.color_999999,
  342 + fontSize: ScreenUtil().setSp(26),
  343 + ),
  344 + ),
  345 + );
  346 + }
  347 +
  348 + Widget _buildModuleCard(int index) {
  349 + final _UpgradeModule module = _modules[index];
  350 + final bool selected = module.selected;
  351 +
  352 + return GestureDetector(
  353 + onTap: () => _toggleModule(index),
  354 + child: Container(
  355 + margin: EdgeInsets.only(bottom: ScreenUtil().setWidth(20)),
  356 + padding: EdgeInsets.all(ScreenUtil().setWidth(24)),
  357 + decoration: BoxDecoration(
  358 + color: MyColours.color_ffffff,
  359 + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(12)),
  360 + border: Border.all(
  361 + color: selected ? MyColours.color_529EA4 : MyColours.color_d9d9d9,
  362 + width: ScreenUtil().setWidth(2),
  363 + ),
  364 + ),
  365 + child: Row(
  366 + crossAxisAlignment: CrossAxisAlignment.center,
  367 + children: [
  368 + Image.asset(
  369 + Utils.getImgPath(selected ? 'base_radio_sel' : 'base_radio_un'),
  370 + width: ScreenUtil().setWidth(36),
  371 + height: ScreenUtil().setWidth(36),
  372 + ),
  373 + SizedBox(width: ScreenUtil().setWidth(18)),
  374 + Expanded(
  375 + child: Column(
  376 + crossAxisAlignment: CrossAxisAlignment.start,
  377 + children: [
  378 + Row(
  379 + crossAxisAlignment: CrossAxisAlignment.start,
  380 + children: [
  381 + Expanded(
  382 + child: Text(
  383 + module.name,
  384 + style: TextStyle(
  385 + color: MyColours.color_353535,
  386 + fontSize: ScreenUtil().setSp(30),
  387 + fontWeight: FontWeight.bold,
  388 + ),
  389 + ),
  390 + ),
  391 + SizedBox(width: ScreenUtil().setWidth(16)),
  392 + Text(
  393 + '¥${_formatPrice(module.price)}',
  394 + style: TextStyle(
  395 + color: MyColours.color_529EA4,
  396 + fontSize: ScreenUtil().setSp(30),
  397 + fontWeight: FontWeight.bold,
  398 + ),
  399 + ),
  400 + ],
  401 + ),
  402 + SizedBox(height: ScreenUtil().setWidth(12)),
  403 + Text(
  404 + module.desc,
  405 + style: TextStyle(
  406 + color: MyColours.color_999999,
  407 + fontSize: ScreenUtil().setSp(24),
  408 + height: 1.4,
  409 + ),
  410 + ),
  411 + ],
  412 + ),
  413 + ),
  414 + ],
  415 + ),
  416 + ),
  417 + );
  418 + }
  419 +
  420 + Widget _buildBottomBar() {
  421 + return Container(
  422 + color: const Color(0xFF98C0C8),
  423 + padding: EdgeInsets.fromLTRB(
  424 + ScreenUtil().setWidth(24),
  425 + ScreenUtil().setWidth(16),
  426 + ScreenUtil().setWidth(24),
  427 + ScreenUtil().setWidth(16),
  428 + ),
  429 + child: SafeArea(
  430 + top: false,
  431 + child: Row(
  432 + children: [
  433 + Text(
  434 + '¥${_formatPrice(_total)}',
  435 + style: TextStyle(
  436 + color: MyColours.color_ffffff,
  437 + fontSize: ScreenUtil().setSp(36),
  438 + fontWeight: FontWeight.bold,
  439 + ),
  440 + ),
  441 + const Spacer(),
  442 + GestureDetector(
  443 + onTap: _hasSelection ? _pay : null,
  444 + child: Container(
  445 + width: ScreenUtil().setWidth(220),
  446 + height: ScreenUtil().setWidth(78),
  447 + alignment: Alignment.center,
  448 + decoration: BoxDecoration(
  449 + color: MyColours.color_ffffff,
  450 + borderRadius:
  451 + BorderRadius.circular(ScreenUtil().setWidth(39)),
  452 + ),
  453 + child: Text(
  454 + '立即支付',
  455 + style: TextStyle(
  456 + color: _hasSelection
  457 + ? MyColours.color_515151
  458 + : MyColours.color_999999,
  459 + fontSize: ScreenUtil().setSp(30),
  460 + fontWeight: FontWeight.bold,
  461 + ),
  462 + ),
  463 + ),
  464 + ),
  465 + ],
  466 + ),
  467 + ),
  468 + );
  469 + }
  470 +}
  471 +
  472 +class _UpgradeModule {
  473 + _UpgradeModule({
  474 + required this.vid,
  475 + required this.name,
  476 + required this.desc,
  477 + required this.price,
  478 + });
  479 +
  480 + final String vid;
  481 + final String name;
  482 + final String desc;
  483 + final double price;
  484 + bool selected = false;
  485 +}
@@ -29,6 +29,7 @@ import 'package:one_key/widgets/h_empty_view.dart'; @@ -29,6 +29,7 @@ import 'package:one_key/widgets/h_empty_view.dart';
29 import 'package:one_key/widgets/my_item.dart'; 29 import 'package:one_key/widgets/my_item.dart';
30 import 'package:one_key/widgets/round_button.dart'; 30 import 'package:one_key/widgets/round_button.dart';
31 import 'package:one_key/widgets/v_empty_view.dart'; 31 import 'package:one_key/widgets/v_empty_view.dart';
  32 +import 'package:one_key/pages/my/function_upgrade_page.dart';
32 import 'package:provider/provider.dart'; 33 import 'package:provider/provider.dart';
33 34
34 import '../../app.dart'; 35 import '../../app.dart';
@@ -135,6 +136,10 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -135,6 +136,10 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
135 _getCustomerActivityBaseinfo(); 136 _getCustomerActivityBaseinfo();
136 // getMyPageCountData(); 137 // getMyPageCountData();
137 }); 138 });
  139 + EventBus().on('refreshSellerVersion', (arg) {
  140 + getSellerVersion();
  141 + getMyPageCountData();
  142 + });
138 } 143 }
139 144
140 @override 145 @override
@@ -146,6 +151,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -146,6 +151,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
146 EventBus().off('refreshMySms'); 151 EventBus().off('refreshMySms');
147 152
148 EventBus().off('refreshMyImage'); 153 EventBus().off('refreshMyImage');
  154 + EventBus().off('refreshSellerVersion');
149 } 155 }
150 156
151 @override 157 @override
@@ -2331,6 +2337,41 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -2331,6 +2337,41 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
2331 ], 2337 ],
2332 )), 2338 )),
2333 VEmptyView(48), 2339 VEmptyView(48),
  2340 + InkWell(
  2341 + onTap: () {
  2342 + Navigator.push(
  2343 + context,
  2344 + MaterialPageRoute(
  2345 + builder: (_) => FunctionUpgradePage(
  2346 + collectStoreProvider:
  2347 + collectStoreProvider),
  2348 + ),
  2349 + );
  2350 + },
  2351 + child: Row(
  2352 + children: [
  2353 + Image.asset(
  2354 + Utils.getImgPath('bbsj'),
  2355 + width: ScreenUtil().setWidth(22 * 2),
  2356 + ),
  2357 + HEmptyView(26),
  2358 + Text(
  2359 + '功能升级',
  2360 + style: TextStyle(
  2361 + fontWeight: FontWeight.bold,
  2362 + color: MyColours.color_515151,
  2363 + fontSize:
  2364 + ScreenUtil().setWidth(28)),
  2365 + ),
  2366 + Spacer(),
  2367 + Image.asset(
  2368 + "assets/arrow_right_new.png",
  2369 + width: ScreenUtil().setWidth(14),
  2370 + height: ScreenUtil().setWidth(22),
  2371 + )
  2372 + ],
  2373 + )),
  2374 + VEmptyView(48),
2334 Consumer<UserModel>( 2375 Consumer<UserModel>(
2335 builder: (BuildContext context, UserModel model, 2376 builder: (BuildContext context, UserModel model,
2336 Widget? child) { 2377 Widget? child) {
@@ -166,6 +166,9 @@ class HomePageSimState extends State<HomePageSim> with WidgetsBindingObserver { @@ -166,6 +166,9 @@ class HomePageSimState extends State<HomePageSim> with WidgetsBindingObserver {
166 // } 166 // }
167 167
168 WidgetsBinding.instance.addObserver(this); 168 WidgetsBinding.instance.addObserver(this);
  169 + EventBus().on('refreshSellerVersion', (arg) {
  170 + getSellerVersion();
  171 + });
169 172
170 _currIndex = widget.initialIndex; 173 _currIndex = widget.initialIndex;
171 174
@@ -2066,6 +2069,7 @@ class HomePageSimState extends State<HomePageSim> with WidgetsBindingObserver { @@ -2066,6 +2069,7 @@ class HomePageSimState extends State<HomePageSim> with WidgetsBindingObserver {
2066 LogUtil.v("home_dispose"); 2069 LogUtil.v("home_dispose");
2067 2070
2068 // bus.off('refresh_token'); 2071 // bus.off('refresh_token');
  2072 + EventBus().off('refreshSellerVersion');
2069 if (timer != null) { 2073 if (timer != null) {
2070 timer!.cancel(); 2074 timer!.cancel();
2071 } 2075 }
@@ -28,6 +28,7 @@ import 'package:one_key/widgets/h_empty_view.dart'; @@ -28,6 +28,7 @@ import 'package:one_key/widgets/h_empty_view.dart';
28 import 'package:one_key/widgets/my_item.dart'; 28 import 'package:one_key/widgets/my_item.dart';
29 import 'package:one_key/widgets/round_button.dart'; 29 import 'package:one_key/widgets/round_button.dart';
30 import 'package:one_key/widgets/v_empty_view.dart'; 30 import 'package:one_key/widgets/v_empty_view.dart';
  31 +import 'package:one_key/pages/my/function_upgrade_page.dart';
31 import 'package:provider/provider.dart'; 32 import 'package:provider/provider.dart';
32 33
33 import '../../app.dart'; 34 import '../../app.dart';
@@ -131,6 +132,10 @@ class MyPageSimState extends State<MyPageSim> with WidgetsBindingObserver { @@ -131,6 +132,10 @@ class MyPageSimState extends State<MyPageSim> with WidgetsBindingObserver {
131 EventBus().on('refreshMySms', (arg) { 132 EventBus().on('refreshMySms', (arg) {
132 getMyPageCountData(); 133 getMyPageCountData();
133 }); 134 });
  135 + EventBus().on('refreshSellerVersion', (arg) {
  136 + getSellerVersion();
  137 + getMyPageCountData();
  138 + });
134 } 139 }
135 140
136 void wxSubscriptionClose() => _wxPay?.cancel(); 141 void wxSubscriptionClose() => _wxPay?.cancel();
@@ -142,6 +147,7 @@ class MyPageSimState extends State<MyPageSim> with WidgetsBindingObserver { @@ -142,6 +147,7 @@ class MyPageSimState extends State<MyPageSim> with WidgetsBindingObserver {
142 // AzhonAppUpdate.dispose(); 147 // AzhonAppUpdate.dispose();
143 EventBus().off('changeStatusColor'); 148 EventBus().off('changeStatusColor');
144 EventBus().off('refreshMySms'); 149 EventBus().off('refreshMySms');
  150 + EventBus().off('refreshSellerVersion');
145 wxSubscriptionClose(); 151 wxSubscriptionClose();
146 } 152 }
147 153
@@ -1799,6 +1805,41 @@ class MyPageSimState extends State<MyPageSim> with WidgetsBindingObserver { @@ -1799,6 +1805,41 @@ class MyPageSimState extends State<MyPageSim> with WidgetsBindingObserver {
1799 ], 1805 ],
1800 )), 1806 )),
1801 VEmptyView(48), 1807 VEmptyView(48),
  1808 + InkWell(
  1809 + onTap: () {
  1810 + Navigator.push(
  1811 + context,
  1812 + MaterialPageRoute(
  1813 + builder: (_) => FunctionUpgradePage(
  1814 + collectStoreProvider:
  1815 + collectStoreProvider),
  1816 + ),
  1817 + );
  1818 + },
  1819 + child: Row(
  1820 + children: [
  1821 + Image.asset(
  1822 + Utils.getImgPath('bbsj'),
  1823 + width: ScreenUtil().setWidth(28 * 2),
  1824 + ),
  1825 + HEmptyView(26),
  1826 + Text(
  1827 + '功能升级',
  1828 + style: TextStyle(
  1829 + fontWeight: FontWeight.bold,
  1830 + color: MyColours.color_515151,
  1831 + fontSize:
  1832 + ScreenUtil().setWidth(28)),
  1833 + ),
  1834 + Spacer(),
  1835 + Image.asset(
  1836 + "assets/arrow_right_new.png",
  1837 + width: ScreenUtil().setWidth(14),
  1838 + height: ScreenUtil().setWidth(22),
  1839 + )
  1840 + ],
  1841 + )),
  1842 + VEmptyView(48),
1802 Consumer<UserModel>( 1843 Consumer<UserModel>(
1803 builder: (BuildContext context, UserModel model, 1844 builder: (BuildContext context, UserModel model,
1804 Widget? child) { 1845 Widget? child) {
@@ -739,6 +739,71 @@ class CollectStoreProvider with ChangeNotifier { @@ -739,6 +739,71 @@ class CollectStoreProvider with ChangeNotifier {
739 } 739 }
740 } 740 }
741 741
  742 + // 获取功能升级页可购买的版本/模块列表
  743 + Future<List<SellerVersionSunModel>?> getFunctionUpgradeList(
  744 + BuildContext context,
  745 + {bool showLoading = true}) async {
  746 + try {
  747 + final BaseResp<dynamic> baseResp = await DioUtil().request<dynamic>(
  748 + context, Method.post, HttpUrl.get_version_list,
  749 + data: const <String, String?>{}, showLoading: showLoading);
  750 + if (baseResp.code == Constant.status_success) {
  751 + final Map<String, dynamic> response =
  752 + baseResp.responseData as Map<String, dynamic>;
  753 + final List<dynamic>? rawList = response['data'] as List<dynamic>?;
  754 + final List<SellerVersionSunModel> list = <SellerVersionSunModel>[];
  755 + if (rawList != null) {
  756 + for (final item in rawList) {
  757 + if (item is! Map) {
  758 + continue;
  759 + }
  760 + final Map<String, dynamic> map = Map<String, dynamic>.from(item);
  761 + final dynamic id = map['id'];
  762 + final dynamic name = map['name'];
  763 + if (id == null || name == null) {
  764 + continue;
  765 + }
  766 + list.add(SellerVersionSunModel(
  767 + vid: '$id',
  768 + vname: '$name',
  769 + vtype: map['type'] == null ? null : '${map['type']}',
  770 + price: map['price'] is num
  771 + ? (map['price'] as num).toDouble()
  772 + : double.tryParse('${map['price']}'),
  773 + ));
  774 + }
  775 + }
  776 + return list;
  777 + }
  778 + Utils.showToast(baseResp.msg ?? '请求失败,请重试');
  779 + } catch (error) {
  780 + print(error.toString());
  781 + Utils.showToast('请求失败,请重试');
  782 + }
  783 + return null;
  784 + }
  785 +
  786 + // 刷新商家版本信息,并同步通知依赖页面的 UI。
  787 + Future<bool> refreshSellerVersion(BuildContext context,
  788 + {bool showLoading = true}) async {
  789 + final bool success =
  790 + await getSellerVersion(context, showLoading: showLoading);
  791 +
  792 + final user = Provider.of<UserModel>(context, listen: false).user;
  793 + if (user != null) {
  794 + final Map<String, String?> params = {
  795 + 'sellerid': user.sellerid,
  796 + };
  797 + if (Utils.getAuthority(context, '个人-月订单量')) {
  798 + params['uid'] = user.openid;
  799 + }
  800 + await getMyPageCountData(context, params, showLoading: showLoading);
  801 + }
  802 +
  803 + notifyListeners();
  804 + return success;
  805 + }
  806 +
742 /// App调起支付(购买版本) 807 /// App调起支付(购买版本)
743 Future<bool> appPayJiSuVersion( 808 Future<bool> appPayJiSuVersion(
744 BuildContext context, Map<String, String?> params, 809 BuildContext context, Map<String, String?> params,
1 import 'dart:async'; 1 import 'dart:async';
2 2
3 -  
4 import 'dart:ui'; 3 import 'dart:ui';
5 4
6 import 'package:cached_network_image/cached_network_image.dart'; 5 import 'package:cached_network_image/cached_network_image.dart';
@@ -14,12 +13,12 @@ import 'package:flutter_lunar_datetime_picker/flutter_lunar_datetime_picker.dart @@ -14,12 +13,12 @@ import 'package:flutter_lunar_datetime_picker/flutter_lunar_datetime_picker.dart
14 import 'package:flutter_picker_plus/flutter_picker_plus.dart'; 13 import 'package:flutter_picker_plus/flutter_picker_plus.dart';
15 import 'package:flutter_screenutil/flutter_screenutil.dart'; 14 import 'package:flutter_screenutil/flutter_screenutil.dart';
16 15
17 -  
18 import 'package:one_key/models/filter_btn_model.dart'; 16 import 'package:one_key/models/filter_btn_model.dart';
19 import 'package:one_key/models/remark.dart'; 17 import 'package:one_key/models/remark.dart';
20 import 'package:one_key/models/seller_role_model.dart'; 18 import 'package:one_key/models/seller_role_model.dart';
21 import 'package:one_key/models/table_list.dart'; 19 import 'package:one_key/models/table_list.dart';
22 20
  21 +import 'package:one_key/pages/my/function_upgrade_page.dart';
23 import 'package:one_key/pages/message/message_dialog_item_f.dart'; 22 import 'package:one_key/pages/message/message_dialog_item_f.dart';
24 import 'package:one_key/provider/message_dialog_model.dart'; 23 import 'package:one_key/provider/message_dialog_model.dart';
25 24
@@ -78,6 +77,18 @@ typedef ClickkListCallbac = void Function(List<String?> value); @@ -78,6 +77,18 @@ typedef ClickkListCallbac = void Function(List<String?> value);
78 // }; 77 // };
79 78
80 class DialogUtil { 79 class DialogUtil {
  80 + static void goFunctionUpgradePage(BuildContext context) {
  81 + final CollectStoreProvider collectStoreProvider =
  82 + Provider.of<CollectStoreProvider>(context, listen: false);
  83 + Navigator.push(
  84 + context,
  85 + MaterialPageRoute(
  86 + builder: (_) =>
  87 + FunctionUpgradePage(collectStoreProvider: collectStoreProvider),
  88 + ),
  89 + );
  90 + }
  91 +
81 static List<Widget> labelSelectBtn(List<CustomerLabelSunModel> labelList, 92 static List<Widget> labelSelectBtn(List<CustomerLabelSunModel> labelList,
82 state, List<String?> datas, ClickkListCallbac callback) { 93 state, List<String?> datas, ClickkListCallbac callback) {
83 List<Widget> temp = []; 94 List<Widget> temp = [];
@@ -1084,6 +1095,7 @@ class DialogUtil { @@ -1084,6 +1095,7 @@ class DialogUtil {
1084 static showSellerVersionEdateDialog(BuildContext context, 1095 static showSellerVersionEdateDialog(BuildContext context,
1085 List<SellerVersionSunModel> showData, CustomCallBack callback, 1096 List<SellerVersionSunModel> showData, CustomCallBack callback,
1086 {GestureTapCallback? onTapLeft, GestureTapCallback? onTapRight}) { 1097 {GestureTapCallback? onTapLeft, GestureTapCallback? onTapRight}) {
  1098 + final BuildContext outerContext = context;
1087 List<String?> names = showData.map((e) => e.vname).toList(); 1099 List<String?> names = showData.map((e) => e.vname).toList();
1088 ScrollController controller = ScrollController(); 1100 ScrollController controller = ScrollController();
1089 return showDialog( 1101 return showDialog(
@@ -1204,17 +1216,12 @@ class DialogUtil { @@ -1204,17 +1216,12 @@ class DialogUtil {
1204 MyDivider(double.infinity, w(1), 1216 MyDivider(double.infinity, w(1),
1205 color: MyColours.color_DBDBDB), 1217 color: MyColours.color_DBDBDB),
1206 Row( 1218 Row(
1207 - // mainAxisAlignment: MainAxisAlignment.spaceBetween,  
1208 children: [ 1219 children: [
1209 Expanded( 1220 Expanded(
1210 flex: 1, 1221 flex: 1,
1211 child: RoundButton( 1222 child: RoundButton(
1212 text: '确定', 1223 text: '确定',
1213 - // width: (ScreenUtil().screenWidth -  
1214 - // ScreenUtil().setWidth(62) * 2) /  
1215 - // 2,  
1216 height: ScreenUtil().setWidth(112), 1224 height: ScreenUtil().setWidth(112),
1217 - // radius: ScreenUtil().setWidth(10),  
1218 gradientStart: Colors.transparent, 1225 gradientStart: Colors.transparent,
1219 gradientEnd: Colors.transparent, 1226 gradientEnd: Colors.transparent,
1220 textColor: MyColours.color_515151, 1227 textColor: MyColours.color_515151,
@@ -1225,6 +1232,25 @@ class DialogUtil { @@ -1225,6 +1232,25 @@ class DialogUtil {
1225 Navigator.pop(context); 1232 Navigator.pop(context);
1226 } 1233 }
1227 })), 1234 })),
  1235 + MyDivider(ScreenUtil().setWidth(2),
  1236 + ScreenUtil().setWidth(112),
  1237 + color: MyColours.color_DBDBDB),
  1238 + Expanded(
  1239 + flex: 1,
  1240 + child: RoundButton(
  1241 + text: '去购买',
  1242 + height: ScreenUtil().setWidth(112),
  1243 + gradientStart: Colors.transparent,
  1244 + gradientEnd: Colors.transparent,
  1245 + textColor: MyColours.color_438E93,
  1246 + fontSize: 32,
  1247 + onPressed: () {
  1248 + if (Navigator.canPop(context)) {
  1249 + Navigator.pop(context);
  1250 + }
  1251 + DialogUtil.goFunctionUpgradePage(
  1252 + outerContext);
  1253 + })),
1228 ], 1254 ],
1229 ), 1255 ),
1230 ]))); 1256 ])));
@@ -1419,6 +1445,7 @@ class DialogUtil { @@ -1419,6 +1445,7 @@ class DialogUtil {
1419 static showSellerVersionBuyDialog( 1445 static showSellerVersionBuyDialog(
1420 BuildContext context, String title, CustomCallBack callback, 1446 BuildContext context, String title, CustomCallBack callback,
1421 {GestureTapCallback? onTapLeft, GestureTapCallback? onTapRight}) { 1447 {GestureTapCallback? onTapLeft, GestureTapCallback? onTapRight}) {
  1448 + final BuildContext outerContext = context;
1422 return showDialog( 1449 return showDialog(
1423 context: context, 1450 context: context,
1424 barrierDismissible: true, 1451 barrierDismissible: true,
@@ -1501,41 +1528,25 @@ class DialogUtil { @@ -1501,41 +1528,25 @@ class DialogUtil {
1501 Navigator.pop(context); 1528 Navigator.pop(context);
1502 } 1529 }
1503 })), 1530 })),
1504 - // MyDivider(ScreenUtil().setWidth(2),  
1505 - // ScreenUtil().setWidth(112),  
1506 - // color: MyColours.color_DBDBDB),  
1507 - // Expanded(  
1508 - // flex: 1,  
1509 - // child: RoundButton(  
1510 - // text: '前往开通',  
1511 - // // width: (ScreenUtil().screenWidth -  
1512 - // // ScreenUtil().setWidth(62) * 2) /  
1513 - // // 2,  
1514 - // height: ScreenUtil().setWidth(112),  
1515 - // // radius: ScreenUtil().setWidth(10),  
1516 - // gradientStart: Colors.transparent,  
1517 - // gradientEnd: Colors.transparent,  
1518 - // textColor: MyColours.color_438E93,  
1519 - // fontSize: 32,  
1520 - // onPressed: () {  
1521 - // // Navigator.pop(context, {  
1522 - // // 'spec': menuSunModel.specCan != null &&  
1523 - // // menuSunModel.specCan.length > 0  
1524 - // // ? menuSunModel.specCan  
1525 - // // .where((element) =>  
1526 - // // element.select == true)  
1527 - // // .toList()  
1528 - // // : [],  
1529 - // // 'practice': menuSunModel.practice !=  
1530 - // // null &&  
1531 - // // menuSunModel.practice.length > 0  
1532 - // // ? menuSunModel.practice  
1533 - // // .where((element) =>  
1534 - // // element.select == true)  
1535 - // // .toList()  
1536 - // // : []  
1537 - // // });  
1538 - // })), 1531 + MyDivider(ScreenUtil().setWidth(2),
  1532 + ScreenUtil().setWidth(112),
  1533 + color: MyColours.color_DBDBDB),
  1534 + Expanded(
  1535 + flex: 1,
  1536 + child: RoundButton(
  1537 + text: '去购买',
  1538 + height: ScreenUtil().setWidth(112),
  1539 + gradientStart: Colors.transparent,
  1540 + gradientEnd: Colors.transparent,
  1541 + textColor: MyColours.color_438E93,
  1542 + fontSize: 32,
  1543 + onPressed: () {
  1544 + if (Navigator.canPop(context)) {
  1545 + Navigator.pop(context);
  1546 + }
  1547 + DialogUtil.goFunctionUpgradePage(
  1548 + outerContext);
  1549 + })),
1539 ], 1550 ],
1540 ), 1551 ),
1541 ]))); 1552 ])));
@@ -11364,6 +11375,7 @@ class DialogUtil { @@ -11364,6 +11375,7 @@ class DialogUtil {
11364 VoidCallback? lCallback, 11375 VoidCallback? lCallback,
11365 VoidCallback? rCallback}) async { 11376 VoidCallback? rCallback}) async {
11366 // bool isRed = content != '' ? false : true; 11377 // bool isRed = content != '' ? false : true;
  11378 + final BuildContext outerContext = context;
11367 final action = await showDialog( 11379 final action = await showDialog(
11368 context: context, 11380 context: context,
11369 barrierDismissible: false, 11381 barrierDismissible: false,
@@ -11450,15 +11462,13 @@ class DialogUtil { @@ -11450,15 +11462,13 @@ class DialogUtil {
11450 // Navigator.pop(context); 11462 // Navigator.pop(context);
11451 // }), 11463 // }),
11452 Row( 11464 Row(
11453 - // mainAxisAlignment: MainAxisAlignment.spaceBetween,  
11454 children: [ 11465 children: [
11455 RoundButton( 11466 RoundButton(
11456 text: lTitle, 11467 text: lTitle,
11457 width: (ScreenUtil().screenWidth - 11468 width: (ScreenUtil().screenWidth -
11458 ScreenUtil().setWidth(62) * 2) / 11469 ScreenUtil().setWidth(62) * 2) /
11459 - 2, 11470 + 3,
11460 height: ScreenUtil().setWidth(112), 11471 height: ScreenUtil().setWidth(112),
11461 - // radius: ScreenUtil().setWidth(10),  
11462 gradientStart: Colors.transparent, 11472 gradientStart: Colors.transparent,
11463 gradientEnd: Colors.transparent, 11473 gradientEnd: Colors.transparent,
11464 textColor: MyColours.color_E6000000, 11474 textColor: MyColours.color_E6000000,
@@ -11476,9 +11486,8 @@ class DialogUtil { @@ -11476,9 +11486,8 @@ class DialogUtil {
11476 text: rTitle, 11486 text: rTitle,
11477 width: (ScreenUtil().screenWidth - 11487 width: (ScreenUtil().screenWidth -
11478 ScreenUtil().setWidth(62) * 2) / 11488 ScreenUtil().setWidth(62) * 2) /
11479 - 2, 11489 + 3,
11480 height: ScreenUtil().setWidth(112), 11490 height: ScreenUtil().setWidth(112),
11481 - // radius: ScreenUtil().setWidth(10),  
11482 gradientStart: Colors.transparent, 11491 gradientStart: Colors.transparent,
11483 gradientEnd: Colors.transparent, 11492 gradientEnd: Colors.transparent,
11484 textColor: MyColours.color_438E93, 11493 textColor: MyColours.color_438E93,
@@ -11489,6 +11498,26 @@ class DialogUtil { @@ -11489,6 +11498,26 @@ class DialogUtil {
11489 Navigator.pop(context); 11498 Navigator.pop(context);
11490 } 11499 }
11491 }), 11500 }),
  11501 + MyDivider(ScreenUtil().setWidth(2),
  11502 + ScreenUtil().setWidth(112),
  11503 + color: MyColours.color_f3f3f3),
  11504 + RoundButton(
  11505 + text: '去购买',
  11506 + width: (ScreenUtil().screenWidth -
  11507 + ScreenUtil().setWidth(62) * 2) /
  11508 + 3,
  11509 + height: ScreenUtil().setWidth(112),
  11510 + gradientStart: Colors.transparent,
  11511 + gradientEnd: Colors.transparent,
  11512 + textColor: MyColours.color_438E93,
  11513 + fontSize: 32,
  11514 + onPressed: () {
  11515 + if (Navigator.canPop(context)) {
  11516 + Navigator.pop(context);
  11517 + }
  11518 + DialogUtil.goFunctionUpgradePage(
  11519 + outerContext);
  11520 + }),
11492 ], 11521 ],
11493 ) 11522 )
11494 ], 11523 ],
@@ -11507,7 +11536,7 @@ class DialogUtil { @@ -11507,7 +11536,7 @@ class DialogUtil {
11507 {String title = "", 11536 {String title = "",
11508 String content = "内容", 11537 String content = "内容",
11509 String lTitle = "我知道了", 11538 String lTitle = "我知道了",
11510 - String rTitle = "立即续费", 11539 + String rTitle = "去购买",
11511 Color rColor = MyColours.color_438E93, 11540 Color rColor = MyColours.color_438E93,
11512 bool isBold = false, 11541 bool isBold = false,
11513 bool isBoldContent = false, 11542 bool isBoldContent = false,
@@ -11515,6 +11544,7 @@ class DialogUtil { @@ -11515,6 +11544,7 @@ class DialogUtil {
11515 VoidCallback? lCallback, 11544 VoidCallback? lCallback,
11516 VoidCallback? rCallback}) async { 11545 VoidCallback? rCallback}) async {
11517 // bool isRed = content != '' ? false : true; 11546 // bool isRed = content != '' ? false : true;
  11547 + final BuildContext outerContext = context;
11518 final action = await showDialog( 11548 final action = await showDialog(
11519 context: context, 11549 context: context,
11520 barrierDismissible: false, 11550 barrierDismissible: false,
@@ -11586,62 +11616,46 @@ class DialogUtil { @@ -11586,62 +11616,46 @@ class DialogUtil {
11586 VEmptyView(66), 11616 VEmptyView(66),
11587 MyDivider(double.infinity, ScreenUtil().setWidth(2), 11617 MyDivider(double.infinity, ScreenUtil().setWidth(2),
11588 color: MyColours.color_f3f3f3), 11618 color: MyColours.color_f3f3f3),
11589 - RoundButton(  
11590 - text: lTitle,  
11591 - width: (ScreenUtil().screenWidth -  
11592 - ScreenUtil().setWidth(62) * 2),  
11593 - height: ScreenUtil().setWidth(112),  
11594 - // radius: ScreenUtil().setWidth(10),  
11595 - gradientStart: Colors.transparent,  
11596 - gradientEnd: Colors.transparent,  
11597 - textColor: MyColours.color_E6000000,  
11598 - isBold: false,  
11599 - fontSize: 32,  
11600 - onPressed: () {  
11601 - if (Navigator.canPop(context)) {  
11602 - Navigator.pop(context);  
11603 - }  
11604 - }),  
11605 - // Row(  
11606 - // // mainAxisAlignment: MainAxisAlignment.spaceBetween,  
11607 - // children: [  
11608 - // RoundButton(  
11609 - // text: lTitle,  
11610 - // width: (ScreenUtil().screenWidth -  
11611 - // ScreenUtil().setWidth(62) * 2) /  
11612 - // 2,  
11613 - // height: ScreenUtil().setWidth(112),  
11614 - // // radius: ScreenUtil().setWidth(10),  
11615 - // gradientStart: Colors.transparent,  
11616 - // gradientEnd: Colors.transparent,  
11617 - // textColor: MyColours.color_E6000000,  
11618 - // isBold: false,  
11619 - // fontSize: 32,  
11620 - // onPressed: () {  
11621 - // Navigator.pop(context);  
11622 - // }),  
11623 - // MyDivider(ScreenUtil().setWidth(2),  
11624 - // ScreenUtil().setWidth(112),  
11625 - // color: MyColours.color_f3f3f3),  
11626 - // RoundButton(  
11627 - // text: rTitle,  
11628 - // width: (ScreenUtil().screenWidth -  
11629 - // ScreenUtil().setWidth(62) * 2) /  
11630 - // 2,  
11631 - // height: ScreenUtil().setWidth(112),  
11632 - // // radius: ScreenUtil().setWidth(10),  
11633 - // gradientStart: Colors.transparent,  
11634 - // gradientEnd: Colors.transparent,  
11635 - // textColor: MyColours.color_438E93,  
11636 - // fontSize: 32,  
11637 - // onPressed: () {  
11638 - // rCallback();  
11639 - // Navigator.pop(  
11640 - // context,  
11641 - // );  
11642 - // }),  
11643 - // ],  
11644 - // ) 11619 + Row(
  11620 + children: [
  11621 + RoundButton(
  11622 + text: lTitle,
  11623 + width: (ScreenUtil().screenWidth -
  11624 + ScreenUtil().setWidth(62) * 2) /
  11625 + 2,
  11626 + height: ScreenUtil().setWidth(112),
  11627 + gradientStart: Colors.transparent,
  11628 + gradientEnd: Colors.transparent,
  11629 + textColor: MyColours.color_E6000000,
  11630 + isBold: false,
  11631 + fontSize: 32,
  11632 + onPressed: () {
  11633 + if (Navigator.canPop(context)) {
  11634 + Navigator.pop(context);
  11635 + }
  11636 + }),
  11637 + MyDivider(ScreenUtil().setWidth(2),
  11638 + ScreenUtil().setWidth(112),
  11639 + color: MyColours.color_f3f3f3),
  11640 + RoundButton(
  11641 + text: rTitle,
  11642 + width: (ScreenUtil().screenWidth -
  11643 + ScreenUtil().setWidth(62) * 2) /
  11644 + 2,
  11645 + height: ScreenUtil().setWidth(112),
  11646 + gradientStart: Colors.transparent,
  11647 + gradientEnd: Colors.transparent,
  11648 + textColor: MyColours.color_438E93,
  11649 + fontSize: 32,
  11650 + onPressed: () {
  11651 + if (Navigator.canPop(context)) {
  11652 + Navigator.pop(context);
  11653 + }
  11654 + DialogUtil.goFunctionUpgradePage(
  11655 + outerContext);
  11656 + }),
  11657 + ],
  11658 + )
11645 ], 11659 ],
11646 ), 11660 ),
11647 ), 11661 ),
@@ -11666,6 +11680,7 @@ class DialogUtil { @@ -11666,6 +11680,7 @@ class DialogUtil {
11666 VoidCallback? lCallback, 11680 VoidCallback? lCallback,
11667 VoidCallback? rCallback}) async { 11681 VoidCallback? rCallback}) async {
11668 // bool isRed = content != '' ? false : true; 11682 // bool isRed = content != '' ? false : true;
  11683 + final BuildContext outerContext = context;
11669 final action = await showDialog( 11684 final action = await showDialog(
11670 context: context, 11685 context: context,
11671 barrierDismissible: false, 11686 barrierDismissible: false,
@@ -11747,15 +11762,13 @@ class DialogUtil { @@ -11747,15 +11762,13 @@ class DialogUtil {
11747 // lCallback(); 11762 // lCallback();
11748 // }), 11763 // }),
11749 Row( 11764 Row(
11750 - // mainAxisAlignment: MainAxisAlignment.spaceBetween,  
11751 children: [ 11765 children: [
11752 RoundButton( 11766 RoundButton(
11753 text: lTitle, 11767 text: lTitle,
11754 width: (ScreenUtil().screenWidth - 11768 width: (ScreenUtil().screenWidth -
11755 ScreenUtil().setWidth(62) * 2) / 11769 ScreenUtil().setWidth(62) * 2) /
11756 - 2, 11770 + 3,
11757 height: ScreenUtil().setWidth(112), 11771 height: ScreenUtil().setWidth(112),
11758 - // radius: ScreenUtil().setWidth(10),  
11759 gradientStart: Colors.transparent, 11772 gradientStart: Colors.transparent,
11760 gradientEnd: Colors.transparent, 11773 gradientEnd: Colors.transparent,
11761 textColor: MyColours.color_E6000000, 11774 textColor: MyColours.color_E6000000,
@@ -11774,9 +11787,8 @@ class DialogUtil { @@ -11774,9 +11787,8 @@ class DialogUtil {
11774 text: rTitle, 11787 text: rTitle,
11775 width: (ScreenUtil().screenWidth - 11788 width: (ScreenUtil().screenWidth -
11776 ScreenUtil().setWidth(62) * 2) / 11789 ScreenUtil().setWidth(62) * 2) /
11777 - 2, 11790 + 3,
11778 height: ScreenUtil().setWidth(112), 11791 height: ScreenUtil().setWidth(112),
11779 - // radius: ScreenUtil().setWidth(10),  
11780 gradientStart: Colors.transparent, 11792 gradientStart: Colors.transparent,
11781 gradientEnd: Colors.transparent, 11793 gradientEnd: Colors.transparent,
11782 textColor: MyColours.color_438E93, 11794 textColor: MyColours.color_438E93,
@@ -11787,6 +11799,26 @@ class DialogUtil { @@ -11787,6 +11799,26 @@ class DialogUtil {
11787 Navigator.pop(context); 11799 Navigator.pop(context);
11788 } 11800 }
11789 }), 11801 }),
  11802 + MyDivider(ScreenUtil().setWidth(2),
  11803 + ScreenUtil().setWidth(112),
  11804 + color: MyColours.color_f3f3f3),
  11805 + RoundButton(
  11806 + text: '去购买',
  11807 + width: (ScreenUtil().screenWidth -
  11808 + ScreenUtil().setWidth(62) * 2) /
  11809 + 3,
  11810 + height: ScreenUtil().setWidth(112),
  11811 + gradientStart: Colors.transparent,
  11812 + gradientEnd: Colors.transparent,
  11813 + textColor: MyColours.color_438E93,
  11814 + fontSize: 32,
  11815 + onPressed: () {
  11816 + if (Navigator.canPop(context)) {
  11817 + Navigator.pop(context);
  11818 + }
  11819 + DialogUtil.goFunctionUpgradePage(
  11820 + outerContext);
  11821 + }),
11790 ], 11822 ],
11791 ) 11823 )
11792 ], 11824 ],
@@ -11805,7 +11837,7 @@ class DialogUtil { @@ -11805,7 +11837,7 @@ class DialogUtil {
11805 {String title = "", 11837 {String title = "",
11806 String content = "内容", 11838 String content = "内容",
11807 String lTitle = "我知道了", 11839 String lTitle = "我知道了",
11808 - String rTitle = "立即续费", 11840 + String rTitle = "去购买",
11809 Color rColor = MyColours.color_438E93, 11841 Color rColor = MyColours.color_438E93,
11810 bool isBold = false, 11842 bool isBold = false,
11811 bool isBoldContent = false, 11843 bool isBoldContent = false,
@@ -11813,6 +11845,7 @@ class DialogUtil { @@ -11813,6 +11845,7 @@ class DialogUtil {
11813 VoidCallback? lCallback, 11845 VoidCallback? lCallback,
11814 VoidCallback? rCallback}) async { 11846 VoidCallback? rCallback}) async {
11815 // bool isRed = content != '' ? false : true; 11847 // bool isRed = content != '' ? false : true;
  11848 + final BuildContext outerContext = context;
11816 final action = await showDialog( 11849 final action = await showDialog(
11817 context: context, 11850 context: context,
11818 barrierDismissible: false, 11851 barrierDismissible: false,
@@ -11878,64 +11911,47 @@ class DialogUtil { @@ -11878,64 +11911,47 @@ class DialogUtil {
11878 VEmptyView(66), 11911 VEmptyView(66),
11879 MyDivider(double.infinity, ScreenUtil().setWidth(2), 11912 MyDivider(double.infinity, ScreenUtil().setWidth(2),
11880 color: MyColours.color_f3f3f3), 11913 color: MyColours.color_f3f3f3),
11881 - RoundButton(  
11882 - text: lTitle,  
11883 - width: (ScreenUtil().screenWidth -  
11884 - ScreenUtil().setWidth(62) * 2),  
11885 - height: ScreenUtil().setWidth(112),  
11886 - // radius: ScreenUtil().setWidth(10),  
11887 - gradientStart: Colors.transparent,  
11888 - gradientEnd: Colors.transparent,  
11889 - textColor: MyColours.color_E6000000,  
11890 - isBold: false,  
11891 - fontSize: 32,  
11892 - onPressed: () {  
11893 - if (Navigator.canPop(context)) {  
11894 - Navigator.pop(context);  
11895 - }  
11896 - lCallback!();  
11897 - }),  
11898 - // Row(  
11899 - // // mainAxisAlignment: MainAxisAlignment.spaceBetween,  
11900 - // children: [  
11901 - // RoundButton(  
11902 - // text: lTitle,  
11903 - // width: (ScreenUtil().screenWidth -  
11904 - // ScreenUtil().setWidth(62) * 2) /  
11905 - // 2,  
11906 - // height: ScreenUtil().setWidth(112),  
11907 - // // radius: ScreenUtil().setWidth(10),  
11908 - // gradientStart: Colors.transparent,  
11909 - // gradientEnd: Colors.transparent,  
11910 - // textColor: MyColours.color_E6000000,  
11911 - // isBold: false,  
11912 - // fontSize: 32,  
11913 - // onPressed: () {  
11914 - // Navigator.pop(context);  
11915 - // lCallback();  
11916 - // }),  
11917 - // MyDivider(ScreenUtil().setWidth(2),  
11918 - // ScreenUtil().setWidth(112),  
11919 - // color: MyColours.color_f3f3f3),  
11920 - // RoundButton(  
11921 - // text: rTitle,  
11922 - // width: (ScreenUtil().screenWidth -  
11923 - // ScreenUtil().setWidth(62) * 2) /  
11924 - // 2,  
11925 - // height: ScreenUtil().setWidth(112),  
11926 - // // radius: ScreenUtil().setWidth(10),  
11927 - // gradientStart: Colors.transparent,  
11928 - // gradientEnd: Colors.transparent,  
11929 - // textColor: MyColours.color_438E93,  
11930 - // fontSize: 32,  
11931 - // onPressed: () {  
11932 - // rCallback();  
11933 - // Navigator.pop(  
11934 - // context,  
11935 - // );  
11936 - // }),  
11937 - // ],  
11938 - // ) 11914 + Row(
  11915 + children: [
  11916 + RoundButton(
  11917 + text: lTitle,
  11918 + width: (ScreenUtil().screenWidth -
  11919 + ScreenUtil().setWidth(62) * 2) /
  11920 + 2,
  11921 + height: ScreenUtil().setWidth(112),
  11922 + gradientStart: Colors.transparent,
  11923 + gradientEnd: Colors.transparent,
  11924 + textColor: MyColours.color_E6000000,
  11925 + isBold: false,
  11926 + fontSize: 32,
  11927 + onPressed: () {
  11928 + if (Navigator.canPop(context)) {
  11929 + Navigator.pop(context);
  11930 + }
  11931 + lCallback?.call();
  11932 + }),
  11933 + MyDivider(ScreenUtil().setWidth(2),
  11934 + ScreenUtil().setWidth(112),
  11935 + color: MyColours.color_f3f3f3),
  11936 + RoundButton(
  11937 + text: rTitle,
  11938 + width: (ScreenUtil().screenWidth -
  11939 + ScreenUtil().setWidth(62) * 2) /
  11940 + 2,
  11941 + height: ScreenUtil().setWidth(112),
  11942 + gradientStart: Colors.transparent,
  11943 + gradientEnd: Colors.transparent,
  11944 + textColor: MyColours.color_438E93,
  11945 + fontSize: 32,
  11946 + onPressed: () {
  11947 + if (Navigator.canPop(context)) {
  11948 + Navigator.pop(context);
  11949 + }
  11950 + DialogUtil.goFunctionUpgradePage(
  11951 + outerContext);
  11952 + }),
  11953 + ],
  11954 + )
11939 ], 11955 ],
11940 ), 11956 ),
11941 ), 11957 ),
@@ -13414,5 +13430,4 @@ class DialogUtil { @@ -13414,5 +13430,4 @@ class DialogUtil {
13414 }, 13430 },
13415 ); 13431 );
13416 } 13432 }
13417 -  
13418 } 13433 }
  1 +package io.flutter.plugins;
  2 +
  3 +import androidx.annotation.Keep;
  4 +import androidx.annotation.NonNull;
  5 +import io.flutter.Log;
  6 +
  7 +import io.flutter.embedding.engine.FlutterEngine;
  8 +
  9 +/**
  10 + * Generated file. Do not edit.
  11 + * This file is generated by the Flutter tool based on the
  12 + * plugins that support the Android platform.
  13 + */
  14 +@Keep
  15 +public final class GeneratedPluginRegistrant {
  16 + private static final String TAG = "GeneratedPluginRegistrant";
  17 + public static void registerWith(@NonNull FlutterEngine flutterEngine) {
  18 + try {
  19 + flutterEngine.getPlugins().add(new com.example.flutter_sms.FlutterSmsPlugin());
  20 + } catch (Exception e) {
  21 + Log.e(TAG, "Error registering plugin flutter_sms, com.example.flutter_sms.FlutterSmsPlugin", e);
  22 + }
  23 + try {
  24 + flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin());
  25 + } catch (Exception e) {
  26 + Log.e(TAG, "Error registering plugin url_launcher_android, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e);
  27 + }
  28 + }
  29 +}
  1 +sdk.dir=/Users/wangdongni/Library/Android/sdk
  2 +flutter.sdk=/Users/wangdongni/fvm/versions/custom_3.27.5_ohos_1.0.6
  1 +// This is a generated file; do not edit or check into version control.
  2 +FLUTTER_ROOT=/Users/wangdongni/fvm/versions/custom_3.27.5_ohos_1.0.6
  3 +FLUTTER_APPLICATION_PATH=/Users/wangdongni/Desktop/Flutter-ReserveApp/library/fluttertpc_flutter_sms-b91cabe9da18110ddf67e9114083b7699cdec588/example
  4 +COCOAPODS_PARALLEL_CODE_SIGN=true
  5 +FLUTTER_TARGET=lib/main.dart
  6 +FLUTTER_BUILD_DIR=build
  7 +FLUTTER_BUILD_NAME=1.0.0
  8 +FLUTTER_BUILD_NUMBER=1
  9 +EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386
  10 +EXCLUDED_ARCHS[sdk=iphoneos*]=armv7
  11 +DART_OBFUSCATION=false
  12 +TRACK_WIDGET_CREATION=true
  13 +TREE_SHAKE_ICONS=false
  14 +PACKAGE_CONFIG=.dart_tool/package_config.json
  1 +#!/bin/sh
  2 +# This is a generated file; do not edit or check into version control.
  3 +export "FLUTTER_ROOT=/Users/wangdongni/fvm/versions/custom_3.27.5_ohos_1.0.6"
  4 +export "FLUTTER_APPLICATION_PATH=/Users/wangdongni/Desktop/Flutter-ReserveApp/library/fluttertpc_flutter_sms-b91cabe9da18110ddf67e9114083b7699cdec588/example"
  5 +export "COCOAPODS_PARALLEL_CODE_SIGN=true"
  6 +export "FLUTTER_TARGET=lib/main.dart"
  7 +export "FLUTTER_BUILD_DIR=build"
  8 +export "FLUTTER_BUILD_NAME=1.0.0"
  9 +export "FLUTTER_BUILD_NUMBER=1"
  10 +export "DART_OBFUSCATION=false"
  11 +export "TRACK_WIDGET_CREATION=true"
  12 +export "TREE_SHAKE_ICONS=false"
  13 +export "PACKAGE_CONFIG=.dart_tool/package_config.json"
  1 +//
  2 +// Generated file. Do not edit.
  3 +//
  4 +
  5 +// clang-format off
  6 +
  7 +#ifndef GeneratedPluginRegistrant_h
  8 +#define GeneratedPluginRegistrant_h
  9 +
  10 +#import <Flutter/Flutter.h>
  11 +
  12 +NS_ASSUME_NONNULL_BEGIN
  13 +
  14 +@interface GeneratedPluginRegistrant : NSObject
  15 ++ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry;
  16 +@end
  17 +
  18 +NS_ASSUME_NONNULL_END
  19 +#endif /* GeneratedPluginRegistrant_h */
  1 +//
  2 +// Generated file. Do not edit.
  3 +//
  4 +
  5 +// clang-format off
  6 +
  7 +#import "GeneratedPluginRegistrant.h"
  8 +
  9 +#if __has_include(<flutter_sms/FlutterSmsPlugin.h>)
  10 +#import <flutter_sms/FlutterSmsPlugin.h>
  11 +#else
  12 +@import flutter_sms;
  13 +#endif
  14 +
  15 +#if __has_include(<url_launcher_ios/URLLauncherPlugin.h>)
  16 +#import <url_launcher_ios/URLLauncherPlugin.h>
  17 +#else
  18 +@import url_launcher_ios;
  19 +#endif
  20 +
  21 +@implementation GeneratedPluginRegistrant
  22 +
  23 ++ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {
  24 + [FlutterSmsPlugin registerWithRegistrar:[registry registrarForPlugin:@"FlutterSmsPlugin"]];
  25 + [URLLauncherPlugin registerWithRegistrar:[registry registrarForPlugin:@"URLLauncherPlugin"]];
  26 +}
  27 +
  28 +@end
  1 +//
  2 +// Generated file. Do not edit.
  3 +//
  4 +
  5 +import FlutterMacOS
  6 +import Foundation
  7 +
  8 +import url_launcher_macos
  9 +
  10 +func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
  11 + UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
  12 +}
  1 +// This is a generated file; do not edit or check into version control.
  2 +FLUTTER_ROOT=/Users/wangdongni/fvm/versions/custom_3.27.5_ohos_1.0.6
  3 +FLUTTER_APPLICATION_PATH=/Users/wangdongni/Desktop/Flutter-ReserveApp/library/fluttertpc_flutter_sms-b91cabe9da18110ddf67e9114083b7699cdec588/example
  4 +COCOAPODS_PARALLEL_CODE_SIGN=true
  5 +FLUTTER_BUILD_DIR=build
  6 +FLUTTER_BUILD_NAME=1.0.0
  7 +FLUTTER_BUILD_NUMBER=1
  8 +DART_OBFUSCATION=false
  9 +TRACK_WIDGET_CREATION=true
  10 +TREE_SHAKE_ICONS=false
  11 +PACKAGE_CONFIG=.dart_tool/package_config.json
  1 +#!/bin/sh
  2 +# This is a generated file; do not edit or check into version control.
  3 +export "FLUTTER_ROOT=/Users/wangdongni/fvm/versions/custom_3.27.5_ohos_1.0.6"
  4 +export "FLUTTER_APPLICATION_PATH=/Users/wangdongni/Desktop/Flutter-ReserveApp/library/fluttertpc_flutter_sms-b91cabe9da18110ddf67e9114083b7699cdec588/example"
  5 +export "COCOAPODS_PARALLEL_CODE_SIGN=true"
  6 +export "FLUTTER_BUILD_DIR=build"
  7 +export "FLUTTER_BUILD_NAME=1.0.0"
  8 +export "FLUTTER_BUILD_NUMBER=1"
  9 +export "DART_OBFUSCATION=false"
  10 +export "TRACK_WIDGET_CREATION=true"
  11 +export "TREE_SHAKE_ICONS=false"
  12 +export "PACKAGE_CONFIG=.dart_tool/package_config.json"
  1 +hwsdk.dir=/Applications/DevEco-Studio.app/Contents/sdk
  2 +flutter.sdk=/Users/wangdongni/fvm/versions/custom_3.27.5_ohos_1.0.6
  1 +# Generated by pub
  2 +# See https://dart.dev/tools/pub/glossary#lockfile
  3 +packages:
  4 + async:
  5 + dependency: transitive
  6 + description:
  7 + name: async
  8 + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
  9 + url: "https://pub.flutter-io.cn"
  10 + source: hosted
  11 + version: "2.11.0"
  12 + boolean_selector:
  13 + dependency: transitive
  14 + description:
  15 + name: boolean_selector
  16 + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
  17 + url: "https://pub.flutter-io.cn"
  18 + source: hosted
  19 + version: "2.1.1"
  20 + characters:
  21 + dependency: transitive
  22 + description:
  23 + name: characters
  24 + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
  25 + url: "https://pub.flutter-io.cn"
  26 + source: hosted
  27 + version: "1.3.0"
  28 + clock:
  29 + dependency: transitive
  30 + description:
  31 + name: clock
  32 + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
  33 + url: "https://pub.flutter-io.cn"
  34 + source: hosted
  35 + version: "1.1.1"
  36 + collection:
  37 + dependency: transitive
  38 + description:
  39 + name: collection
  40 + sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
  41 + url: "https://pub.flutter-io.cn"
  42 + source: hosted
  43 + version: "1.19.0"
  44 + fake_async:
  45 + dependency: transitive
  46 + description:
  47 + name: fake_async
  48 + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
  49 + url: "https://pub.flutter-io.cn"
  50 + source: hosted
  51 + version: "1.3.1"
  52 + flutter:
  53 + dependency: "direct main"
  54 + description: flutter
  55 + source: sdk
  56 + version: "0.0.0"
  57 + flutter_sms:
  58 + dependency: "direct dev"
  59 + description:
  60 + path: ".."
  61 + relative: true
  62 + source: path
  63 + version: "2.3.3"
  64 + flutter_test:
  65 + dependency: "direct dev"
  66 + description: flutter
  67 + source: sdk
  68 + version: "0.0.0"
  69 + flutter_web_plugins:
  70 + dependency: transitive
  71 + description: flutter
  72 + source: sdk
  73 + version: "0.0.0"
  74 + leak_tracker:
  75 + dependency: transitive
  76 + description:
  77 + name: leak_tracker
  78 + sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06"
  79 + url: "https://pub.flutter-io.cn"
  80 + source: hosted
  81 + version: "10.0.7"
  82 + leak_tracker_flutter_testing:
  83 + dependency: transitive
  84 + description:
  85 + name: leak_tracker_flutter_testing
  86 + sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379"
  87 + url: "https://pub.flutter-io.cn"
  88 + source: hosted
  89 + version: "3.0.8"
  90 + leak_tracker_testing:
  91 + dependency: transitive
  92 + description:
  93 + name: leak_tracker_testing
  94 + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
  95 + url: "https://pub.flutter-io.cn"
  96 + source: hosted
  97 + version: "3.0.1"
  98 + matcher:
  99 + dependency: transitive
  100 + description:
  101 + name: matcher
  102 + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
  103 + url: "https://pub.flutter-io.cn"
  104 + source: hosted
  105 + version: "0.12.16+1"
  106 + material_color_utilities:
  107 + dependency: transitive
  108 + description:
  109 + name: material_color_utilities
  110 + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
  111 + url: "https://pub.flutter-io.cn"
  112 + source: hosted
  113 + version: "0.11.1"
  114 + meta:
  115 + dependency: transitive
  116 + description:
  117 + name: meta
  118 + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
  119 + url: "https://pub.flutter-io.cn"
  120 + source: hosted
  121 + version: "1.15.0"
  122 + path:
  123 + dependency: transitive
  124 + description:
  125 + name: path
  126 + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
  127 + url: "https://pub.flutter-io.cn"
  128 + source: hosted
  129 + version: "1.9.0"
  130 + plugin_platform_interface:
  131 + dependency: transitive
  132 + description:
  133 + name: plugin_platform_interface
  134 + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
  135 + url: "https://pub.flutter-io.cn"
  136 + source: hosted
  137 + version: "2.1.8"
  138 + sky_engine:
  139 + dependency: transitive
  140 + description: flutter
  141 + source: sdk
  142 + version: "0.0.0"
  143 + source_span:
  144 + dependency: transitive
  145 + description:
  146 + name: source_span
  147 + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
  148 + url: "https://pub.flutter-io.cn"
  149 + source: hosted
  150 + version: "1.10.0"
  151 + stack_trace:
  152 + dependency: transitive
  153 + description:
  154 + name: stack_trace
  155 + sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377"
  156 + url: "https://pub.flutter-io.cn"
  157 + source: hosted
  158 + version: "1.12.0"
  159 + stream_channel:
  160 + dependency: transitive
  161 + description:
  162 + name: stream_channel
  163 + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
  164 + url: "https://pub.flutter-io.cn"
  165 + source: hosted
  166 + version: "2.1.2"
  167 + string_scanner:
  168 + dependency: transitive
  169 + description:
  170 + name: string_scanner
  171 + sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3"
  172 + url: "https://pub.flutter-io.cn"
  173 + source: hosted
  174 + version: "1.3.0"
  175 + term_glyph:
  176 + dependency: transitive
  177 + description:
  178 + name: term_glyph
  179 + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
  180 + url: "https://pub.flutter-io.cn"
  181 + source: hosted
  182 + version: "1.2.1"
  183 + test_api:
  184 + dependency: transitive
  185 + description:
  186 + name: test_api
  187 + sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c"
  188 + url: "https://pub.flutter-io.cn"
  189 + source: hosted
  190 + version: "0.7.3"
  191 + url_launcher:
  192 + dependency: transitive
  193 + description:
  194 + name: url_launcher
  195 + sha256: f6a7e5c4835bb4e3026a04793a4199ca2d14c739ec378fdfe23fc8075d0439f8
  196 + url: "https://pub.flutter-io.cn"
  197 + source: hosted
  198 + version: "6.3.2"
  199 + url_launcher_android:
  200 + dependency: transitive
  201 + description:
  202 + name: url_launcher_android
  203 + sha256: "0aedad096a85b49df2e4725fa32118f9fa580f3b14af7a2d2221896a02cd5656"
  204 + url: "https://pub.flutter-io.cn"
  205 + source: hosted
  206 + version: "6.3.17"
  207 + url_launcher_ios:
  208 + dependency: transitive
  209 + description:
  210 + name: url_launcher_ios
  211 + sha256: "7f2022359d4c099eea7df3fdf739f7d3d3b9faf3166fb1dd390775176e0b76cb"
  212 + url: "https://pub.flutter-io.cn"
  213 + source: hosted
  214 + version: "6.3.3"
  215 + url_launcher_linux:
  216 + dependency: transitive
  217 + description:
  218 + name: url_launcher_linux
  219 + sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935"
  220 + url: "https://pub.flutter-io.cn"
  221 + source: hosted
  222 + version: "3.2.1"
  223 + url_launcher_macos:
  224 + dependency: transitive
  225 + description:
  226 + name: url_launcher_macos
  227 + sha256: "17ba2000b847f334f16626a574c702b196723af2a289e7a93ffcb79acff855c2"
  228 + url: "https://pub.flutter-io.cn"
  229 + source: hosted
  230 + version: "3.2.2"
  231 + url_launcher_platform_interface:
  232 + dependency: transitive
  233 + description:
  234 + name: url_launcher_platform_interface
  235 + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029"
  236 + url: "https://pub.flutter-io.cn"
  237 + source: hosted
  238 + version: "2.3.2"
  239 + url_launcher_web:
  240 + dependency: transitive
  241 + description:
  242 + name: url_launcher_web
  243 + sha256: "4bd2b7b4dc4d4d0b94e5babfffbca8eac1a126c7f3d6ecbc1a11013faa3abba2"
  244 + url: "https://pub.flutter-io.cn"
  245 + source: hosted
  246 + version: "2.4.1"
  247 + url_launcher_windows:
  248 + dependency: transitive
  249 + description:
  250 + name: url_launcher_windows
  251 + sha256: "3284b6d2ac454cf34f114e1d3319866fdd1e19cdc329999057e44ffe936cfa77"
  252 + url: "https://pub.flutter-io.cn"
  253 + source: hosted
  254 + version: "3.1.4"
  255 + vector_math:
  256 + dependency: transitive
  257 + description:
  258 + name: vector_math
  259 + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
  260 + url: "https://pub.flutter-io.cn"
  261 + source: hosted
  262 + version: "2.1.4"
  263 + vm_service:
  264 + dependency: transitive
  265 + description:
  266 + name: vm_service
  267 + sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b
  268 + url: "https://pub.flutter-io.cn"
  269 + source: hosted
  270 + version: "14.3.0"
  271 + web:
  272 + dependency: transitive
  273 + description:
  274 + name: web
  275 + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a"
  276 + url: "https://pub.flutter-io.cn"
  277 + source: hosted
  278 + version: "1.1.1"
  279 +sdks:
  280 + dart: ">=3.6.0 <4.0.0"
  281 + flutter: ">=3.27.0"
  1 +# Generated by pub
  2 +# See https://dart.dev/tools/pub/glossary#lockfile
  3 +packages:
  4 + async:
  5 + dependency: transitive
  6 + description:
  7 + name: async
  8 + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
  9 + url: "https://pub.flutter-io.cn"
  10 + source: hosted
  11 + version: "2.11.0"
  12 + boolean_selector:
  13 + dependency: transitive
  14 + description:
  15 + name: boolean_selector
  16 + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
  17 + url: "https://pub.flutter-io.cn"
  18 + source: hosted
  19 + version: "2.1.1"
  20 + characters:
  21 + dependency: transitive
  22 + description:
  23 + name: characters
  24 + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
  25 + url: "https://pub.flutter-io.cn"
  26 + source: hosted
  27 + version: "1.3.0"
  28 + clock:
  29 + dependency: transitive
  30 + description:
  31 + name: clock
  32 + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
  33 + url: "https://pub.flutter-io.cn"
  34 + source: hosted
  35 + version: "1.1.1"
  36 + collection:
  37 + dependency: transitive
  38 + description:
  39 + name: collection
  40 + sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
  41 + url: "https://pub.flutter-io.cn"
  42 + source: hosted
  43 + version: "1.19.0"
  44 + fake_async:
  45 + dependency: transitive
  46 + description:
  47 + name: fake_async
  48 + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
  49 + url: "https://pub.flutter-io.cn"
  50 + source: hosted
  51 + version: "1.3.1"
  52 + flutter:
  53 + dependency: "direct main"
  54 + description: flutter
  55 + source: sdk
  56 + version: "0.0.0"
  57 + flutter_test:
  58 + dependency: "direct dev"
  59 + description: flutter
  60 + source: sdk
  61 + version: "0.0.0"
  62 + flutter_web_plugins:
  63 + dependency: "direct main"
  64 + description: flutter
  65 + source: sdk
  66 + version: "0.0.0"
  67 + leak_tracker:
  68 + dependency: transitive
  69 + description:
  70 + name: leak_tracker
  71 + sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06"
  72 + url: "https://pub.flutter-io.cn"
  73 + source: hosted
  74 + version: "10.0.7"
  75 + leak_tracker_flutter_testing:
  76 + dependency: transitive
  77 + description:
  78 + name: leak_tracker_flutter_testing
  79 + sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379"
  80 + url: "https://pub.flutter-io.cn"
  81 + source: hosted
  82 + version: "3.0.8"
  83 + leak_tracker_testing:
  84 + dependency: transitive
  85 + description:
  86 + name: leak_tracker_testing
  87 + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
  88 + url: "https://pub.flutter-io.cn"
  89 + source: hosted
  90 + version: "3.0.1"
  91 + matcher:
  92 + dependency: transitive
  93 + description:
  94 + name: matcher
  95 + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
  96 + url: "https://pub.flutter-io.cn"
  97 + source: hosted
  98 + version: "0.12.16+1"
  99 + material_color_utilities:
  100 + dependency: transitive
  101 + description:
  102 + name: material_color_utilities
  103 + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
  104 + url: "https://pub.flutter-io.cn"
  105 + source: hosted
  106 + version: "0.11.1"
  107 + meta:
  108 + dependency: transitive
  109 + description:
  110 + name: meta
  111 + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
  112 + url: "https://pub.flutter-io.cn"
  113 + source: hosted
  114 + version: "1.15.0"
  115 + path:
  116 + dependency: transitive
  117 + description:
  118 + name: path
  119 + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
  120 + url: "https://pub.flutter-io.cn"
  121 + source: hosted
  122 + version: "1.9.0"
  123 + plugin_platform_interface:
  124 + dependency: "direct main"
  125 + description:
  126 + name: plugin_platform_interface
  127 + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
  128 + url: "https://pub.flutter-io.cn"
  129 + source: hosted
  130 + version: "2.1.8"
  131 + sky_engine:
  132 + dependency: transitive
  133 + description: flutter
  134 + source: sdk
  135 + version: "0.0.0"
  136 + source_span:
  137 + dependency: transitive
  138 + description:
  139 + name: source_span
  140 + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
  141 + url: "https://pub.flutter-io.cn"
  142 + source: hosted
  143 + version: "1.10.0"
  144 + stack_trace:
  145 + dependency: transitive
  146 + description:
  147 + name: stack_trace
  148 + sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377"
  149 + url: "https://pub.flutter-io.cn"
  150 + source: hosted
  151 + version: "1.12.0"
  152 + stream_channel:
  153 + dependency: transitive
  154 + description:
  155 + name: stream_channel
  156 + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
  157 + url: "https://pub.flutter-io.cn"
  158 + source: hosted
  159 + version: "2.1.2"
  160 + string_scanner:
  161 + dependency: transitive
  162 + description:
  163 + name: string_scanner
  164 + sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3"
  165 + url: "https://pub.flutter-io.cn"
  166 + source: hosted
  167 + version: "1.3.0"
  168 + term_glyph:
  169 + dependency: transitive
  170 + description:
  171 + name: term_glyph
  172 + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
  173 + url: "https://pub.flutter-io.cn"
  174 + source: hosted
  175 + version: "1.2.1"
  176 + test_api:
  177 + dependency: transitive
  178 + description:
  179 + name: test_api
  180 + sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c"
  181 + url: "https://pub.flutter-io.cn"
  182 + source: hosted
  183 + version: "0.7.3"
  184 + url_launcher:
  185 + dependency: "direct main"
  186 + description:
  187 + name: url_launcher
  188 + sha256: f6a7e5c4835bb4e3026a04793a4199ca2d14c739ec378fdfe23fc8075d0439f8
  189 + url: "https://pub.flutter-io.cn"
  190 + source: hosted
  191 + version: "6.3.2"
  192 + url_launcher_android:
  193 + dependency: transitive
  194 + description:
  195 + name: url_launcher_android
  196 + sha256: "0aedad096a85b49df2e4725fa32118f9fa580f3b14af7a2d2221896a02cd5656"
  197 + url: "https://pub.flutter-io.cn"
  198 + source: hosted
  199 + version: "6.3.17"
  200 + url_launcher_ios:
  201 + dependency: transitive
  202 + description:
  203 + name: url_launcher_ios
  204 + sha256: "7f2022359d4c099eea7df3fdf739f7d3d3b9faf3166fb1dd390775176e0b76cb"
  205 + url: "https://pub.flutter-io.cn"
  206 + source: hosted
  207 + version: "6.3.3"
  208 + url_launcher_linux:
  209 + dependency: transitive
  210 + description:
  211 + name: url_launcher_linux
  212 + sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935"
  213 + url: "https://pub.flutter-io.cn"
  214 + source: hosted
  215 + version: "3.2.1"
  216 + url_launcher_macos:
  217 + dependency: transitive
  218 + description:
  219 + name: url_launcher_macos
  220 + sha256: "17ba2000b847f334f16626a574c702b196723af2a289e7a93ffcb79acff855c2"
  221 + url: "https://pub.flutter-io.cn"
  222 + source: hosted
  223 + version: "3.2.2"
  224 + url_launcher_platform_interface:
  225 + dependency: transitive
  226 + description:
  227 + name: url_launcher_platform_interface
  228 + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029"
  229 + url: "https://pub.flutter-io.cn"
  230 + source: hosted
  231 + version: "2.3.2"
  232 + url_launcher_web:
  233 + dependency: transitive
  234 + description:
  235 + name: url_launcher_web
  236 + sha256: "4bd2b7b4dc4d4d0b94e5babfffbca8eac1a126c7f3d6ecbc1a11013faa3abba2"
  237 + url: "https://pub.flutter-io.cn"
  238 + source: hosted
  239 + version: "2.4.1"
  240 + url_launcher_windows:
  241 + dependency: transitive
  242 + description:
  243 + name: url_launcher_windows
  244 + sha256: "3284b6d2ac454cf34f114e1d3319866fdd1e19cdc329999057e44ffe936cfa77"
  245 + url: "https://pub.flutter-io.cn"
  246 + source: hosted
  247 + version: "3.1.4"
  248 + vector_math:
  249 + dependency: transitive
  250 + description:
  251 + name: vector_math
  252 + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
  253 + url: "https://pub.flutter-io.cn"
  254 + source: hosted
  255 + version: "2.1.4"
  256 + vm_service:
  257 + dependency: transitive
  258 + description:
  259 + name: vm_service
  260 + sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b
  261 + url: "https://pub.flutter-io.cn"
  262 + source: hosted
  263 + version: "14.3.0"
  264 + web:
  265 + dependency: transitive
  266 + description:
  267 + name: web
  268 + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a"
  269 + url: "https://pub.flutter-io.cn"
  270 + source: hosted
  271 + version: "1.1.1"
  272 +sdks:
  273 + dart: ">=3.6.0 <4.0.0"
  274 + flutter: ">=3.27.0"
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +import 'package:flutter_test/flutter_test.dart';
  4 +import 'package:one_key/models/seller_version_model.dart';
  5 +import 'package:one_key/provider/collect_store_provider.dart';
  6 +import 'package:one_key/utils/dialog_util.dart';
  7 +import 'package:provider/provider.dart';
  8 +
  9 +class _FakeCollectStoreProvider extends CollectStoreProvider {
  10 + @override
  11 + Future<List<SellerVersionSunModel>?> getFunctionUpgradeList(
  12 + BuildContext context, {
  13 + bool showLoading = true,
  14 + }) async {
  15 + return <SellerVersionSunModel>[];
  16 + }
  17 +}
  18 +
  19 +Widget _buildTestApp(
  20 + _FakeCollectStoreProvider provider,
  21 + void Function(BuildContext context) openDialog,
  22 +) {
  23 + return ScreenUtilInit(
  24 + designSize: const Size(750, 1334),
  25 + minTextAdapt: true,
  26 + splitScreenMode: true,
  27 + builder: (context, child) {
  28 + return ChangeNotifierProvider<CollectStoreProvider>.value(
  29 + value: provider,
  30 + child: MaterialApp(
  31 + home: Scaffold(
  32 + body: Center(
  33 + child: Builder(
  34 + builder: (context) {
  35 + return TextButton(
  36 + onPressed: () => openDialog(context),
  37 + child: const Text('打开弹窗'),
  38 + );
  39 + },
  40 + ),
  41 + ),
  42 + ),
  43 + ),
  44 + );
  45 + },
  46 + );
  47 +}
  48 +
  49 +Future<void> _tapAndOpenUpgrade(WidgetTester tester) async {
  50 + await tester.tap(find.text('打开弹窗'));
  51 + await tester.pumpAndSettle();
  52 + expect(find.text('去购买'), findsOneWidget);
  53 +
  54 + await tester.tap(find.text('去购买'));
  55 + await tester.pump();
  56 + await tester.pump(const Duration(milliseconds: 600));
  57 + expect(find.text('功能升级'), findsOneWidget);
  58 +}
  59 +
  60 +void _setPhoneViewport(WidgetTester tester) {
  61 + tester.view.physicalSize = const Size(1080, 2340);
  62 + tester.view.devicePixelRatio = 1.0;
  63 + addTearDown(() {
  64 + tester.view.physicalSize = const Size(800, 600);
  65 + tester.view.devicePixelRatio = 1.0;
  66 + });
  67 +}
  68 +
  69 +void main() {
  70 + testWidgets('未购买模块弹窗可以去购买', (tester) async {
  71 + _setPhoneViewport(tester);
  72 + final provider = _FakeCollectStoreProvider();
  73 + await tester.pumpWidget(
  74 + _buildTestApp(provider, (context) {
  75 + DialogUtil.showSellerVersionBuyDialog(context, '宴会管理', (_) {});
  76 + }),
  77 + );
  78 + await _tapAndOpenUpgrade(tester);
  79 + });
  80 +
  81 + testWidgets('普通版模块过期弹窗可以去购买', (tester) async {
  82 + _setPhoneViewport(tester);
  83 + final provider = _FakeCollectStoreProvider();
  84 + final showData = <SellerVersionSunModel>[
  85 + SellerVersionSunModel(
  86 + vid: '12',
  87 + vname: '宴会管理',
  88 + edate: '1798761600',
  89 + ),
  90 + ];
  91 + await tester.pumpWidget(
  92 + _buildTestApp(provider, (context) {
  93 + DialogUtil.showSellerVersionEdateDialog(context, showData, (_) {});
  94 + }),
  95 + );
  96 + await _tapAndOpenUpgrade(tester);
  97 + });
  98 +
  99 + testWidgets('极速版模块过期弹窗可以去购买', (tester) async {
  100 + _setPhoneViewport(tester);
  101 + final provider = _FakeCollectStoreProvider();
  102 + await tester.pumpWidget(
  103 + _buildTestApp(provider, (context) {
  104 + DialogUtil.cupertinoAlertSellerEdateDialogSim(
  105 + context,
  106 + title: '温馨提示',
  107 + content: '2026-10-01',
  108 + rCallback: () {},
  109 + );
  110 + }),
  111 + );
  112 + await _tapAndOpenUpgrade(tester);
  113 + });
  114 +
  115 + testWidgets('普通版店铺过期弹窗可以去购买', (tester) async {
  116 + _setPhoneViewport(tester);
  117 + final provider = _FakeCollectStoreProvider();
  118 + await tester.pumpWidget(
  119 + _buildTestApp(provider, (context) {
  120 + DialogUtil.cupertinoAlertSellerHasEdateDialog(
  121 + context,
  122 + title: '温馨提示',
  123 + lCallback: () {},
  124 + rCallback: () {},
  125 + );
  126 + }),
  127 + );
  128 + await _tapAndOpenUpgrade(tester);
  129 + });
  130 +
  131 + testWidgets('极速版店铺过期弹窗可以去购买', (tester) async {
  132 + _setPhoneViewport(tester);
  133 + final provider = _FakeCollectStoreProvider();
  134 + await tester.pumpWidget(
  135 + _buildTestApp(provider, (context) {
  136 + DialogUtil.cupertinoAlertSellerHasEdateDialogSim(
  137 + context,
  138 + title: '温馨提示',
  139 + lCallback: () {},
  140 + rCallback: () {},
  141 + );
  142 + }),
  143 + );
  144 + await _tapAndOpenUpgrade(tester);
  145 + });
  146 +}
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +import 'package:flutter/services.dart';
  4 +import 'package:flutter_test/flutter_test.dart';
  5 +import 'package:one_key/models/seller_version_model.dart';
  6 +import 'package:one_key/provider/collect_store_provider.dart';
  7 +import 'package:one_key/utils/dialog_util.dart';
  8 +import 'package:provider/provider.dart';
  9 +
  10 +class _PreviewCollectStoreProvider extends CollectStoreProvider {
  11 + @override
  12 + Future<List<SellerVersionSunModel>?> getFunctionUpgradeList(
  13 + BuildContext context, {
  14 + bool showLoading = true,
  15 + }) async {
  16 + return <SellerVersionSunModel>[];
  17 + }
  18 +}
  19 +
  20 +Widget _buildPreviewApp(
  21 + _PreviewCollectStoreProvider provider,
  22 + void Function(BuildContext context) openDialog,
  23 +) {
  24 + return ScreenUtilInit(
  25 + designSize: const Size(750, 1334),
  26 + minTextAdapt: true,
  27 + splitScreenMode: true,
  28 + builder: (context, child) {
  29 + return ChangeNotifierProvider<CollectStoreProvider>.value(
  30 + value: provider,
  31 + child: MaterialApp(
  32 + home: Scaffold(
  33 + backgroundColor: Colors.white,
  34 + body: Center(
  35 + child: Builder(
  36 + builder: (context) {
  37 + return TextButton(
  38 + onPressed: () => openDialog(context),
  39 + child: const Text('打开弹窗'),
  40 + );
  41 + },
  42 + ),
  43 + ),
  44 + ),
  45 + ),
  46 + );
  47 + },
  48 + );
  49 +}
  50 +
  51 +void _setPhoneViewport(WidgetTester tester) {
  52 + tester.view.physicalSize = const Size(1080, 2340);
  53 + tester.view.devicePixelRatio = 1.0;
  54 + const MethodChannel statusBarChannel =
  55 + MethodChannel('plugins.sameer.com/statusbar');
  56 + tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
  57 + statusBarChannel,
  58 + (call) async => null,
  59 + );
  60 + addTearDown(() {
  61 + tester.view.physicalSize = const Size(800, 600);
  62 + tester.view.devicePixelRatio = 1.0;
  63 + tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
  64 + statusBarChannel,
  65 + null,
  66 + );
  67 + });
  68 +}
  69 +
  70 +void main() {
  71 + testWidgets('导出未购买和跳转预览图', (tester) async {
  72 + _setPhoneViewport(tester);
  73 + final provider = _PreviewCollectStoreProvider();
  74 + await tester.pumpWidget(
  75 + _buildPreviewApp(provider, (context) {
  76 + DialogUtil.showSellerVersionBuyDialog(context, '宴会管理', (_) {});
  77 + }),
  78 + );
  79 + await tester.tap(find.text('打开弹窗'));
  80 + await tester.pumpAndSettle();
  81 + await expectLater(
  82 + find.byType(MaterialApp),
  83 + matchesGoldenFile('goldens/preview_buy_dialog.png'),
  84 + );
  85 +
  86 + await tester.tap(find.text('去购买'));
  87 + await tester.pump();
  88 + await tester.pump(const Duration(milliseconds: 600));
  89 + await tester.pump(const Duration(milliseconds: 200));
  90 + await expectLater(
  91 + find.byType(MaterialApp),
  92 + matchesGoldenFile('goldens/preview_upgrade_page.png'),
  93 + );
  94 + });
  95 +
  96 + testWidgets('导出普通版模块过期预览图', (tester) async {
  97 + _setPhoneViewport(tester);
  98 + final provider = _PreviewCollectStoreProvider();
  99 + final showData = <SellerVersionSunModel>[
  100 + SellerVersionSunModel(
  101 + vid: '12',
  102 + vname: '宴会管理',
  103 + edate: '1798761600',
  104 + ),
  105 + ];
  106 + await tester.pumpWidget(
  107 + _buildPreviewApp(provider, (context) {
  108 + DialogUtil.showSellerVersionEdateDialog(context, showData, (_) {});
  109 + }),
  110 + );
  111 + await tester.tap(find.text('打开弹窗'));
  112 + await tester.pumpAndSettle();
  113 + await expectLater(
  114 + find.byType(MaterialApp),
  115 + matchesGoldenFile('goldens/preview_expire_dialog.png'),
  116 + );
  117 + });
  118 +
  119 + testWidgets('导出极速版模块过期预览图', (tester) async {
  120 + _setPhoneViewport(tester);
  121 + final provider = _PreviewCollectStoreProvider();
  122 + await tester.pumpWidget(
  123 + _buildPreviewApp(provider, (context) {
  124 + DialogUtil.cupertinoAlertSellerEdateDialogSim(
  125 + context,
  126 + title: '温馨提示',
  127 + content: '2026-10-01',
  128 + rCallback: () {},
  129 + );
  130 + }),
  131 + );
  132 + await tester.tap(find.text('打开弹窗'));
  133 + await tester.pumpAndSettle();
  134 + await expectLater(
  135 + find.byType(MaterialApp),
  136 + matchesGoldenFile('goldens/preview_sim_expire_dialog.png'),
  137 + );
  138 + });
  139 +
  140 + testWidgets('导出普通版店铺过期预览图', (tester) async {
  141 + _setPhoneViewport(tester);
  142 + final provider = _PreviewCollectStoreProvider();
  143 + await tester.pumpWidget(
  144 + _buildPreviewApp(provider, (context) {
  145 + DialogUtil.cupertinoAlertSellerHasEdateDialog(
  146 + context,
  147 + title: '温馨提示',
  148 + lCallback: () {},
  149 + rCallback: () {},
  150 + );
  151 + }),
  152 + );
  153 + await tester.tap(find.text('打开弹窗'));
  154 + await tester.pumpAndSettle();
  155 + await expectLater(
  156 + find.byType(MaterialApp),
  157 + matchesGoldenFile('goldens/preview_store_expire_dialog.png'),
  158 + );
  159 + });
  160 +
  161 + testWidgets('导出极速版店铺过期预览图', (tester) async {
  162 + _setPhoneViewport(tester);
  163 + final provider = _PreviewCollectStoreProvider();
  164 + await tester.pumpWidget(
  165 + _buildPreviewApp(provider, (context) {
  166 + DialogUtil.cupertinoAlertSellerHasEdateDialogSim(
  167 + context,
  168 + title: '温馨提示',
  169 + lCallback: () {},
  170 + rCallback: () {},
  171 + );
  172 + }),
  173 + );
  174 + await tester.tap(find.text('打开弹窗'));
  175 + await tester.pumpAndSettle();
  176 + await expectLater(
  177 + find.byType(MaterialApp),
  178 + matchesGoldenFile('goldens/preview_sim_store_expire_dialog.png'),
  179 + );
  180 + });
  181 +}