Minor change.
This commit is contained in:
parent
26d49b4da3
commit
14ce9fc12e
|
@ -15,6 +15,7 @@ import '../local_storage/sqflite_localpodcast.dart';
|
|||
import '../state/audio_state.dart';
|
||||
import '../type/episodebrief.dart';
|
||||
import '../type/play_histroy.dart';
|
||||
import '../type/playlist.dart';
|
||||
import '../util/extension_helper.dart';
|
||||
import '../util/pageroute.dart';
|
||||
import '../widgets/audiopanel.dart';
|
||||
|
@ -402,7 +403,9 @@ class _PlaylistWidgetState extends State<PlaylistWidget> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var audio = Provider.of<AudioPlayerNotifier>(context, listen: false);
|
||||
return Container(
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: Container(
|
||||
alignment: Alignment.topLeft,
|
||||
height: 300,
|
||||
width: double.infinity,
|
||||
|
@ -410,19 +413,21 @@ class _PlaylistWidgetState extends State<PlaylistWidget> {
|
|||
color: context.accentColor.withAlpha(70),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Column(
|
||||
child: Selector<AudioPlayerNotifier, Tuple2<Playlist, EpisodeBrief>>(
|
||||
selector: (_, audio) => Tuple2(audio.playlist, audio.episode),
|
||||
builder: (_, data, __) {
|
||||
var episodes = data.item1.episodes;
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Selector<AudioPlayerNotifier, List<EpisodeBrief>>(
|
||||
selector: (_, audio) => audio.playlist.episodes,
|
||||
builder: (_, data, __) {
|
||||
var episodesToPlay = data.sublist(1);
|
||||
return AnimatedList(
|
||||
child: data.item1.name == 'Queue'
|
||||
? AnimatedList(
|
||||
key: miniPlaylistKey,
|
||||
shrinkWrap: true,
|
||||
scrollDirection: Axis.vertical,
|
||||
initialItemCount: episodesToPlay.length,
|
||||
itemBuilder: (context, index, animation) => ScaleTransition(
|
||||
initialItemCount: episodes.length,
|
||||
itemBuilder: (context, index, animation) =>
|
||||
ScaleTransition(
|
||||
alignment: Alignment.center,
|
||||
scale: animation,
|
||||
child: Column(
|
||||
|
@ -434,15 +439,17 @@ class _PlaylistWidgetState extends State<PlaylistWidget> {
|
|||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
audio.episodeLoad(data[index]);
|
||||
miniPlaylistKey.currentState.removeItem(
|
||||
audio.episodeLoad(episodes[index]);
|
||||
miniPlaylistKey.currentState
|
||||
.removeItem(
|
||||
index,
|
||||
(context, animation) => Center());
|
||||
(context, animation) =>
|
||||
Center());
|
||||
},
|
||||
child: Container(
|
||||
height: 60,
|
||||
padding:
|
||||
EdgeInsets.symmetric(horizontal: 20),
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 20),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
|
@ -454,22 +461,26 @@ class _PlaylistWidgetState extends State<PlaylistWidget> {
|
|||
Container(
|
||||
padding: EdgeInsets.all(10.0),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(15.0)),
|
||||
borderRadius:
|
||||
BorderRadius.all(
|
||||
Radius.circular(
|
||||
15.0)),
|
||||
child: Container(
|
||||
height: 30.0,
|
||||
width: 30.0,
|
||||
child: Image.file(File(
|
||||
"${episodesToPlay[index].imagePath}"))),
|
||||
"${episodes[index].imagePath}"))),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
alignment:
|
||||
Alignment.centerLeft,
|
||||
child: Text(
|
||||
episodesToPlay[index].title,
|
||||
episodes[index].title,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
overflow:
|
||||
TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -480,31 +491,37 @@ class _PlaylistWidgetState extends State<PlaylistWidget> {
|
|||
),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 20.0),
|
||||
child: Material(
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
borderRadius:
|
||||
BorderRadius.circular(100),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
color: context.primaryColor,
|
||||
child: InkWell(
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(15.0)),
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(15.0)),
|
||||
onTap: () async {
|
||||
var episdoe =
|
||||
episodesToPlay.removeAt(index);
|
||||
episodesToPlay.insert(0, episdoe);
|
||||
miniPlaylistKey.currentState.removeItem(
|
||||
episodes.removeAt(index);
|
||||
episodes.insert(0, episdoe);
|
||||
miniPlaylistKey.currentState
|
||||
.removeItem(
|
||||
index,
|
||||
(context, animation) {
|
||||
return Center();
|
||||
},
|
||||
duration: Duration.zero,
|
||||
);
|
||||
miniPlaylistKey.currentState.insertItem(0,
|
||||
duration: Duration(milliseconds: 100));
|
||||
miniPlaylistKey.currentState
|
||||
.insertItem(
|
||||
0,
|
||||
duration: Duration(
|
||||
milliseconds: 100));
|
||||
await Future.delayed(
|
||||
Duration(milliseconds: 100));
|
||||
await audio.moveToTop(data[index + 1]);
|
||||
await audio.moveToTop(
|
||||
data.item1.episodes[index + 1]);
|
||||
},
|
||||
child: SizedBox(
|
||||
height: 30.0,
|
||||
|
@ -526,6 +543,65 @@ class _PlaylistWidgetState extends State<PlaylistWidget> {
|
|||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: ListView.builder(
|
||||
itemCount: episodes.length,
|
||||
itemBuilder: (context, index) {
|
||||
final isPlaying = episodes[index] != null &&
|
||||
episodes[index] == data.item2;
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
if (!isPlaying) {
|
||||
await context
|
||||
.read<AudioPlayerNotifier>()
|
||||
.loadEpisodeFromPlaylist(episodes[index]);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
color: isPlaying
|
||||
? context.accentColor
|
||||
: Colors.transparent,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.all(10.0),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(15.0)),
|
||||
child: Container(
|
||||
height: 30.0,
|
||||
width: 30.0,
|
||||
child: Image.file(File(
|
||||
"${episodes[index].imagePath}"))),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
episodes[index].title,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (isPlaying)
|
||||
Container(
|
||||
height: 20,
|
||||
width: 20,
|
||||
margin: EdgeInsets.symmetric(
|
||||
horizontal: 10),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: WaveLoader(
|
||||
color: context.primaryColor)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
@ -537,7 +613,10 @@ class _PlaylistWidgetState extends State<PlaylistWidget> {
|
|||
child: Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
context.s.homeMenuPlaylist,
|
||||
data.item1.name == 'Queue'
|
||||
? context.s.queue
|
||||
: '${context.s.homeMenuPlaylist}${'-${data.item1.name}'}',
|
||||
overflow: TextOverflow.fade,
|
||||
style: TextStyle(
|
||||
color: context.accentColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
@ -551,8 +630,8 @@ class _PlaylistWidgetState extends State<PlaylistWidget> {
|
|||
borderRadius: BorderRadius.all(Radius.circular(15)),
|
||||
onTap: () {
|
||||
audio.playNext();
|
||||
miniPlaylistKey.currentState
|
||||
.removeItem(0, (context, animation) => Container());
|
||||
miniPlaylistKey.currentState.removeItem(
|
||||
0, (context, animation) => Container());
|
||||
miniPlaylistKey.currentState.insertItem(0);
|
||||
},
|
||||
child: SizedBox(
|
||||
|
@ -598,6 +677,9 @@ class _PlaylistWidgetState extends State<PlaylistWidget> {
|
|||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1361,7 +1361,7 @@ class DBHelper {
|
|||
|
||||
Future<void> removeGroupNewMark(List<String> group) async {
|
||||
var dbClient = await database;
|
||||
if (group.length > 0) {
|
||||
if (group.isNotEmpty) {
|
||||
var s = group.map<String>((e) => "'$e'").toList();
|
||||
await dbClient.transaction((txn) async {
|
||||
await txn.rawUpdate(
|
||||
|
|
Loading…
Reference in New Issue