feat(app): 完成 P0 钱包解锁、下载落盘与手机号登录
This commit is contained in:
1 parent
de941c841c
commit
136ee74618
47 files changed
+3264
-70
No files matched your search
@@ -13,6 +13,7 @@ import '../../core/data/repositories/watch_history_repository.dart';
|
||||
import '../../core/data/services/auth_controller.dart';
|
||||
import '../../core/data/services/favorite_controller.dart';
|
||||
import '../../core/data/services/interaction_controller.dart';
|
||||
import '../../core/data/services/wallet_controller.dart';
|
||||
import '../../core/formatting/error_text.dart';
|
||||
import '../../core/formatting/localized_content.dart';
|
||||
import '../../core/theme/app_colors.dart';
|
||||
@@ -25,6 +26,7 @@ import '../account/account_entry_card.dart';
|
||||
import '../downloads/downloads_page.dart';
|
||||
import '../favorites/favorites_page.dart';
|
||||
import '../notices/notices_page.dart';
|
||||
import '../wallet/wallet_page.dart';
|
||||
import '../watch_records/watch_records_page.dart';
|
||||
import 'mine_binding.dart';
|
||||
import 'mine_logic.dart';
|
||||
@@ -46,6 +48,7 @@ class MyPage extends StatefulWidget {
|
||||
this.onSignOut,
|
||||
this.dramas,
|
||||
this.onDramaSelected,
|
||||
this.wallet,
|
||||
this.debugShowSetting = kDebugMode,
|
||||
});
|
||||
|
||||
@@ -63,6 +66,7 @@ class MyPage extends StatefulWidget {
|
||||
final VoidCallback? onSignOut;
|
||||
final List<Drama>? dramas;
|
||||
final ValueChanged<Drama>? onDramaSelected;
|
||||
final WalletController? wallet;
|
||||
final bool debugShowSetting;
|
||||
|
||||
@override
|
||||
@@ -308,9 +312,21 @@ class _MyPageState extends State<MyPage> {
|
||||
}
|
||||
|
||||
Widget _wallet(AppLocalizations l10n) {
|
||||
final wallet = widget.wallet;
|
||||
if (wallet == null) return _walletCard(l10n, null);
|
||||
return ListenableBuilder(
|
||||
listenable: wallet,
|
||||
builder: (context, _) => _walletCard(l10n, wallet),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _walletCard(AppLocalizations l10n, WalletController? wallet) {
|
||||
final value = wallet == null
|
||||
? l10n.coins
|
||||
: l10n.walletBalanceShort(wallet.balance);
|
||||
return InkWell(
|
||||
key: const Key('mine-wallet'),
|
||||
onTap: () => _mockSnack(l10n),
|
||||
onTap: () => _openWallet(context),
|
||||
borderRadius: BorderRadius.circular(13),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
@@ -340,7 +356,7 @@ class _MyPageState extends State<MyPage> {
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
'0 ${l10n.coins} · ${l10n.topUpWallet}',
|
||||
widget.signedIn ? value : l10n.logInHint,
|
||||
style: const TextStyle(
|
||||
color: AppColors.accent,
|
||||
fontSize: 9,
|
||||
@@ -360,6 +376,16 @@ class _MyPageState extends State<MyPage> {
|
||||
);
|
||||
}
|
||||
|
||||
void _openWallet(BuildContext context) {
|
||||
if (!widget.signedIn) {
|
||||
widget.onSignIn?.call();
|
||||
return;
|
||||
}
|
||||
Navigator.of(
|
||||
context,
|
||||
).push(MaterialPageRoute<void>(builder: (_) => const WalletPage()));
|
||||
}
|
||||
|
||||
WatchProgress? get _continueRecord {
|
||||
for (final record in logic.recent) {
|
||||
if (!record.finished && record.hasPosition) return record;
|
||||
@@ -934,12 +960,6 @@ class _MyPageState extends State<MyPage> {
|
||||
}
|
||||
}
|
||||
|
||||
void _mockSnack(AppLocalizations l10n) {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(l10n.mockNotice)));
|
||||
}
|
||||
|
||||
Widget _poster(
|
||||
Drama drama, {
|
||||
required double width,
|
||||
|
||||
Reference in new issue
Block a user