Skip to content

Commit

Permalink
Merge pull request Harsh-23#3 from cyberboysumanjay/master
Browse files Browse the repository at this point in the history
Other Fixes
  • Loading branch information
cyberboysumanjay authored Aug 11, 2020
2 parents c454dac + 187df1d commit 41df0b1
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 74 deletions.
47 changes: 36 additions & 11 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_media_notification/flutter_media_notification.dart';
import 'package:music/API/saavn.dart';
import 'package:music/about.dart';
import 'package:ext_storage/ext_storage.dart';
import 'package:progress_dialog/progress_dialog.dart';
import 'music.dart';

Expand Down Expand Up @@ -65,7 +66,8 @@ class AppState extends State<AppName> {
getSongDetails(String id, var context) async {
await fetchSongDetails(id);
checker = "Haa";
Navigator.push(context, MaterialPageRoute(builder: (context) => AudioApp()));
Navigator.push(
context, MaterialPageRoute(builder: (context) => AudioApp()));
}

downloadSong(id) async {
Expand All @@ -88,15 +90,19 @@ class AppState extends State<AppName> {
messageTextStyle: TextStyle(color: accent),
progressWidget: Padding(
padding: const EdgeInsets.all(20.0),
child: CircularProgressIndicator(valueColor: new AlwaysStoppedAnimation<Color>(accent)),
child: CircularProgressIndicator(
valueColor: new AlwaysStoppedAnimation<Color>(accent)),
),
);
await pr.show();

final filename = title + ".mp3";
final artname = title + "_artwork.jpg";
String filepath = "storage/emulated/0/Download/" + filename;
String filepath2 = "storage/emulated/0/Download/" + artname;

String dlPath = await ExtStorage.getExternalStoragePublicDirectory(
ExtStorage.DIRECTORY_MUSIC);
String filepath = dlPath + "/" + filename;
String filepath2 = dlPath + "/" + artname;

var request = await HttpClient().getUrl(Uri.parse(kUrl));
var response = await request.close();
Expand Down Expand Up @@ -129,6 +135,10 @@ class AppState extends State<AppName> {
);
await new Future.delayed(const Duration(seconds: 1), () {});
await pr.hide();

if (await file2.exists()) {
await file2.delete();
}
print("Done");
}

Expand All @@ -153,7 +163,10 @@ class AppState extends State<AppName> {
else
Scaffold.of(contextt).showSnackBar(new SnackBar(
content: new Text("Nothing is Playing."),
action: SnackBarAction(label: 'Okay', textColor: accent, onPressed: Scaffold.of(contextt).hideCurrentSnackBar),
action: SnackBarAction(
label: 'Okay',
textColor: accent,
onPressed: Scaffold.of(contextt).hideCurrentSnackBar),
backgroundColor: Color.fromARGB(255, 20, 20, 20),
duration: Duration(seconds: 2),
))
Expand All @@ -173,14 +186,18 @@ class AppState extends State<AppName> {
Row(children: <Widget>[
new Text(
"Musify.",
style: TextStyle(color: accent, fontSize: 35, fontWeight: FontWeight.bold),
style: TextStyle(
color: accent, fontSize: 35, fontWeight: FontWeight.bold),
),
Spacer(),
IconButton(
icon: Icon(Icons.info_outline),
color: accent,
onPressed: () => {
Navigator.push(context, MaterialPageRoute(builder: (context) => AboutPage())),
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AboutPage())),
})
]),
new Padding(padding: EdgeInsets.only(top: 20)),
Expand Down Expand Up @@ -230,12 +247,14 @@ class AppState extends State<AppName> {
padding: const EdgeInsets.only(top: 5, bottom: 5),
child: Card(
color: Color.fromARGB(255, 20, 20, 20),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10.0)),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
elevation: 0,
child: InkWell(
borderRadius: BorderRadius.circular(10.0),
onTap: () {
getSongDetails(searchedList[index]["id"], context);
getSongDetails(
searchedList[index]["id"], context);
},
splashColor: accent,
hoverColor: accent,
Expand All @@ -253,14 +272,20 @@ class AppState extends State<AppName> {
),
),
title: Text(
(searchedList[index]['title']).toString().split("(")[0],
(searchedList[index]['title'])
.toString()
.split("(")[0],
style: TextStyle(color: Colors.white),
),
subtitle: Text(
searchedList[index]['more_info']["singers"],
style: TextStyle(color: Colors.white),
),
trailing: IconButton(color: accent, icon: Icon(Icons.file_download), onPressed: () => downloadSong(searchedList[index]["id"])),
trailing: IconButton(
color: accent,
icon: Icon(Icons.file_download),
onPressed: () => downloadSong(
searchedList[index]["id"])),
),
],
),
Expand Down
98 changes: 35 additions & 63 deletions pubspec.lock
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
archive:
dependency: transitive
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.11"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.2"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
version: "2.4.2"
audioplayer:
dependency: "direct main"
description:
Expand Down Expand Up @@ -49,35 +35,35 @@ packages:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
charcode:
version: "2.0.0"
characters:
dependency: transitive
description:
name: charcode
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
collection:
version: "1.0.0"
charcode:
dependency: transitive
description:
name: collection
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.11"
convert:
version: "1.1.3"
clock:
dependency: transitive
description:
name: convert
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
crypto:
version: "1.0.1"
collection:
dependency: transitive
description:
name: crypto
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
version: "1.14.13"
cupertino_icons:
dependency: "direct main"
description:
Expand All @@ -92,6 +78,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.3"
ext_storage:
dependency: "direct main"
description:
name: ext_storage
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
file:
dependency: transitive
description:
Expand Down Expand Up @@ -137,13 +137,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.4"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
intl:
dependency: transitive
description:
Expand All @@ -157,7 +150,7 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.6"
version: "0.12.8"
meta:
dependency: transitive
description:
Expand All @@ -171,7 +164,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.4"
version: "1.7.0"
path_provider:
dependency: "direct main"
description:
Expand Down Expand Up @@ -207,13 +200,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0+1"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
platform:
dependency: transitive
description:
Expand Down Expand Up @@ -242,13 +228,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.4"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -260,14 +239,14 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.5"
version: "1.7.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.3"
version: "1.9.5"
stream_channel:
dependency: transitive
description:
Expand Down Expand Up @@ -295,14 +274,14 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.11"
version: "0.2.17"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
version: "1.2.0"
vector_math:
dependency: transitive
description:
Expand All @@ -317,13 +296,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.5.0"
sdks:
dart: ">=2.7.0 <3.0.0"
dart: ">=2.9.0-14.0.dev <3.0.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0"
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ dependencies:
audioplayer: 0.8.1
audioplayer_web: 0.7.1
des_plugin: ^0.0.3
ext_storage: ^1.0.3
audiotagger: ^1.1.0
path_provider: ^1.6.11
progress_dialog: ^1.2.4
Expand Down

0 comments on commit 41df0b1

Please sign in to comment.