0417 0022
更新
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -8,6 +7,7 @@ import 'package:dio/dio.dart';
|
||||
|
||||
import '../../model/user_model.dart';
|
||||
import '../../providers/user_provider.dart';
|
||||
import '../../service/sega_service.dart';
|
||||
import 'login_page.dart';
|
||||
|
||||
class UserPage extends StatefulWidget {
|
||||
@@ -27,12 +27,10 @@ class _UserPageState extends State<UserPage> {
|
||||
final _lxKeyController = TextEditingController();
|
||||
static const _pinkColor = Color(0xFFFFC0D6);
|
||||
|
||||
// 开关状态
|
||||
bool _isDisagreeRecommend = false;
|
||||
bool _isDisagreeFriend = false;
|
||||
Map<String, dynamic>? _radarData;
|
||||
|
||||
// 获取雷达图方法
|
||||
Future<void> _loadRadarData() async {
|
||||
final provider = Provider.of<UserProvider>(context, listen: false);
|
||||
try {
|
||||
@@ -53,10 +51,11 @@ class _UserPageState extends State<UserPage> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_loadRadarData;
|
||||
super.initState();
|
||||
_loadRadarData();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
final provider = Provider.of<UserProvider>(context, listen: false);
|
||||
provider.fetchSexTags();
|
||||
@@ -75,7 +74,6 @@ class _UserPageState extends State<UserPage> {
|
||||
_dfPwdController.text = user?.dfPassword ?? '';
|
||||
_lxKeyController.text = user?.lxKey ?? '';
|
||||
|
||||
// 初始化开关
|
||||
_isDisagreeRecommend = user?.isDisagreeRecommend ?? false;
|
||||
_isDisagreeFriend = user?.isDisagreeFriend ?? false;
|
||||
}
|
||||
@@ -92,7 +90,6 @@ class _UserPageState extends State<UserPage> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
// 2. 添加打开链接的方法
|
||||
Future<void> _launchURL(String urlString) async {
|
||||
final Uri url = Uri.parse(urlString);
|
||||
if (!await launchUrl(url, mode: LaunchMode.externalApplication)) {
|
||||
@@ -108,7 +105,6 @@ class _UserPageState extends State<UserPage> {
|
||||
final username = _dfUserController.text.trim();
|
||||
final password = _dfPwdController.text.trim();
|
||||
|
||||
// 1. 判空校验
|
||||
if (username.isEmpty || password.isEmpty) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text("请输入水鱼用户名和密码")),
|
||||
@@ -116,7 +112,6 @@ class _UserPageState extends State<UserPage> {
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. 显示加载提示
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
@@ -127,7 +122,6 @@ class _UserPageState extends State<UserPage> {
|
||||
}
|
||||
|
||||
try {
|
||||
// 3. 创建Dio实例,发送POST请求
|
||||
final dio = Dio();
|
||||
final response = await dio.post(
|
||||
'https://maimai.diving-fish.com/api/maimaidxprober/login',
|
||||
@@ -135,18 +129,15 @@ class _UserPageState extends State<UserPage> {
|
||||
"username": username,
|
||||
"password": password,
|
||||
},
|
||||
// 可选:设置请求超时
|
||||
options: Options(
|
||||
sendTimeout: const Duration(seconds: 10),
|
||||
receiveTimeout: const Duration(seconds: 10),
|
||||
),
|
||||
);
|
||||
|
||||
// 4. 解析返回结果
|
||||
final Map<String, dynamic> result = response.data;
|
||||
|
||||
if (mounted) {
|
||||
// 登录成功
|
||||
if (result['message'] == "登录成功") {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
@@ -155,9 +146,7 @@ class _UserPageState extends State<UserPage> {
|
||||
duration: Duration(seconds: 1),
|
||||
),
|
||||
);
|
||||
// TODO: 验证成功后的逻辑(保存信息、跳转页面等)
|
||||
} else {
|
||||
// 账号密码错误
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(result['message'] ?? "验证失败"),
|
||||
@@ -168,7 +157,6 @@ class _UserPageState extends State<UserPage> {
|
||||
}
|
||||
}
|
||||
} on DioException catch (e) {
|
||||
// 5. Dio网络错误处理(无网络、超时、服务器异常)
|
||||
if (mounted) {
|
||||
String errorMsg = "网络请求失败";
|
||||
if (e.type == DioExceptionType.connectionTimeout) {
|
||||
@@ -187,14 +175,12 @@ class _UserPageState extends State<UserPage> {
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
// 其他未知错误
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text("未知错误,请重试"),
|
||||
backgroundColor: Colors.red,
|
||||
duration: Duration(seconds: 1),
|
||||
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -213,8 +199,6 @@ class _UserPageState extends State<UserPage> {
|
||||
|
||||
try {
|
||||
final dio = Dio();
|
||||
|
||||
// 发起请求
|
||||
final response = await dio.get(
|
||||
'https://maimai.lxns.net/api/v0/user/maimai/player',
|
||||
options: Options(
|
||||
@@ -224,7 +208,6 @@ class _UserPageState extends State<UserPage> {
|
||||
),
|
||||
);
|
||||
|
||||
// ✅ 关键:解析外层响应 + 内层 data
|
||||
final result = LuoxueResponse.fromJson(response.data);
|
||||
|
||||
if (result.success && mounted) {
|
||||
@@ -233,12 +216,6 @@ class _UserPageState extends State<UserPage> {
|
||||
content: Text("✅ 验证成功!玩家:${result.data.name}\nDX Rating:${result.data.rating}"),
|
||||
),
|
||||
);
|
||||
|
||||
// 在这里可以使用完整的玩家数据
|
||||
// result.data.name
|
||||
// result.data.rating
|
||||
// result.data.friendCode
|
||||
// result.data.trophy.name
|
||||
}
|
||||
} on DioException catch (e) {
|
||||
String msg = "验证失败";
|
||||
@@ -303,6 +280,288 @@ class _UserPageState extends State<UserPage> {
|
||||
);
|
||||
}
|
||||
|
||||
void _showSyncProgressDialog(BuildContext context, ValueNotifier<String> status) {
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: ValueListenableBuilder<String>(
|
||||
valueListenable: status,
|
||||
builder: (_, text, __) {
|
||||
return Row(
|
||||
children: [
|
||||
const CircularProgressIndicator(),
|
||||
const SizedBox(width: 20),
|
||||
Expanded(child: Text(text)),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _verifyBoundSega(SegaCard card) async {
|
||||
final segaId = card.segaId;
|
||||
final pwd = card.password;
|
||||
final type = card.type;
|
||||
|
||||
if (segaId == null || pwd == null || type == null) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text("账号信息不完整")));
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text("正在验证 SegaID…")));
|
||||
|
||||
final region = type == "jp" ? Region.jp : Region.intl;
|
||||
final data = await SegaService.verifyOnlyLogin(
|
||||
region: region,
|
||||
segaId: segaId,
|
||||
password: pwd,
|
||||
);
|
||||
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text("✅ 验证成功:${data['user']['name']}"), backgroundColor: Colors.green),
|
||||
);
|
||||
}
|
||||
} on NetImportError catch (e) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text("❌ ${e.message}"), backgroundColor: Colors.red),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text("验证失败")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _refreshBoundSegaScore(SegaCard card) async {
|
||||
final segaId = card.segaId;
|
||||
final pwd = card.password;
|
||||
final type = card.type;
|
||||
|
||||
if (segaId == null || pwd == null || type == null) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text("账号信息不完整")));
|
||||
return;
|
||||
}
|
||||
|
||||
final statusNotifier = ValueNotifier<String>("准备同步成绩...");
|
||||
if (mounted) _showSyncProgressDialog(context, statusNotifier);
|
||||
|
||||
try {
|
||||
final region = type == "jp" ? Region.jp : Region.intl;
|
||||
final data = await SegaService.fetchAndSync(
|
||||
region: region,
|
||||
segaId: segaId,
|
||||
password: pwd,
|
||||
onProgress: (status, percent) {
|
||||
statusNotifier.value = status;
|
||||
},
|
||||
);
|
||||
|
||||
// 同步到后端
|
||||
final provider = Provider.of<UserProvider>(context, listen: false);
|
||||
await provider.syncSegaScore(data);
|
||||
|
||||
// 关闭弹窗
|
||||
if (mounted) Navigator.pop(context);
|
||||
|
||||
// ✅【正确提示:上传成功】
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text("✅ 成绩同步成功(已上传至服务器)"),
|
||||
backgroundColor: Colors.green,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
} on NetImportError catch (e) {
|
||||
if (mounted) Navigator.pop(context);
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text("❌ ${e.message}"), backgroundColor: Colors.red),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) Navigator.pop(context);
|
||||
if (mounted) {
|
||||
// ❌【上传失败提示】
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text("❌ 成绩同步失败(服务器上传失败)"),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _showAddSegaSheet() {
|
||||
final idController = TextEditingController();
|
||||
final pwdController = TextEditingController();
|
||||
Region selectedRegion = Region.intl;
|
||||
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(16))),
|
||||
builder: (ctx) => Padding(
|
||||
padding: EdgeInsets.fromLTRB(20, 20, 20, MediaQuery.of(ctx).viewInsets.bottom + 20),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Text("添加 Sega 账号", style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600)),
|
||||
const SizedBox(height: 16),
|
||||
TextField(
|
||||
controller: idController,
|
||||
decoration: const InputDecoration(labelText: "SegaID", isDense: true, border: OutlineInputBorder()),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
TextField(
|
||||
controller: pwdController,
|
||||
obscureText: true,
|
||||
decoration: const InputDecoration(labelText: "密码", isDense: true, border: OutlineInputBorder()),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
DropdownButtonFormField<Region>(
|
||||
value: selectedRegion,
|
||||
decoration: const InputDecoration(border: OutlineInputBorder(), isDense: true),
|
||||
items: const [
|
||||
DropdownMenuItem(value: Region.intl, child: Text("国际服")),
|
||||
DropdownMenuItem(value: Region.jp, child: Text("日服")),
|
||||
],
|
||||
onChanged: (v) {
|
||||
if (v != null) selectedRegion = v;
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: ElevatedButton(
|
||||
onPressed: () async {
|
||||
final id = idController.text.trim();
|
||||
final pwd = pwdController.text.trim();
|
||||
if (id.isEmpty || pwd.isEmpty) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text("请输入完整信息")));
|
||||
return;
|
||||
}
|
||||
|
||||
final newCard = SegaCard(
|
||||
segaId: id,
|
||||
password: pwd,
|
||||
type: selectedRegion.name,
|
||||
);
|
||||
|
||||
final provider = Provider.of<UserProvider>(context, listen: false);
|
||||
final user = provider.user;
|
||||
if (user != null) {
|
||||
final list = user.segaCards ?? [];
|
||||
final newList = List<SegaCard>.from(list)..add(newCard);
|
||||
|
||||
final updatedUser = UserModel(
|
||||
id: user.id,
|
||||
name: user.name,
|
||||
userId: user.userId,
|
||||
teamId: user.teamId,
|
||||
email: user.email,
|
||||
password: user.password,
|
||||
twoFactorKey: user.twoFactorKey,
|
||||
apiKey: user.apiKey,
|
||||
apiBindKey: user.apiBindKey,
|
||||
protectRole: user.protectRole,
|
||||
risks: user.risks,
|
||||
mcName: user.mcName,
|
||||
userName2userId: user.userName2userId,
|
||||
lxKey: user.lxKey,
|
||||
dfUsername: user.dfUsername,
|
||||
dfPassword: user.dfPassword,
|
||||
nuoId: user.nuoId,
|
||||
botId: user.botId,
|
||||
spasolBotId: user.spasolBotId,
|
||||
githubId: user.githubId,
|
||||
rating: user.rating,
|
||||
ratingMax: user.ratingMax,
|
||||
iconId: user.iconId,
|
||||
plateId: user.plateId,
|
||||
plateIds: user.plateIds,
|
||||
frameId: user.frameId,
|
||||
charaSlots: user.charaSlots,
|
||||
qiandaoDay: user.qiandaoDay,
|
||||
inviter: user.inviter,
|
||||
successLogoutTime: user.successLogoutTime,
|
||||
lastLoginTime: user.lastLoginTime,
|
||||
friendIds: user.friendIds,
|
||||
bio: user.bio,
|
||||
friendBio: user.friendBio,
|
||||
sex: user.sex,
|
||||
isDisagreeRecommend: user.isDisagreeRecommend,
|
||||
isDisagreeFriend: user.isDisagreeFriend,
|
||||
points: user.points,
|
||||
planPoints: user.planPoints,
|
||||
cardIds: user.cardIds,
|
||||
userCards: user.userCards,
|
||||
tags: user.tags,
|
||||
useBeta: user.useBeta,
|
||||
useNuo: user.useNuo,
|
||||
useServer: user.useServer,
|
||||
useB50Type: user.useB50Type,
|
||||
userHot: user.userHot,
|
||||
chatInGroupNumbers: user.chatInGroupNumbers,
|
||||
sc: user.sc,
|
||||
id2pcNuo: user.id2pcNuo,
|
||||
mai2links: user.mai2links,
|
||||
key2KeychipEn: user.key2KeychipEn,
|
||||
key2key2KeychipEn: user.key2key2KeychipEn,
|
||||
mai2link: user.mai2link,
|
||||
userRegion: user.userRegion,
|
||||
rinUsernameOrEmail: user.rinUsernameOrEmail,
|
||||
rinPassword: user.rinPassword,
|
||||
rinChusanUser: user.rinChusanUser,
|
||||
segaCards: newList,
|
||||
placeList: user.placeList,
|
||||
lastKeyChip: user.lastKeyChip,
|
||||
token: user.token,
|
||||
timesRegionData: user.timesRegionData,
|
||||
yearTotal: user.yearTotal,
|
||||
yearTotalComment: user.yearTotalComment,
|
||||
userCollCardMap: user.userCollCardMap,
|
||||
collName2musicIds: user.collName2musicIds,
|
||||
ai: user.ai,
|
||||
pkScore: user.pkScore,
|
||||
pkScoreStr: user.pkScoreStr,
|
||||
pkScoreReality: user.pkScoreReality,
|
||||
pkUserId: user.pkUserId,
|
||||
limitPkTimestamp: user.limitPkTimestamp,
|
||||
hasAcceptPk: user.hasAcceptPk,
|
||||
pkPlayNum: user.pkPlayNum,
|
||||
pkWin: user.pkWin,
|
||||
userData: user.userData,
|
||||
banState: user.banState,
|
||||
);
|
||||
|
||||
provider.updateUser(updatedUser);
|
||||
await provider.saveUserInfo();
|
||||
}
|
||||
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text("✅ 添加成功")));
|
||||
Navigator.pop(ctx);
|
||||
}
|
||||
},
|
||||
child: const Text("保存"),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final userProvider = Provider.of<UserProvider>(context);
|
||||
@@ -312,11 +571,8 @@ class _UserPageState extends State<UserPage> {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text("用户中心")),
|
||||
body: Center(
|
||||
|
||||
child: Transform.translate(
|
||||
// Offset(水平, 垂直)
|
||||
// 垂直向上:负值
|
||||
offset: const Offset(0, -40), // 往上移 10 像素
|
||||
offset: const Offset(0, -40),
|
||||
child: _buildLoginCard(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
@@ -379,14 +635,10 @@ class _UserPageState extends State<UserPage> {
|
||||
_buildRadarChartSection(),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
|
||||
|
||||
_buildSaveButton(userProvider),
|
||||
const SizedBox(height: 12),
|
||||
_buildLogoutButton(context, userProvider),
|
||||
const SizedBox(height: 100),
|
||||
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -396,7 +648,6 @@ class _UserPageState extends State<UserPage> {
|
||||
);
|
||||
}
|
||||
|
||||
// 5. 修改 _buildScoreCheckerCard以添加按钮
|
||||
Widget _buildScoreCheckerCard(UserModel user) {
|
||||
return _webCard(
|
||||
child: Column(
|
||||
@@ -408,7 +659,6 @@ class _UserPageState extends State<UserPage> {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// --- 水鱼部分 ---
|
||||
const Text("水鱼查分器", style: TextStyle(fontSize: 15, fontWeight: FontWeight.w500)),
|
||||
const SizedBox(height: 8),
|
||||
TextField(
|
||||
@@ -430,7 +680,6 @@ class _UserPageState extends State<UserPage> {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
// 水鱼操作按钮行
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
@@ -443,14 +692,13 @@ class _UserPageState extends State<UserPage> {
|
||||
TextButton.icon(
|
||||
icon: const Icon(Icons.open_in_new, size: 18),
|
||||
label: const Text("跳转水鱼官网"),
|
||||
onPressed: () => _launchURL("https://www.diving-fish.com/"), // 替换为实际水鱼官网地址
|
||||
onPressed: () => _launchURL("https://www.diving-fish.com/"),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// --- 落雪部分 ---
|
||||
const Text("落雪查分器", style: TextStyle(fontSize: 15, fontWeight: FontWeight.w500)),
|
||||
const SizedBox(height: 8),
|
||||
TextField(
|
||||
@@ -462,7 +710,6 @@ class _UserPageState extends State<UserPage> {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
// 落雪操作按钮行
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
@@ -475,7 +722,7 @@ class _UserPageState extends State<UserPage> {
|
||||
TextButton.icon(
|
||||
icon: const Icon(Icons.open_in_new, size: 18),
|
||||
label: const Text("跳转落雪官网"),
|
||||
onPressed: () => _launchURL("https://maimai.lxns.net/"), // 替换为实际落雪官网地址
|
||||
onPressed: () => _launchURL("https://maimai.lxns.net/"),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -525,9 +772,9 @@ class _UserPageState extends State<UserPage> {
|
||||
color: Colors.pinkAccent,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Text(
|
||||
"舞萌账号" ,
|
||||
style: const TextStyle(color: Colors.white, fontSize: 12),
|
||||
child: const Text(
|
||||
"舞萌账号",
|
||||
style: TextStyle(color: Colors.white, fontSize: 12),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
@@ -535,7 +782,7 @@ class _UserPageState extends State<UserPage> {
|
||||
],
|
||||
),
|
||||
);
|
||||
})
|
||||
})
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -712,7 +959,7 @@ class _UserPageState extends State<UserPage> {
|
||||
image: NetworkImage(
|
||||
"https://cdn.godserver.cn/resource/static/coll/Chara/UI_Chara_$charaId.png",
|
||||
),
|
||||
fit: BoxFit.cover,
|
||||
fit:BoxFit.cover,
|
||||
colorFilter: ColorFilter.mode(
|
||||
Colors.black.withOpacity(0.4), BlendMode.darken),
|
||||
),
|
||||
@@ -799,7 +1046,6 @@ class _UserPageState extends State<UserPage> {
|
||||
friendBio: user.friendBio,
|
||||
sex: _sexController.text.trim(),
|
||||
|
||||
// 开关已正确保存
|
||||
isDisagreeRecommend: _isDisagreeRecommend,
|
||||
isDisagreeFriend: _isDisagreeFriend,
|
||||
|
||||
@@ -876,13 +1122,16 @@ class _UserPageState extends State<UserPage> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text("SegaID 账号",
|
||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600)),
|
||||
const Text(
|
||||
"SegaID 账号",
|
||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
|
||||
if (user.segaCards != null && user.segaCards!.isNotEmpty)
|
||||
...user.segaCards!.map((card) {
|
||||
...user.segaCards!.map((SegaCard card) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8),
|
||||
padding: const EdgeInsets.only(bottom: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
@@ -897,13 +1146,38 @@ class _UserPageState extends State<UserPage> {
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Text(card.segaId ?? ""),
|
||||
Expanded(child: Text(card.segaId ?? "")),
|
||||
const SizedBox(width: 6),
|
||||
TextButton(
|
||||
onPressed: () => _verifyBoundSega(card),
|
||||
child: const Text("验证", style: TextStyle(fontSize: 12)),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
TextButton(
|
||||
onPressed: () => _refreshBoundSegaScore(card),
|
||||
child: const Text("刷新成绩", style: TextStyle(fontSize: 12)),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
}).toList(),
|
||||
|
||||
if (user.segaCards == null || user.segaCards!.isEmpty)
|
||||
const Text("暂无 SegaID"),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 8),
|
||||
child: Text("暂无 SegaID"),
|
||||
),
|
||||
|
||||
const SizedBox(height: 12),
|
||||
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: OutlinedButton.icon(
|
||||
onPressed: _showAddSegaSheet,
|
||||
icon: const Icon(Icons.add, size: 18),
|
||||
label: const Text("添加 Sega 账号"),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -1055,7 +1329,6 @@ class _UserPageState extends State<UserPage> {
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
// 1. 头部图标与标题
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
@@ -1089,7 +1362,6 @@ class _UserPageState extends State<UserPage> {
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// 2. 登录好处列表 (Value Proposition)
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
@@ -1125,7 +1397,6 @@ class _UserPageState extends State<UserPage> {
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// 3. 登录按钮
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
height: 50,
|
||||
@@ -1159,7 +1430,6 @@ class _UserPageState extends State<UserPage> {
|
||||
);
|
||||
}
|
||||
|
||||
// 辅助方法:构建单个权益项
|
||||
Widget _buildBenefitItem({
|
||||
required IconData icon,
|
||||
required String title,
|
||||
@@ -1212,17 +1482,15 @@ class _UserPageState extends State<UserPage> {
|
||||
child: const Text("点击加载雷达图数据"),
|
||||
)
|
||||
else
|
||||
// 使用我们自定义的雷达图
|
||||
SizedBox(
|
||||
height: 300,
|
||||
width: double.infinity,
|
||||
child: CustomRadarChart(
|
||||
// 传入你的数据,确保 Map<String, double>
|
||||
data: _radarData!.map((key, value) =>
|
||||
MapEntry(key.toString(), double.tryParse(value.toString()) ?? 0.0)
|
||||
),
|
||||
maxValue: 1.3, // 强制最大值为 1.5,不再自动缩放
|
||||
lineColor: Colors.grey.shade200, // 极淡的网格线,视觉上接近“无”
|
||||
maxValue: 1.3,
|
||||
lineColor: Colors.grey.shade200,
|
||||
areaColor: Colors.pink.withOpacity(0.15),
|
||||
borderColor: Colors.pinkAccent,
|
||||
),
|
||||
@@ -1230,9 +1498,6 @@ class _UserPageState extends State<UserPage> {
|
||||
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// ————————————————————————————————
|
||||
// 下面的列表保持不变
|
||||
// ————————————————————————————————
|
||||
if (_radarData != null)
|
||||
GridView.count(
|
||||
shrinkWrap: true,
|
||||
@@ -1260,12 +1525,11 @@ class _UserPageState extends State<UserPage> {
|
||||
children: [
|
||||
Text(
|
||||
key,
|
||||
style: const TextStyle(fontSize: 12,
|
||||
fontWeight: FontWeight.w500),
|
||||
style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w500),
|
||||
),
|
||||
Text(
|
||||
value.toStringAsFixed(2),
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user