Add dot indicator in popup menu.

This commit is contained in:
stonegate 2020-07-24 23:07:46 +08:00
parent 6596566634
commit 0bff5b8f3b
5 changed files with 61 additions and 37 deletions

View File

@ -817,7 +817,10 @@ class _RecentUpdateState extends State<_RecentUpdate>
mainAxisSize: mainAxisSize:
MainAxisSize.min, MainAxisSize.min,
children: <Widget>[ children: <Widget>[
Text(_groupName), Text(_groupName ==
'All'
? s.all
: _groupName),
Padding( Padding(
padding: EdgeInsets padding: EdgeInsets
.symmetric( .symmetric(
@ -833,16 +836,29 @@ class _RecentUpdateState extends State<_RecentUpdate>
)), )),
itemBuilder: (context) => [ itemBuilder: (context) => [
PopupMenuItem( PopupMenuItem(
child: Text('All'), child: Row(children: [
Text(s.all),
Spacer(),
if (_groupName ==
'All')
DotIndicator()
]),
value: 'All') value: 'All')
]..addAll(groupList.groups ]..addAll(groupList.groups
.map< .map<
PopupMenuEntry< PopupMenuEntry<
String>>((e) => String>>(
PopupMenuItem( (e) => PopupMenuItem(
value: e.name, value: e.name,
child: child: Row(
Text(e.name))) children: [
Text(e.name),
Spacer(),
if (e.name ==
_groupName)
DotIndicator()
],
)))
.toList()), .toList()),
onSelected: (value) { onSelected: (value) {
if (value == 'All') { if (value == 'All') {
@ -862,7 +878,6 @@ class _RecentUpdateState extends State<_RecentUpdate>
}); });
} }
} }
;
} }
}, },
), ),
@ -881,17 +896,19 @@ class _RecentUpdateState extends State<_RecentUpdate>
child: IconButton( child: IconButton(
tooltip: s tooltip: s
.addNewEpisodeTooltip, .addNewEpisodeTooltip,
icon: icon: SizedBox(
// Icon(Icons.playlist_add), height: 16,
SizedBox(
height:
16,
width: 21, width: 21,
child: CustomPaint( child: CustomPaint(
painter: AddToPlaylistPainter( painter: AddToPlaylistPainter(
context.textTheme.bodyText1.color, context
Colors.red))), .textTheme
onPressed: () async { .bodyText1
.color,
Colors
.red))),
onPressed:
() async {
await audio await audio
.addNewEpisode( .addNewEpisode(
_group); _group);
@ -930,19 +947,18 @@ class _RecentUpdateState extends State<_RecentUpdate>
child: CustomPaint( child: CustomPaint(
painter: AddToPlaylistPainter( painter: AddToPlaylistPainter(
context context
.textTheme .textColor,
.bodyText1
.color,
context context
.textTheme .textColor,
.bodyText1
.color,
))), ))),
onPressed: () {}), onPressed: () {}),
); );
}), }),
Material( Material(
color: Colors.transparent, color: Colors.transparent,
clipBehavior: Clip.hardEdge,
borderRadius:
BorderRadius.circular(100),
child: IconButton( child: IconButton(
tooltip: s.changeLayout, tooltip: s.changeLayout,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
@ -1140,11 +1156,8 @@ class _MyFavoriteState extends State<_MyFavorite>
horizontal: 5), horizontal: 5),
), ),
Icon( Icon(
_sortBy == 0 LineIcons
? LineIcons .hourglass_start_solid,
.cloud_download_alt_solid
: LineIcons
.heartbeat_solid,
size: 18, size: 18,
) )
], ],
@ -1152,11 +1165,25 @@ class _MyFavoriteState extends State<_MyFavorite>
itemBuilder: (context) => [ itemBuilder: (context) => [
PopupMenuItem( PopupMenuItem(
value: 0, value: 0,
child: Text(s.updateDate), child: Row(
children: [
Text(s.updateDate),
Spacer(),
if (_sortBy == 0)
DotIndicator()
],
),
), ),
PopupMenuItem( PopupMenuItem(
value: 1, value: 1,
child: Text(s.likeDate), child: Row(
children: [
Text(s.likeDate),
Spacer(),
if (_sortBy == 1)
DotIndicator()
],
),
) )
], ],
onSelected: (value) { onSelected: (value) {

View File

@ -1,9 +1,7 @@
import 'dart:io';
import 'dart:async'; import 'dart:async';
import 'dart:math' as math; import 'dart:math' as math;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:color_thief_flutter/color_thief_flutter.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';

View File

@ -7,7 +7,6 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:html/parser.dart'; import 'package:html/parser.dart';
import 'package:tsacdop/state/download_state.dart'; import 'package:tsacdop/state/download_state.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:fluttertoast/fluttertoast.dart'; import 'package:fluttertoast/fluttertoast.dart';
import 'package:flutter_linkify/flutter_linkify.dart'; import 'package:flutter_linkify/flutter_linkify.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -465,6 +464,8 @@ class _PodcastDetailState extends State<PodcastDetail> {
SizedBox(width: 5), SizedBox(width: 5),
Icon( Icon(
LineIcons.filter_solid, LineIcons.filter_solid,
color:
_filter != Filter.all ? context.accentColor : null,
size: 18, size: 18,
) )
], ],

View File

@ -1,7 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:line_icons/line_icons.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import '../util/extension_helper.dart'; import '../util/extension_helper.dart';

View File

@ -5,7 +5,6 @@ import 'package:flutter/material.dart';
import 'package:focused_menu/focused_menu.dart'; import 'package:focused_menu/focused_menu.dart';
import 'package:focused_menu/modals.dart'; import 'package:focused_menu/modals.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:intl/intl.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:tuple/tuple.dart'; import 'package:tuple/tuple.dart';
import 'package:line_icons/line_icons.dart'; import 'package:line_icons/line_icons.dart';