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