modified: lib/episodes/episodedetail.dart
modified: lib/episodes/episodedownload.dart modified: lib/home/home.dart modified: lib/main.dart Add favorite effect
This commit is contained in:
parent
5d43a7e641
commit
0cc9a7f690
|
@ -258,12 +258,18 @@ class _MenuBarState extends State<MenuBar> {
|
|||
color: Colors.grey[700],
|
||||
),
|
||||
() => saveLiked(widget.episodeItem.title))
|
||||
: _buttonOnMenu(
|
||||
Icon(
|
||||
Icons.favorite,
|
||||
color: Colors.red,
|
||||
),
|
||||
() => setUnliked(widget.episodeItem.title)),
|
||||
: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: <Widget>[
|
||||
LoveOpen(),
|
||||
_buttonOnMenu(
|
||||
Icon(
|
||||
Icons.favorite,
|
||||
color: Colors.red,
|
||||
),
|
||||
() => setUnliked(widget.episodeItem.title)),
|
||||
],
|
||||
),
|
||||
DownloadButton(episodeBrief: widget.episodeItem),
|
||||
_buttonOnMenu(Icon(Icons.playlist_add, color: Colors.grey[700]),
|
||||
() {
|
||||
|
@ -285,7 +291,8 @@ class _MenuBarState extends State<MenuBar> {
|
|||
urlChange.audioUrl = widget.episodeItem.enclosureUrl;
|
||||
urlChange.rssTitle = widget.episodeItem.title;
|
||||
urlChange.feedTitle = widget.episodeItem.feedTitle;
|
||||
urlChange.primaryColor = widget.episodeItem.primaryColor;
|
||||
urlChange.primaryColor =
|
||||
widget.episodeItem.primaryColor;
|
||||
print('Playing');
|
||||
},
|
||||
child: Container(
|
||||
|
@ -354,8 +361,8 @@ class _LineLoaderState extends State<LineLoader>
|
|||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
controller = AnimationController(
|
||||
vsync: this, duration: Duration(milliseconds: 500));
|
||||
controller =
|
||||
AnimationController(vsync: this, duration: Duration(milliseconds: 500));
|
||||
animation = Tween(begin: 0.0, end: 1.0).animate(controller)
|
||||
..addListener(() {
|
||||
if (mounted)
|
||||
|
@ -541,3 +548,134 @@ class _ImageRotateState extends State<ImageRotate>
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
class LovePainter extends CustomPainter {
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
Path _path = Path();
|
||||
Paint _paint = Paint()
|
||||
..color = Colors.red
|
||||
..strokeWidth = 2.0
|
||||
..strokeCap = StrokeCap.round;
|
||||
|
||||
_path.moveTo(size.width / 2, size.height / 6);
|
||||
_path.quadraticBezierTo(size.width / 4, 0, size.width / 8, size.height / 6);
|
||||
_path.quadraticBezierTo(
|
||||
0, size.height / 3, size.width / 8, size.height * 0.55);
|
||||
_path.quadraticBezierTo(
|
||||
size.width / 4, size.height * 0.8, size.width / 2, size.height);
|
||||
_path.quadraticBezierTo(size.width * 0.75, size.height * 0.8,
|
||||
size.width * 7 / 8, size.height * 0.55);
|
||||
_path.quadraticBezierTo(
|
||||
size.width, size.height / 3, size.width * 7 / 8, size.height / 6);
|
||||
_path.quadraticBezierTo(
|
||||
size.width * 3 / 4, 0, size.width / 2, size.height / 6);
|
||||
|
||||
canvas.drawPath(_path, _paint);
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldRepaint(CustomPainter oldDelegate) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class LoveOpen extends StatefulWidget {
|
||||
@override
|
||||
_LoveOpenState createState() => _LoveOpenState();
|
||||
}
|
||||
|
||||
class _LoveOpenState extends State<LoveOpen>
|
||||
with SingleTickerProviderStateMixin {
|
||||
Animation _animationA;
|
||||
Animation _animationB;
|
||||
AnimationController _controller;
|
||||
|
||||
var rect = RelativeRect.fromLTRB(100, 100, 100, 100);
|
||||
var rectend = RelativeRect.fromLTRB(0, 0, 0, 0);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_controller = AnimationController(
|
||||
vsync: this,
|
||||
duration: Duration(milliseconds: 500),
|
||||
);
|
||||
|
||||
_animationA = Tween(begin: 0.0, end: 1.0).animate(_controller)
|
||||
..addListener(() {
|
||||
if (mounted) setState(() {});
|
||||
});
|
||||
_animationB =
|
||||
RelativeRectTween(begin: rect, end: rectend).animate(_controller)
|
||||
..addListener(() {
|
||||
if (mounted) setState(() {});
|
||||
});
|
||||
|
||||
_controller.forward();
|
||||
_controller.addStatusListener((status) {
|
||||
if (status == AnimationStatus.completed) {
|
||||
_controller.reset();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Widget _littleHeart(double scale, double value, double angle) => Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: EdgeInsets.only(left: value),
|
||||
child: ScaleTransition(
|
||||
scale: _animationA,
|
||||
alignment: Alignment.center,
|
||||
child: Transform.rotate(
|
||||
angle: angle,
|
||||
child: SizedBox(
|
||||
height: 5 * scale,
|
||||
width: 6 * scale,
|
||||
child: CustomPaint(
|
||||
painter: LovePainter(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: 50,
|
||||
height: 50,
|
||||
alignment: Alignment.center,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
_littleHeart(1.3, 10, -math.pi/6),
|
||||
_littleHeart(1.5, 3, 0),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
_littleHeart(0.8, 6, math.pi*1.5),
|
||||
_littleHeart(1.2, 24, math.pi/2),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
_littleHeart(1, 8,-math.pi*0.7),
|
||||
_littleHeart(1.3, 8, math.pi),
|
||||
_littleHeart(1.1, 3, -math.pi*1.2)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -217,28 +217,33 @@ class _DownloadButtonState extends State<DownloadButton> {
|
|||
),
|
||||
() => _requestDownload(task));
|
||||
} else if (task.status == DownloadTaskStatus.running) {
|
||||
return Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
_pauseDownload(task);
|
||||
},
|
||||
child: Container(
|
||||
height: 50.0,
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsets.symmetric(horizontal: 18.0),
|
||||
child: SizedBox(
|
||||
height: 18,
|
||||
width: 18,
|
||||
child: CircularProgressIndicator(
|
||||
backgroundColor: Colors.grey[500],
|
||||
strokeWidth: 2,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(Colors.blue),
|
||||
value: task.progress / 100,
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
_pauseDownload(task);
|
||||
},
|
||||
child: Container(
|
||||
height: 50.0,
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsets.symmetric(horizontal: 18.0),
|
||||
child: SizedBox(
|
||||
height: 18,
|
||||
width: 18,
|
||||
child: CircularProgressIndicator(
|
||||
backgroundColor: Colors.grey[500],
|
||||
strokeWidth: 2,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(Colors.blue),
|
||||
value: task.progress / 100,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Text('${task.progress}%', style: TextStyle(color: Colors.blue,),),
|
||||
],
|
||||
);
|
||||
} else if (task.status == DownloadTaskStatus.paused) {
|
||||
return Material(
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:tsacdop/class/audiostate.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:tsacdop/podcasts/podcastlist.dart';
|
||||
import 'hometab.dart';
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_statusbarcolor/flutter_statusbarcolor.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_downloader/flutter_downloader.dart';
|
||||
import 'package:tsacdop/home/appbar/addpodcast.dart';
|
||||
import 'package:tsacdop/class/audiostate.dart';
|
||||
|
@ -18,6 +19,7 @@ void main() async {
|
|||
);
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await FlutterDownloader.initialize();
|
||||
await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
await FlutterStatusbarcolor.setStatusBarColor(Colors.grey[100]);
|
||||
await FlutterStatusbarcolor.setNavigationBarColor(Colors.grey[100]);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue