Commit 30f20ce4c331b0329588b8a80e58fa1b4885ae76

Authored by 常守达
1 parent 994bf738

fix(today):看板问题修复

@@ -582,8 +582,8 @@ class TodayController extends GetMaterialController { @@ -582,8 +582,8 @@ class TodayController extends GetMaterialController {
582 final products = (result.data.productList ?? const <PayProduct>[]) 582 final products = (result.data.productList ?? const <PayProduct>[])
583 .where((product) => _nonEmpty(product.appleId) != null) 583 .where((product) => _nonEmpty(product.appleId) != null)
584 .toList(); 584 .toList();
585 - yearlyProduct.value = products  
586 - .firstWhereOrNull((p) => p.appleId == Membership.yearlyProductId); 585 + yearlyProduct.value =
  586 + products.firstWhereOrNull((p) => p.content?.isDiscountOffer == 1);
587 // AppLogger.e(yearlyProduct); 587 // AppLogger.e(yearlyProduct);
588 if (yearlyProduct.value != null) { 588 if (yearlyProduct.value != null) {
589 final appleProductId = _nonEmpty(yearlyProduct.value!.appleId); 589 final appleProductId = _nonEmpty(yearlyProduct.value!.appleId);
@@ -418,8 +418,7 @@ class _UnlockPremiumCard extends StatelessWidget { @@ -418,8 +418,7 @@ class _UnlockPremiumCard extends StatelessWidget {
418 ), 418 ),
419 Container( 419 Container(
420 height: 32, 420 height: 32,
421 - padding: const EdgeInsets.symmetric(  
422 - horizontal: 22, vertical: 8), 421 + padding: const EdgeInsets.fromLTRB(18, 8, 22, 8),
423 margin: EdgeInsets.only(bottom: 20, top: 12), 422 margin: EdgeInsets.only(bottom: 20, top: 12),
424 decoration: ShapeDecoration( 423 decoration: ShapeDecoration(
425 color: const Color(0xFFFFDF50), 424 color: const Color(0xFFFFDF50),
@@ -297,31 +297,33 @@ class _AgreementText extends GetView<LoginController> { @@ -297,31 +297,33 @@ class _AgreementText extends GetView<LoginController> {
297 decorationColor: _linkColor, 297 decorationColor: _linkColor,
298 ); 298 );
299 299
300 - return Row(  
301 - mainAxisAlignment: MainAxisAlignment.center,  
302 - children: [  
303 - Obx(() {  
304 - final isChecked = controller.termsChecked.value;  
305 - return GestureDetector(  
306 - onTap: controller.toggleTermsChecked,  
307 - child: Padding(  
308 - padding: const EdgeInsets.only(right: 8.0, top: 4.0, bottom: 4.0),  
309 - child: Icon(  
310 - isChecked  
311 - ? Icons.check_circle_rounded  
312 - : Icons.radio_button_unchecked_rounded,  
313 - color: isChecked  
314 - ? context.colors.primary  
315 - : context.colors.textSecondary,  
316 - size: 18,  
317 - ),  
318 - ),  
319 - );  
320 - }),  
321 - Text.rich( 300 + return Padding(
  301 + padding: const EdgeInsets.symmetric(horizontal: 24.0),
  302 + child: GestureDetector(
  303 + onTap: controller.toggleTermsChecked,
  304 + behavior: HitTestBehavior.opaque,
  305 + child: Text.rich(
322 TextSpan( 306 TextSpan(
323 style: baseStyle, 307 style: baseStyle,
324 children: [ 308 children: [
  309 + WidgetSpan(
  310 + alignment: PlaceholderAlignment.middle,
  311 + child: Obx(() {
  312 + final isChecked = controller.termsChecked.value;
  313 + return Icon(
  314 + isChecked
  315 + ? Icons.check_circle_rounded
  316 + : Icons.radio_button_unchecked_rounded,
  317 + color: isChecked
  318 + ? context.colors.primary
  319 + : context.colors.textSecondary,
  320 + size: 18,
  321 + );
  322 + }),
  323 + ),
  324 + const WidgetSpan(
  325 + child: SizedBox(width: 8),
  326 + ),
325 TextSpan(text: l10n.loginAgreementPrefix), 327 TextSpan(text: l10n.loginAgreementPrefix),
326 TextSpan( 328 TextSpan(
327 text: l10n.loginTerms, 329 text: l10n.loginTerms,
@@ -340,7 +342,7 @@ class _AgreementText extends GetView<LoginController> { @@ -340,7 +342,7 @@ class _AgreementText extends GetView<LoginController> {
340 ), 342 ),
341 textAlign: TextAlign.center, 343 textAlign: TextAlign.center,
342 ), 344 ),
343 - ], 345 + ),
344 ); 346 );
345 } 347 }
346 } 348 }
@@ -192,8 +192,8 @@ class MembershipOfferController extends GetxController { @@ -192,8 +192,8 @@ class MembershipOfferController extends GetxController {
192 final products = (result.data.productList ?? const <PayProduct>[]) 192 final products = (result.data.productList ?? const <PayProduct>[])
193 .where((product) => _nonEmpty(product.appleId) != null) 193 .where((product) => _nonEmpty(product.appleId) != null)
194 .toList(); 194 .toList();
195 - yearlyProduct.value = products  
196 - .firstWhereOrNull((p) => p.appleId == Membership.yearlyProductId); 195 + yearlyProduct.value =
  196 + products.firstWhereOrNull((p) => p.content?.isDiscountOffer == 1);
197 197
198 if (yearlyProduct.value != null) { 198 if (yearlyProduct.value != null) {
199 final appleProductId = _nonEmpty(yearlyProduct.value!.appleId); 199 final appleProductId = _nonEmpty(yearlyProduct.value!.appleId);
@@ -135,6 +135,7 @@ class MembershipOfferView extends GetView<MembershipOfferController> { @@ -135,6 +135,7 @@ class MembershipOfferView extends GetView<MembershipOfferController> {
135 var arguments = {}; 135 var arguments = {};
136 if (controller.isFromOnboard) { 136 if (controller.isFromOnboard) {
137 arguments['from'] = 'onboarding'; 137 arguments['from'] = 'onboarding';
  138 + arguments['is_membership_offer'] = true;
138 } else { 139 } else {
139 arguments['channel_type'] = 140 arguments['channel_type'] =
140 Get.arguments?['channel_type'] ?? ''; 141 Get.arguments?['channel_type'] ?? '';
@@ -91,15 +91,19 @@ class PurchaseController extends GetxController { @@ -91,15 +91,19 @@ class PurchaseController extends GetxController {
91 91
92 void onBackPressed() { 92 void onBackPressed() {
93 if (isFromOnboard) { 93 if (isFromOnboard) {
94 - Get.offNamed(  
95 - Routes.MEMBERSHIP_OFFER,  
96 - arguments: {'from': 'onboarding'},  
97 - ); 94 + if (Get.arguments?['is_membership_offer'] == true) {
  95 + Get.offAllNamed(AppRoutes.home, arguments: {'isFromOnboard': true});
  96 + } else {
  97 + Get.offNamed(
  98 + Routes.MEMBERSHIP_OFFER,
  99 + arguments: {'from': 'onboarding'},
  100 + );
  101 + }
98 } else { 102 } else {
99 if (Navigator.canPop(Get.context!)) { 103 if (Navigator.canPop(Get.context!)) {
100 Get.back(); 104 Get.back();
101 } else { 105 } else {
102 - Get.offAllNamed(AppRoutes.home); 106 + Get.offAllNamed(AppRoutes.home, arguments: {'isFromOnboard': true});
103 } 107 }
104 } 108 }
105 } 109 }
@@ -267,7 +271,7 @@ class PurchaseController extends GetxController { @@ -267,7 +271,7 @@ class PurchaseController extends GetxController {
267 } finally { 271 } finally {
268 if (isFromOnboard) { 272 if (isFromOnboard) {
269 // onboarding 流程购买成功,清空栈进入首页 273 // onboarding 流程购买成功,清空栈进入首页
270 - Get.offAllNamed(AppRoutes.home); 274 + Get.offAllNamed(AppRoutes.home, arguments: {'isFromOnboard': true});
271 } else { 275 } else {
272 Get.offNamed(Routes.PREMIUM_ACTIVATED); 276 Get.offNamed(Routes.PREMIUM_ACTIVATED);
273 } 277 }
@@ -88,6 +88,7 @@ class PayProductContent { @@ -88,6 +88,7 @@ class PayProductContent {
88 this.description, 88 this.description,
89 this.isForever, 89 this.isForever,
90 this.isDefault, 90 this.isDefault,
  91 + this.isDiscountOffer,
91 this.share, 92 this.share,
92 }); 93 });
93 94
@@ -97,6 +98,7 @@ class PayProductContent { @@ -97,6 +98,7 @@ class PayProductContent {
97 final String? description; 98 final String? description;
98 final int? isForever; 99 final int? isForever;
99 final int? isDefault; 100 final int? isDefault;
  101 + final int? isDiscountOffer;
100 final int? share; 102 final int? share;
101 103
102 factory PayProductContent.fromJson(Map<String, dynamic> json) { 104 factory PayProductContent.fromJson(Map<String, dynamic> json) {
@@ -107,6 +109,7 @@ class PayProductContent { @@ -107,6 +109,7 @@ class PayProductContent {
107 description: json['description'] as String?, 109 description: json['description'] as String?,
108 isForever: json['is_forever'] as int?, 110 isForever: json['is_forever'] as int?,
109 isDefault: json['is_default'] as int?, 111 isDefault: json['is_default'] as int?,
  112 + isDiscountOffer: json['is_year_vip_discount'] as int?,
110 share: json['share'] as int?, 113 share: json['share'] as int?,
111 ); 114 );
112 } 115 }
@@ -119,6 +122,7 @@ class PayProductContent { @@ -119,6 +122,7 @@ class PayProductContent {
119 if (description != null) val['description'] = description; 122 if (description != null) val['description'] = description;
120 if (isForever != null) val['is_forever'] = isForever; 123 if (isForever != null) val['is_forever'] = isForever;
121 if (isDefault != null) val['is_default'] = isDefault; 124 if (isDefault != null) val['is_default'] = isDefault;
  125 + if (isDiscountOffer != null) val['is_year_vip_discount'] = isDiscountOffer;
122 if (share != null) val['share'] = share; 126 if (share != null) val['share'] = share;
123 return val; 127 return val;
124 } 128 }
@@ -86,7 +86,7 @@ @@ -86,7 +86,7 @@
86 "loginWithPhone": "Sign in with Phone", 86 "loginWithPhone": "Sign in with Phone",
87 "loginWithApple": "Sign in with Apple", 87 "loginWithApple": "Sign in with Apple",
88 "loginLastUsed": "Last used", 88 "loginLastUsed": "Last used",
89 - "loginAgreementPrefix": "I have read and agree to the ", 89 + "loginAgreementPrefix": "By clicking above, you agree to the ",
90 "loginTerms": "Terms of Service", 90 "loginTerms": "Terms of Service",
91 "loginAgreementAnd": " and ", 91 "loginAgreementAnd": " and ",
92 "loginPrivacy": "Privacy Policy", 92 "loginPrivacy": "Privacy Policy",
@@ -101,7 +101,7 @@ @@ -101,7 +101,7 @@
101 "@loginLastUsed": { 101 "@loginLastUsed": {
102 "description": "上次使用标签" 102 "description": "上次使用标签"
103 }, 103 },
104 - "loginAgreementPrefix": "我已阅读并同意", 104 + "loginAgreementPrefix": "点击上方即表示你同意",
105 "@loginAgreementPrefix": { 105 "@loginAgreementPrefix": {
106 "description": "协议勾选前缀" 106 "description": "协议勾选前缀"
107 }, 107 },
@@ -618,7 +618,7 @@ abstract class AppLocalizations { @@ -618,7 +618,7 @@ abstract class AppLocalizations {
618 /// 协议勾选前缀 618 /// 协议勾选前缀
619 /// 619 ///
620 /// In zh, this message translates to: 620 /// In zh, this message translates to:
621 - /// **'我已阅读并同意'** 621 + /// **'点击上方即表示你同意'**
622 String get loginAgreementPrefix; 622 String get loginAgreementPrefix;
623 623
624 /// 用户协议链接 624 /// 用户协议链接
@@ -288,7 +288,7 @@ class AppLocalizationsEn extends AppLocalizations { @@ -288,7 +288,7 @@ class AppLocalizationsEn extends AppLocalizations {
288 String get loginLastUsed => 'Last used'; 288 String get loginLastUsed => 'Last used';
289 289
290 @override 290 @override
291 - String get loginAgreementPrefix => 'I have read and agree to the '; 291 + String get loginAgreementPrefix => 'By clicking above, you agree to the ';
292 292
293 @override 293 @override
294 String get loginTerms => 'Terms of Service'; 294 String get loginTerms => 'Terms of Service';
@@ -274,7 +274,7 @@ class AppLocalizationsZh extends AppLocalizations { @@ -274,7 +274,7 @@ class AppLocalizationsZh extends AppLocalizations {
274 String get loginLastUsed => '上次使用'; 274 String get loginLastUsed => '上次使用';
275 275
276 @override 276 @override
277 - String get loginAgreementPrefix => '我已阅读并同意'; 277 + String get loginAgreementPrefix => '点击上方即表示你同意';
278 278
279 @override 279 @override
280 String get loginTerms => '用户协议'; 280 String get loginTerms => '用户协议';