Update layout one UI,

This commit is contained in:
stonegate 2020-10-13 00:40:25 +08:00
parent bc69276541
commit e8708535ee
1 changed files with 116 additions and 3 deletions

View File

@ -201,10 +201,10 @@ class EpisodeGrid extends StatelessWidget {
/// Circel avatar widget. /// Circel avatar widget.
Widget _circleImage(BuildContext context, Widget _circleImage(BuildContext context,
{EpisodeBrief episode, Color color, bool boo}) => {EpisodeBrief episode, Color color, bool boo, double radius}) =>
Container( Container(
height: context.width / 16, height: radius ?? context.width / 16,
width: context.width / 16, width: radius ?? context.width / 16,
child: boo child: boo
? Center() ? Center()
: CircleAvatar( : CircleAvatar(
@ -283,6 +283,14 @@ class EpisodeGrid extends StatelessWidget {
Widget _episodeCard(BuildContext context, Widget _episodeCard(BuildContext context,
{int index, Color color, bool isLiked, bool isDownloaded, bool boo}) { {int index, Color color, bool isLiked, bool isDownloaded, bool boo}) {
var width = context.width; var width = context.width;
if (layout == Layout.one) {
return _layoutOneCard(context,
index: index,
color: color,
isLiked: isLiked,
isDownloaded: isDownloaded,
boo: boo);
}
return Padding( return Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Column( child: Column(
@ -376,6 +384,111 @@ class EpisodeGrid extends StatelessWidget {
); );
} }
Widget _layoutOneCard(BuildContext context,
{int index, Color color, bool isLiked, bool isDownloaded, bool boo}) {
var width = context.width;
return Padding(
padding: EdgeInsets.symmetric(vertical: 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
flex: 1,
child: Center(
child: _circleImage(context,
episode: episodes[index],
color: color,
boo: boo,
radius: context.width / 8),
),
),
Expanded(
flex: 4,
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
flex: 1,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Expanded(
child: Text(episodes[index].feedTitle,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.bold, color: color)),
),
_isNewIndicator(episodes[index]),
_downloadIndicater(context,
episode: episodes[index], isDownloaded: isDownloaded),
_numberIndicater(context, index: index, color: color)
],
),
),
Expanded(
flex: 2,
child: Align(
alignment: Alignment.topLeft,
child: _title(episodes[index]))),
Expanded(
flex: 1,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
if (episodes[index].duration != 0)
Align(
alignment: Alignment.center,
child: Text(
episodes[index].duration.toTime,
style: TextStyle(fontSize: width / 35),
),
),
if (episodes[index].duration != 0 &&
episodes[index].enclosureLength != null &&
episodes[index].enclosureLength != 0 &&
layout != Layout.three)
Text(
'|',
style: TextStyle(
fontSize: width / 35,
),
),
if (episodes[index].enclosureLength != null &&
episodes[index].enclosureLength != 0)
Align(
alignment: Alignment.center,
child: Text(
'${(episodes[index].enclosureLength) ~/ 1000000}MB',
style: TextStyle(fontSize: width / 35),
),
),
SizedBox(width: 4),
if (isLiked)
Icon(
Icons.favorite,
color: Colors.red,
size: width / 35,
),
Spacer(),
_pubDate(context,
episode: episodes[index], color: color),
]),
)
],
),
),
SizedBox(width: 8)
],
),
);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var audio = Provider.of<AudioPlayerNotifier>(context, listen: false); var audio = Provider.of<AudioPlayerNotifier>(context, listen: false);