Change podcast setting ui.

This commit is contained in:
stonega 2021-01-02 22:52:28 +08:00
parent 7cf751fed0
commit b36d9f80be
1 changed files with 249 additions and 258 deletions

View File

@ -173,53 +173,45 @@ class __PodcastCardState extends State<_PodcastCard>
Widget build(BuildContext context) {
final c = widget.podcastLocal.backgroudColor(context);
final s = context.s;
var width = context.width;
var groupList = context.watch<GroupList>();
_belongGroups = groupList.getPodcastGroup(widget.podcastLocal.id);
return Container(
decoration: BoxDecoration(
border: Border(
bottom: Divider.createBorderSide(context),
),
),
child: Column(
return Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
InkWell(
Material(
color: Colors.transparent,
child: InkWell(
onTap: () => setState(() => _addGroup = !_addGroup),
child: Container(
padding: EdgeInsets.symmetric(horizontal: 12),
child: SizedBox(
height: 100,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.unfold_more,
color: c,
),
SizedBox(width: 5),
CircleAvatar(
radius: 30,
child:
Image.file(File("${widget.podcastLocal.imagePath}")),
radius: 25,
backgroundImage: widget.podcastLocal.avatarImage,
),
SizedBox(width: 10),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
alignment: Alignment.centerLeft,
child: Text(
Text(
widget.podcastLocal.title,
maxLines: 2,
overflow: TextOverflow.fade,
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 15),
),
),
Row(
children: _belongGroups.map((group) {
return Container(
@ -246,23 +238,24 @@ class __PodcastCardState extends State<_PodcastCard>
child: PodcastSetting(
podcastLocal: widget.podcastLocal),
).then((value) {
setState(() {});
if (mounted) setState(() {});
})),
SizedBox(width: 10),
]),
),
),
),
!_addGroup
? Center()
: Container(
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
border: Border(
bottom: BorderSide(
color: Theme.of(context).primaryColorDark),
top: BorderSide(
color: Theme.of(context).primaryColorDark))),
color: context.scaffoldBackgroundColor,
),
// border: Border(
// bottom: BorderSide(
// color: Theme.of(context).primaryColorDark),
// top: BorderSide(
// color: Theme.of(context).primaryColorDark))),
height: 50,
child: _addGroup
? Row(
@ -279,8 +272,7 @@ class __PodcastCardState extends State<_PodcastCard>
child: FilterChip(
key: ValueKey<String>(group.id),
label: Text(group.name),
selected:
_selectedGroups.contains(group),
selected: _selectedGroups.contains(group),
onSelected: (value) {
setState(() {
if (!value) {
@ -295,18 +287,22 @@ class __PodcastCardState extends State<_PodcastCard>
}).toList()),
),
),
SizedBox(
width: 100,
Material(
color: Colors.transparent,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
IconButton(
icon: Icon(Icons.clear),
splashRadius: 20,
onPressed: () => setState(() {
_addGroup = false;
}),
),
IconButton(
icon: Icon(Icons.done),
splashRadius: 20,
onPressed: () async {
if (_selectedGroups.length > 0) {
setState(() {
@ -327,7 +323,6 @@ class __PodcastCardState extends State<_PodcastCard>
);
}
},
icon: Icon(Icons.done),
),
],
),
@ -347,8 +342,7 @@ class __PodcastCardState extends State<_PodcastCard>
},
tooltip: s.groups(0)),
FutureBuilder<bool>(
future:
_getAutoDownload(widget.podcastLocal.id),
future: _getAutoDownload(widget.podcastLocal.id),
initialData: false,
builder: (context, snapshot) {
return _buttonOnMenu(
@ -377,16 +371,14 @@ class __PodcastCardState extends State<_PodcastCard>
tooltip: s.autoDownload,
onTap: () async {
await _setAutoDownload(
widget.podcastLocal.id,
!snapshot.data);
widget.podcastLocal.id, !snapshot.data);
setState(() {});
},
);
},
),
FutureBuilder<int>(
future:
_getSkipSecond(widget.podcastLocal.id),
future: _getSkipSecond(widget.podcastLocal.id),
initialData: 0,
builder: (context, snapshot) {
return _buttonOnMenu(
@ -433,8 +425,7 @@ class __PodcastCardState extends State<_PodcastCard>
child: Text(
s.confirm,
style: TextStyle(
color:
context.accentColor),
color: context.accentColor),
),
)
],
@ -484,8 +475,8 @@ class __PodcastCardState extends State<_PodcastCard>
),
),
),
Divider(height: 1)
],
),
);
}
}
@ -573,12 +564,12 @@ class _RenameGroupState extends State<RenameGroup> {
hintStyle: TextStyle(fontSize: 18),
filled: true,
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).accentColor, width: 2.0),
borderSide:
BorderSide(color: context.accentColor, width: 2.0),
),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).accentColor, width: 2.0),
borderSide:
BorderSide(color: context.accentColor, width: 2.0),
),
),
cursorRadius: Radius.circular(2),