2026-05-25 12:58:29 +08:00
|
|
|
|
import 'package:flutter/material.dart';
|
2026-09-01 08:59:20 +08:00
|
|
|
|
import 'package:flutter/services.dart';
|
2026-05-25 12:58:29 +08:00
|
|
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
|
|
|
|
import 'package:get_it/get_it.dart';
|
|
|
|
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
|
|
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
|
|
|
|
|
import 'package:maibu_satabot_v2/core/localization/locale_cubit.dart';
|
2026-10-12 14:21:09 +08:00
|
|
|
|
import 'package:maibu_satabot_v2/components/language_selection_dialog.dart';
|
2026-05-25 12:58:29 +08:00
|
|
|
|
import 'package:maibu_satabot_v2/core/router/route_paths.dart';
|
2026-08-18 08:52:33 +08:00
|
|
|
|
import 'package:maibu_satabot_v2/core/theme/AppTheme.dart';
|
2026-05-25 12:58:29 +08:00
|
|
|
|
import 'package:maibu_satabot_v2/core/storage/user_storage.dart';
|
|
|
|
|
|
import 'package:maibu_satabot_v2/features/auth/presentation/bloc/auth_cubit.dart';
|
|
|
|
|
|
import 'package:maibu_satabot_v2/features/main_container/presentation/cubit/tab_config_cubit.dart';
|
2026-09-14 12:35:20 +08:00
|
|
|
|
import 'package:maibu_satabot_v2/features/main_container/domain/tab_config.dart';
|
|
|
|
|
|
import 'package:maibu_satabot_v2/core/app/app_user_cubit.dart';
|
2026-07-02 16:04:30 +08:00
|
|
|
|
import 'package:maibu_satabot_v2/features/v2/device_list/presentation/float_bar/cubit/float_bar_setting_cubit.dart';
|
2026-09-01 08:59:20 +08:00
|
|
|
|
import 'package:maibu_satabot_v2/core/update/update_cubit.dart';
|
|
|
|
|
|
import 'package:maibu_satabot_v2/core/update/update_state.dart';
|
2026-05-25 12:58:29 +08:00
|
|
|
|
|
|
|
|
|
|
/// 系统设置综合页面
|
|
|
|
|
|
class SystemSettingsPage extends StatefulWidget {
|
|
|
|
|
|
const SystemSettingsPage({super.key});
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
State<SystemSettingsPage> createState() => _SystemSettingsPageState();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class _SystemSettingsPageState extends State<SystemSettingsPage> {
|
2026-09-01 08:59:20 +08:00
|
|
|
|
String _currentVersion = '';
|
|
|
|
|
|
int _currentVersionCode = 0;
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
void initState() {
|
|
|
|
|
|
super.initState();
|
|
|
|
|
|
_loadVersion();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> _loadVersion() async {
|
|
|
|
|
|
try {
|
|
|
|
|
|
final String versionString = await rootBundle.loadString('pubspec.yaml');
|
|
|
|
|
|
final versionMatch = RegExp(r'version:\s*(\d+\.\d+\.\d+)\+(\d+)').firstMatch(versionString);
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
_currentVersion = versionMatch?.group(1) ?? '1.0.0';
|
|
|
|
|
|
_currentVersionCode = int.tryParse(versionMatch?.group(2) ?? '1') ?? 1;
|
|
|
|
|
|
});
|
|
|
|
|
|
} catch (_) {}
|
|
|
|
|
|
}
|
2026-05-25 12:58:29 +08:00
|
|
|
|
@override
|
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
return Scaffold(
|
2026-08-18 08:52:33 +08:00
|
|
|
|
backgroundColor: context.appColors.pageBackground,
|
2026-05-25 12:58:29 +08:00
|
|
|
|
appBar: AppBar(
|
|
|
|
|
|
elevation: 0,
|
|
|
|
|
|
leading: IconButton(
|
2026-08-18 08:52:33 +08:00
|
|
|
|
icon: Icon(Icons.arrow_back, color: context.appColors.textPrimary),
|
2026-05-25 12:58:29 +08:00
|
|
|
|
onPressed: () => Navigator.pop(context),
|
|
|
|
|
|
),
|
|
|
|
|
|
title: Text(
|
|
|
|
|
|
AppLocalizations.of(context).translate('my.settings'),
|
2026-08-18 08:52:33 +08:00
|
|
|
|
style: TextStyle(
|
2026-05-25 12:58:29 +08:00
|
|
|
|
fontSize: 18,
|
|
|
|
|
|
fontWeight: FontWeight.bold,
|
2026-08-18 08:52:33 +08:00
|
|
|
|
color: context.appColors.textPrimary,
|
2026-05-25 12:58:29 +08:00
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
centerTitle: true,
|
|
|
|
|
|
),
|
|
|
|
|
|
body: ListView(
|
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
|
children: [
|
|
|
|
|
|
// Tab 设置
|
|
|
|
|
|
_buildTabSettingsSection(),
|
|
|
|
|
|
const SizedBox(height: 12),
|
2026-07-02 16:04:30 +08:00
|
|
|
|
// 悬浮条设置
|
|
|
|
|
|
_buildFloatBarSection(),
|
|
|
|
|
|
const SizedBox(height: 12),
|
2026-05-25 12:58:29 +08:00
|
|
|
|
// 语言设置
|
|
|
|
|
|
_buildLanguageSection(),
|
|
|
|
|
|
const SizedBox(height: 12),
|
2026-09-01 08:59:20 +08:00
|
|
|
|
// 版本更新
|
|
|
|
|
|
_buildUpdateSection(),
|
|
|
|
|
|
const SizedBox(height: 12),
|
2026-09-10 09:02:23 +08:00
|
|
|
|
// 退出登录(已挪至“我的”页面最下边,此处注释掉)
|
|
|
|
|
|
// _buildLogoutButton(context),
|
|
|
|
|
|
// const SizedBox(height: 20),
|
2026-05-25 12:58:29 +08:00
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-02 16:04:30 +08:00
|
|
|
|
/// 悬浮条设置
|
|
|
|
|
|
Widget _buildFloatBarSection() {
|
|
|
|
|
|
return Container(
|
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
|
decoration: BoxDecoration(
|
2026-08-18 08:52:33 +08:00
|
|
|
|
color: context.appColors.cardBackground,
|
2026-07-02 16:04:30 +08:00
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
2026-08-18 08:52:33 +08:00
|
|
|
|
boxShadow: [
|
2026-07-02 16:04:30 +08:00
|
|
|
|
BoxShadow(
|
2026-08-18 08:52:33 +08:00
|
|
|
|
color: context.appColors.cardShadow,
|
2026-07-02 16:04:30 +08:00
|
|
|
|
blurRadius: 8,
|
|
|
|
|
|
offset: Offset(0, 2),
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
child: Row(
|
|
|
|
|
|
children: [
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
children: [
|
|
|
|
|
|
Text(
|
|
|
|
|
|
AppLocalizations.of(context).translate('my_v2.suspend_bar'),
|
2026-08-18 08:52:33 +08:00
|
|
|
|
style: TextStyle(
|
2026-07-02 16:04:30 +08:00
|
|
|
|
fontSize: 16,
|
|
|
|
|
|
fontWeight: FontWeight.bold,
|
2026-08-18 08:52:33 +08:00
|
|
|
|
color: context.appColors.textPrimary,
|
2026-07-02 16:04:30 +08:00
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
const SizedBox(height: 4),
|
|
|
|
|
|
Text(
|
|
|
|
|
|
AppLocalizations.of(
|
|
|
|
|
|
context,
|
|
|
|
|
|
).translate('my_v2.suspend_bar_desc'),
|
2026-08-18 08:52:33 +08:00
|
|
|
|
style: TextStyle(
|
2026-07-02 16:04:30 +08:00
|
|
|
|
fontSize: 13,
|
2026-08-18 08:52:33 +08:00
|
|
|
|
color: context.appColors.textTertiary,
|
2026-07-02 16:04:30 +08:00
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
ValueListenableBuilder<bool>(
|
|
|
|
|
|
valueListenable: FloatBarSettingService.settingNotifier,
|
|
|
|
|
|
builder: (context, isEnabled, child) {
|
|
|
|
|
|
return Switch(
|
|
|
|
|
|
value: isEnabled,
|
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
|
FloatBarSettingService.setEnabled(value);
|
|
|
|
|
|
},
|
|
|
|
|
|
activeColor: const Color(0xFF165DFF),
|
|
|
|
|
|
);
|
|
|
|
|
|
},
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-25 12:58:29 +08:00
|
|
|
|
/// Tab 设置
|
|
|
|
|
|
Widget _buildTabSettingsSection() {
|
2026-09-14 12:35:20 +08:00
|
|
|
|
// 🔥 个人角色(roleKey == 'personal'):Tab 设置只列出「设备 + 我的」,且开关常开锁定
|
|
|
|
|
|
final roleKey = context.watch<AppUserCubit>().state.user?.roleKey;
|
|
|
|
|
|
final isPersonal = roleKey == TabConfig.personalRoleKey;
|
2026-05-25 12:58:29 +08:00
|
|
|
|
return Container(
|
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
|
decoration: BoxDecoration(
|
2026-08-18 08:52:33 +08:00
|
|
|
|
color: context.appColors.cardBackground,
|
2026-05-25 12:58:29 +08:00
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
2026-08-18 08:52:33 +08:00
|
|
|
|
boxShadow: [
|
2026-05-25 12:58:29 +08:00
|
|
|
|
BoxShadow(
|
2026-08-18 08:52:33 +08:00
|
|
|
|
color: context.appColors.cardShadow,
|
2026-05-25 12:58:29 +08:00
|
|
|
|
blurRadius: 8,
|
|
|
|
|
|
offset: Offset(0, 2),
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
children: [
|
2026-07-02 16:04:30 +08:00
|
|
|
|
Text(
|
|
|
|
|
|
AppLocalizations.of(context).translate('my_v2.tab_settings'),
|
2026-08-18 08:52:33 +08:00
|
|
|
|
style: TextStyle(
|
2026-05-25 12:58:29 +08:00
|
|
|
|
fontSize: 16,
|
|
|
|
|
|
fontWeight: FontWeight.bold,
|
2026-08-18 08:52:33 +08:00
|
|
|
|
color: context.appColors.textPrimary,
|
2026-05-25 12:58:29 +08:00
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
const SizedBox(height: 16),
|
|
|
|
|
|
BlocBuilder<TabConfigCubit, dynamic>(
|
|
|
|
|
|
builder: (context, state) {
|
|
|
|
|
|
if (state.runtimeType.toString() != 'TabConfigLoaded') {
|
|
|
|
|
|
return const Center(child: CircularProgressIndicator());
|
|
|
|
|
|
}
|
2026-07-02 16:04:30 +08:00
|
|
|
|
|
2026-09-14 12:35:20 +08:00
|
|
|
|
final tabs = state.config.settingItemsForRole(roleKey);
|
2026-07-02 16:04:30 +08:00
|
|
|
|
|
2026-05-25 12:58:29 +08:00
|
|
|
|
return ListView.builder(
|
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
|
itemCount: tabs.length,
|
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
|
final tab = tabs[index];
|
|
|
|
|
|
return Padding(
|
|
|
|
|
|
padding: const EdgeInsets.only(bottom: 12),
|
|
|
|
|
|
child: Row(
|
|
|
|
|
|
children: [
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
child: Text(
|
2026-10-12 14:21:09 +08:00
|
|
|
|
// 按当前语言显示 Tab 名
|
|
|
|
|
|
Localizations.localeOf(context).languageCode == 'en'
|
|
|
|
|
|
? tab.nameEn
|
|
|
|
|
|
: tab.name,
|
2026-08-18 08:52:33 +08:00
|
|
|
|
style: TextStyle(
|
2026-05-25 12:58:29 +08:00
|
|
|
|
fontSize: 14,
|
2026-08-18 08:52:33 +08:00
|
|
|
|
color: context.appColors.textPrimary,
|
2026-05-25 12:58:29 +08:00
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
Switch(
|
2026-09-14 12:35:20 +08:00
|
|
|
|
// 个人角色:设备/我的 强制常开且不可关闭
|
|
|
|
|
|
value: isPersonal ? true : tab.isEnabled,
|
|
|
|
|
|
onChanged: isPersonal
|
|
|
|
|
|
? null
|
|
|
|
|
|
: (value) {
|
|
|
|
|
|
context.read<TabConfigCubit>().toggleTab(tab.id);
|
|
|
|
|
|
},
|
2026-05-25 12:58:29 +08:00
|
|
|
|
activeColor: const Color(0xFF165DFF),
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
},
|
|
|
|
|
|
);
|
|
|
|
|
|
},
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// 语言设置
|
|
|
|
|
|
Widget _buildLanguageSection() {
|
|
|
|
|
|
return Container(
|
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
|
decoration: BoxDecoration(
|
2026-08-18 08:52:33 +08:00
|
|
|
|
color: context.appColors.cardBackground,
|
2026-05-25 12:58:29 +08:00
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
2026-08-18 08:52:33 +08:00
|
|
|
|
boxShadow: [
|
2026-05-25 12:58:29 +08:00
|
|
|
|
BoxShadow(
|
2026-08-18 08:52:33 +08:00
|
|
|
|
color: context.appColors.cardShadow,
|
2026-05-25 12:58:29 +08:00
|
|
|
|
blurRadius: 8,
|
|
|
|
|
|
offset: Offset(0, 2),
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
children: [
|
|
|
|
|
|
Text(
|
|
|
|
|
|
AppLocalizations.of(context).translate('my.language'),
|
2026-08-18 08:52:33 +08:00
|
|
|
|
style: TextStyle(
|
2026-05-25 12:58:29 +08:00
|
|
|
|
fontSize: 16,
|
|
|
|
|
|
fontWeight: FontWeight.bold,
|
2026-08-18 08:52:33 +08:00
|
|
|
|
color: context.appColors.textPrimary,
|
2026-05-25 12:58:29 +08:00
|
|
|
|
),
|
|
|
|
|
|
),
|
2026-10-12 14:21:09 +08:00
|
|
|
|
const SizedBox(height: 12),
|
|
|
|
|
|
// 统一复用语言选择弹窗,只需选一个入口维护语言列表
|
2026-05-25 12:58:29 +08:00
|
|
|
|
BlocBuilder<LocaleCubit, Locale>(
|
|
|
|
|
|
builder: (context, locale) {
|
2026-10-12 14:21:09 +08:00
|
|
|
|
return GestureDetector(
|
|
|
|
|
|
behavior: HitTestBehavior.opaque,
|
|
|
|
|
|
onTap: () => showDialog(
|
|
|
|
|
|
context: context,
|
|
|
|
|
|
builder: (_) => const LanguageSelectionDialog(mandatory: false),
|
|
|
|
|
|
),
|
|
|
|
|
|
child: Row(
|
|
|
|
|
|
children: [
|
|
|
|
|
|
Icon(
|
|
|
|
|
|
Icons.language,
|
|
|
|
|
|
size: 20,
|
|
|
|
|
|
color: context.appColors.textSecondary,
|
2026-07-02 16:04:30 +08:00
|
|
|
|
),
|
2026-10-12 14:21:09 +08:00
|
|
|
|
const SizedBox(width: 8),
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
AppLanguages.instance.nameOf(locale),
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
|
color: context.appColors.textPrimary,
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
2026-07-02 16:04:30 +08:00
|
|
|
|
),
|
2026-10-12 14:21:09 +08:00
|
|
|
|
Icon(
|
|
|
|
|
|
Icons.arrow_forward_ios,
|
|
|
|
|
|
size: 16,
|
|
|
|
|
|
color: context.appColors.textTertiary,
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
2026-05-25 12:58:29 +08:00
|
|
|
|
);
|
|
|
|
|
|
},
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-09-01 08:59:20 +08:00
|
|
|
|
/// 版本更新
|
|
|
|
|
|
Widget _buildUpdateSection() {
|
|
|
|
|
|
return Container(
|
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
color: context.appColors.cardBackground,
|
|
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
|
|
boxShadow: [
|
|
|
|
|
|
BoxShadow(
|
|
|
|
|
|
color: context.appColors.cardShadow,
|
|
|
|
|
|
blurRadius: 8,
|
|
|
|
|
|
offset: Offset(0, 2),
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
child: BlocConsumer<UpdateCubit, UpdateState>(
|
|
|
|
|
|
listener: (context, state) {
|
|
|
|
|
|
if (state is UpdateUpToDate) {
|
|
|
|
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
|
|
|
|
SnackBar(
|
|
|
|
|
|
content: const Text('当前已是最新版本'),
|
|
|
|
|
|
backgroundColor: context.appColors.success,
|
|
|
|
|
|
duration: const Duration(seconds: 2),
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
builder: (context, state) {
|
|
|
|
|
|
final isChecking = state is UpdateChecking;
|
|
|
|
|
|
return Row(
|
|
|
|
|
|
children: [
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
children: [
|
|
|
|
|
|
Text(
|
|
|
|
|
|
'版本更新',
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
|
color: context.appColors.textPrimary,
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
const SizedBox(height: 4),
|
|
|
|
|
|
Text(
|
|
|
|
|
|
'当前版本: $_currentVersion ($_currentVersionCode)',
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
fontSize: 13,
|
|
|
|
|
|
color: context.appColors.textTertiary,
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
const SizedBox(height: 2),
|
|
|
|
|
|
Text(
|
|
|
|
|
|
isChecking ? '正在检查更新...' : '点击检查是否有新版本',
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
fontSize: 13,
|
|
|
|
|
|
color: context.appColors.textTertiary,
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
if (isChecking)
|
|
|
|
|
|
const SizedBox(
|
|
|
|
|
|
width: 24,
|
|
|
|
|
|
height: 24,
|
|
|
|
|
|
child: CircularProgressIndicator(strokeWidth: 2),
|
|
|
|
|
|
)
|
|
|
|
|
|
else
|
|
|
|
|
|
GestureDetector(
|
|
|
|
|
|
onTap: () {
|
|
|
|
|
|
context.read<UpdateCubit>().checkUpdate();
|
|
|
|
|
|
},
|
|
|
|
|
|
child: Container(
|
|
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
|
|
horizontal: 16,
|
|
|
|
|
|
vertical: 8,
|
|
|
|
|
|
),
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
color: const Color(0xFF165DFF),
|
|
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
|
|
),
|
|
|
|
|
|
child: const Text(
|
|
|
|
|
|
'检查更新',
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
);
|
|
|
|
|
|
},
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-09-10 09:02:23 +08:00
|
|
|
|
/// 退出登录按钮(已挪至“我的”页面最下边,此处注释掉)
|
|
|
|
|
|
// Widget _buildLogoutButton(BuildContext context) {
|
|
|
|
|
|
// return GestureDetector(
|
|
|
|
|
|
// onTap: () {
|
|
|
|
|
|
// _showLogoutDialog(context);
|
|
|
|
|
|
// },
|
|
|
|
|
|
// child: Container(
|
|
|
|
|
|
// padding: const EdgeInsets.symmetric(vertical: 16),
|
|
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
|
|
// color: context.appColors.cardBackground,
|
|
|
|
|
|
// borderRadius: BorderRadius.circular(12),
|
|
|
|
|
|
// boxShadow: [
|
|
|
|
|
|
// BoxShadow(
|
|
|
|
|
|
// color: context.appColors.cardShadow,
|
|
|
|
|
|
// blurRadius: 8,
|
|
|
|
|
|
// offset: Offset(0, 2),
|
|
|
|
|
|
// ),
|
|
|
|
|
|
// ],
|
|
|
|
|
|
// ),
|
|
|
|
|
|
// child: Center(
|
|
|
|
|
|
// child: Text(
|
|
|
|
|
|
// AppLocalizations.of(context).translate('login.logout'),
|
|
|
|
|
|
// style: const TextStyle(
|
|
|
|
|
|
// fontSize: 16,
|
|
|
|
|
|
// fontWeight: FontWeight.w500,
|
|
|
|
|
|
// color: Color(0xFFF53F3F),
|
|
|
|
|
|
// ),
|
|
|
|
|
|
// ),
|
|
|
|
|
|
// ),
|
|
|
|
|
|
// ),
|
|
|
|
|
|
// );
|
|
|
|
|
|
// }
|
2026-05-25 12:58:29 +08:00
|
|
|
|
|
2026-09-10 09:02:23 +08:00
|
|
|
|
/// 显示退出登录确认对话框(已挪至“我的”页面最下边,此处注释掉)
|
|
|
|
|
|
// void _showLogoutDialog(BuildContext context) {
|
|
|
|
|
|
// showDialog(
|
|
|
|
|
|
// context: context,
|
|
|
|
|
|
// builder: (context) => AlertDialog(
|
|
|
|
|
|
// title: Text(AppLocalizations.of(context).translate('login.logout')),
|
|
|
|
|
|
// content: Text(
|
|
|
|
|
|
// AppLocalizations.of(context).translate('login.confirm_logout'),
|
|
|
|
|
|
// ),
|
|
|
|
|
|
// actions: [
|
|
|
|
|
|
// TextButton(
|
|
|
|
|
|
// onPressed: () => Navigator.pop(context),
|
|
|
|
|
|
// child: Text(AppLocalizations.of(context).translate('my_v2.cancel')),
|
|
|
|
|
|
// ),
|
|
|
|
|
|
// TextButton(
|
|
|
|
|
|
// onPressed: () async {
|
|
|
|
|
|
// Navigator.pop(context);
|
|
|
|
|
|
// // 执行退出登录逻辑
|
|
|
|
|
|
// await GetIt.I<UserStorage>().deleteUser();
|
|
|
|
|
|
// GetIt.I<AuthCubit>().logout();
|
|
|
|
|
|
// context.go(RoutePaths.login);
|
|
|
|
|
|
// },
|
|
|
|
|
|
// style: TextButton.styleFrom(
|
|
|
|
|
|
// foregroundColor: const Color(0xFFF53F3F),
|
|
|
|
|
|
// ),
|
|
|
|
|
|
// child: Text(
|
|
|
|
|
|
// AppLocalizations.of(context).translate('my_v2.confirm'),
|
|
|
|
|
|
// ),
|
|
|
|
|
|
// ),
|
|
|
|
|
|
// ],
|
|
|
|
|
|
// ),
|
|
|
|
|
|
// );
|
|
|
|
|
|
// }
|
2026-05-25 12:58:29 +08:00
|
|
|
|
}
|