From 7a43dd90581ae742589019075108042f039f1367 Mon Sep 17 00:00:00 2001 From: Stonegate Date: Sat, 2 Jan 2021 18:48:55 +0800 Subject: [PATCH] Minor ui update. --- lib/playlists/playlist_home.dart | 11 +-- lib/podcasts/podcast_detail.dart | 94 ++++++++++++++++---------- lib/widgets/audiopanel.dart | 7 ++ lib/widgets/custom_widget.dart | 55 +++++++++++++++ lib/widgets/dismissible_container.dart | 12 +++- 5 files changed, 136 insertions(+), 43 deletions(-) diff --git a/lib/playlists/playlist_home.dart b/lib/playlists/playlist_home.dart index e4ae724..8279a44 100644 --- a/lib/playlists/playlist_home.dart +++ b/lib/playlists/playlist_home.dart @@ -67,6 +67,7 @@ class _PlaylistHomeState extends State { child: Scaffold( appBar: AppBar( leading: CustomBackButton(), + centerTitle: true, title: Selector( selector: (_, audio) => audio.episode, builder: (_, data, __) { @@ -218,10 +219,10 @@ class _PlaylistHomeState extends State { 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>( 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() .playlistLoad(queue); }, - child: Text('Play')) + child: Text(s.play)) ], ) ], diff --git a/lib/podcasts/podcast_detail.dart b/lib/podcasts/podcast_detail.dart index b0f9bb3..8e9a583 100644 --- a/lib/podcasts/podcast_detail.dart +++ b/lib/podcasts/podcast_detail.dart @@ -780,6 +780,10 @@ class _PodcastDetailState extends State { brightness: Brightness.dark, actions: [ 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 { 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 { // 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: [ - 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: [ + 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), + ], + ), ), ), ), diff --git a/lib/widgets/audiopanel.dart b/lib/widgets/audiopanel.dart index 3226ff7..b6c7c43 100644 --- a/lib/widgets/audiopanel.dart +++ b/lib/widgets/audiopanel.dart @@ -138,6 +138,13 @@ class AudioPanelState extends State 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( diff --git a/lib/widgets/custom_widget.dart b/lib/widgets/custom_widget.dart index 24f2763..4fc3e2c 100644 --- a/lib/widgets/custom_widget.dart +++ b/lib/widgets/custom_widget.dart @@ -1393,3 +1393,58 @@ class _SleepTimerPickerState extends State { )); } } + +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 + 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(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, + ), + ); + } +} diff --git a/lib/widgets/dismissible_container.dart b/lib/widgets/dismissible_container.dart index 42921a8..963ad7e 100644 --- a/lib/widgets/dismissible_container.dart +++ b/lib/widgets/dismissible_container.dart @@ -101,6 +101,7 @@ class _DismissibleContainerState extends State { child: EpisodeCard( widget.episode, isPlaying: false, + canReorder: true, onTap: () async { await context .read() @@ -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),