Minor ui update.

This commit is contained in:
Stonegate 2021-01-02 18:48:55 +08:00
parent 48ca171ada
commit 7a43dd9058
5 changed files with 136 additions and 43 deletions

View File

@ -67,6 +67,7 @@ class _PlaylistHomeState extends State<PlaylistHome> {
child: Scaffold(
appBar: AppBar(
leading: CustomBackButton(),
centerTitle: true,
title: Selector<AudioPlayerNotifier, EpisodeBrief>(
selector: (_, audio) => audio.episode,
builder: (_, data, __) {
@ -218,10 +219,10 @@ class _PlaylistHomeState extends State<PlaylistHome> {
icon: Icon(Icons.history),
label: 'History',
color: Colors.green,
isSelected: _selected == 'Histtory',
isSelected: _selected == 'History',
onTap: () => setState(() {
_body = _History();
_selected = 'Histtory';
_selected = 'History';
})),
_tabWidget(
icon: Icon(Icons.playlist_play),
@ -284,6 +285,7 @@ class __QueueState extends State<_Queue> {
return EpisodeCard(episode,
key: ValueKey('playing'),
isPlaying: true,
canReorder: true,
tileColor: context.primaryColorDark);
}
}).toList()
@ -610,6 +612,7 @@ class __PlaylistsState extends State<_Playlists> {
@override
Widget build(BuildContext context) {
final s = context.s;
return Selector<AudioPlayerNotifier, List<Playlist>>(
selector: (_, audio) => audio.playlists,
builder: (_, data, __) {
@ -628,7 +631,7 @@ class __PlaylistsState extends State<_Playlists> {
fullscreenDialog: true,
builder: (context) =>
PlaylistDetail(data[index])),
);
).then((value) => setState(() {}));
},
child: Padding(
padding: const EdgeInsets.all(15.0),
@ -680,7 +683,7 @@ class __PlaylistsState extends State<_Playlists> {
.read<AudioPlayerNotifier>()
.playlistLoad(queue);
},
child: Text('Play'))
child: Text(s.play))
],
)
],

View File

@ -780,6 +780,10 @@ class _PodcastDetailState extends State<PodcastDetail> {
brightness: Brightness.dark,
actions: <Widget>[
Container(
width: 30,
height: 30,
margin:
EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
color: widget.podcastLocal.primaryColor
.colorizedark()
@ -789,7 +793,7 @@ class _PodcastDetailState extends State<PodcastDetail> {
child: IconButton(
icon: Icon(Icons.more_vert),
padding: EdgeInsets.zero,
splashRadius: 20,
splashRadius: 15,
tooltip: s.menu,
onPressed: () => generalSheet(
context,
@ -836,42 +840,60 @@ class _PodcastDetailState extends State<PodcastDetail> {
// return Center();
// }),
// ),
InkWell(
onTap: () => setState(
() => _showInfo = !_showInfo),
child: Container(
margin: EdgeInsets.only(
top: 100 + context.paddingTop),
padding: EdgeInsets.only(
left: 80, right: 20),
color: Colors.white10,
alignment: Alignment.centerLeft,
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Text(
widget.podcastLocal
.author ??
'',
maxLines: 1,
overflow:
TextOverflow.ellipsis,
style: TextStyle(
color: Colors.white)),
if (widget.podcastLocal.provider
.isNotEmpty)
Text(
s.hostedOn(widget
.podcastLocal.provider),
maxLines: 1,
style: TextStyle(
color: Colors.white),
Padding(
padding: EdgeInsets.only(
top: 100 + context.paddingTop),
child: InkWell(
onTap: () => setState(
() => _showInfo = !_showInfo),
child: Container(
padding: EdgeInsets.only(
left: 80, right: 130),
color: Colors.white10,
alignment: Alignment.centerLeft,
child: Row(
children: [
Expanded(
child: Column(
mainAxisAlignment:
MainAxisAlignment
.start,
mainAxisSize:
MainAxisSize.min,
crossAxisAlignment:
CrossAxisAlignment
.start,
children: <Widget>[
Text(
widget.podcastLocal
.author ??
'',
maxLines: 1,
overflow:
TextOverflow
.ellipsis,
style: TextStyle(
color: Colors
.white)),
if (widget
.podcastLocal
.provider
.isNotEmpty)
Text(
s.hostedOn(widget
.podcastLocal
.provider),
maxLines: 1,
style: TextStyle(
color: Colors
.white),
),
],
),
),
],
UpDownIndicator(_showInfo, color: Colors.white),
],
),
),
),
),

View File

@ -138,6 +138,13 @@ class AudioPanelState extends State<AudioPanel> with TickerProviderStateMixin {
? Colors.grey[400].withOpacity(0.5)
: Colors.grey[800],
),
BoxShadow(
offset: Offset(1, 0),
blurRadius: 1,
color: context.brightness == Brightness.light
? Colors.grey[400].withOpacity(0.5)
: Colors.grey[800],
),
],
),
child: SingleChildScrollView(

View File

@ -1393,3 +1393,58 @@ class _SleepTimerPickerState extends State<SleepTimerPicker> {
));
}
}
class UpDownIndicator extends StatefulWidget {
final bool status;
final Color color;
UpDownIndicator(this.status, {this.color = Colors.white, Key key})
: super(key: key);
@override
_UpDownIndicatorState createState() => _UpDownIndicatorState();
}
class _UpDownIndicatorState extends State<UpDownIndicator>
with SingleTickerProviderStateMixin {
double _value;
AnimationController _controller;
Animation _animation;
@override
void initState() {
super.initState();
_value = 0;
_controller =
AnimationController(vsync: this, duration: Duration(milliseconds: 300));
_animation = Tween<double>(begin: 0.0, end: 1.0).animate(_controller)
..addListener(() {
setState(() {
_value = _animation.value;
});
});
}
@override
void didUpdateWidget(covariant UpDownIndicator oldWidget) {
if (widget.status != oldWidget.status) {
widget.status ? _controller.forward() : _controller.reverse();
}
super.didUpdateWidget(oldWidget);
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Transform.rotate(
angle: widget.status ? -math.pi * _value : math.pi * _value,
child: Icon(
Icons.keyboard_arrow_down,
color: widget.color,
),
);
}
}

View File

@ -101,6 +101,7 @@ class _DismissibleContainerState extends State<DismissibleContainer> {
child: EpisodeCard(
widget.episode,
isPlaying: false,
canReorder: true,
onTap: () async {
await context
.read<AudioPlayerNotifier>()
@ -192,8 +193,13 @@ class EpisodeCard extends StatelessWidget {
final Color tileColor;
final VoidCallback onTap;
final bool isPlaying;
final bool canReorder;
const EpisodeCard(this.episode,
{this.tileColor, this.onTap, this.isPlaying, Key key})
{this.tileColor,
this.onTap,
this.isPlaying,
this.canReorder = false,
Key key})
: super(key: key);
@override
@ -223,8 +229,8 @@ class EpisodeCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
// Icon(Icons.unfold_more, color: c),
SizedBox(width: 24),
if (canReorder) Icon(Icons.unfold_more, color: c),
SizedBox(width: canReorder ? 0 : 24),
CircleAvatar(
backgroundColor: c.withOpacity(0.5),
backgroundImage: episode.avatarImage),