Add play next in popupmenu.
This commit is contained in:
parent
434609eaeb
commit
074f31e7cd
|
@ -220,6 +220,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||
"password" : MessageLookupByLibrary.simpleMessage("Password"),
|
||||
"pause" : MessageLookupByLibrary.simpleMessage("Pause"),
|
||||
"play" : MessageLookupByLibrary.simpleMessage("Play"),
|
||||
"playNext" : MessageLookupByLibrary.simpleMessage("Play next"),
|
||||
"playNextDes" : MessageLookupByLibrary.simpleMessage("Add episode to top of the playlist"),
|
||||
"playback" : MessageLookupByLibrary.simpleMessage("Playback control"),
|
||||
"player" : MessageLookupByLibrary.simpleMessage("Player"),
|
||||
"playerHeightMed" : MessageLookupByLibrary.simpleMessage("Medium"),
|
||||
|
|
|
@ -220,6 +220,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||
"password" : MessageLookupByLibrary.simpleMessage("Password"),
|
||||
"pause" : MessageLookupByLibrary.simpleMessage("Pause"),
|
||||
"play" : MessageLookupByLibrary.simpleMessage("Reproducir"),
|
||||
"playNext" : MessageLookupByLibrary.simpleMessage(""),
|
||||
"playNextDes" : MessageLookupByLibrary.simpleMessage(""),
|
||||
"playback" : MessageLookupByLibrary.simpleMessage("Control de reproducción"),
|
||||
"player" : MessageLookupByLibrary.simpleMessage("Reproductor"),
|
||||
"playerHeightMed" : MessageLookupByLibrary.simpleMessage("Medio"),
|
||||
|
|
|
@ -220,6 +220,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||
"password" : MessageLookupByLibrary.simpleMessage("Password"),
|
||||
"pause" : MessageLookupByLibrary.simpleMessage("Pause"),
|
||||
"play" : MessageLookupByLibrary.simpleMessage("Lecture"),
|
||||
"playNext" : MessageLookupByLibrary.simpleMessage(""),
|
||||
"playNextDes" : MessageLookupByLibrary.simpleMessage(""),
|
||||
"playback" : MessageLookupByLibrary.simpleMessage("Commandes du lecteur"),
|
||||
"player" : MessageLookupByLibrary.simpleMessage("Player"),
|
||||
"playerHeightMed" : MessageLookupByLibrary.simpleMessage("Moyen"),
|
||||
|
|
|
@ -220,6 +220,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||
"password" : MessageLookupByLibrary.simpleMessage("Password"),
|
||||
"pause" : MessageLookupByLibrary.simpleMessage("Pausa"),
|
||||
"play" : MessageLookupByLibrary.simpleMessage("Riproduci"),
|
||||
"playNext" : MessageLookupByLibrary.simpleMessage(""),
|
||||
"playNextDes" : MessageLookupByLibrary.simpleMessage(""),
|
||||
"playback" : MessageLookupByLibrary.simpleMessage("Controlli di riproduzione"),
|
||||
"player" : MessageLookupByLibrary.simpleMessage("Player"),
|
||||
"playerHeightMed" : MessageLookupByLibrary.simpleMessage("Medio"),
|
||||
|
|
|
@ -220,6 +220,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||
"password" : MessageLookupByLibrary.simpleMessage("Password"),
|
||||
"pause" : MessageLookupByLibrary.simpleMessage("Pausa"),
|
||||
"play" : MessageLookupByLibrary.simpleMessage("Reproduzir"),
|
||||
"playNext" : MessageLookupByLibrary.simpleMessage(""),
|
||||
"playNextDes" : MessageLookupByLibrary.simpleMessage(""),
|
||||
"playback" : MessageLookupByLibrary.simpleMessage("Controlo da reprodução"),
|
||||
"player" : MessageLookupByLibrary.simpleMessage("Reprodutor"),
|
||||
"playerHeightMed" : MessageLookupByLibrary.simpleMessage("Médio"),
|
||||
|
|
|
@ -220,6 +220,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||
"password" : MessageLookupByLibrary.simpleMessage("密码"),
|
||||
"pause" : MessageLookupByLibrary.simpleMessage("暂停"),
|
||||
"play" : MessageLookupByLibrary.simpleMessage("播放"),
|
||||
"playNext" : MessageLookupByLibrary.simpleMessage("下一首"),
|
||||
"playNextDes" : MessageLookupByLibrary.simpleMessage("添加节目到播放列表的顶部"),
|
||||
"playback" : MessageLookupByLibrary.simpleMessage("播放控制"),
|
||||
"player" : MessageLookupByLibrary.simpleMessage("播放器"),
|
||||
"playerHeightMed" : MessageLookupByLibrary.simpleMessage("中"),
|
||||
|
|
|
@ -1495,6 +1495,26 @@ class S {
|
|||
);
|
||||
}
|
||||
|
||||
/// `Play next`
|
||||
String get playNext {
|
||||
return Intl.message(
|
||||
'Play next',
|
||||
name: 'playNext',
|
||||
desc: 'Popup menu for episode.',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Add episode to top of the playlist`
|
||||
String get playNextDes {
|
||||
return Intl.message(
|
||||
'Add episode to top of the playlist',
|
||||
name: 'playNextDes',
|
||||
desc: 'Description for next play.',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Plugins`
|
||||
String get plugins {
|
||||
return Intl.message(
|
||||
|
|
|
@ -752,130 +752,142 @@ class ShowEpisode extends StatelessWidget {
|
|||
audio.episodeLoad(episodes[index]);
|
||||
}
|
||||
}),
|
||||
menuList.contains(1)
|
||||
? FocusedMenuItem(
|
||||
backgroundColor: context.brightness ==
|
||||
Brightness.light
|
||||
? context.primaryColor
|
||||
: context.dialogBackgroundColor,
|
||||
title: data.item2.contains(
|
||||
episodes[index].enclosureUrl)
|
||||
? Text(s.remove)
|
||||
: Text(s.later),
|
||||
trailingIcon: Icon(
|
||||
LineIcons.clock_solid,
|
||||
color: Colors.cyan,
|
||||
),
|
||||
onPressed: () {
|
||||
if (!data.item2.contains(
|
||||
episodes[index].enclosureUrl)) {
|
||||
audio
|
||||
.addToPlaylist(episodes[index]);
|
||||
Fluttertoast.showToast(
|
||||
msg: s.toastAddPlaylist,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
} else {
|
||||
audio.delFromPlaylist(
|
||||
episodes[index]);
|
||||
Fluttertoast.showToast(
|
||||
msg: s.toastRemovePlaylist,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
}
|
||||
})
|
||||
: null,
|
||||
menuList.contains(2)
|
||||
? FocusedMenuItem(
|
||||
backgroundColor: context.brightness ==
|
||||
Brightness.light
|
||||
? context.primaryColor
|
||||
: context.dialogBackgroundColor,
|
||||
title: isLiked
|
||||
? Text(s.unlike)
|
||||
: Text(s.like),
|
||||
trailingIcon: Icon(LineIcons.heart,
|
||||
color: Colors.red, size: 21),
|
||||
onPressed: () async {
|
||||
if (isLiked) {
|
||||
await _setUnliked(
|
||||
episodes[index].enclosureUrl);
|
||||
audio.setEpisodeState = true;
|
||||
Fluttertoast.showToast(
|
||||
msg: s.unliked,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
} else {
|
||||
await _saveLiked(
|
||||
episodes[index].enclosureUrl);
|
||||
audio.setEpisodeState = true;
|
||||
Fluttertoast.showToast(
|
||||
msg: s.liked,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
}
|
||||
})
|
||||
: null,
|
||||
menuList.contains(3)
|
||||
? FocusedMenuItem(
|
||||
backgroundColor: context.brightness ==
|
||||
Brightness.light
|
||||
? context.primaryColor
|
||||
: context.dialogBackgroundColor,
|
||||
title: isListened > 0
|
||||
? Text(s.listened,
|
||||
style: TextStyle(
|
||||
color: context.textColor
|
||||
.withOpacity(0.5)))
|
||||
: Text(
|
||||
s.markListened,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
trailingIcon: SizedBox(
|
||||
width: 23,
|
||||
height: 23,
|
||||
child: CustomPaint(
|
||||
painter: ListenedAllPainter(
|
||||
Colors.blue,
|
||||
stroke: 1.5)),
|
||||
),
|
||||
onPressed: () async {
|
||||
if (isListened < 1) {
|
||||
await _markListened(
|
||||
episodes[index]);
|
||||
audio.setEpisodeState = true;
|
||||
Fluttertoast.showToast(
|
||||
msg: s.markListened,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
}
|
||||
})
|
||||
: null,
|
||||
menuList.contains(4)
|
||||
? FocusedMenuItem(
|
||||
backgroundColor: context.brightness ==
|
||||
Brightness.light
|
||||
? context.primaryColor
|
||||
: context.dialogBackgroundColor,
|
||||
title: isDownloaded
|
||||
? Text(s.downloaded,
|
||||
style: TextStyle(
|
||||
color: context.textColor
|
||||
.withOpacity(0.5)))
|
||||
: Text(s.download),
|
||||
trailingIcon: Icon(
|
||||
LineIcons.download_solid,
|
||||
color: Colors.green),
|
||||
onPressed: () {
|
||||
if (!isDownloaded) {
|
||||
_requestDownload(context,
|
||||
episode: episodes[index]);
|
||||
// downloader
|
||||
// .startTask(episodes[index]);
|
||||
}
|
||||
})
|
||||
: null
|
||||
if (menuList.contains(1))
|
||||
FocusedMenuItem(
|
||||
backgroundColor:
|
||||
context.brightness == Brightness.light
|
||||
? context.primaryColor
|
||||
: context.dialogBackgroundColor,
|
||||
title: data.item2.contains(
|
||||
episodes[index].enclosureUrl)
|
||||
? Text(s.remove)
|
||||
: Text(s.later),
|
||||
trailingIcon: Icon(
|
||||
LineIcons.clock_solid,
|
||||
color: Colors.cyan,
|
||||
),
|
||||
onPressed: () {
|
||||
if (!data.item2.contains(
|
||||
episodes[index].enclosureUrl)) {
|
||||
audio.addToPlaylist(episodes[index]);
|
||||
Fluttertoast.showToast(
|
||||
msg: s.toastAddPlaylist,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
} else {
|
||||
audio
|
||||
.delFromPlaylist(episodes[index]);
|
||||
Fluttertoast.showToast(
|
||||
msg: s.toastRemovePlaylist,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
}
|
||||
}),
|
||||
if (menuList.contains(2))
|
||||
FocusedMenuItem(
|
||||
backgroundColor:
|
||||
context.brightness == Brightness.light
|
||||
? context.primaryColor
|
||||
: context.dialogBackgroundColor,
|
||||
title: isLiked
|
||||
? Text(s.unlike)
|
||||
: Text(s.like),
|
||||
trailingIcon: Icon(LineIcons.heart,
|
||||
color: Colors.red, size: 21),
|
||||
onPressed: () async {
|
||||
if (isLiked) {
|
||||
await _setUnliked(
|
||||
episodes[index].enclosureUrl);
|
||||
audio.setEpisodeState = true;
|
||||
Fluttertoast.showToast(
|
||||
msg: s.unliked,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
} else {
|
||||
await _saveLiked(
|
||||
episodes[index].enclosureUrl);
|
||||
audio.setEpisodeState = true;
|
||||
Fluttertoast.showToast(
|
||||
msg: s.liked,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
}
|
||||
}),
|
||||
if (menuList.contains(3))
|
||||
FocusedMenuItem(
|
||||
backgroundColor:
|
||||
context.brightness == Brightness.light
|
||||
? context.primaryColor
|
||||
: context.dialogBackgroundColor,
|
||||
title: isListened > 0
|
||||
? Text(s.listened,
|
||||
style: TextStyle(
|
||||
color: context.textColor
|
||||
.withOpacity(0.5)))
|
||||
: Text(
|
||||
s.markListened,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
trailingIcon: SizedBox(
|
||||
width: 23,
|
||||
height: 23,
|
||||
child: CustomPaint(
|
||||
painter: ListenedAllPainter(
|
||||
Colors.blue,
|
||||
stroke: 1.5)),
|
||||
),
|
||||
onPressed: () async {
|
||||
if (isListened < 1) {
|
||||
await _markListened(episodes[index]);
|
||||
audio.setEpisodeState = true;
|
||||
Fluttertoast.showToast(
|
||||
msg: s.markListened,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
}
|
||||
}),
|
||||
if (menuList.contains(4))
|
||||
FocusedMenuItem(
|
||||
backgroundColor:
|
||||
context.brightness == Brightness.light
|
||||
? context.primaryColor
|
||||
: context.dialogBackgroundColor,
|
||||
title: isDownloaded
|
||||
? Text(s.downloaded,
|
||||
style: TextStyle(
|
||||
color: context.textColor
|
||||
.withOpacity(0.5)))
|
||||
: Text(s.download),
|
||||
trailingIcon: Icon(
|
||||
LineIcons.download_solid,
|
||||
color: Colors.green),
|
||||
onPressed: () {
|
||||
if (!isDownloaded) {
|
||||
_requestDownload(context,
|
||||
episode: episodes[index]);
|
||||
// downloader
|
||||
// .startTask(episodes[index]);
|
||||
}
|
||||
}),
|
||||
if (menuList.contains(5))
|
||||
FocusedMenuItem(
|
||||
backgroundColor:
|
||||
context.brightness == Brightness.light
|
||||
? context.primaryColor
|
||||
: context.dialogBackgroundColor,
|
||||
title: Text(s.playNext),
|
||||
trailingIcon: Icon(
|
||||
LineIcons.bolt_solid,
|
||||
color: Colors.amber,
|
||||
),
|
||||
onPressed: () {
|
||||
audio.moveToTop(episodes[index]);
|
||||
Fluttertoast.showToast(
|
||||
msg: s.playNextDes,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
}),
|
||||
],
|
||||
action: () => Navigator.push(
|
||||
context,
|
||||
|
|
|
@ -364,6 +364,14 @@
|
|||
"@playerHeightTall": {},
|
||||
"playing": "Playing",
|
||||
"@playing": {},
|
||||
"playNext": "Play next",
|
||||
"@playNext": {
|
||||
"description": "Popup menu for episode."
|
||||
},
|
||||
"playNextDes": "Add episode to top of the playlist",
|
||||
"@playNextDes": {
|
||||
"description": "Description for next play."
|
||||
},
|
||||
"plugins": "Plugins",
|
||||
"@plugins": {},
|
||||
"podcast": "{count, plural, zero{} one{Podcast} other{Podcasts}}",
|
||||
|
|
|
@ -364,6 +364,14 @@
|
|||
"@playerHeightTall": {},
|
||||
"playing": "Reproduciendo",
|
||||
"@playing": {},
|
||||
"playNext": "",
|
||||
"@playNext": {
|
||||
"description": "Popup menu for episode."
|
||||
},
|
||||
"playNextDes": "",
|
||||
"@playNextDes": {
|
||||
"description": "Description for next play."
|
||||
},
|
||||
"plugins": "Plugins",
|
||||
"@plugins": {},
|
||||
"podcast": "{count, plural, zero{} one{Podcast} other{Podcasts}}",
|
||||
|
|
|
@ -364,6 +364,14 @@
|
|||
"@playerHeightTall": {},
|
||||
"playing": "En cours",
|
||||
"@playing": {},
|
||||
"playNext": "",
|
||||
"@playNext": {
|
||||
"description": "Popup menu for episode."
|
||||
},
|
||||
"playNextDes": "",
|
||||
"@playNextDes": {
|
||||
"description": "Description for next play."
|
||||
},
|
||||
"plugins": "Plugins",
|
||||
"@plugins": {},
|
||||
"podcast": "{count, plural, zero{} one{Podcast} other{Podcasts}}",
|
||||
|
|
|
@ -364,6 +364,14 @@
|
|||
"@playerHeightTall": {},
|
||||
"playing": "In riproduzione",
|
||||
"@playing": {},
|
||||
"playNext": "",
|
||||
"@playNext": {
|
||||
"description": "Popup menu for episode."
|
||||
},
|
||||
"playNextDes": "",
|
||||
"@playNextDes": {
|
||||
"description": "Description for next play."
|
||||
},
|
||||
"plugins": "Plugin",
|
||||
"@plugins": {},
|
||||
"podcast": "{count, plural, zero{} one{Podcast} other{Podcast}}",
|
||||
|
|
|
@ -364,6 +364,14 @@
|
|||
"@playerHeightTall": {},
|
||||
"playing": "Em reprodução",
|
||||
"@playing": {},
|
||||
"playNext": "",
|
||||
"@playNext": {
|
||||
"description": "Popup menu for episode."
|
||||
},
|
||||
"playNextDes": "",
|
||||
"@playNextDes": {
|
||||
"description": "Description for next play."
|
||||
},
|
||||
"plugins": "Plugins",
|
||||
"@plugins": {},
|
||||
"podcast": "{count, plural, zero{} one{Podcast} other{Podcasts}}",
|
||||
|
|
|
@ -364,6 +364,14 @@
|
|||
"@playerHeightTall": {},
|
||||
"playing": "正在播放",
|
||||
"@playing": {},
|
||||
"playNext": "下一首",
|
||||
"@playNext": {
|
||||
"description": "Popup menu for episode."
|
||||
},
|
||||
"playNextDes": "添加节目到播放列表的顶部",
|
||||
"@playNextDes": {
|
||||
"description": "Description for next play."
|
||||
},
|
||||
"plugins": "插件",
|
||||
"@plugins": {},
|
||||
"podcast": "{count, plural, zero{} other{播客}}",
|
||||
|
|
|
@ -132,9 +132,10 @@ class KeyValueStorage {
|
|||
Future<List<int>> getMenu() async {
|
||||
var prefs = await SharedPreferences.getInstance();
|
||||
if (prefs.getStringList(key) == null || prefs.getStringList(key).isEmpty) {
|
||||
await prefs.setStringList(key, ['0', '1', '2', '13', '14']);
|
||||
await prefs.setStringList(key, ['0', '1', '2', '13', '14', '15']);
|
||||
}
|
||||
var list = prefs.getStringList(key);
|
||||
if(list.length == 5) list = [...list,'15'];
|
||||
return list.map(int.parse).toList();
|
||||
}
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ class _PopupMenuSettingState extends State<PopupMenuSetting> {
|
|||
)),
|
||||
FutureBuilder<List<int>>(
|
||||
future: _getEpisodeMenu(),
|
||||
initialData: [0, 1, 12, 13, 14],
|
||||
initialData: [0, 1, 12, 13, 14, 15],
|
||||
builder: (context, snapshot) {
|
||||
var menu = snapshot.data;
|
||||
return Expanded(
|
||||
|
@ -206,8 +206,15 @@ class _PopupMenuSettingState extends State<PopupMenuSetting> {
|
|||
text: s.download,
|
||||
description: s.popupMenuDownloadDes);
|
||||
break;
|
||||
case 5:
|
||||
return _popupMenuItem(menu, e,
|
||||
icon: Icon(LineIcons.bolt_solid,
|
||||
color: Colors.amber,),
|
||||
text: s.playNext,
|
||||
description: s.playNextDes);
|
||||
break;
|
||||
default:
|
||||
return Text('Text');
|
||||
return Center();
|
||||
break;
|
||||
}
|
||||
}).toList(),
|
||||
|
|
|
@ -666,139 +666,152 @@ class EpisodeGrid extends StatelessWidget {
|
|||
audio.episodeLoad(episodes[index]);
|
||||
}
|
||||
}),
|
||||
menuList.contains(1)
|
||||
? FocusedMenuItem(
|
||||
backgroundColor: context.brightness ==
|
||||
Brightness.light
|
||||
? context.primaryColor
|
||||
: context.dialogBackgroundColor,
|
||||
title: data.item2.contains(
|
||||
episodes[index].enclosureUrl)
|
||||
? Text(s.remove)
|
||||
: Text(s.later),
|
||||
trailingIcon: Icon(
|
||||
LineIcons.clock_solid,
|
||||
color: Colors.cyan,
|
||||
),
|
||||
onPressed: () {
|
||||
if (!data.item2.contains(
|
||||
episodes[index].enclosureUrl)) {
|
||||
audio.addToPlaylist(
|
||||
episodes[index]);
|
||||
Fluttertoast.showToast(
|
||||
msg: s.toastAddPlaylist,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
} else {
|
||||
audio.delFromPlaylist(
|
||||
episodes[index]);
|
||||
Fluttertoast.showToast(
|
||||
msg: s.toastRemovePlaylist,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
}
|
||||
})
|
||||
: null,
|
||||
menuList.contains(2)
|
||||
? FocusedMenuItem(
|
||||
backgroundColor: context.brightness ==
|
||||
Brightness.light
|
||||
? context.primaryColor
|
||||
: context.dialogBackgroundColor,
|
||||
title: isLiked
|
||||
? Text(s.unlike)
|
||||
: Text(s.like),
|
||||
trailingIcon: Icon(LineIcons.heart,
|
||||
color: Colors.red, size: 21),
|
||||
onPressed: () async {
|
||||
if (isLiked) {
|
||||
await _setUnliked(
|
||||
episodes[index].enclosureUrl);
|
||||
audio.setEpisodeState = true;
|
||||
Fluttertoast.showToast(
|
||||
msg: s.unliked,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
} else {
|
||||
await _saveLiked(
|
||||
episodes[index].enclosureUrl);
|
||||
audio.setEpisodeState = true;
|
||||
Fluttertoast.showToast(
|
||||
msg: s.liked,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
}
|
||||
})
|
||||
: null,
|
||||
menuList.contains(3)
|
||||
? FocusedMenuItem(
|
||||
backgroundColor: context.brightness ==
|
||||
Brightness.light
|
||||
? context.primaryColor
|
||||
: context.dialogBackgroundColor,
|
||||
title: isListened > 0
|
||||
? Text(s.markNotListened,
|
||||
style: TextStyle(
|
||||
color: context.textColor
|
||||
.withOpacity(0.5)))
|
||||
: Text(
|
||||
s.markListened,
|
||||
maxLines: 1,
|
||||
overflow:
|
||||
TextOverflow.ellipsis,
|
||||
),
|
||||
trailingIcon: SizedBox(
|
||||
width: 23,
|
||||
height: 23,
|
||||
child: CustomPaint(
|
||||
painter: ListenedAllPainter(
|
||||
Colors.blue,
|
||||
stroke: 1.5)),
|
||||
),
|
||||
onPressed: () async {
|
||||
if (isListened < 1) {
|
||||
await _markListened(
|
||||
episodes[index]);
|
||||
audio.setEpisodeState = true;
|
||||
Fluttertoast.showToast(
|
||||
msg: s.markListened,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
} else {
|
||||
await _markNotListened(
|
||||
episodes[index].enclosureUrl);
|
||||
audio.setEpisodeState = true;
|
||||
Fluttertoast.showToast(
|
||||
msg: s.markNotListened,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
}
|
||||
})
|
||||
: null,
|
||||
menuList.contains(4)
|
||||
? FocusedMenuItem(
|
||||
backgroundColor: context.brightness ==
|
||||
Brightness.light
|
||||
? context.primaryColor
|
||||
: context.dialogBackgroundColor,
|
||||
title: isDownloaded
|
||||
? Text(s.downloaded,
|
||||
style: TextStyle(
|
||||
color: context.textColor
|
||||
.withOpacity(0.5)))
|
||||
: Text(s.download),
|
||||
trailingIcon: Icon(
|
||||
LineIcons.download_solid,
|
||||
color: Colors.green),
|
||||
onPressed: () async {
|
||||
if (!isDownloaded) {
|
||||
await _requestDownload(context,
|
||||
episode: episodes[index]);
|
||||
// downloader
|
||||
// .startTask(episodes[index]);
|
||||
}
|
||||
})
|
||||
: null
|
||||
if (menuList.contains(1))
|
||||
FocusedMenuItem(
|
||||
backgroundColor: context.brightness ==
|
||||
Brightness.light
|
||||
? context.primaryColor
|
||||
: context.dialogBackgroundColor,
|
||||
title: data.item2.contains(
|
||||
episodes[index].enclosureUrl)
|
||||
? Text(s.remove)
|
||||
: Text(s.later),
|
||||
trailingIcon: Icon(
|
||||
LineIcons.clock_solid,
|
||||
color: Colors.cyan,
|
||||
),
|
||||
onPressed: () {
|
||||
if (!data.item2.contains(
|
||||
episodes[index].enclosureUrl)) {
|
||||
audio
|
||||
.addToPlaylist(episodes[index]);
|
||||
Fluttertoast.showToast(
|
||||
msg: s.toastAddPlaylist,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
} else {
|
||||
audio.delFromPlaylist(
|
||||
episodes[index]);
|
||||
Fluttertoast.showToast(
|
||||
msg: s.toastRemovePlaylist,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
}
|
||||
}),
|
||||
if (menuList.contains(2))
|
||||
FocusedMenuItem(
|
||||
backgroundColor: context.brightness ==
|
||||
Brightness.light
|
||||
? context.primaryColor
|
||||
: context.dialogBackgroundColor,
|
||||
title: isLiked
|
||||
? Text(s.unlike)
|
||||
: Text(s.like),
|
||||
trailingIcon: Icon(LineIcons.heart,
|
||||
color: Colors.red, size: 21),
|
||||
onPressed: () async {
|
||||
if (isLiked) {
|
||||
await _setUnliked(
|
||||
episodes[index].enclosureUrl);
|
||||
audio.setEpisodeState = true;
|
||||
Fluttertoast.showToast(
|
||||
msg: s.unliked,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
} else {
|
||||
await _saveLiked(
|
||||
episodes[index].enclosureUrl);
|
||||
audio.setEpisodeState = true;
|
||||
Fluttertoast.showToast(
|
||||
msg: s.liked,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
}
|
||||
}),
|
||||
if (menuList.contains(3))
|
||||
FocusedMenuItem(
|
||||
backgroundColor: context.brightness ==
|
||||
Brightness.light
|
||||
? context.primaryColor
|
||||
: context.dialogBackgroundColor,
|
||||
title: isListened > 0
|
||||
? Text(s.markNotListened,
|
||||
style: TextStyle(
|
||||
color: context.textColor
|
||||
.withOpacity(0.5)))
|
||||
: Text(
|
||||
s.markListened,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
trailingIcon: SizedBox(
|
||||
width: 23,
|
||||
height: 23,
|
||||
child: CustomPaint(
|
||||
painter: ListenedAllPainter(
|
||||
Colors.blue,
|
||||
stroke: 1.5)),
|
||||
),
|
||||
onPressed: () async {
|
||||
if (isListened < 1) {
|
||||
await _markListened(
|
||||
episodes[index]);
|
||||
audio.setEpisodeState = true;
|
||||
Fluttertoast.showToast(
|
||||
msg: s.markListened,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
} else {
|
||||
await _markNotListened(
|
||||
episodes[index].enclosureUrl);
|
||||
audio.setEpisodeState = true;
|
||||
Fluttertoast.showToast(
|
||||
msg: s.markNotListened,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
}
|
||||
}),
|
||||
if (menuList.contains(4))
|
||||
FocusedMenuItem(
|
||||
backgroundColor: context.brightness ==
|
||||
Brightness.light
|
||||
? context.primaryColor
|
||||
: context.dialogBackgroundColor,
|
||||
title: isDownloaded
|
||||
? Text(s.downloaded,
|
||||
style: TextStyle(
|
||||
color: context.textColor
|
||||
.withOpacity(0.5)))
|
||||
: Text(s.download),
|
||||
trailingIcon: Icon(
|
||||
LineIcons.download_solid,
|
||||
color: Colors.green),
|
||||
onPressed: () async {
|
||||
if (!isDownloaded) {
|
||||
await _requestDownload(context,
|
||||
episode: episodes[index]);
|
||||
// downloader
|
||||
// .startTask(episodes[index]);
|
||||
}
|
||||
}),
|
||||
if (menuList.contains(5))
|
||||
FocusedMenuItem(
|
||||
backgroundColor: context.brightness ==
|
||||
Brightness.light
|
||||
? context.primaryColor
|
||||
: context.dialogBackgroundColor,
|
||||
title: Text(s.playNext),
|
||||
trailingIcon: Icon(
|
||||
LineIcons.bolt_solid,
|
||||
color: Colors.amber,
|
||||
),
|
||||
onPressed: () {
|
||||
audio.moveToTop(episodes[index]);
|
||||
Fluttertoast.showToast(
|
||||
msg: s.playNextDes,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
}),
|
||||
],
|
||||
action: action,
|
||||
child: _episodeCard(context,
|
||||
|
|
Loading…
Reference in New Issue