新增:应用图标,更改应用名称
1
.gitignore
vendored
@ -29,6 +29,7 @@ migrate_working_dir/
|
||||
pubspec.lock
|
||||
|
||||
# Android
|
||||
**/android/key.properties
|
||||
**/android/**/gradle-wrapper.jar
|
||||
**/android/.gradle
|
||||
**/android/captures/
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# MagiEvery AI - Flutter 应用
|
||||
# PetsHero - Flutter 应用
|
||||
|
||||
基于 `design/MagiEveryAI-AB` 设计图实现的 AI 图像/视频生成应用。
|
||||
|
||||
|
||||
@ -12,6 +12,12 @@ if (localPropertiesFile.exists()) {
|
||||
}
|
||||
}
|
||||
|
||||
def keystoreProperties = new Properties()
|
||||
def keystorePropertiesFile = rootProject.file('key.properties')
|
||||
if (keystorePropertiesFile.exists()) {
|
||||
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
|
||||
}
|
||||
|
||||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
||||
if (flutterVersionCode == null) {
|
||||
flutterVersionCode = '1'
|
||||
@ -48,13 +54,22 @@ android {
|
||||
versionName flutterVersionName
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
keyAlias keystoreProperties['keyAlias']
|
||||
keyPassword keystoreProperties['keyPassword']
|
||||
storeFile file(keystoreProperties['storeFile'])
|
||||
storePassword keystoreProperties['storePassword']
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
// 允许 HTTP 连接本地代理(手机无法直连域名时)
|
||||
manifestPlaceholders = [usesCleartextTraffic: "true"]
|
||||
}
|
||||
release {
|
||||
signingConfig signingConfigs.debug
|
||||
signingConfig signingConfigs.release
|
||||
manifestPlaceholders = [usesCleartextTraffic: "false"]
|
||||
}
|
||||
}
|
||||
@ -63,6 +78,7 @@ android {
|
||||
dependencies {
|
||||
implementation 'com.google.android.gms:play-services-ads-identifier:18.1.0'
|
||||
implementation 'com.android.installreferrer:installreferrer:2.2'
|
||||
implementation 'androidx.appcompat:appcompat:1.7.0'
|
||||
}
|
||||
|
||||
flutter {
|
||||
|
||||
@ -4,9 +4,9 @@
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
|
||||
<application
|
||||
android:usesCleartextTraffic="${usesCleartextTraffic}"
|
||||
android:label="AI创作"
|
||||
android:label="PetsHero"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@android:drawable/ic_menu_gallery">
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
|
||||
BIN
android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 7.9 KiB |
BIN
android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
design/images/generated-1773069485332.png
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
140
ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
Normal file
@ -0,0 +1,140 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "Icon-App-20x20@1x.png",
|
||||
"idiom" : "iphone",
|
||||
"scale" : "1x",
|
||||
"size" : "20x20"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-App-20x20@2x.png",
|
||||
"idiom" : "iphone",
|
||||
"scale" : "2x",
|
||||
"size" : "20x20"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-App-20x20@3x.png",
|
||||
"idiom" : "iphone",
|
||||
"scale" : "3x",
|
||||
"size" : "20x20"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-App-29x29@1x.png",
|
||||
"idiom" : "iphone",
|
||||
"scale" : "1x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-App-29x29@2x.png",
|
||||
"idiom" : "iphone",
|
||||
"scale" : "2x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-App-29x29@3x.png",
|
||||
"idiom" : "iphone",
|
||||
"scale" : "3x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-App-40x40@1x.png",
|
||||
"idiom" : "iphone",
|
||||
"scale" : "1x",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-App-40x40@2x.png",
|
||||
"idiom" : "iphone",
|
||||
"scale" : "2x",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-App-40x40@3x.png",
|
||||
"idiom" : "iphone",
|
||||
"scale" : "3x",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-App-60x60@1x.png",
|
||||
"idiom" : "iphone",
|
||||
"scale" : "1x",
|
||||
"size" : "60x60"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-App-60x60@2x.png",
|
||||
"idiom" : "iphone",
|
||||
"scale" : "2x",
|
||||
"size" : "60x60"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-App-60x60@3x.png",
|
||||
"idiom" : "iphone",
|
||||
"scale" : "3x",
|
||||
"size" : "60x60"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-App-20x20@1x.png",
|
||||
"idiom" : "ipad",
|
||||
"scale" : "1x",
|
||||
"size" : "20x20"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-App-20x20@2x.png",
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "20x20"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-App-29x29@1x.png",
|
||||
"idiom" : "ipad",
|
||||
"scale" : "1x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-App-29x29@2x.png",
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-App-40x40@1x.png",
|
||||
"idiom" : "ipad",
|
||||
"scale" : "1x",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-App-40x40@2x.png",
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-App-76x76@1x.png",
|
||||
"idiom" : "ipad",
|
||||
"scale" : "1x",
|
||||
"size" : "76x76"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-App-76x76@2x.png",
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "76x76"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-App-83.5x83.5@2x.png",
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "83.5x83.5"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-App-1024x1024@1x.png",
|
||||
"idiom" : "ios-marketing",
|
||||
"scale" : "1x",
|
||||
"size" : "1024x1024"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-1024.png
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-20@2x.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-20@3x.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-29@2x.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-29@3x.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-40@2x.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-40@3x.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-76@2x.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-83.5@2x.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 1014 B |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 6.4 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 5.3 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 6.4 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 7.9 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 9.5 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 11 KiB |
@ -5,7 +5,7 @@
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>MagiEvery AI</string>
|
||||
<string>PetsHero</string>
|
||||
<key>NSPhotoLibraryUsageDescription</key>
|
||||
<string>We need access to your photos to use as reference for AI image generation.</string>
|
||||
<key>NSPhotoLibraryAddUsageDescription</key>
|
||||
|
||||
@ -5,8 +5,8 @@ abstract final class ApiConfig {
|
||||
/// AES 密钥
|
||||
static const String aesKey = 'liyP4LkMfP68XvCt';
|
||||
|
||||
/// 应用 ID
|
||||
static const String appId = 'com.petsheroai.app';
|
||||
/// 应用标识 (sentinel)
|
||||
static const String appId = 'HAndroid';
|
||||
|
||||
/// 应用包名
|
||||
static const String packageName = 'com.petsheroai.app';
|
||||
|
||||
@ -1,13 +1,14 @@
|
||||
import '../api_client.dart';
|
||||
import '../api_config.dart';
|
||||
import '../proxy_client.dart';
|
||||
|
||||
/// 支付相关 API
|
||||
abstract final class PaymentApi {
|
||||
static final _client = ApiClient.instance.proxy;
|
||||
|
||||
/// 获取 Google 商品列表
|
||||
/// 获取 Google 商品列表(Android)
|
||||
static Future<ApiResponse> getGooglePayActivities({
|
||||
required String sentinel,
|
||||
String? sentinel,
|
||||
String? shield,
|
||||
String? vambrace,
|
||||
String? portal,
|
||||
@ -16,17 +17,17 @@ abstract final class PaymentApi {
|
||||
path: '/v1/payment/getGooglePayActivities',
|
||||
method: 'GET',
|
||||
queryParams: {
|
||||
'sentinel': sentinel,
|
||||
'sentinel': sentinel ?? ApiConfig.appId,
|
||||
'portal': portal ?? ApiConfig.packageName,
|
||||
if (shield != null) 'shield': shield,
|
||||
if (vambrace != null) 'vambrace': vambrace,
|
||||
if (portal != null) 'portal': portal,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// 获取 Apple 商品列表
|
||||
/// 获取 Apple 商品列表(iOS)
|
||||
static Future<ApiResponse> getApplePayActivities({
|
||||
required String sentinel,
|
||||
String? sentinel,
|
||||
String? shield,
|
||||
String? vambrace,
|
||||
String? portal,
|
||||
@ -35,10 +36,10 @@ abstract final class PaymentApi {
|
||||
path: '/v1/payment/getApplePayActivities',
|
||||
method: 'GET',
|
||||
queryParams: {
|
||||
'sentinel': sentinel,
|
||||
'sentinel': sentinel ?? 'HAndroid',
|
||||
'portal': portal ?? ApiConfig.packageName,
|
||||
if (shield != null) 'shield': shield,
|
||||
if (vambrace != null) 'vambrace': vambrace,
|
||||
if (portal != null) 'portal': portal,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@ -126,6 +126,10 @@ class AuthService {
|
||||
if (name != null && name.isNotEmpty) {
|
||||
UserState.setUserName(name);
|
||||
}
|
||||
final countryCode = data?['navigate'] as String?;
|
||||
if (countryCode != null) {
|
||||
UserState.setNavigate(countryCode);
|
||||
}
|
||||
} else {
|
||||
_log('init: 登录失败');
|
||||
}
|
||||
|
||||
@ -8,6 +8,8 @@ class UserState {
|
||||
static final ValueNotifier<String?> userId = ValueNotifier<String?>(null);
|
||||
static final ValueNotifier<String?> avatar = ValueNotifier<String?>(null);
|
||||
static final ValueNotifier<String?> userName = ValueNotifier<String?>(null);
|
||||
/// 国家码 (navigate / countryCode)
|
||||
static final ValueNotifier<String?> navigate = ValueNotifier<String?>(null);
|
||||
|
||||
static void setCredits(int? value) {
|
||||
credits.value = value;
|
||||
@ -25,6 +27,10 @@ class UserState {
|
||||
userName.value = value;
|
||||
}
|
||||
|
||||
static void setNavigate(String? value) {
|
||||
navigate.value = value;
|
||||
}
|
||||
|
||||
static String formatCredits(int? value) {
|
||||
if (value == null) return '--';
|
||||
return value.toString().replaceAllMapped(
|
||||
|
||||
69
lib/features/recharge/models/activity_item.dart
Normal file
@ -0,0 +1,69 @@
|
||||
/// 商品/活动项(V2 字段映射)- getGooglePayActivities / getApplePayActivities
|
||||
class ActivityItem {
|
||||
const ActivityItem({
|
||||
required this.code,
|
||||
required this.title,
|
||||
required this.credits,
|
||||
required this.actualAmount,
|
||||
this.originAmount,
|
||||
this.discountOff,
|
||||
this.bonus = 0,
|
||||
this.activityId,
|
||||
this.currency,
|
||||
});
|
||||
|
||||
final String code; // helm 产品代码
|
||||
final String title; // glossary 标题
|
||||
final int credits; // greaves 积分数
|
||||
final String actualAmount; // guardian 实际金额
|
||||
final String? originAmount; // curriculum 原价
|
||||
final String? discountOff; // lead 折扣
|
||||
final int bonus; // forge 赠送积分
|
||||
final String? activityId; // warrior 活动ID
|
||||
final String? currency; // familiar 货币
|
||||
|
||||
factory ActivityItem.fromJson(Map<String, dynamic> json) {
|
||||
return ActivityItem(
|
||||
code: json['helm']?.toString() ?? '',
|
||||
title: json['glossary']?.toString() ?? '',
|
||||
credits: (json['greaves'] as num?)?.toInt() ?? 0,
|
||||
actualAmount: json['guardian']?.toString() ?? '',
|
||||
originAmount: json['curriculum']?.toString(),
|
||||
discountOff: json['lead']?.toString(),
|
||||
bonus: (json['forge'] as num?)?.toInt() ?? 0,
|
||||
activityId: json['warrior']?.toString(),
|
||||
currency: json['familiar']?.toString(),
|
||||
);
|
||||
}
|
||||
|
||||
/// 显示积分文案,如 "100 Credits"
|
||||
String get creditsDisplay =>
|
||||
credits > 0 ? '${credits.toString().replaceAllMapped(RegExp(r'(\d{1,3})(?=(\d{3})+(?!\d))'), (m) => '${m[1]},')} Credits' : title;
|
||||
|
||||
/// 显示价格文案,如 "¥6" 或 "¥25 Save ¥5"
|
||||
String get priceDisplay {
|
||||
if (actualAmount.isEmpty) return '';
|
||||
if (discountOff != null && discountOff!.isNotEmpty) {
|
||||
return '$actualAmount $discountOff';
|
||||
}
|
||||
if (originAmount != null &&
|
||||
originAmount!.isNotEmpty &&
|
||||
originAmount != actualAmount) {
|
||||
final diff = _diffAmount(originAmount!, actualAmount);
|
||||
return diff.isNotEmpty ? '$actualAmount Save $diff' : actualAmount;
|
||||
}
|
||||
return actualAmount;
|
||||
}
|
||||
|
||||
String _diffAmount(String origin, String actual) {
|
||||
try {
|
||||
final o = double.tryParse(origin.replaceAll(RegExp(r'[^\d.]'), '')) ?? 0;
|
||||
final a = double.tryParse(actual.replaceAll(RegExp(r'[^\d.]'), '')) ?? 0;
|
||||
final d = (o - a).toStringAsFixed(0);
|
||||
final currencySymbol = RegExp(r'^[^\d]+').stringMatch(actual) ?? '';
|
||||
return '$currencySymbol$d';
|
||||
} catch (_) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,16 +1,88 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_lucide/flutter_lucide.dart';
|
||||
|
||||
import '../../core/api/services/payment_api.dart';
|
||||
import '../../core/auth/auth_service.dart';
|
||||
import '../../core/theme/app_colors.dart';
|
||||
import '../../core/user/user_state.dart';
|
||||
import '../../core/theme/app_spacing.dart';
|
||||
import '../../core/theme/app_typography.dart';
|
||||
import '../../shared/widgets/top_nav_bar.dart';
|
||||
|
||||
import 'models/activity_item.dart';
|
||||
|
||||
/// Recharge screen - matches Pencil tPjdN
|
||||
class RechargeScreen extends StatelessWidget {
|
||||
/// Tier cards (DC6NS, YRaOG, QlNz6) 对接 getGooglePayActivities / getApplePayActivities
|
||||
class RechargeScreen extends StatefulWidget {
|
||||
const RechargeScreen({super.key});
|
||||
|
||||
@override
|
||||
State<RechargeScreen> createState() => _RechargeScreenState();
|
||||
}
|
||||
|
||||
class _RechargeScreenState extends State<RechargeScreen> {
|
||||
List<ActivityItem> _activities = [];
|
||||
bool _loadingTiers = true;
|
||||
String? _tierError;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_fetchActivities();
|
||||
}
|
||||
|
||||
Future<void> _fetchActivities() async {
|
||||
setState(() {
|
||||
_loadingTiers = true;
|
||||
_tierError = null;
|
||||
});
|
||||
try {
|
||||
await AuthService.loginComplete;
|
||||
final country = UserState.navigate.value ?? '';
|
||||
|
||||
final res = defaultTargetPlatform == TargetPlatform.iOS
|
||||
? await PaymentApi.getApplePayActivities(
|
||||
vambrace: country.isEmpty ? null : country,
|
||||
)
|
||||
: await PaymentApi.getGooglePayActivities(
|
||||
vambrace: country.isEmpty ? null : country,
|
||||
);
|
||||
if (!mounted) return;
|
||||
if (res.isSuccess && res.data != null) {
|
||||
final data = res.data as Map<String, dynamic>?;
|
||||
final summon = data?['summon'] as List<dynamic>? ?? [];
|
||||
final list = summon
|
||||
.whereType<Map<String, dynamic>>()
|
||||
.map((e) => ActivityItem.fromJson(e))
|
||||
.where((e) => e.code.isNotEmpty)
|
||||
.toList();
|
||||
setState(() {
|
||||
_activities = list;
|
||||
_loadingTiers = false;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
_activities = [];
|
||||
_loadingTiers = false;
|
||||
_tierError = res.msg.isNotEmpty ? res.msg : 'Failed to load';
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_activities = [];
|
||||
_loadingTiers = false;
|
||||
_tierError = e.toString();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _onBuy(ActivityItem item) {
|
||||
// TODO: 创建支付订单
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@ -46,23 +118,70 @@ class RechargeScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
_TierCard(
|
||||
credits: '100 Credits',
|
||||
price: '¥6',
|
||||
onBuy: () {},
|
||||
),
|
||||
const SizedBox(height: AppSpacing.xl),
|
||||
_TierCardRecommended(
|
||||
credits: '500 Credits',
|
||||
price: '¥25 Save ¥5',
|
||||
onBuy: () {},
|
||||
),
|
||||
const SizedBox(height: AppSpacing.xl),
|
||||
_TierCardPopular(
|
||||
credits: '1,000 Credits',
|
||||
price: '¥45 Save ¥15',
|
||||
onBuy: () {},
|
||||
),
|
||||
if (_loadingTiers)
|
||||
const Padding(
|
||||
padding: EdgeInsets.all(AppSpacing.xxl),
|
||||
child: Center(
|
||||
child: SizedBox(
|
||||
width: 24,
|
||||
height: 24,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
),
|
||||
),
|
||||
)
|
||||
else if (_tierError != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: AppSpacing.screenPadding),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
_tierError!,
|
||||
style: AppTypography.bodyRegular.copyWith(
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: AppSpacing.md),
|
||||
TextButton(
|
||||
onPressed: _fetchActivities,
|
||||
child: const Text('Retry'),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
else if (_activities.isEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: AppSpacing.screenPadding),
|
||||
child: Text(
|
||||
'No packages available',
|
||||
style: AppTypography.bodyRegular.copyWith(
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
)
|
||||
else
|
||||
...List.generate(_activities.length, (i) {
|
||||
final item = _activities[i];
|
||||
final isRecommended = i == 1;
|
||||
final isPopular = i == 2;
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: i < _activities.length - 1
|
||||
? AppSpacing.xl
|
||||
: 0,
|
||||
),
|
||||
child: _TierCardFromActivity(
|
||||
item: item,
|
||||
badge: isRecommended
|
||||
? _TierBadge.recommended
|
||||
: isPopular
|
||||
? _TierBadge.popular
|
||||
: _TierBadge.none,
|
||||
onBuy: () => _onBuy(item),
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -70,6 +189,108 @@ class RechargeScreen extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
enum _TierBadge { none, recommended, popular }
|
||||
|
||||
class _TierCardFromActivity extends StatelessWidget {
|
||||
const _TierCardFromActivity({
|
||||
required this.item,
|
||||
required this.badge,
|
||||
required this.onBuy,
|
||||
});
|
||||
|
||||
final ActivityItem item;
|
||||
final _TierBadge badge;
|
||||
final VoidCallback onBuy;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final content = Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: AppSpacing.screenPadding),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: AppSpacing.xxl,
|
||||
vertical: AppSpacing.xl,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.surface,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: AppColors.border),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColors.shadowLight,
|
||||
blurRadius: 6,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
item.creditsDisplay,
|
||||
style: AppTypography.bodyLarge.copyWith(
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
SizedBox(height: badge == _TierBadge.none ? AppSpacing.xs : AppSpacing.sm),
|
||||
Text(
|
||||
item.priceDisplay,
|
||||
style: AppTypography.bodyRegular.copyWith(
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
_BuyButton(onTap: onBuy),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
if (badge == _TierBadge.none) {
|
||||
return content;
|
||||
}
|
||||
|
||||
return Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
content,
|
||||
Positioned(
|
||||
top: 0,
|
||||
right: AppSpacing.screenPadding,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: AppSpacing.md,
|
||||
vertical: AppSpacing.xs,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: badge == _TierBadge.recommended
|
||||
? AppColors.primaryLight
|
||||
: AppColors.accentOrangeLight,
|
||||
borderRadius: const BorderRadius.only(
|
||||
topRight: Radius.circular(16),
|
||||
bottomLeft: Radius.circular(16),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
badge == _TierBadge.recommended
|
||||
? 'Recommended'
|
||||
: 'Most Popular',
|
||||
style: AppTypography.label.copyWith(
|
||||
color: badge == _TierBadge.recommended
|
||||
? AppColors.primary
|
||||
: AppColors.accentOrange,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _CreditsSection extends StatelessWidget {
|
||||
const _CreditsSection({required this.currentCredits});
|
||||
|
||||
@ -122,243 +343,6 @@ class _CreditsSection extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class _TierCard extends StatelessWidget {
|
||||
const _TierCard({
|
||||
required this.credits,
|
||||
required this.price,
|
||||
required this.onBuy,
|
||||
});
|
||||
|
||||
final String credits;
|
||||
final String price;
|
||||
final VoidCallback onBuy;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: AppSpacing.screenPadding),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: AppSpacing.xxl,
|
||||
vertical: AppSpacing.xl,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.surface,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: AppColors.border),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColors.shadowLight,
|
||||
blurRadius: 6,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
credits,
|
||||
style: AppTypography.bodyLarge.copyWith(
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: AppSpacing.xs),
|
||||
Text(
|
||||
price,
|
||||
style: AppTypography.bodyRegular.copyWith(
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
_BuyButton(onTap: onBuy),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _TierCardRecommended extends StatelessWidget {
|
||||
const _TierCardRecommended({
|
||||
required this.credits,
|
||||
required this.price,
|
||||
required this.onBuy,
|
||||
});
|
||||
|
||||
final String credits;
|
||||
final String price;
|
||||
final VoidCallback onBuy;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Container(
|
||||
margin:
|
||||
const EdgeInsets.symmetric(horizontal: AppSpacing.screenPadding),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: AppSpacing.xxl,
|
||||
vertical: AppSpacing.xl,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.surface,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: AppColors.border),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColors.shadowLight,
|
||||
blurRadius: 6,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
credits,
|
||||
style: AppTypography.bodyLarge.copyWith(
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: AppSpacing.sm),
|
||||
Text(
|
||||
price,
|
||||
style: AppTypography.bodyRegular.copyWith(
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
_BuyButton(onTap: onBuy),
|
||||
],
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 0,
|
||||
right: AppSpacing.screenPadding,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: AppSpacing.md,
|
||||
vertical: AppSpacing.xs,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.primaryLight,
|
||||
borderRadius: const BorderRadius.only(
|
||||
topRight: Radius.circular(16),
|
||||
bottomLeft: Radius.circular(16),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
'Recommended',
|
||||
style: AppTypography.label.copyWith(
|
||||
color: AppColors.primary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _TierCardPopular extends StatelessWidget {
|
||||
const _TierCardPopular({
|
||||
required this.credits,
|
||||
required this.price,
|
||||
required this.onBuy,
|
||||
});
|
||||
|
||||
final String credits;
|
||||
final String price;
|
||||
final VoidCallback onBuy;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Container(
|
||||
margin:
|
||||
const EdgeInsets.symmetric(horizontal: AppSpacing.screenPadding),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: AppSpacing.xxl,
|
||||
vertical: AppSpacing.xl,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.surface,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: AppColors.border),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColors.shadowLight,
|
||||
blurRadius: 6,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
credits,
|
||||
style: AppTypography.bodyLarge.copyWith(
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: AppSpacing.sm),
|
||||
Text(
|
||||
price,
|
||||
style: AppTypography.bodyRegular.copyWith(
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
_BuyButton(onTap: onBuy),
|
||||
],
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 0,
|
||||
right: AppSpacing.screenPadding,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: AppSpacing.md,
|
||||
vertical: AppSpacing.xs,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.accentOrangeLight,
|
||||
borderRadius: const BorderRadius.only(
|
||||
topRight: Radius.circular(16),
|
||||
bottomLeft: Radius.circular(16),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
'Most Popular',
|
||||
style: AppTypography.label.copyWith(
|
||||
color: AppColors.accentOrange,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _BuyButton extends StatelessWidget {
|
||||
const _BuyButton({required this.onTap});
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ environment:
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
adjust_sdk: ^5.5.0
|
||||
adjust_sdk: ^5.5.1
|
||||
cupertino_icons: ^1.0.6
|
||||
play_install_referrer: ^0.5.0
|
||||
flutter_lucide: ^1.8.2
|
||||
@ -30,6 +30,13 @@ dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
flutter_lints: ^3.0.0
|
||||
flutter_launcher_icons: ^0.14.4
|
||||
|
||||
flutter_launcher_icons:
|
||||
android: true
|
||||
ios: true
|
||||
image_path: "design/images/generated-1773069485332.png"
|
||||
remove_alpha_ios: true
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
||||