mirror of
https://github.com/stonega/tsacdop
synced 2025-02-17 20:10:37 +01:00
Chang rss and link layout.
This commit is contained in:
parent
a34b9f3a8a
commit
f36ae4f486
@ -180,6 +180,7 @@ class _PodcastDetailState extends State<PodcastDetail> {
|
|||||||
|
|
||||||
Future<Tuple2<String, List<PodcastHost>>> _getHosts(
|
Future<Tuple2<String, List<PodcastHost>>> _getHosts(
|
||||||
PodcastLocal podcastLocal) async {
|
PodcastLocal podcastLocal) async {
|
||||||
|
if (!podcastLocal.provider.contains('fireside')) return Tuple2('', []);
|
||||||
var data = FiresideData(podcastLocal.id, podcastLocal.link);
|
var data = FiresideData(podcastLocal.id, podcastLocal.link);
|
||||||
await data.getData();
|
await data.getData();
|
||||||
var backgroundImage = data.background;
|
var backgroundImage = data.background;
|
||||||
@ -220,110 +221,134 @@ class _PodcastDetailState extends State<PodcastDetail> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _podcastLink(
|
||||||
|
{String title, Widget child, VoidCallback onTap, Color backgroundColor}) {
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.fromLTRB(5, 10, 5, 0),
|
||||||
|
width: 60.0,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
InkWell(
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
onTap: onTap,
|
||||||
|
child: CircleAvatar(
|
||||||
|
radius: 20,
|
||||||
|
child: child,
|
||||||
|
backgroundColor: backgroundColor.withOpacity(0.5),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 4),
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: TextStyle(fontWeight: FontWeight.bold),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
maxLines: 2,
|
||||||
|
overflow: TextOverflow.fade,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
Widget _hostsList(BuildContext context, PodcastLocal podcastLocal) {
|
Widget _hostsList(BuildContext context, PodcastLocal podcastLocal) {
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
if (podcastLocal.provider.contains('fireside'))
|
FutureBuilder(
|
||||||
FutureBuilder(
|
future: _getHosts(podcastLocal),
|
||||||
future: _getHosts(podcastLocal),
|
builder: (context, snapshot) {
|
||||||
builder: (context, snapshot) {
|
//if (snapshot.hasData) {
|
||||||
if (snapshot.hasData) {
|
//var hosts = snapshot.data.item2;
|
||||||
var hosts = snapshot.data.item2;
|
//var backgroundImage = snapshot.data.item1;
|
||||||
var backgroundImage = snapshot.data.item1;
|
// CachedNetworkImage(
|
||||||
return CachedNetworkImage(
|
// imageUrl: backgroundImage,
|
||||||
imageUrl: backgroundImage,
|
// errorWidget: (context, url, error) => Center(),
|
||||||
errorWidget: (context, url, error) => Center(),
|
// imageBuilder: (context, backgroundImageProvider) =>
|
||||||
imageBuilder: (context, backgroundImageProvider) =>
|
// Container(
|
||||||
Container(
|
// // decoration: BoxDecoration(
|
||||||
// decoration: BoxDecoration(
|
// // image: DecorationImage(
|
||||||
// image: DecorationImage(
|
// // image: backgroundImageProvider,
|
||||||
// image: backgroundImageProvider,
|
// // fit: BoxFit.cover)),
|
||||||
// fit: BoxFit.cover)),
|
// alignment: Alignment.centerRight,
|
||||||
alignment: Alignment.centerRight,
|
return Container(
|
||||||
child: Container(
|
width: double.infinity,
|
||||||
//color: Colors.black26,
|
alignment: Alignment.centerLeft,
|
||||||
padding: EdgeInsets.symmetric(vertical: 5.0),
|
child: SingleChildScrollView(
|
||||||
width: double.infinity,
|
scrollDirection: Axis.horizontal,
|
||||||
alignment: Alignment.centerLeft,
|
child: Row(
|
||||||
child: SingleChildScrollView(
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
scrollDirection: Axis.horizontal,
|
children: [
|
||||||
child: Row(
|
_podcastLink(
|
||||||
|
title: 'Link',
|
||||||
|
child: Icon(Icons.link, size: 30),
|
||||||
|
backgroundColor: Colors.green[600],
|
||||||
|
onTap: () => widget.podcastLocal.link.launchUrl),
|
||||||
|
_podcastLink(
|
||||||
|
title: 'Rss',
|
||||||
|
child: Icon(LineIcons.rss_square_solid, size: 30),
|
||||||
|
backgroundColor: Colors.blue[600],
|
||||||
|
onTap: () => widget.podcastLocal.rssUrl.launchUrl),
|
||||||
|
if (snapshot.hasData)
|
||||||
|
...snapshot.data.item2
|
||||||
|
.map<Widget>((host) {
|
||||||
|
final image = host.image == KDefaultAvatar
|
||||||
|
? KDefaultAvatar
|
||||||
|
: host.image;
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.fromLTRB(5, 10, 5, 0),
|
||||||
|
width: 60.0,
|
||||||
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: hosts
|
mainAxisSize: MainAxisSize.min,
|
||||||
.map<Widget>((host) {
|
children: <Widget>[
|
||||||
final image =
|
CachedNetworkImage(
|
||||||
host.image == KDefaultAvatar
|
imageUrl: image,
|
||||||
? KDefaultAvatar
|
progressIndicatorBuilder:
|
||||||
: host.image;
|
(context, url, downloadProgress) =>
|
||||||
return Container(
|
CircleAvatar(
|
||||||
padding: EdgeInsets.all(5.0),
|
backgroundColor:
|
||||||
width: 80.0,
|
Colors.cyan[600].withOpacity(0.5),
|
||||||
child: Column(
|
child: SizedBox(
|
||||||
mainAxisAlignment:
|
width: 30,
|
||||||
MainAxisAlignment.center,
|
height: 2,
|
||||||
mainAxisSize: MainAxisSize.min,
|
child: LinearProgressIndicator(
|
||||||
children: <Widget>[
|
value:
|
||||||
CachedNetworkImage(
|
downloadProgress.progress),
|
||||||
imageUrl: image,
|
),
|
||||||
progressIndicatorBuilder:
|
),
|
||||||
(context, url,
|
errorWidget: (context, url, error) =>
|
||||||
downloadProgress) =>
|
CircleAvatar(
|
||||||
SizedBox(
|
backgroundColor: Colors.grey[400],
|
||||||
width: 40,
|
backgroundImage:
|
||||||
height: 2,
|
AssetImage('assets/fireside.jpg'),
|
||||||
child: LinearProgressIndicator(
|
),
|
||||||
value:
|
imageBuilder: (context, hostImage) =>
|
||||||
downloadProgress
|
CircleAvatar(
|
||||||
.progress),
|
backgroundColor:
|
||||||
),
|
Colors.grey[400],
|
||||||
errorWidget:
|
backgroundImage: hostImage),
|
||||||
(context, url, error) =>
|
),
|
||||||
CircleAvatar(
|
SizedBox(height: 4),
|
||||||
backgroundColor:
|
Text(
|
||||||
Colors.grey[400],
|
host.name,
|
||||||
backgroundImage: AssetImage(
|
style: TextStyle(
|
||||||
'assets/fireside.jpg'),
|
fontWeight: FontWeight.bold),
|
||||||
),
|
textAlign: TextAlign.center,
|
||||||
imageBuilder: (context,
|
maxLines: 2,
|
||||||
hostImage) =>
|
overflow: TextOverflow.fade,
|
||||||
CircleAvatar(
|
),
|
||||||
backgroundColor:
|
],
|
||||||
Colors
|
),
|
||||||
.grey[400],
|
);
|
||||||
backgroundImage:
|
})
|
||||||
hostImage),
|
.toList()
|
||||||
),
|
.cast<Widget>()
|
||||||
Padding(
|
]),
|
||||||
padding: EdgeInsets.all(2),
|
),
|
||||||
),
|
);
|
||||||
Text(
|
}),
|
||||||
host.name,
|
|
||||||
style: TextStyle(
|
|
||||||
fontWeight:
|
|
||||||
FontWeight.bold
|
|
||||||
// backgroundColor: Colors
|
|
||||||
// .black
|
|
||||||
// .withOpacity(0.5),
|
|
||||||
//color: Colors.white,
|
|
||||||
),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
maxLines: 2,
|
|
||||||
overflow: TextOverflow.fade,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
));
|
|
||||||
})
|
|
||||||
.toList()
|
|
||||||
.cast<Widget>()),
|
|
||||||
),
|
|
||||||
)),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return Center();
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.fromLTRB(15, 10, 15, 10),
|
padding: EdgeInsets.fromLTRB(15, 10, 15, 10),
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
@ -753,7 +778,32 @@ class _PodcastDetailState extends State<PodcastDetail> {
|
|||||||
slivers: <Widget>[
|
slivers: <Widget>[
|
||||||
SliverAppBar(
|
SliverAppBar(
|
||||||
brightness: Brightness.dark,
|
brightness: Brightness.dark,
|
||||||
actions: <Widget>[_rightTopMenu(context)],
|
actions: <Widget>[
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: widget.podcastLocal.primaryColor
|
||||||
|
.colorizedark()
|
||||||
|
.withOpacity(0.6),
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
),
|
||||||
|
child: IconButton(
|
||||||
|
icon: Icon(Icons.more_vert),
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
splashRadius: 20,
|
||||||
|
tooltip: s.menu,
|
||||||
|
onPressed: () => generalSheet(
|
||||||
|
context,
|
||||||
|
title: widget.podcastLocal.title,
|
||||||
|
child: PodcastSetting(
|
||||||
|
podcastLocal: widget.podcastLocal),
|
||||||
|
).then((value) {
|
||||||
|
_checkPodcast();
|
||||||
|
setState(() {});
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
//_rightTopMenu(context)
|
||||||
|
],
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
iconTheme: IconThemeData(
|
iconTheme: IconThemeData(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user