Minor change.

This commit is contained in:
stonega 2021-02-17 23:25:23 +08:00
parent 927907b78f
commit 97406a1ddb
3 changed files with 25 additions and 14 deletions

View File

@ -5,12 +5,12 @@ import 'package:flutter/services.dart';
import 'package:flutter_downloader/flutter_downloader.dart'; import 'package:flutter_downloader/flutter_downloader.dart';
import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:tsacdop/playlists/playlist_home.dart';
import 'package:tuple/tuple.dart'; import 'package:tuple/tuple.dart';
import 'generated/l10n.dart'; import 'generated/l10n.dart';
import 'home/home.dart'; import 'home/home.dart';
import 'intro_slider/app_intro.dart'; import 'intro_slider/app_intro.dart';
import 'playlists/playlist_home.dart';
import 'state/audio_state.dart'; import 'state/audio_state.dart';
import 'state/download_state.dart'; import 'state/download_state.dart';
import 'state/podcast_group.dart'; import 'state/podcast_group.dart';

View File

@ -282,12 +282,13 @@ class AudioPlayerNotifier extends ChangeNotifier {
await _playlist.getPlaylist(); await _playlist.getPlaylist();
if (state[1] != '') { if (state[1] != '') {
var episode = await _dbHelper.getRssItemWithUrl(state[1]); var episode = await _dbHelper.getRssItemWithUrl(state[1]);
if (episode != null && ((!_playlist.isQueue && if (episode != null &&
episode != null && ((!_playlist.isQueue &&
_playlist.contains(episode)) || episode != null &&
(_playlist.isQueue && _playlist.contains(episode)) ||
_queue.isNotEmpty && (_playlist.isQueue &&
_queue.episodes.first.title == episode.title))) { _queue.isNotEmpty &&
_queue.episodes.first.title == episode.title))) {
_episode = episode; _episode = episode;
_lastPosition = int.parse(state[2] ?? '0'); _lastPosition = int.parse(state[2] ?? '0');
if (_lastPosition > 0) { if (_lastPosition > 0) {
@ -745,6 +746,9 @@ class AudioPlayerNotifier extends ChangeNotifier {
} }
notifyListeners(); notifyListeners();
_savePlaylists(); _savePlaylists();
if (playlist.isLocal) {
_dbHelper.deleteLocalEpisodes(playlist.episodeList);
}
} }
void addEpisodesToPlaylist(Playlist playlist, {List<EpisodeBrief> episodes}) { void addEpisodesToPlaylist(Playlist playlist, {List<EpisodeBrief> episodes}) {
@ -1115,7 +1119,11 @@ class AudioPlayerTask extends BackgroundAudioTask {
} }
await AudioServiceBackground.setQueue(_queue); await AudioServiceBackground.setQueue(_queue);
} else { } else {
_index += 1; if (_index == _queue.length - 1) {
_index = 0;
} else {
_index += 1;
}
} }
if (_queue.length == 0 || _stopAtEnd) { if (_queue.length == 0 || _stopAtEnd) {

View File

@ -39,8 +39,8 @@ class _DismissibleContainerState extends State<DismissibleContainer> {
color: Colors.transparent, color: Colors.transparent,
) )
: Column( : Column(
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0), padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Dismissible( child: Dismissible(
key: ValueKey('${widget.episode.enclosureUrl}dis'), key: ValueKey('${widget.episode.enclosureUrl}dis'),
@ -116,8 +116,8 @@ class _DismissibleContainerState extends State<DismissibleContainer> {
), ),
), ),
Divider(height: 1) Divider(height: 1)
], ],
), ),
); );
} }
} }
@ -129,12 +129,14 @@ class EpisodeCard extends StatelessWidget {
final bool isPlaying; final bool isPlaying;
final bool canReorder; final bool canReorder;
final bool showDivider; final bool showDivider;
final bool havePadding;
const EpisodeCard(this.episode, const EpisodeCard(this.episode,
{this.tileColor, {this.tileColor,
this.onTap, this.onTap,
this.isPlaying, this.isPlaying,
this.canReorder = false, this.canReorder = false,
this.showDivider = true, this.showDivider = true,
this.havePadding = false,
Key key}) Key key})
: assert(episode != null), : assert(episode != null),
super(key: key); super(key: key);
@ -165,8 +167,9 @@ class EpisodeCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
if (canReorder) Icon(Icons.unfold_more, color: c), if (canReorder && !havePadding)
SizedBox(width: canReorder ? 0 : 24), Icon(Icons.unfold_more, color: c),
SizedBox(width: canReorder && !havePadding ? 0 : 24),
CircleAvatar( CircleAvatar(
backgroundColor: c.withOpacity(0.5), backgroundColor: c.withOpacity(0.5),
backgroundImage: episode.avatarImage), backgroundImage: episode.avatarImage),