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: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 }

View File

@ -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;

View File

@ -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
@ -203,7 +204,6 @@ class _SearchResultState extends State<SearchResult> {
return primaryColor;
}
@override
Widget build(BuildContext context) {
final importOmpl = Provider.of<ImportOmpl>(context);
@ -211,8 +211,7 @@ class _SearchResultState extends State<SearchResult> {
print(rss);
if (mounted) setState(() => _adding = true);
importOmpl.importState =
ImportState.import;
importOmpl.importState = ImportState.import;
Response response = await Dio().get(rss);
if (mounted) setState(() => _issubscribe = true);
@ -231,24 +230,23 @@ class _SearchResultState extends State<SearchResult> {
File("${dir.path}/${_p.title}.png")
..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(
_p.title, _p.itunes.image.href, rss, _primaryColor, _p.author);
podcastLocal.description = _p.description;
var dbHelper = DBHelper();
await dbHelper.savePodcastLocal(podcastLocal);
importOmpl.importState =
ImportState.parse;
importOmpl.importState = ImportState.parse;
await dbHelper.savePodcastRss(response.data);
importOmpl.importState =
ImportState.complete;
importOmpl.importState =
ImportState.stop;
importOmpl.importState = ImportState.complete;
importOmpl.importState = ImportState.stop;
print('fatch data');
}
return Container(
padding: EdgeInsets.symmetric(horizontal: 12.0),
child: ListTile(
@ -270,8 +268,7 @@ class _SearchResultState extends State<SearchResult> {
child:
Text('Subscribe', style: TextStyle(color: Colors.blue)),
onPressed: () {
importOmpl.rssTitle =
widget.onlinePodcast.title;
importOmpl.rssTitle = widget.onlinePodcast.title;
savePodcast(widget.onlinePodcast.rss);
})
: OutlineButton(

View File

@ -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),
@ -65,9 +60,11 @@ class Import extends StatelessWidget {
child: LinearProgressIndicator()),
Container(
height: 20.0,
padding: EdgeInsets.symmetric(horizontal: 20.0),
padding:
EdgeInsets.symmetric(horizontal: 20.0),
alignment: Alignment.centerLeft,
child: Text('Error: ' + (importOmpl.rsstitle)),
child:
Text('Error: ' + (importOmpl.rsstitle)),
),
],
)

View File

@ -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;

View File

@ -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');

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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(

View File

@ -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);

View File

@ -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();

View File

@ -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;