organize fold
This commit is contained in:
parent
4e01b3979f
commit
b471c15b52
|
@ -6,10 +6,9 @@ import 'package:provider/provider.dart';
|
|||
import 'package:flutter_html/flutter_html.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import 'class/audiostate.dart';
|
||||
import 'class/episodebrief.dart';
|
||||
import 'class/sqflite_localpodcast.dart';
|
||||
import 'package:tsacdop/class/audiostate.dart';
|
||||
import 'package:tsacdop/class/episodebrief.dart';
|
||||
import 'package:tsacdop/class/sqflite_localpodcast.dart';
|
||||
import 'episodedownload.dart';
|
||||
|
||||
enum DownloadState { stop, load, donwload, complete, error }
|
|
@ -8,8 +8,8 @@ import 'package:path_provider/path_provider.dart';
|
|||
import 'package:flutter_downloader/flutter_downloader.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'class/episodebrief.dart';
|
||||
import 'class/sqflite_localpodcast.dart';
|
||||
import 'package:tsacdop/class/episodebrief.dart';
|
||||
import 'package:tsacdop/class/sqflite_localpodcast.dart';
|
||||
|
||||
class DownloadButton extends StatefulWidget {
|
||||
final EpisodeBrief episodeBrief;
|
|
@ -1,20 +1,21 @@
|
|||
import 'dart:io';
|
||||
import 'dart:convert';
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:color_thief_flutter/color_thief_flutter.dart';
|
||||
import 'class/importompl.dart';
|
||||
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 'dart:convert';
|
||||
import 'dart:async';
|
||||
import 'class/searchpodcast.dart';
|
||||
import 'class/podcastlocal.dart';
|
||||
import 'class/sqflite_localpodcast.dart';
|
||||
import 'home.dart';
|
||||
|
||||
import 'package:tsacdop/class/importompl.dart';
|
||||
import 'package:tsacdop/class/searchpodcast.dart';
|
||||
import 'package:tsacdop/class/podcastlocal.dart';
|
||||
import 'package:tsacdop/class/sqflite_localpodcast.dart';
|
||||
import 'package:tsacdop/home/home.dart';
|
||||
import 'popupmenu.dart';
|
||||
import 'webfeed/webfeed.dart';
|
||||
import 'package:tsacdop/webfeed/webfeed.dart';
|
||||
|
||||
class MyHomePage extends StatefulWidget {
|
||||
@override
|
||||
|
@ -142,7 +143,7 @@ class _MyHomePageDelegate extends SearchDelegate<int> {
|
|||
margin: EdgeInsets.only(top: 400),
|
||||
child: SizedBox(
|
||||
height: 10,
|
||||
child: Image.asset(
|
||||
child: Image.asset(
|
||||
'assets/listennote.png',
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
|
@ -203,52 +204,49 @@ class _SearchResultState extends State<SearchResult> {
|
|||
return primaryColor;
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final importOmpl = Provider.of<ImportOmpl>(context);
|
||||
savePodcast(String rss) async {
|
||||
print(rss);
|
||||
if (mounted) setState(() => _adding = true);
|
||||
|
||||
importOmpl.importState =
|
||||
ImportState.import;
|
||||
print(rss);
|
||||
if (mounted) setState(() => _adding = true);
|
||||
|
||||
Response response = await Dio().get(rss);
|
||||
if (mounted) setState(() => _issubscribe = true);
|
||||
importOmpl.importState = ImportState.import;
|
||||
|
||||
var _p = RssFeed.parse(response.data);
|
||||
Response response = await Dio().get(rss);
|
||||
if (mounted) setState(() => _issubscribe = true);
|
||||
|
||||
print(_p.title);
|
||||
var dir = await getApplicationDocumentsDirectory();
|
||||
var _p = RssFeed.parse(response.data);
|
||||
|
||||
Response<List<int>> imageResponse = await Dio().get<List<int>>(
|
||||
_p.itunes.image.href,
|
||||
options: Options(responseType: ResponseType.bytes));
|
||||
print(_p.title);
|
||||
var dir = await getApplicationDocumentsDirectory();
|
||||
|
||||
img.Image image = img.decodeImage(imageResponse.data);
|
||||
img.Image thumbnail = img.copyResize(image, width: 300);
|
||||
File("${dir.path}/${_p.title}.png")
|
||||
..writeAsBytesSync(img.encodePng(thumbnail));
|
||||
Response<List<int>> imageResponse = await Dio().get<List<int>>(
|
||||
_p.itunes.image.href,
|
||||
options: Options(responseType: ResponseType.bytes));
|
||||
|
||||
String _primaryColor = await getColor(File("${dir.path}/${_p.title}.png"));
|
||||
PodcastLocal podcastLocal = PodcastLocal(
|
||||
_p.title, _p.itunes.image.href, rss, _primaryColor, _p.author);
|
||||
podcastLocal.description = _p.description;
|
||||
img.Image image = img.decodeImage(imageResponse.data);
|
||||
img.Image thumbnail = img.copyResize(image, width: 300);
|
||||
File("${dir.path}/${_p.title}.png")
|
||||
..writeAsBytesSync(img.encodePng(thumbnail));
|
||||
|
||||
String _primaryColor =
|
||||
await getColor(File("${dir.path}/${_p.title}.png"));
|
||||
PodcastLocal podcastLocal = PodcastLocal(
|
||||
_p.title, _p.itunes.image.href, rss, _primaryColor, _p.author);
|
||||
podcastLocal.description = _p.description;
|
||||
var dbHelper = DBHelper();
|
||||
await dbHelper.savePodcastLocal(podcastLocal);
|
||||
await dbHelper.savePodcastLocal(podcastLocal);
|
||||
|
||||
importOmpl.importState =
|
||||
ImportState.parse;
|
||||
importOmpl.importState = ImportState.parse;
|
||||
|
||||
await dbHelper.savePodcastRss(response.data);
|
||||
await dbHelper.savePodcastRss(response.data);
|
||||
|
||||
importOmpl.importState = ImportState.complete;
|
||||
importOmpl.importState = ImportState.stop;
|
||||
print('fatch data');
|
||||
}
|
||||
|
||||
importOmpl.importState =
|
||||
ImportState.complete;
|
||||
importOmpl.importState =
|
||||
ImportState.stop;
|
||||
print('fatch data');
|
||||
}
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12.0),
|
||||
child: ListTile(
|
||||
|
@ -270,9 +268,8 @@ class _SearchResultState extends State<SearchResult> {
|
|||
child:
|
||||
Text('Subscribe', style: TextStyle(color: Colors.blue)),
|
||||
onPressed: () {
|
||||
importOmpl.rssTitle =
|
||||
widget.onlinePodcast.title;
|
||||
savePodcast(widget.onlinePodcast.rss);
|
||||
importOmpl.rssTitle = widget.onlinePodcast.title;
|
||||
savePodcast(widget.onlinePodcast.rss);
|
||||
})
|
||||
: OutlineButton(
|
||||
child: SizedBox(
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'class/importompl.dart';
|
||||
import 'package:tsacdop/class/importompl.dart';
|
||||
|
||||
class Import extends StatelessWidget {
|
||||
@override
|
||||
|
@ -13,9 +13,7 @@ class Import extends StatelessWidget {
|
|||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 2.0,
|
||||
child: LinearProgressIndicator()),
|
||||
SizedBox(height: 2.0, child: LinearProgressIndicator()),
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20.0),
|
||||
height: 20.0,
|
||||
|
@ -28,9 +26,7 @@ class Import extends StatelessWidget {
|
|||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 2.0,
|
||||
child: LinearProgressIndicator()),
|
||||
SizedBox(height: 2.0, child: LinearProgressIndicator()),
|
||||
Container(
|
||||
height: 20.0,
|
||||
padding: EdgeInsets.symmetric(horizontal: 20.0),
|
||||
|
@ -45,8 +41,7 @@ class Import extends StatelessWidget {
|
|||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 2.0,
|
||||
child: LinearProgressIndicator()),
|
||||
height: 2.0, child: LinearProgressIndicator()),
|
||||
Container(
|
||||
height: 20.0,
|
||||
padding: EdgeInsets.symmetric(horizontal: 20.0),
|
||||
|
@ -55,23 +50,25 @@ class Import extends StatelessWidget {
|
|||
),
|
||||
],
|
||||
)
|
||||
: importOmpl.importState == ImportState.error
|
||||
? Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 2.0,
|
||||
child: LinearProgressIndicator()),
|
||||
Container(
|
||||
height: 20.0,
|
||||
padding: EdgeInsets.symmetric(horizontal: 20.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text('Error: ' + (importOmpl.rsstitle)),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Center()),
|
||||
: importOmpl.importState == ImportState.error
|
||||
? Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 2.0,
|
||||
child: LinearProgressIndicator()),
|
||||
Container(
|
||||
height: 20.0,
|
||||
padding:
|
||||
EdgeInsets.symmetric(horizontal: 20.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
child:
|
||||
Text('Error: ' + (importOmpl.rsstitle)),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Center()),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
import 'dart:io';
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
@ -9,11 +10,12 @@ import 'package:flutter/services.dart';
|
|||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:color_thief_flutter/color_thief_flutter.dart';
|
||||
import 'package:image/image.dart' as img;
|
||||
|
||||
import 'about.dart';
|
||||
import 'class/podcastlocal.dart';
|
||||
import 'class/sqflite_localpodcast.dart';
|
||||
import 'class/importompl.dart';
|
||||
import 'webfeed/webfeed.dart';
|
||||
import 'package:tsacdop/class/podcastlocal.dart';
|
||||
import 'package:tsacdop/class/sqflite_localpodcast.dart';
|
||||
import 'package:tsacdop/class/importompl.dart';
|
||||
import 'package:tsacdop/webfeed/webfeed.dart';
|
||||
|
||||
class OmplOutline {
|
||||
final String text;
|
|
@ -10,7 +10,7 @@ import 'package:logging/logging.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:marquee/marquee.dart';
|
||||
import 'package:flutter_downloader/flutter_downloader.dart';
|
||||
import 'class/audiostate.dart';
|
||||
import 'package:tsacdop/class/audiostate.dart';
|
||||
|
||||
final Logger _logger = Logger('audiofileplayer');
|
||||
|
|
@ -1,11 +1,12 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'podcastlist.dart';
|
||||
|
||||
import '../podcasts/podcastlist.dart';
|
||||
import 'hometab.dart';
|
||||
import 'importompl.dart';
|
||||
import 'package:tsacdop/home/appbar/importompl.dart';
|
||||
import 'audio_player.dart';
|
||||
import 'homescroll.dart';
|
||||
import 'pageroute.dart';
|
||||
import 'package:tsacdop/util/pageroute.dart';
|
||||
|
||||
class Home extends StatefulWidget {
|
||||
@override
|
|
@ -8,14 +8,14 @@ import 'package:provider/provider.dart';
|
|||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
import 'class/episodebrief.dart';
|
||||
import 'class/podcastlocal.dart';
|
||||
import 'class/importompl.dart';
|
||||
import 'class/sqflite_localpodcast.dart';
|
||||
import 'package:tsacdop/class/episodebrief.dart';
|
||||
import 'package:tsacdop/class/podcastlocal.dart';
|
||||
import 'package:tsacdop/class/importompl.dart';
|
||||
import 'package:tsacdop/class/sqflite_localpodcast.dart';
|
||||
|
||||
import 'episodedetail.dart';
|
||||
import 'podcastdetail.dart';
|
||||
import 'pageroute.dart';
|
||||
import 'package:tsacdop/episodes/episodedetail.dart';
|
||||
import 'package:tsacdop/podcasts/podcastdetail.dart';
|
||||
import 'package:tsacdop/util/pageroute.dart';
|
||||
|
||||
class ScrollPodcasts extends StatefulWidget {
|
||||
@override
|
|
@ -1,9 +1,9 @@
|
|||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'class/episodebrief.dart';
|
||||
import 'class/sqflite_localpodcast.dart';
|
||||
import 'episodegrid.dart';
|
||||
import 'package:tsacdop/class/episodebrief.dart';
|
||||
import 'package:tsacdop/class/sqflite_localpodcast.dart';
|
||||
import 'package:tsacdop/util/episodegrid.dart';
|
||||
|
||||
class MainTab extends StatefulWidget {
|
||||
@override
|
|
@ -2,9 +2,9 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_statusbarcolor/flutter_statusbarcolor.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:flutter_downloader/flutter_downloader.dart';
|
||||
import 'addpodcast.dart';
|
||||
import 'class/audiostate.dart';
|
||||
import 'class/importompl.dart';
|
||||
import 'package:tsacdop/home/appbar/addpodcast.dart';
|
||||
import 'package:tsacdop/class/audiostate.dart';
|
||||
import 'package:tsacdop/class/importompl.dart';
|
||||
|
||||
void main() async {
|
||||
runApp(
|
||||
|
|
|
@ -3,10 +3,10 @@ import 'package:flutter/material.dart';
|
|||
import 'package:dio/dio.dart';
|
||||
import 'dart:async';
|
||||
|
||||
import 'class/podcastlocal.dart';
|
||||
import 'class/episodebrief.dart';
|
||||
import 'class/sqflite_localpodcast.dart';
|
||||
import 'episodegrid.dart';
|
||||
import 'package:tsacdop/class/podcastlocal.dart';
|
||||
import 'package:tsacdop/class/episodebrief.dart';
|
||||
import 'package:tsacdop/class/sqflite_localpodcast.dart';
|
||||
import 'package:tsacdop/util/episodegrid.dart';
|
||||
|
||||
class PodcastDetail extends StatefulWidget {
|
||||
PodcastDetail({Key key, this.podcastLocal}) : super(key: key);
|
|
@ -5,9 +5,9 @@ import 'package:flutter/foundation.dart';
|
|||
import 'package:flutter_html/flutter_html.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
|
||||
import 'class/podcastlocal.dart';
|
||||
import 'class/sqflite_localpodcast.dart';
|
||||
import 'podcastdetail.dart';
|
||||
import 'package:tsacdop/class/podcastlocal.dart';
|
||||
import 'package:tsacdop/class/sqflite_localpodcast.dart';
|
||||
import 'package:tsacdop/podcasts/podcastdetail.dart';
|
||||
|
||||
Future<List<PodcastLocal>> getPodcastLocal() async {
|
||||
var dbHelper = DBHelper();
|
|
@ -6,9 +6,9 @@ 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 'class/episodebrief.dart';
|
||||
import 'episodedetail.dart';
|
||||
import 'pageroute.dart';
|
||||
import 'package:tsacdop/class/episodebrief.dart';
|
||||
import 'package:tsacdop/episodes/episodedetail.dart';
|
||||
import 'package:tsacdop/util/pageroute.dart';
|
||||
|
||||
class EpisodeGrid extends StatelessWidget {
|
||||
final List<EpisodeBrief> podcast;
|
Loading…
Reference in New Issue