0417 0022
更新
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../service/recommendation_helper.dart';
|
||||
import '../../service/song_service.dart';
|
||||
import '../../tool/gradientText.dart';
|
||||
// 注意:如果 UserPage, SongListPage 等只是作为内部卡片展示,不需要再 import 用于 Navigator push
|
||||
// 但如果其他卡片还需要跳转,保留 import 即可
|
||||
import '../user/userpage.dart';
|
||||
import '../songlistpage.dart';
|
||||
import '../scorelist.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../providers/user_provider.dart';
|
||||
import '../../model/song_model.dart';
|
||||
|
||||
class HomePage extends StatelessWidget {
|
||||
// ✅ 1. 添加回调函数参数
|
||||
final Function(int)? onSwitchTab;
|
||||
|
||||
const HomePage({super.key, this.onSwitchTab});
|
||||
@@ -57,7 +57,7 @@ class HomePage extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(0), // 修正语法错误,原代码可能有误
|
||||
borderRadius: BorderRadius.circular(0),
|
||||
child: SizedBox(
|
||||
width: 54,
|
||||
height: 54,
|
||||
@@ -89,13 +89,10 @@ class HomePage extends StatelessWidget {
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
// ✅ 2. 修改:用户中心 -> 切换到 Tab 3 (UserPage)
|
||||
_buildCardWithTitle(
|
||||
context: context,
|
||||
title: "用户中心",
|
||||
icon: Icons.person_outline,
|
||||
// 不再传递 targetPage,而是传递 targetIndex
|
||||
targetIndex: 3,
|
||||
gradient: const LinearGradient(
|
||||
colors: [Colors.black, Colors.grey],
|
||||
@@ -106,12 +103,11 @@ class HomePage extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
|
||||
// 歌曲列表 (保持原有跳转逻辑或自行定义)
|
||||
_buildCardWithTitle(
|
||||
context: context,
|
||||
title: "歌曲列表",
|
||||
icon: Icons.music_note_outlined,
|
||||
targetPage: const SongListPage(), // 假设这个还是用 Push 跳转
|
||||
targetPage: const SongListPage(),
|
||||
gradient: const LinearGradient(
|
||||
colors: [Color(0xFFff9a9e), Color(0xFFfecfef)],
|
||||
begin: Alignment.topLeft,
|
||||
@@ -121,7 +117,6 @@ class HomePage extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
|
||||
// ✅ 3. 修改:成绩管理 -> 切换到 Tab 1 (ScorePage)
|
||||
_buildCardWithTitle(
|
||||
context: context,
|
||||
title: "成绩管理",
|
||||
@@ -136,7 +131,6 @@ class HomePage extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
|
||||
// 娱乐功能
|
||||
_buildCardWithTitle(
|
||||
context: context,
|
||||
title: "娱乐功能",
|
||||
@@ -151,7 +145,6 @@ class HomePage extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
|
||||
// 评分列表
|
||||
_buildCardWithTitle(
|
||||
context: context,
|
||||
title: "评分列表",
|
||||
@@ -171,27 +164,176 @@ class HomePage extends StatelessWidget {
|
||||
),
|
||||
|
||||
// ====================== 海报 ======================
|
||||
// 假设 PosterImage 是你自定义的一个 Widget
|
||||
const PosterImage(imageUrl: 'https://cdn.godserver.cn/post/post%20unionapp1.png'),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// ====================== 新增:用户数据展示卡片 ======================
|
||||
// ====================== 用户数据展示卡片 ======================
|
||||
const _UserInfoCard(),
|
||||
const SizedBox(height: 30),
|
||||
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 左侧:智能推荐乐曲(占 6 份宽度)
|
||||
Expanded(
|
||||
flex: 6,
|
||||
child: const _RecommendedSongsSection(),
|
||||
),
|
||||
const SizedBox(width: 20), // 左右间距
|
||||
// 右侧:快捷按钮区域(占 4 份宽度)
|
||||
Expanded(
|
||||
flex: 6,
|
||||
child: _buildQuickActionButtons(), // 快捷按钮组件
|
||||
),
|
||||
const SizedBox(width: 10), // 左右间距
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
// 右侧快捷按钮区域(你可以自由修改图标、文字、点击事件)
|
||||
Widget _buildQuickActionButtons() {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
"快捷操作",
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
// 按钮网格
|
||||
GridView.count(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
crossAxisCount: 2, // 一行 2 个按钮
|
||||
crossAxisSpacing: 12,
|
||||
mainAxisSpacing: 12,
|
||||
childAspectRatio: 1.0,
|
||||
children: [
|
||||
_quickActionItem(
|
||||
icon: Icons.download,
|
||||
label: "更新成绩",
|
||||
gradient: LinearGradient(
|
||||
colors: [Colors.lightBlueAccent.withAlpha(10), Colors.pinkAccent.withOpacity(0.1)],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
color: Colors.pinkAccent.shade100,
|
||||
onTap: () {},
|
||||
),
|
||||
_quickActionItem(
|
||||
icon: Icons.stars_outlined,
|
||||
label: "ADX",
|
||||
color: Colors.white,
|
||||
gradient: LinearGradient(
|
||||
colors: [Colors.blueAccent, Colors.pinkAccent.shade100],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.topRight,
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.blueAccent.withOpacity(0.3),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(2, 4),
|
||||
),
|
||||
],
|
||||
onTap: () {},
|
||||
),
|
||||
|
||||
// ✅ 4. 修改构建方法,支持 targetIndex 和 targetPage 两种模式
|
||||
// 橙色渐变
|
||||
_quickActionItem(
|
||||
icon: Icons.generating_tokens,
|
||||
label: "ReiSasol",
|
||||
color: Colors.white,
|
||||
gradient: LinearGradient(
|
||||
colors: [Colors.orange, Colors.deepOrangeAccent],
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.orange.withOpacity(0.3),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(2, 4),
|
||||
),
|
||||
],
|
||||
onTap: () {},
|
||||
),
|
||||
_quickActionItem(
|
||||
icon: Icons.link,
|
||||
label: "友站",
|
||||
color: Colors.white,
|
||||
gradient: LinearGradient(
|
||||
colors: [Colors.grey[600]!, Colors.grey[400]!],
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.2),
|
||||
blurRadius: 6,
|
||||
offset: const Offset(1, 2),
|
||||
),
|
||||
],
|
||||
onTap: () {},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// 修改后的组件方法
|
||||
Widget _quickActionItem({
|
||||
required IconData icon,
|
||||
required String label,
|
||||
required Color color,
|
||||
required VoidCallback onTap,
|
||||
// 新增:渐变背景(可选)
|
||||
Gradient? gradient,
|
||||
// 新增:阴影(可选)
|
||||
List<BoxShadow>? boxShadow,
|
||||
}) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
// 优先级:渐变 > 纯色背景
|
||||
color: gradient == null ? Colors.black.withOpacity(0.1) : null,
|
||||
gradient: gradient,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: boxShadow,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 8), // 优化内边距
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(icon, color: color, size: 28),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: color,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
Widget _buildCardWithTitle({
|
||||
required BuildContext context,
|
||||
required String title,
|
||||
required IconData icon,
|
||||
int? targetIndex, // 新增:如果是切换 Tab,传这个
|
||||
Widget? targetPage, // 保留:如果是页面跳转,传这个
|
||||
int? targetIndex,
|
||||
Widget? targetPage,
|
||||
required LinearGradient gradient,
|
||||
required Color shadowColor,
|
||||
}) {
|
||||
@@ -201,10 +343,8 @@ class HomePage extends StatelessWidget {
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
if (targetIndex != null && onSwitchTab != null) {
|
||||
// ✅ 执行 Tab 切换
|
||||
onSwitchTab!(targetIndex);
|
||||
} else if (targetPage != null) {
|
||||
// ✅ 执行页面跳转
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => targetPage),
|
||||
@@ -269,7 +409,7 @@ class HomePage extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
// ====================== 新增:用户数据卡片组件 ======================
|
||||
// ====================== 用户数据卡片 ======================
|
||||
class _UserInfoCard extends StatelessWidget {
|
||||
const _UserInfoCard();
|
||||
|
||||
@@ -278,19 +418,18 @@ class _UserInfoCard extends StatelessWidget {
|
||||
final userProvider = Provider.of<UserProvider>(context);
|
||||
|
||||
return Padding(
|
||||
// 内边距和海报完全一致,保证同宽
|
||||
padding: const EdgeInsets.symmetric(horizontal: 17.0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: Colors.white.withOpacity(0.8),
|
||||
color: Colors.white,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.pink.shade100,
|
||||
color: Colors.lightBlueAccent.shade100,
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 6),
|
||||
spreadRadius: 1,
|
||||
offset: const Offset(0, 2),
|
||||
spreadRadius: 3,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -298,22 +437,8 @@ class _UserInfoCard extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 标题
|
||||
const Text(
|
||||
"当前用户信息",
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
color: Colors.purpleAccent,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const Divider(height: 5, thickness: 1),
|
||||
const SizedBox(height: 6),
|
||||
|
||||
// 用户信息行
|
||||
Row(
|
||||
children: [
|
||||
// 头像
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(0),
|
||||
child: SizedBox(
|
||||
@@ -331,14 +456,12 @@ class _UserInfoCard extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 18),
|
||||
|
||||
// 文字信息
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
GradientText(
|
||||
data:"用户名:${userProvider.username}",
|
||||
data:"用户名:${userProvider.username} ",
|
||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||||
gradientLayers: [
|
||||
GradientLayer(
|
||||
@@ -349,7 +472,19 @@ class _UserInfoCard extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
GradientText(
|
||||
data:"Ra${userProvider.user?.rating} ",
|
||||
style: const TextStyle(fontSize: 12, fontWeight: FontWeight.bold),
|
||||
gradientLayers: [
|
||||
GradientLayer(
|
||||
gradient: const LinearGradient(
|
||||
colors: [Colors.deepPurple, Colors.pinkAccent],
|
||||
),
|
||||
blendMode: BlendMode.srcIn,
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(height: 5, thickness: 1),
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
userProvider.username == "未登录"
|
||||
@@ -374,6 +509,270 @@ class _UserInfoCard extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
// ====================== 🎵 修复完成:推荐乐曲组件 ======================
|
||||
class _RecommendedSongsSection extends StatelessWidget {
|
||||
const _RecommendedSongsSection();
|
||||
|
||||
Future<Map<String, dynamic>> _loadData(UserProvider userProvider) async {
|
||||
// 加载歌曲 + 用户数据
|
||||
final allSongs = await SongService.getAllSongs();
|
||||
List<dynamic> userMusicList = [];
|
||||
final token = userProvider.token;
|
||||
|
||||
try {
|
||||
final scoreData = await SongService.getUserAllScores(
|
||||
token!,
|
||||
name: userProvider.selectedCnUserName,
|
||||
);
|
||||
if (scoreData.containsKey('userScoreAll_')) {
|
||||
userMusicList = scoreData['userScoreAll_']['userMusicList'] ?? [];
|
||||
} else if (scoreData.containsKey('userMusicList')) {
|
||||
userMusicList = scoreData['userMusicList'] ?? [];
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
final int currentRating = userProvider.user?.rating ?? 0;
|
||||
final int estimatedB35Min = (currentRating / 50).toInt();
|
||||
|
||||
final recommended = RecommendationHelper.getSmartRecommendations(
|
||||
allSongs: allSongs,
|
||||
userMusicList: userMusicList,
|
||||
userRating: currentRating, // 传入非空 int
|
||||
b35MinRating: estimatedB35Min, // 传入非空 int
|
||||
count: 6,
|
||||
);
|
||||
|
||||
return {
|
||||
'songs': recommended,
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final userProvider = context.read<UserProvider>();
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Row(
|
||||
children: [
|
||||
Icon(Icons.music_note, color: Colors.purpleAccent),
|
||||
SizedBox(width: 8),
|
||||
Text(
|
||||
"为你推荐",
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
FutureBuilder<Map<String, dynamic>>(
|
||||
future: _loadData(userProvider),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
if (snapshot.hasError || !snapshot.hasData) {
|
||||
return const Center(child: Text("加载推荐失败"));
|
||||
}
|
||||
|
||||
final List<SongModel> songs = snapshot.data!['songs'] ?? [];
|
||||
if (songs.isEmpty) {
|
||||
return const Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(20.0),
|
||||
child: Text("暂无推荐歌曲,快去游玩更多曲目吧!"),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return SizedBox(
|
||||
height: 200,
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: songs.length,
|
||||
itemBuilder: (context, index) {
|
||||
return _SongItemCard(song: songs[index]);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _SongItemCard extends StatelessWidget {
|
||||
final SongModel song;
|
||||
|
||||
const _SongItemCard({required this.song});
|
||||
|
||||
String _getCoverUrl(int musicId) {
|
||||
int displayId = musicId % 10000;
|
||||
// 注意:这里逻辑可能需要根据你的实际资源调整,通常 DX 歌曲 ID > 10000
|
||||
if (musicId >= 10000) {
|
||||
String idStr = displayId.toString().padLeft(6, '0');
|
||||
return "https://u.mai2.link/jacket/UI_Jacket_$idStr.jpg";
|
||||
} else {
|
||||
return "https://cdn.godserver.cn/resource/static/mai/cover/$displayId.png";
|
||||
}
|
||||
}
|
||||
|
||||
// 获取难度颜色
|
||||
Color _getLevelColor(int levelIndex) {
|
||||
switch (levelIndex) {
|
||||
case 0: return Colors.green; // Basic
|
||||
case 1: return Colors.blue; // Advanced
|
||||
case 2: return Colors.yellow[700]!; // Expert
|
||||
case 3: return Colors.red; // Master
|
||||
case 4: return Colors.purple; // Re:Master
|
||||
default: return Colors.grey;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// 假设我们要显示 Master (3) 和 Re:Master (4) 的难度
|
||||
// 你需要从 song.sd 或 song.dx 中解析出具体的 level_value (定数)
|
||||
double? masterLv = _getLevelValue(song, 3);
|
||||
double? reMasterLv = _getLevelValue(song, 4);
|
||||
|
||||
return Container(
|
||||
width: 140,
|
||||
margin: const EdgeInsets.only(right: 12),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.15),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// ✅ 1. 图片优化:增加 loadingBuilder 和 cacheWidth
|
||||
ClipRRect(
|
||||
borderRadius: const BorderRadius.vertical(top: Radius.circular(12)),
|
||||
child: SizedBox(
|
||||
height: 120,
|
||||
width: double.infinity,
|
||||
child: Image.network(
|
||||
_getCoverUrl(song.id),
|
||||
fit: BoxFit.cover,
|
||||
// 关键优化:指定缓存宽度,减少内存占用和解码时间
|
||||
cacheWidth: 280,
|
||||
loadingBuilder: (context, child, loadingProgress) {
|
||||
if (loadingProgress == null) return child;
|
||||
return Container(
|
||||
color: Colors.grey[200],
|
||||
child: Center(child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
value: loadingProgress.expectedTotalBytes != null
|
||||
? loadingProgress.cumulativeBytesLoaded /
|
||||
loadingProgress.expectedTotalBytes!
|
||||
: null,
|
||||
)),
|
||||
);
|
||||
},
|
||||
errorBuilder: (_, __, ___) {
|
||||
return Container(
|
||||
color: Colors.grey[200],
|
||||
child: const Icon(Icons.music_note, size: 40, color: Colors.grey),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 8),
|
||||
|
||||
// 标题
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Text(
|
||||
song.title ?? "未知歌曲",
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
|
||||
// 艺术家 (修复了重复显示的问题)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Text(
|
||||
song.artist ?? "未知艺术家",
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 11, color: Colors.grey[600]),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 6),
|
||||
|
||||
// ✅ 2. 底部难度标签
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
child: Row(
|
||||
children: [
|
||||
if (masterLv != null)
|
||||
_buildLevelTag("MAS", masterLv, Colors.purple),
|
||||
if (reMasterLv != null) ...[
|
||||
const SizedBox(width: 4),
|
||||
_buildLevelTag("ReM", reMasterLv, Colors.deepPurple),
|
||||
]
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildLevelTag(String prefix, double level, Color color) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: color.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
border: Border.all(color: color.withOpacity(0.5), width: 0.5),
|
||||
),
|
||||
child: Text(
|
||||
"$prefix ${level.toStringAsFixed(1)}",
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 辅助方法:获取定数
|
||||
double? _getLevelValue(SongModel song, int levelIndex) {
|
||||
Map ?diffMap = song.dx;
|
||||
if (diffMap==null|| diffMap.isEmpty) {
|
||||
diffMap = song.sd;
|
||||
}
|
||||
|
||||
var data = diffMap?["$levelIndex"] ?? diffMap?[levelIndex];
|
||||
if (data is Map && data["level_value"] != null) {
|
||||
return (data["level_value"] as num).toDouble();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class PosterImage extends StatelessWidget {
|
||||
final String imageUrl;
|
||||
|
||||
@@ -385,7 +784,6 @@ class PosterImage extends StatelessWidget {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: 800,
|
||||
),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
@@ -426,5 +824,4 @@ class PosterImage extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user