organize fold

This commit is contained in:
stonegate 2020-02-11 21:48:11 +08:00
parent 4e01b3979f
commit b471c15b52
15 changed files with 103 additions and 107 deletions

View File

@ -6,10 +6,9 @@ import 'package:provider/provider.dart';
import 'package:flutter_html/flutter_html.dart'; import 'package:flutter_html/flutter_html.dart';
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import 'package:tsacdop/class/audiostate.dart';
import 'class/audiostate.dart'; import 'package:tsacdop/class/episodebrief.dart';
import 'class/episodebrief.dart'; import 'package:tsacdop/class/sqflite_localpodcast.dart';
import 'class/sqflite_localpodcast.dart';
import 'episodedownload.dart'; import 'episodedownload.dart';
enum DownloadState { stop, load, donwload, complete, error } enum DownloadState { stop, load, donwload, complete, error }

View File

@ -8,8 +8,8 @@ import 'package:path_provider/path_provider.dart';
import 'package:flutter_downloader/flutter_downloader.dart'; import 'package:flutter_downloader/flutter_downloader.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:fluttertoast/fluttertoast.dart'; import 'package:fluttertoast/fluttertoast.dart';
import 'class/episodebrief.dart'; import 'package:tsacdop/class/episodebrief.dart';
import 'class/sqflite_localpodcast.dart'; import 'package:tsacdop/class/sqflite_localpodcast.dart';
class DownloadButton extends StatefulWidget { class DownloadButton extends StatefulWidget {
final EpisodeBrief episodeBrief; final EpisodeBrief episodeBrief;

View File

@ -1,20 +1,21 @@
import 'dart:io'; import 'dart:io';
import 'dart:convert';
import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:color_thief_flutter/color_thief_flutter.dart'; import 'package:color_thief_flutter/color_thief_flutter.dart';
import 'class/importompl.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'package:image/image.dart' as img; import 'package:image/image.dart' as img;
import 'dart:convert';
import 'dart:async'; import 'package:tsacdop/class/importompl.dart';
import 'class/searchpodcast.dart'; import 'package:tsacdop/class/searchpodcast.dart';
import 'class/podcastlocal.dart'; import 'package:tsacdop/class/podcastlocal.dart';
import 'class/sqflite_localpodcast.dart'; import 'package:tsacdop/class/sqflite_localpodcast.dart';
import 'home.dart'; import 'package:tsacdop/home/home.dart';
import 'popupmenu.dart'; import 'popupmenu.dart';
import 'webfeed/webfeed.dart'; import 'package:tsacdop/webfeed/webfeed.dart';
class MyHomePage extends StatefulWidget { class MyHomePage extends StatefulWidget {
@override @override
@ -203,7 +204,6 @@ class _SearchResultState extends State<SearchResult> {
return primaryColor; return primaryColor;
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final importOmpl = Provider.of<ImportOmpl>(context); final importOmpl = Provider.of<ImportOmpl>(context);
@ -211,8 +211,7 @@ class _SearchResultState extends State<SearchResult> {
print(rss); print(rss);
if (mounted) setState(() => _adding = true); if (mounted) setState(() => _adding = true);
importOmpl.importState = importOmpl.importState = ImportState.import;
ImportState.import;
Response response = await Dio().get(rss); Response response = await Dio().get(rss);
if (mounted) setState(() => _issubscribe = true); if (mounted) setState(() => _issubscribe = true);
@ -231,24 +230,23 @@ class _SearchResultState extends State<SearchResult> {
File("${dir.path}/${_p.title}.png") File("${dir.path}/${_p.title}.png")
..writeAsBytesSync(img.encodePng(thumbnail)); ..writeAsBytesSync(img.encodePng(thumbnail));
String _primaryColor = await getColor(File("${dir.path}/${_p.title}.png")); String _primaryColor =
await getColor(File("${dir.path}/${_p.title}.png"));
PodcastLocal podcastLocal = PodcastLocal( PodcastLocal podcastLocal = PodcastLocal(
_p.title, _p.itunes.image.href, rss, _primaryColor, _p.author); _p.title, _p.itunes.image.href, rss, _primaryColor, _p.author);
podcastLocal.description = _p.description; podcastLocal.description = _p.description;
var dbHelper = DBHelper(); var dbHelper = DBHelper();
await dbHelper.savePodcastLocal(podcastLocal); await dbHelper.savePodcastLocal(podcastLocal);
importOmpl.importState = importOmpl.importState = ImportState.parse;
ImportState.parse;
await dbHelper.savePodcastRss(response.data); await dbHelper.savePodcastRss(response.data);
importOmpl.importState = importOmpl.importState = ImportState.complete;
ImportState.complete; importOmpl.importState = ImportState.stop;
importOmpl.importState =
ImportState.stop;
print('fatch data'); print('fatch data');
} }
return Container( return Container(
padding: EdgeInsets.symmetric(horizontal: 12.0), padding: EdgeInsets.symmetric(horizontal: 12.0),
child: ListTile( child: ListTile(
@ -270,8 +268,7 @@ class _SearchResultState extends State<SearchResult> {
child: child:
Text('Subscribe', style: TextStyle(color: Colors.blue)), Text('Subscribe', style: TextStyle(color: Colors.blue)),
onPressed: () { onPressed: () {
importOmpl.rssTitle = importOmpl.rssTitle = widget.onlinePodcast.title;
widget.onlinePodcast.title;
savePodcast(widget.onlinePodcast.rss); savePodcast(widget.onlinePodcast.rss);
}) })
: OutlineButton( : OutlineButton(

View File

@ -1,6 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'class/importompl.dart'; import 'package:tsacdop/class/importompl.dart';
class Import extends StatelessWidget { class Import extends StatelessWidget {
@override @override
@ -13,9 +13,7 @@ class Import extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
SizedBox( SizedBox(height: 2.0, child: LinearProgressIndicator()),
height: 2.0,
child: LinearProgressIndicator()),
Container( Container(
padding: EdgeInsets.symmetric(horizontal: 20.0), padding: EdgeInsets.symmetric(horizontal: 20.0),
height: 20.0, height: 20.0,
@ -28,9 +26,7 @@ class Import extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
SizedBox( SizedBox(height: 2.0, child: LinearProgressIndicator()),
height: 2.0,
child: LinearProgressIndicator()),
Container( Container(
height: 20.0, height: 20.0,
padding: EdgeInsets.symmetric(horizontal: 20.0), padding: EdgeInsets.symmetric(horizontal: 20.0),
@ -45,8 +41,7 @@ class Import extends StatelessWidget {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
SizedBox( SizedBox(
height: 2.0, height: 2.0, child: LinearProgressIndicator()),
child: LinearProgressIndicator()),
Container( Container(
height: 20.0, height: 20.0,
padding: EdgeInsets.symmetric(horizontal: 20.0), padding: EdgeInsets.symmetric(horizontal: 20.0),
@ -65,9 +60,11 @@ class Import extends StatelessWidget {
child: LinearProgressIndicator()), child: LinearProgressIndicator()),
Container( Container(
height: 20.0, height: 20.0,
padding: EdgeInsets.symmetric(horizontal: 20.0), padding:
EdgeInsets.symmetric(horizontal: 20.0),
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Text('Error: ' + (importOmpl.rsstitle)), child:
Text('Error: ' + (importOmpl.rsstitle)),
), ),
], ],
) )

View File

@ -1,5 +1,6 @@
import 'dart:io'; import 'dart:io';
import 'dart:async'; import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -9,11 +10,12 @@ import 'package:flutter/services.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'package:color_thief_flutter/color_thief_flutter.dart'; import 'package:color_thief_flutter/color_thief_flutter.dart';
import 'package:image/image.dart' as img; import 'package:image/image.dart' as img;
import 'about.dart'; import 'about.dart';
import 'class/podcastlocal.dart'; import 'package:tsacdop/class/podcastlocal.dart';
import 'class/sqflite_localpodcast.dart'; import 'package:tsacdop/class/sqflite_localpodcast.dart';
import 'class/importompl.dart'; import 'package:tsacdop/class/importompl.dart';
import 'webfeed/webfeed.dart'; import 'package:tsacdop/webfeed/webfeed.dart';
class OmplOutline { class OmplOutline {
final String text; final String text;

View File

@ -10,7 +10,7 @@ import 'package:logging/logging.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:marquee/marquee.dart'; import 'package:marquee/marquee.dart';
import 'package:flutter_downloader/flutter_downloader.dart'; import 'package:flutter_downloader/flutter_downloader.dart';
import 'class/audiostate.dart'; import 'package:tsacdop/class/audiostate.dart';
final Logger _logger = Logger('audiofileplayer'); final Logger _logger = Logger('audiofileplayer');

View File

@ -1,11 +1,12 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'podcastlist.dart';
import '../podcasts/podcastlist.dart';
import 'hometab.dart'; import 'hometab.dart';
import 'importompl.dart'; import 'package:tsacdop/home/appbar/importompl.dart';
import 'audio_player.dart'; import 'audio_player.dart';
import 'homescroll.dart'; import 'homescroll.dart';
import 'pageroute.dart'; import 'package:tsacdop/util/pageroute.dart';
class Home extends StatefulWidget { class Home extends StatefulWidget {
@override @override

View File

@ -8,14 +8,14 @@ import 'package:provider/provider.dart';
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'class/episodebrief.dart'; import 'package:tsacdop/class/episodebrief.dart';
import 'class/podcastlocal.dart'; import 'package:tsacdop/class/podcastlocal.dart';
import 'class/importompl.dart'; import 'package:tsacdop/class/importompl.dart';
import 'class/sqflite_localpodcast.dart'; import 'package:tsacdop/class/sqflite_localpodcast.dart';
import 'episodedetail.dart'; import 'package:tsacdop/episodes/episodedetail.dart';
import 'podcastdetail.dart'; import 'package:tsacdop/podcasts/podcastdetail.dart';
import 'pageroute.dart'; import 'package:tsacdop/util/pageroute.dart';
class ScrollPodcasts extends StatefulWidget { class ScrollPodcasts extends StatefulWidget {
@override @override

View File

@ -1,9 +1,9 @@
import 'dart:ui'; import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'class/episodebrief.dart'; import 'package:tsacdop/class/episodebrief.dart';
import 'class/sqflite_localpodcast.dart'; import 'package:tsacdop/class/sqflite_localpodcast.dart';
import 'episodegrid.dart'; import 'package:tsacdop/util/episodegrid.dart';
class MainTab extends StatefulWidget { class MainTab extends StatefulWidget {
@override @override

View File

@ -2,9 +2,9 @@ import 'package:flutter/material.dart';
import 'package:flutter_statusbarcolor/flutter_statusbarcolor.dart'; import 'package:flutter_statusbarcolor/flutter_statusbarcolor.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:flutter_downloader/flutter_downloader.dart'; import 'package:flutter_downloader/flutter_downloader.dart';
import 'addpodcast.dart'; import 'package:tsacdop/home/appbar/addpodcast.dart';
import 'class/audiostate.dart'; import 'package:tsacdop/class/audiostate.dart';
import 'class/importompl.dart'; import 'package:tsacdop/class/importompl.dart';
void main() async { void main() async {
runApp( runApp(

View File

@ -3,10 +3,10 @@ import 'package:flutter/material.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'dart:async'; import 'dart:async';
import 'class/podcastlocal.dart'; import 'package:tsacdop/class/podcastlocal.dart';
import 'class/episodebrief.dart'; import 'package:tsacdop/class/episodebrief.dart';
import 'class/sqflite_localpodcast.dart'; import 'package:tsacdop/class/sqflite_localpodcast.dart';
import 'episodegrid.dart'; import 'package:tsacdop/util/episodegrid.dart';
class PodcastDetail extends StatefulWidget { class PodcastDetail extends StatefulWidget {
PodcastDetail({Key key, this.podcastLocal}) : super(key: key); PodcastDetail({Key key, this.podcastLocal}) : super(key: key);

View File

@ -5,9 +5,9 @@ import 'package:flutter/foundation.dart';
import 'package:flutter_html/flutter_html.dart'; import 'package:flutter_html/flutter_html.dart';
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'class/podcastlocal.dart'; import 'package:tsacdop/class/podcastlocal.dart';
import 'class/sqflite_localpodcast.dart'; import 'package:tsacdop/class/sqflite_localpodcast.dart';
import 'podcastdetail.dart'; import 'package:tsacdop/podcasts/podcastdetail.dart';
Future<List<PodcastLocal>> getPodcastLocal() async { Future<List<PodcastLocal>> getPodcastLocal() async {
var dbHelper = DBHelper(); var dbHelper = DBHelper();

View File

@ -6,9 +6,9 @@ import 'package:flutter/material.dart';
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter_downloader/flutter_downloader.dart'; import 'package:flutter_downloader/flutter_downloader.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'class/episodebrief.dart'; import 'package:tsacdop/class/episodebrief.dart';
import 'episodedetail.dart'; import 'package:tsacdop/episodes/episodedetail.dart';
import 'pageroute.dart'; import 'package:tsacdop/util/pageroute.dart';
class EpisodeGrid extends StatelessWidget { class EpisodeGrid extends StatelessWidget {
final List<EpisodeBrief> podcast; final List<EpisodeBrief> podcast;