Commit 30f20ce4c331b0329588b8a80e58fa1b4885ae76

Authored by 常守达
1 parent 994bf738

fix(today):看板问题修复

... ... @@ -582,8 +582,8 @@ class TodayController extends GetMaterialController {
final products = (result.data.productList ?? const <PayProduct>[])
.where((product) => _nonEmpty(product.appleId) != null)
.toList();
yearlyProduct.value = products
.firstWhereOrNull((p) => p.appleId == Membership.yearlyProductId);
yearlyProduct.value =
products.firstWhereOrNull((p) => p.content?.isDiscountOffer == 1);
// AppLogger.e(yearlyProduct);
if (yearlyProduct.value != null) {
final appleProductId = _nonEmpty(yearlyProduct.value!.appleId);
... ...
... ... @@ -418,8 +418,7 @@ class _UnlockPremiumCard extends StatelessWidget {
),
Container(
height: 32,
padding: const EdgeInsets.symmetric(
horizontal: 22, vertical: 8),
padding: const EdgeInsets.fromLTRB(18, 8, 22, 8),
margin: EdgeInsets.only(bottom: 20, top: 12),
decoration: ShapeDecoration(
color: const Color(0xFFFFDF50),
... ...
... ... @@ -297,31 +297,33 @@ class _AgreementText extends GetView<LoginController> {
decorationColor: _linkColor,
);
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Obx(() {
final isChecked = controller.termsChecked.value;
return GestureDetector(
onTap: controller.toggleTermsChecked,
child: Padding(
padding: const EdgeInsets.only(right: 8.0, top: 4.0, bottom: 4.0),
child: Icon(
isChecked
? Icons.check_circle_rounded
: Icons.radio_button_unchecked_rounded,
color: isChecked
? context.colors.primary
: context.colors.textSecondary,
size: 18,
),
),
);
}),
Text.rich(
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 24.0),
child: GestureDetector(
onTap: controller.toggleTermsChecked,
behavior: HitTestBehavior.opaque,
child: Text.rich(
TextSpan(
style: baseStyle,
children: [
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: Obx(() {
final isChecked = controller.termsChecked.value;
return Icon(
isChecked
? Icons.check_circle_rounded
: Icons.radio_button_unchecked_rounded,
color: isChecked
? context.colors.primary
: context.colors.textSecondary,
size: 18,
);
}),
),
const WidgetSpan(
child: SizedBox(width: 8),
),
TextSpan(text: l10n.loginAgreementPrefix),
TextSpan(
text: l10n.loginTerms,
... ... @@ -340,7 +342,7 @@ class _AgreementText extends GetView<LoginController> {
),
textAlign: TextAlign.center,
),
],
),
);
}
}
... ...
... ... @@ -192,8 +192,8 @@ class MembershipOfferController extends GetxController {
final products = (result.data.productList ?? const <PayProduct>[])
.where((product) => _nonEmpty(product.appleId) != null)
.toList();
yearlyProduct.value = products
.firstWhereOrNull((p) => p.appleId == Membership.yearlyProductId);
yearlyProduct.value =
products.firstWhereOrNull((p) => p.content?.isDiscountOffer == 1);
if (yearlyProduct.value != null) {
final appleProductId = _nonEmpty(yearlyProduct.value!.appleId);
... ...
... ... @@ -135,6 +135,7 @@ class MembershipOfferView extends GetView<MembershipOfferController> {
var arguments = {};
if (controller.isFromOnboard) {
arguments['from'] = 'onboarding';
arguments['is_membership_offer'] = true;
} else {
arguments['channel_type'] =
Get.arguments?['channel_type'] ?? '';
... ...
... ... @@ -91,15 +91,19 @@ class PurchaseController extends GetxController {
void onBackPressed() {
if (isFromOnboard) {
Get.offNamed(
Routes.MEMBERSHIP_OFFER,
arguments: {'from': 'onboarding'},
);
if (Get.arguments?['is_membership_offer'] == true) {
Get.offAllNamed(AppRoutes.home, arguments: {'isFromOnboard': true});
} else {
Get.offNamed(
Routes.MEMBERSHIP_OFFER,
arguments: {'from': 'onboarding'},
);
}
} else {
if (Navigator.canPop(Get.context!)) {
Get.back();
} else {
Get.offAllNamed(AppRoutes.home);
Get.offAllNamed(AppRoutes.home, arguments: {'isFromOnboard': true});
}
}
}
... ... @@ -267,7 +271,7 @@ class PurchaseController extends GetxController {
} finally {
if (isFromOnboard) {
// onboarding 流程购买成功,清空栈进入首页
Get.offAllNamed(AppRoutes.home);
Get.offAllNamed(AppRoutes.home, arguments: {'isFromOnboard': true});
} else {
Get.offNamed(Routes.PREMIUM_ACTIVATED);
}
... ...
... ... @@ -88,6 +88,7 @@ class PayProductContent {
this.description,
this.isForever,
this.isDefault,
this.isDiscountOffer,
this.share,
});
... ... @@ -97,6 +98,7 @@ class PayProductContent {
final String? description;
final int? isForever;
final int? isDefault;
final int? isDiscountOffer;
final int? share;
factory PayProductContent.fromJson(Map<String, dynamic> json) {
... ... @@ -107,6 +109,7 @@ class PayProductContent {
description: json['description'] as String?,
isForever: json['is_forever'] as int?,
isDefault: json['is_default'] as int?,
isDiscountOffer: json['is_year_vip_discount'] as int?,
share: json['share'] as int?,
);
}
... ... @@ -119,6 +122,7 @@ class PayProductContent {
if (description != null) val['description'] = description;
if (isForever != null) val['is_forever'] = isForever;
if (isDefault != null) val['is_default'] = isDefault;
if (isDiscountOffer != null) val['is_year_vip_discount'] = isDiscountOffer;
if (share != null) val['share'] = share;
return val;
}
... ...
... ... @@ -86,7 +86,7 @@
"loginWithPhone": "Sign in with Phone",
"loginWithApple": "Sign in with Apple",
"loginLastUsed": "Last used",
"loginAgreementPrefix": "I have read and agree to the ",
"loginAgreementPrefix": "By clicking above, you agree to the ",
"loginTerms": "Terms of Service",
"loginAgreementAnd": " and ",
"loginPrivacy": "Privacy Policy",
... ...
... ... @@ -101,7 +101,7 @@
"@loginLastUsed": {
"description": "上次使用标签"
},
"loginAgreementPrefix": "我已阅读并同意",
"loginAgreementPrefix": "点击上方即表示你同意",
"@loginAgreementPrefix": {
"description": "协议勾选前缀"
},
... ...
... ... @@ -618,7 +618,7 @@ abstract class AppLocalizations {
/// 协议勾选前缀
///
/// In zh, this message translates to:
/// **'我已阅读并同意'**
/// **'点击上方即表示你同意'**
String get loginAgreementPrefix;
/// 用户协议链接
... ...
... ... @@ -288,7 +288,7 @@ class AppLocalizationsEn extends AppLocalizations {
String get loginLastUsed => 'Last used';
@override
String get loginAgreementPrefix => 'I have read and agree to the ';
String get loginAgreementPrefix => 'By clicking above, you agree to the ';
@override
String get loginTerms => 'Terms of Service';
... ...
... ... @@ -274,7 +274,7 @@ class AppLocalizationsZh extends AppLocalizations {
String get loginLastUsed => '上次使用';
@override
String get loginAgreementPrefix => '我已阅读并同意';
String get loginAgreementPrefix => '点击上方即表示你同意';
@override
String get loginTerms => '用户协议';
... ...