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_localizations/flutter_localizations.dart';
import 'package:provider/provider.dart';
import 'package:tsacdop/playlists/playlist_home.dart';
import 'package:tuple/tuple.dart';
import 'generated/l10n.dart';
import 'home/home.dart';
import 'intro_slider/app_intro.dart';
import 'playlists/playlist_home.dart';
import 'state/audio_state.dart';
import 'state/download_state.dart';
import 'state/podcast_group.dart';

View File

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

View File

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