From 0bff5b8f3b912e876f016eb69111da7e11e8e7f8 Mon Sep 17 00:00:00 2001 From: stonegate Date: Fri, 24 Jul 2020 23:07:46 +0800 Subject: [PATCH] Add dot indicator in popup menu. --- lib/home/home.dart | 91 +++++++++++++++++++++----------- lib/home/search_podcast.dart | 2 - lib/podcasts/podcast_detail.dart | 3 +- lib/settings/languages.dart | 1 - lib/util/episodegrid.dart | 1 - 5 files changed, 61 insertions(+), 37 deletions(-) diff --git a/lib/home/home.dart b/lib/home/home.dart index c3873e6..1c031b2 100644 --- a/lib/home/home.dart +++ b/lib/home/home.dart @@ -817,7 +817,10 @@ class _RecentUpdateState extends State<_RecentUpdate> mainAxisSize: MainAxisSize.min, children: [ - Text(_groupName), + Text(_groupName == + 'All' + ? s.all + : _groupName), Padding( padding: EdgeInsets .symmetric( @@ -833,16 +836,29 @@ class _RecentUpdateState extends State<_RecentUpdate> )), itemBuilder: (context) => [ PopupMenuItem( - child: Text('All'), + child: Row(children: [ + Text(s.all), + Spacer(), + if (_groupName == + 'All') + DotIndicator() + ]), value: 'All') ]..addAll(groupList.groups .map< - PopupMenuEntry< - String>>((e) => - PopupMenuItem( + PopupMenuEntry< + String>>( + (e) => PopupMenuItem( value: e.name, - child: - Text(e.name))) + child: Row( + children: [ + Text(e.name), + Spacer(), + if (e.name == + _groupName) + DotIndicator() + ], + ))) .toList()), onSelected: (value) { if (value == 'All') { @@ -862,7 +878,6 @@ class _RecentUpdateState extends State<_RecentUpdate> }); } } - ; } }, ), @@ -881,17 +896,19 @@ class _RecentUpdateState extends State<_RecentUpdate> child: IconButton( tooltip: s .addNewEpisodeTooltip, - icon: - // Icon(Icons.playlist_add), - SizedBox( - height: - 16, - width: 21, - child: CustomPaint( - painter: AddToPlaylistPainter( - context.textTheme.bodyText1.color, - Colors.red))), - onPressed: () async { + icon: SizedBox( + height: 16, + width: 21, + child: CustomPaint( + painter: AddToPlaylistPainter( + context + .textTheme + .bodyText1 + .color, + Colors + .red))), + onPressed: + () async { await audio .addNewEpisode( _group); @@ -930,19 +947,18 @@ class _RecentUpdateState extends State<_RecentUpdate> child: CustomPaint( painter: AddToPlaylistPainter( context - .textTheme - .bodyText1 - .color, + .textColor, context - .textTheme - .bodyText1 - .color, + .textColor, ))), onPressed: () {}), ); }), Material( color: Colors.transparent, + clipBehavior: Clip.hardEdge, + borderRadius: + BorderRadius.circular(100), child: IconButton( tooltip: s.changeLayout, padding: EdgeInsets.zero, @@ -1140,11 +1156,8 @@ class _MyFavoriteState extends State<_MyFavorite> horizontal: 5), ), Icon( - _sortBy == 0 - ? LineIcons - .cloud_download_alt_solid - : LineIcons - .heartbeat_solid, + LineIcons + .hourglass_start_solid, size: 18, ) ], @@ -1152,11 +1165,25 @@ class _MyFavoriteState extends State<_MyFavorite> itemBuilder: (context) => [ PopupMenuItem( value: 0, - child: Text(s.updateDate), + child: Row( + children: [ + Text(s.updateDate), + Spacer(), + if (_sortBy == 0) + DotIndicator() + ], + ), ), PopupMenuItem( value: 1, - child: Text(s.likeDate), + child: Row( + children: [ + Text(s.likeDate), + Spacer(), + if (_sortBy == 1) + DotIndicator() + ], + ), ) ], onSelected: (value) { diff --git a/lib/home/search_podcast.dart b/lib/home/search_podcast.dart index fb97a98..dc02da6 100644 --- a/lib/home/search_podcast.dart +++ b/lib/home/search_podcast.dart @@ -1,9 +1,7 @@ -import 'dart:io'; import 'dart:async'; import 'dart:math' as math; import 'package:flutter/material.dart'; -import 'package:color_thief_flutter/color_thief_flutter.dart'; import 'package:dio/dio.dart'; import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; diff --git a/lib/podcasts/podcast_detail.dart b/lib/podcasts/podcast_detail.dart index 0896d70..b429935 100644 --- a/lib/podcasts/podcast_detail.dart +++ b/lib/podcasts/podcast_detail.dart @@ -7,7 +7,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:html/parser.dart'; import 'package:tsacdop/state/download_state.dart'; -import 'package:url_launcher/url_launcher.dart'; import 'package:fluttertoast/fluttertoast.dart'; import 'package:flutter_linkify/flutter_linkify.dart'; import 'package:provider/provider.dart'; @@ -465,6 +464,8 @@ class _PodcastDetailState extends State { SizedBox(width: 5), Icon( LineIcons.filter_solid, + color: + _filter != Filter.all ? context.accentColor : null, size: 18, ) ], diff --git a/lib/settings/languages.dart b/lib/settings/languages.dart index 6f370d8..593b6ff 100644 --- a/lib/settings/languages.dart +++ b/lib/settings/languages.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:intl/intl.dart'; -import 'package:line_icons/line_icons.dart'; import 'package:url_launcher/url_launcher.dart'; import '../util/extension_helper.dart'; diff --git a/lib/util/episodegrid.dart b/lib/util/episodegrid.dart index 756dcd3..6da6fb2 100644 --- a/lib/util/episodegrid.dart +++ b/lib/util/episodegrid.dart @@ -5,7 +5,6 @@ import 'package:flutter/material.dart'; import 'package:focused_menu/focused_menu.dart'; import 'package:focused_menu/modals.dart'; import 'package:google_fonts/google_fonts.dart'; -import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; import 'package:tuple/tuple.dart'; import 'package:line_icons/line_icons.dart';