Merge remote-tracking branch 'origin/test'
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import '../services/audio_service.dart';
|
import '../services/audio_service.dart';
|
||||||
import '../main.dart';
|
|
||||||
|
|
||||||
class GlobalMiniPlayer extends StatelessWidget {
|
class GlobalMiniPlayer extends StatelessWidget {
|
||||||
const GlobalMiniPlayer({super.key});
|
const GlobalMiniPlayer({super.key});
|
||||||
@@ -13,7 +12,6 @@ class GlobalMiniPlayer extends StatelessWidget {
|
|||||||
final isPlaying = context.select<AudioService, bool>((s) => s.isPlaying);
|
final isPlaying = context.select<AudioService, bool>((s) => s.isPlaying);
|
||||||
final bottomPadding = MediaQuery.of(context).padding.bottom;
|
final bottomPadding = MediaQuery.of(context).padding.bottom;
|
||||||
|
|
||||||
// 如果没有歌曲,不显示
|
|
||||||
if (song == null) {
|
if (song == null) {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
@@ -21,7 +19,6 @@ class GlobalMiniPlayer extends StatelessWidget {
|
|||||||
return Stack(
|
return Stack(
|
||||||
clipBehavior: Clip.none,
|
clipBehavior: Clip.none,
|
||||||
children: [
|
children: [
|
||||||
// 背景条
|
|
||||||
Positioned(
|
Positioned(
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
@@ -31,7 +28,6 @@ class GlobalMiniPlayer extends StatelessWidget {
|
|||||||
color: const Color(0xFF1A1F1E),
|
color: const Color(0xFF1A1F1E),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// 主内容
|
|
||||||
Positioned(
|
Positioned(
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
@@ -44,21 +40,21 @@ class GlobalMiniPlayer extends StatelessWidget {
|
|||||||
height: 60,
|
height: 60,
|
||||||
color: const Color(0xFF1A1F1E),
|
color: const Color(0xFF1A1F1E),
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
// ⭐ 修复涟漪圆角问题
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
child: Material(
|
child: Material(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
navigatorKey.currentState?.pushNamed('/player');
|
// ⭐ 使用 Navigator.of(context) 替代 navigatorKey
|
||||||
|
Navigator.of(context).pushNamed('/player');
|
||||||
},
|
},
|
||||||
highlightColor: Colors.white.withOpacity(0.05),
|
// ⭐ 替换弃用的 withOpacity 为 withValues
|
||||||
splashColor: Colors.white.withOpacity(0.1),
|
highlightColor: Colors.white.withValues(alpha: 0.05),
|
||||||
|
splashColor: Colors.white.withValues(alpha: 0.1),
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
// 封面图
|
|
||||||
Container(
|
Container(
|
||||||
width: 44,
|
width: 44,
|
||||||
height: 44,
|
height: 44,
|
||||||
@@ -81,7 +77,6 @@ class GlobalMiniPlayer extends StatelessWidget {
|
|||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
// 标题 + 艺术家
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@@ -111,7 +106,6 @@ class GlobalMiniPlayer extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// 播放/暂停按钮
|
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
isPlaying ? Icons.pause : Icons.play_arrow,
|
isPlaying ? Icons.pause : Icons.play_arrow,
|
||||||
@@ -122,7 +116,6 @@ class GlobalMiniPlayer extends StatelessWidget {
|
|||||||
context.read<AudioService>().togglePlay();
|
context.read<AudioService>().togglePlay();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
// 播放列表按钮
|
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.playlist_play_outlined,
|
Icons.playlist_play_outlined,
|
||||||
@@ -130,7 +123,8 @@ class GlobalMiniPlayer extends StatelessWidget {
|
|||||||
size: 24,
|
size: 24,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
navigatorKey.currentState?.pushNamed('/playlist');
|
// ⭐ 使用 Navigator.of(context)
|
||||||
|
Navigator.of(context).pushNamed('/playlist');
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 4),
|
||||||
|
|||||||
+10
-2
@@ -284,10 +284,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: js
|
name: js
|
||||||
sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc"
|
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.7.2"
|
version: "0.6.7"
|
||||||
leak_tracker:
|
leak_tracker:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -352,6 +352,14 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.6"
|
version: "1.2.6"
|
||||||
|
media_kit_libs_android_audio:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: media_kit_libs_android_audio
|
||||||
|
sha256: "8f8f9759e537e12d66f08bc4d5279eb1bb21a0ccc519ff3442c68a9f3b6dd68b"
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "1.3.8"
|
||||||
meta:
|
meta:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
+2
-2
@@ -30,8 +30,8 @@ environment:
|
|||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
media_kit: ^1.2.6
|
media_kit: 1.2.6
|
||||||
#media_kit_libs_audio: ^1.0.7
|
media_kit_libs_android_audio: 1.3.8
|
||||||
shared_preferences: 2.2.2
|
shared_preferences: 2.2.2
|
||||||
provider: ^6.1.2
|
provider: ^6.1.2
|
||||||
dio: ^5.4.0 # HTTP 客户端
|
dio: ^5.4.0 # HTTP 客户端
|
||||||
|
|||||||
Reference in New Issue
Block a user