1
0
mirror of https://github.com/stonega/tsacdop synced 2025-02-26 16:27:39 +01:00

Change podcast setting ui.

This commit is contained in:
stonega 2021-01-02 22:52:28 +08:00
parent 7cf751fed0
commit b36d9f80be

View File

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