mirror of
https://github.com/stonega/tsacdop
synced 2025-02-18 04:20:37 +01:00
Reorder bug fixed.
This commit is contained in:
parent
b90970f92e
commit
058e97a8f2
@ -288,6 +288,30 @@ class LastPosition extends StatelessWidget {
|
|||||||
textColor: data ? Colors.white : null,
|
textColor: data ? Colors.white : null,
|
||||||
onPressed: () => audio.setSkipSilence(skipSilence: !data))),
|
onPressed: () => audio.setSkipSilence(skipSilence: !data))),
|
||||||
SizedBox(width: 10),
|
SizedBox(width: 10),
|
||||||
|
Selector<AudioPlayerNotifier, bool>(
|
||||||
|
selector: (_, audio) => audio.boostVolume,
|
||||||
|
builder: (_, data, __) => FlatButton(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Icon(Icons.flash_on, size: 18),
|
||||||
|
SizedBox(width: 5),
|
||||||
|
Text('Boost Volume'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
color: data ? context.accentColor : Colors.transparent,
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(100.0),
|
||||||
|
side: BorderSide(
|
||||||
|
color: data
|
||||||
|
? context.accentColor
|
||||||
|
: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.onSurface
|
||||||
|
.withOpacity(0.12))),
|
||||||
|
textColor: data ? Colors.white : null,
|
||||||
|
onPressed: () => audio.setBoostVolume(boostVolume: !data))),
|
||||||
|
SizedBox(width: 10),
|
||||||
FutureBuilder<PlayHistory>(
|
FutureBuilder<PlayHistory>(
|
||||||
future: getPosition(episode),
|
future: getPosition(episode),
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
|
@ -41,6 +41,7 @@ class _PlaylistPageState extends State<PlaylistPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
double _topHeight;
|
double _topHeight;
|
||||||
|
List<EpisodeBrief> episodes = [];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -72,14 +73,14 @@ class _PlaylistPageState extends State<PlaylistPage> {
|
|||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: _topHeight == 60 ? Text(s.homeMenuPlaylist) : Center(),
|
title: _topHeight == 60 ? Text(s.homeMenuPlaylist) : Center(),
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
backgroundColor: Theme.of(context).primaryColor,
|
backgroundColor: context.primaryColor,
|
||||||
),
|
),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Selector<AudioPlayerNotifier, Tuple3<Playlist, bool, bool>>(
|
child: Selector<AudioPlayerNotifier, Tuple3<Playlist, bool, bool>>(
|
||||||
selector: (_, audio) =>
|
selector: (_, audio) =>
|
||||||
Tuple3(audio.queue, audio.playerRunning, audio.queueUpdate),
|
Tuple3(audio.queue, audio.playerRunning, audio.queueUpdate),
|
||||||
builder: (_, data, __) {
|
builder: (_, data, __) {
|
||||||
final episodes = data.item1.playlist;
|
episodes = data.item1.playlist;
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@ -103,10 +104,7 @@ class _PlaylistPageState extends State<PlaylistPage> {
|
|||||||
? '${s.homeMenuPlaylist}\n'
|
? '${s.homeMenuPlaylist}\n'
|
||||||
: '',
|
: '',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context)
|
color: context.textColor,
|
||||||
.textTheme
|
|
||||||
.bodyText1
|
|
||||||
.color,
|
|
||||||
fontSize: 30,
|
fontSize: 30,
|
||||||
),
|
),
|
||||||
children: <TextSpan>[
|
children: <TextSpan>[
|
||||||
@ -124,7 +122,7 @@ class _PlaylistPageState extends State<PlaylistPage> {
|
|||||||
? 'episode'
|
? 'episode'
|
||||||
: 'episodes',
|
: 'episodes',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).accentColor,
|
color: context.accentColor,
|
||||||
fontSize: 15,
|
fontSize: 15,
|
||||||
)),
|
)),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
@ -132,14 +130,14 @@ class _PlaylistPageState extends State<PlaylistPage> {
|
|||||||
_sumPlaylistLength(episodes).toString(),
|
_sumPlaylistLength(episodes).toString(),
|
||||||
style: GoogleFonts.cairo(
|
style: GoogleFonts.cairo(
|
||||||
textStyle: TextStyle(
|
textStyle: TextStyle(
|
||||||
color: Theme.of(context).accentColor,
|
color: context.accentColor,
|
||||||
fontSize: 25,
|
fontSize: 25,
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: 'mins',
|
text: 'mins',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).accentColor,
|
color: context.accentColor,
|
||||||
fontSize: 15,
|
fontSize: 15,
|
||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
@ -226,8 +224,7 @@ class _PlaylistPageState extends State<PlaylistPage> {
|
|||||||
padding: EdgeInsets.all(0),
|
padding: EdgeInsets.all(0),
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
icon: Icon(Icons.play_circle_filled,
|
icon: Icon(Icons.play_circle_filled,
|
||||||
size: 40,
|
size: 40, color: (context).accentColor),
|
||||||
color: Theme.of(context).accentColor),
|
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
audio.playlistLoad();
|
audio.playlistLoad();
|
||||||
// setState(() {});
|
// setState(() {});
|
||||||
@ -247,10 +244,11 @@ class _PlaylistPageState extends State<PlaylistPage> {
|
|||||||
if (newIndex > oldIndex) {
|
if (newIndex > oldIndex) {
|
||||||
newIndex -= 1;
|
newIndex -= 1;
|
||||||
}
|
}
|
||||||
final episodeRemove = episodes[oldIndex];
|
audio.reorderPlaylist(newIndex, oldIndex);
|
||||||
audio.delFromPlaylist(episodeRemove);
|
final episodeRemove = episodes.removeAt(oldIndex);
|
||||||
audio.addToPlaylistAt(episodeRemove, newIndex);
|
setState(() {
|
||||||
setState(() {});
|
episodes.insert(newIndex, episodeRemove);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
scrollDirection: Axis.vertical,
|
scrollDirection: Axis.vertical,
|
||||||
children: data.item2
|
children: data.item2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user