diff --git a/lib/episodes/episodedetail.dart b/lib/episodes/episodedetail.dart index 86d60fb..007d4e2 100644 --- a/lib/episodes/episodedetail.dart +++ b/lib/episodes/episodedetail.dart @@ -241,23 +241,25 @@ class _MenuBarState extends State { ), ), (_like == 0 && !_liked) - ? IconButton( - icon: Icon( - Icons.favorite_border, - color: Colors.grey[700], + ? InkWell( + onTap: () => saveLiked(widget.episodeItem.title), + child: Container( + padding: EdgeInsets.symmetric(horizontal: 10.0), + child: Icon( + Icons.favorite_border, + color: Colors.grey[700], + ), ), - onPressed: () { - saveLiked(widget.episodeItem.title); - }, ) - : IconButton( - icon: Icon( - Icons.favorite, - color: Colors.red, + : InkWell( + onTap: () => setUnliked(widget.episodeItem.title), + child: Container( + padding: EdgeInsets.symmetric(horizontal: 10.0), + child: Icon( + Icons.favorite, + color: Colors.red, + ), ), - onPressed: () { - setUnliked(widget.episodeItem.title); - }, ), DownloadButton(episodeBrief: widget.episodeItem), IconButton( @@ -519,4 +521,4 @@ class _ImageRotateState extends State ), ); } -} \ No newline at end of file +} diff --git a/lib/home/appbar/addpodcast.dart b/lib/home/appbar/addpodcast.dart index 8f796e0..5bd08b2 100644 --- a/lib/home/appbar/addpodcast.dart +++ b/lib/home/appbar/addpodcast.dart @@ -8,6 +8,7 @@ import 'package:dio/dio.dart'; import 'package:provider/provider.dart'; import 'package:path_provider/path_provider.dart'; import 'package:image/image.dart' as img; +import 'package:fluttertoast/fluttertoast.dart'; import 'package:tsacdop/class/importompl.dart'; import 'package:tsacdop/class/searchpodcast.dart'; @@ -221,8 +222,8 @@ class _SearchResultState extends State { print(_p.title); var dir = await getApplicationDocumentsDirectory(); - - Response> imageResponse = await Dio().get>( + try{ + Response> imageResponse = await Dio().get>( _p.itunes.image.href, options: Options(responseType: ResponseType.bytes)); @@ -246,6 +247,13 @@ class _SearchResultState extends State { importOmpl.importState = ImportState.complete; importOmpl.importState = ImportState.stop; print('fatch data'); + } + catch(e){ + Fluttertoast.showToast( + msg: 'Network error, Subscribe failed', + gravity: ToastGravity.BOTTOM, + ); + } } return Container( diff --git a/lib/home/audio_player.dart b/lib/home/audio_player.dart index 69ddfcb..0c79cdf 100644 --- a/lib/home/audio_player.dart +++ b/lib/home/audio_player.dart @@ -9,6 +9,7 @@ import 'package:audiofileplayer/audio_system.dart'; import 'package:logging/logging.dart'; import 'package:flutter/material.dart'; import 'package:marquee/marquee.dart'; +import 'package:path_provider/path_provider.dart'; import 'package:flutter_downloader/flutter_downloader.dart'; import 'package:tsacdop/class/audiostate.dart'; @@ -250,7 +251,8 @@ class _PlayerWidgetState extends State { 'playnow', likeButtonId, 'ic_stat_play_circle_filled'); Future _setNotification() async { - final Uint8List imageBytes = await _networkImageToByte(_imgurl); + var dir = await getApplicationDocumentsDirectory(); + final Uint8List imageBytes = File('${dir.path}/$_feedtitle.png').readAsBytesSync(); AudioSystem.instance.setMetadata(AudioMetadata( title: _title, artist: _feedtitle, @@ -288,8 +290,9 @@ class _PlayerWidgetState extends State { Provider.of(context, listen: false).audioState = AudioState.play; }); - - final Uint8List imageBytes = await _networkImageToByte(_imgurl); + var dir = await getApplicationDocumentsDirectory(); + final Uint8List imageBytes = File('${dir.path}/$_feedtitle.png').readAsBytesSync(); + //final Uint8List imageBytes = await _networkImageToByte(_imgurl); AudioSystem.instance.setMetadata(AudioMetadata( title: _title, artist: _feedtitle, diff --git a/lib/podcasts/podcastlist.dart b/lib/podcasts/podcastlist.dart index da75c22..e2b0196 100644 --- a/lib/podcasts/podcastlist.dart +++ b/lib/podcasts/podcastlist.dart @@ -10,6 +10,7 @@ import 'package:path_provider/path_provider.dart'; import 'package:tsacdop/class/podcastlocal.dart'; import 'package:tsacdop/class/sqflite_localpodcast.dart'; import 'package:tsacdop/podcasts/podcastdetail.dart'; +import 'package:tsacdop/util/pageroute.dart'; class AboutPodcast extends StatefulWidget { final PodcastLocal podcastLocal; @@ -118,10 +119,10 @@ class _PodcastListState extends State { onTap: () { Navigator.push( context, - MaterialPageRoute( - builder: (context) => PodcastDetail( - podcastLocal: snapshot.data[index], - )), + ScaleRoute( + page: PodcastDetail( + podcastLocal: snapshot.data[index], + )), ); }, onLongPress: () { @@ -145,8 +146,8 @@ class _PodcastListState extends State { child: Container( height: 120.0, width: 120.0, - child: Image.file( - File("${dir.path}/${snapshot.data[index].title}.png")), + child: Image.file(File( + "${dir.path}/${snapshot.data[index].title}.png")), ), ), Container( diff --git a/lib/util/episodegrid.dart b/lib/util/episodegrid.dart index 5bf8f21..02dce14 100644 --- a/lib/util/episodegrid.dart +++ b/lib/util/episodegrid.dart @@ -4,7 +4,6 @@ import 'dart:isolate'; import 'dart:ui'; import 'package:flutter/material.dart'; -import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter_downloader/flutter_downloader.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:path_provider/path_provider.dart';