modified: lib/home/home.dart
modified: lib/util/episodegrid.dart
This commit is contained in:
parent
d23502ed97
commit
f5e6308de6
|
@ -485,187 +485,199 @@ class _RecentUpdateState extends State<_RecentUpdate>
|
|||
child: Container(
|
||||
height: 40,
|
||||
color: context.primaryColor,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Consumer<GroupList>(
|
||||
builder:
|
||||
(context, groupList, child) =>
|
||||
Material(
|
||||
color: Colors.transparent,
|
||||
child: PopupMenuButton<String>(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius:
|
||||
BorderRadius.all(
|
||||
Radius.circular(10))),
|
||||
elevation: 1,
|
||||
tooltip: 'Groups fliter',
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 20),
|
||||
height: 50,
|
||||
child: Row(
|
||||
mainAxisSize:
|
||||
MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(_groupName),
|
||||
Padding(
|
||||
padding: EdgeInsets
|
||||
.symmetric(
|
||||
horizontal: 5),
|
||||
),
|
||||
Icon(
|
||||
LineIcons.filter_solid,
|
||||
size: 18,
|
||||
)
|
||||
],
|
||||
)),
|
||||
itemBuilder: (context) => [
|
||||
PopupMenuItem(
|
||||
child: Text('All'),
|
||||
value: 'All')
|
||||
]..addAll(groupList.groups
|
||||
.map<PopupMenuEntry<String>>(
|
||||
(e) => PopupMenuItem(
|
||||
value: e.name,
|
||||
child: Text(e.name)))
|
||||
.toList()),
|
||||
onSelected: (value) {
|
||||
if (value == 'All') {
|
||||
setState(() {
|
||||
_groupName = 'All';
|
||||
_group = ['All'];
|
||||
});
|
||||
} else {
|
||||
groupList.groups
|
||||
.forEach((group) {
|
||||
if (group.name == value) {
|
||||
setState(() {
|
||||
_groupName = value;
|
||||
_group =
|
||||
group.podcastList;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Consumer<GroupList>(
|
||||
builder:
|
||||
(context, groupList, child) =>
|
||||
Material(
|
||||
color: Colors.transparent,
|
||||
child: PopupMenuButton<String>(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius:
|
||||
BorderRadius.all(
|
||||
Radius.circular(
|
||||
10))),
|
||||
elevation: 1,
|
||||
tooltip: 'Groups fliter',
|
||||
child: Container(
|
||||
padding:
|
||||
EdgeInsets.symmetric(
|
||||
horizontal: 20),
|
||||
height: 50,
|
||||
child: Row(
|
||||
mainAxisSize:
|
||||
MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(_groupName),
|
||||
Padding(
|
||||
padding: EdgeInsets
|
||||
.symmetric(
|
||||
horizontal:
|
||||
5),
|
||||
),
|
||||
Icon(
|
||||
LineIcons
|
||||
.filter_solid,
|
||||
size: 18,
|
||||
)
|
||||
],
|
||||
)),
|
||||
itemBuilder: (context) => [
|
||||
PopupMenuItem(
|
||||
child: Text('All'),
|
||||
value: 'All')
|
||||
]..addAll(groupList.groups
|
||||
.map<
|
||||
PopupMenuEntry<
|
||||
String>>((e) =>
|
||||
PopupMenuItem(
|
||||
value: e.name,
|
||||
child:
|
||||
Text(e.name)))
|
||||
.toList()),
|
||||
onSelected: (value) {
|
||||
if (value == 'All') {
|
||||
setState(() {
|
||||
_groupName = 'All';
|
||||
_group = ['All'];
|
||||
});
|
||||
} else {
|
||||
groupList.groups
|
||||
.forEach((group) {
|
||||
if (group.name == value) {
|
||||
setState(() {
|
||||
_groupName = value;
|
||||
_group =
|
||||
group.podcastList;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
FutureBuilder<int>(
|
||||
future: _getUpdateCounts(_group),
|
||||
initialData: 0,
|
||||
builder: (context, snapshot) {
|
||||
return snapshot.data != 0
|
||||
? Material(
|
||||
color: Colors.transparent,
|
||||
child: IconButton(
|
||||
tooltip:
|
||||
'Add new episodes to playlist',
|
||||
icon:
|
||||
// Icon(Icons.playlist_add),
|
||||
SizedBox(
|
||||
height: 16,
|
||||
width: 21,
|
||||
child: CustomPaint(
|
||||
painter: AddToPlaylistPainter(
|
||||
context
|
||||
.textTheme
|
||||
.bodyText1
|
||||
.color,
|
||||
Colors
|
||||
.red))),
|
||||
onPressed: () async {
|
||||
await audio
|
||||
.addNewEpisode(
|
||||
_group);
|
||||
if (mounted)
|
||||
setState(() {});
|
||||
Fluttertoast
|
||||
.showToast(
|
||||
msg: _groupName ==
|
||||
'All'
|
||||
? '${snapshot.data} episode added to playlist'
|
||||
: '${snapshot.data} episode in $_groupName added to playlist',
|
||||
gravity:
|
||||
ToastGravity
|
||||
.BOTTOM,
|
||||
);
|
||||
}),
|
||||
)
|
||||
: Material(
|
||||
color: Colors.transparent,
|
||||
child: IconButton(
|
||||
tooltip:
|
||||
'Add new episodes to playlist',
|
||||
icon:
|
||||
// Icon(Icons.playlist_add),
|
||||
SizedBox(
|
||||
height: 16,
|
||||
width: 21,
|
||||
child:
|
||||
CustomPaint(
|
||||
painter:
|
||||
AddToPlaylistPainter(
|
||||
context
|
||||
.textTheme
|
||||
.bodyText1
|
||||
.color,
|
||||
context
|
||||
.textTheme
|
||||
.bodyText1
|
||||
.color,
|
||||
))),
|
||||
onPressed: () {}),
|
||||
);
|
||||
}),
|
||||
Material(
|
||||
color: Colors.transparent,
|
||||
child: IconButton(
|
||||
tooltip: 'Change layout',
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: () {
|
||||
if (_layout == Layout.three)
|
||||
setState(() {
|
||||
_layout = Layout.two;
|
||||
});
|
||||
else
|
||||
setState(() {
|
||||
_layout = Layout.three;
|
||||
});
|
||||
},
|
||||
icon: _layout == Layout.three
|
||||
? SizedBox(
|
||||
height: 10,
|
||||
width: 30,
|
||||
child: CustomPaint(
|
||||
painter: LayoutPainter(
|
||||
0,
|
||||
context
|
||||
.textTheme
|
||||
.bodyText1
|
||||
.color),
|
||||
Spacer(),
|
||||
FutureBuilder<int>(
|
||||
future: _getUpdateCounts(_group),
|
||||
initialData: 0,
|
||||
builder: (context, snapshot) {
|
||||
return snapshot.data != 0
|
||||
? Material(
|
||||
color:
|
||||
Colors.transparent,
|
||||
child: IconButton(
|
||||
tooltip:
|
||||
'Add new episodes to playlist',
|
||||
icon:
|
||||
// Icon(Icons.playlist_add),
|
||||
SizedBox(
|
||||
height: 16,
|
||||
width: 21,
|
||||
child: CustomPaint(
|
||||
painter: AddToPlaylistPainter(
|
||||
context
|
||||
.textTheme.bodyText1.color,
|
||||
Colors
|
||||
.red))),
|
||||
onPressed:
|
||||
() async {
|
||||
await audio
|
||||
.addNewEpisode(
|
||||
_group);
|
||||
if (mounted)
|
||||
setState(() {});
|
||||
Fluttertoast
|
||||
.showToast(
|
||||
msg: _groupName ==
|
||||
'All'
|
||||
? '${snapshot.data} episode added to playlist'
|
||||
: '${snapshot.data} episode in $_groupName added to playlist',
|
||||
gravity:
|
||||
ToastGravity
|
||||
.BOTTOM,
|
||||
);
|
||||
}),
|
||||
)
|
||||
: Material(
|
||||
color:
|
||||
Colors.transparent,
|
||||
child: IconButton(
|
||||
tooltip:
|
||||
'Add new episodes to playlist',
|
||||
icon:
|
||||
// Icon(Icons.playlist_add),
|
||||
SizedBox(
|
||||
height: 16,
|
||||
width: 21,
|
||||
child: CustomPaint(
|
||||
painter: AddToPlaylistPainter(
|
||||
context
|
||||
.textTheme
|
||||
.bodyText1
|
||||
.color,
|
||||
context
|
||||
.textTheme
|
||||
.bodyText1
|
||||
.color,
|
||||
))),
|
||||
onPressed: () {}),
|
||||
);
|
||||
}),
|
||||
Material(
|
||||
color: Colors.transparent,
|
||||
child: IconButton(
|
||||
tooltip: 'Change layout',
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: () {
|
||||
if (_layout == Layout.three)
|
||||
setState(() {
|
||||
_layout = Layout.two;
|
||||
});
|
||||
else
|
||||
setState(() {
|
||||
_layout = Layout.three;
|
||||
});
|
||||
},
|
||||
icon: _layout == Layout.three
|
||||
? SizedBox(
|
||||
height: 10,
|
||||
width: 30,
|
||||
child: CustomPaint(
|
||||
painter:
|
||||
LayoutPainter(
|
||||
0,
|
||||
context
|
||||
.textTheme
|
||||
.bodyText1
|
||||
.color),
|
||||
),
|
||||
)
|
||||
: SizedBox(
|
||||
height: 10,
|
||||
width: 30,
|
||||
child: CustomPaint(
|
||||
painter:
|
||||
LayoutPainter(
|
||||
1,
|
||||
context
|
||||
.textTheme
|
||||
.bodyText1
|
||||
.color),
|
||||
),
|
||||
),
|
||||
)
|
||||
: SizedBox(
|
||||
height: 10,
|
||||
width: 30,
|
||||
child: CustomPaint(
|
||||
painter: LayoutPainter(
|
||||
1,
|
||||
context
|
||||
.textTheme
|
||||
.bodyText1
|
||||
.color),
|
||||
),
|
||||
),
|
||||
)),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
)),
|
||||
),
|
||||
EpisodeGrid(
|
||||
episodes: snapshot.data,
|
||||
layout: _layout,
|
||||
initNum: 9,
|
||||
),
|
||||
SliverList(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
|
@ -856,6 +868,7 @@ class _MyFavoriteState extends State<_MyFavorite>
|
|||
EpisodeGrid(
|
||||
episodes: snapshot.data,
|
||||
layout: _layout,
|
||||
initNum: 9,
|
||||
),
|
||||
SliverList(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
|
@ -978,6 +991,7 @@ class _MyDownloadState extends State<_MyDownload>
|
|||
: EpisodeGrid(
|
||||
episodes: episodes,
|
||||
layout: _layout,
|
||||
initNum: 9,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
|
|
@ -28,6 +28,7 @@ class EpisodeGrid extends StatelessWidget {
|
|||
final int episodeCount;
|
||||
final Layout layout;
|
||||
final bool reverse;
|
||||
final int initNum;
|
||||
Future<int> _isListened(EpisodeBrief episode) async {
|
||||
DBHelper dbHelper = DBHelper();
|
||||
return await dbHelper.isListened(episode.enclosureUrl);
|
||||
|
@ -46,6 +47,7 @@ class EpisodeGrid extends StatelessWidget {
|
|||
EpisodeGrid({
|
||||
Key key,
|
||||
@required this.episodes,
|
||||
this.initNum = 12,
|
||||
this.showDownload = false,
|
||||
this.showFavorite = false,
|
||||
this.showNumber = false,
|
||||
|
@ -148,7 +150,7 @@ class EpisodeGrid extends StatelessWidget {
|
|||
: episodes[index].primaryColor.colorizeLight();
|
||||
return FadeTransition(
|
||||
opacity: Tween<double>(
|
||||
begin: index < 12 ? 0 : 1,
|
||||
begin: index < initNum ? 0 : 1,
|
||||
end: 1,
|
||||
).animate(animation),
|
||||
child: Selector<AudioPlayerNotifier,
|
||||
|
|
Loading…
Reference in New Issue