Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Done - Yash #7

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added details page & fixed overflow issues
  • Loading branch information
yasharora102 committed Mar 27, 2022
commit 3966b708aadd6ed083f7fc39932faf62efe2fc67
6 changes: 6 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
PODS:
- Flutter (1.0.0)
- path_provider_ios (0.0.1):
- Flutter
- uni_links (0.0.1):
- Flutter
- url_launcher_ios (0.0.1):
- Flutter

DEPENDENCIES:
- Flutter (from `Flutter`)
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
- uni_links (from `.symlinks/plugins/uni_links/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)

EXTERNAL SOURCES:
Flutter:
:path: Flutter
path_provider_ios:
:path: ".symlinks/plugins/path_provider_ios/ios"
uni_links:
:path: ".symlinks/plugins/uni_links/ios"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"

SPEC CHECKSUMS:
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
uni_links: d97da20c7701486ba192624d99bffaaffcfc298a
url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de

Expand Down
186 changes: 186 additions & 0 deletions lib/task_pages/components/bodyForDetails.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
// ignore_for_file: camel_case_types, file_names, prefer_const_constructors, prefer_const_literals_to_create_immutables
import 'package:google_fonts/google_fonts.dart';
import 'package:flutter/material.dart';

class bodyForDetails extends StatefulWidget {
const bodyForDetails(
{Key? key,
required this.count,
required this.playlistName,
required this.playlistImg,
required this.playlistCount,
required this.totalSongs,
required this.followers,
required this.owners})
: super(key: key);
final count;
final playlistName;
final playlistImg;
final playlistCount;
final totalSongs;
final followers;
final owners;

@override
_bodyForDetailsState createState() => _bodyForDetailsState();
}

class _bodyForDetailsState extends State<bodyForDetails> {
@override
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
return Scaffold(
backgroundColor: Color.fromARGB(255, 203, 13, 236),
body: Scrollbar(
child: Column(
children: [
Container(
// width: double.infinity,
margin: EdgeInsets.symmetric(vertical: 30, horizontal: 43),
height: size.width * 0.8,
child: Container(
// height: size.width * 0.7,
// width: size.width * 0.7,

alignment: Alignment.topCenter,
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.black,
blurRadius: 20.0,
offset: Offset(10, 10),
),
],
color: Colors.black, //del_later
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(22),
image: DecorationImage(
image: NetworkImage(widget.playlistImg[widget.count]),
fit: BoxFit.fitHeight),
),
),
),
Container(
margin: EdgeInsets.symmetric(horizontal: 43, vertical: 20),
padding: EdgeInsets.symmetric(vertical: 5),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.black,
blurRadius: 20.0,
offset: Offset(10, 10),
),
],
borderRadius: BorderRadius.all(Radius.circular(50)),
// gradient: LinearGradient(
// begin: Alignment.topCenter,
// end: Alignment.bottomCenter,
// // ignore: prefer_const_literals_to_create_immutables
// colors: [
// Color(0xff7A69C7),
// Color(0xffb06ab3),
// ]),
color: Colors.white,
),
alignment: Alignment.topCenter,
height: size.width * 0.5,
// width: MediaQuery.of(context).size.width,
// child: SingleChildScrollView(
// scrollDirection: Axis.vertical,
// child: DataTable(
// columns: [
// DataColumn(
// label: Text('#',
// style: TextStyle(
// fontSize: 18,
// fontWeight: FontWeight.bold,
// color: Colors.black))),
// DataColumn(
// label: Text('Song Name',
// style: TextStyle(
// fontSize: 18,
// fontWeight: FontWeight.bold,
// color: Colors.black)))
// ],
// rows: [
// for (int counter = 1;
// counter <= widget.playlistCount;
// counter++)
// DataRow(cells: [
// DataCell(Text('$counter',
// style: TextStyle(color: Colors.black))),
// DataCell(Text(
// '${widget.playlistName[counter - 1]}',
// style: TextStyle(color: Colors.black))),
// ]),
// ],
// ),
// ),
child: Column(
// crossAxisAlignment: CrossAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
// Spacer(),
Container(
// alignment: Alignment.topCenter,
padding:
const EdgeInsets.only(left: 20, right: 20, top: 25),
child: Text('${widget.playlistName[widget.count]}',
textAlign: TextAlign.center,
style: GoogleFonts.montserrat(
textStyle: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
))),
),
// Spacer(),
Container(
padding: const EdgeInsets.only(top: 20),
child: Text(
'Songs: ${widget.totalSongs[widget.count]}',
textAlign: TextAlign.center,
style: GoogleFonts.montserrat(
textStyle: TextStyle(
fontSize: 18,
// fontWeight: FontWeight.bold,
)),
),
),
Container(
padding: const EdgeInsets.symmetric(
horizontal: 5,
vertical: 2,
),
child: Text(
'Followers: ${widget.followers[widget.count]}',
textAlign: TextAlign.left,
style: GoogleFonts.montserrat(
textStyle: TextStyle(
fontSize: 18,
// fontWeight: FontWeight.bold,
)),
),
),
Container(
// padding: const EdgeInsets.symmetric(
// horizontal: 5,
// vertical: 15,
// ),
child: Text(
'By ${widget.owners[widget.count]}',
textAlign: TextAlign.left,
style: GoogleFonts.montserrat(
textStyle: TextStyle(
fontSize: 18,
// fontWeight: FontWeight.bold,
)),
),
),
],
)),
],
),
),
);
}
}
20 changes: 14 additions & 6 deletions lib/task_pages/components/data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import 'package:flutter/material.dart';
import 'dart:convert';
import 'package:http/http.dart' as http;

import 'items.dart';

Future<Map> getData() async {
// Have to find a way to hide this stuff
const map = {
Expand All @@ -22,13 +20,10 @@ Future<Map> getData() async {
if (tokenResponse.statusCode != 200) {
throw Exception('http.post error: statusCode= ${tokenResponse.statusCode}');
}


var accessToken =
json.decode(tokenResponse.body).cast<String, dynamic>()['access_token'];



var headersForRequests = {
'Accept': 'application/json',
'Content-Type': 'application/json',
Expand All @@ -41,14 +36,15 @@ Future<Map> getData() async {

final playlistData =
json.decode(playlistResponse.body).cast<String, dynamic>();


final noOfPlaylists = playlistData['total'];
List<String> links = [];
List<String> names = [];
List<int> likes = [];
List<int> songCount = [];
List<String> imgLink = [];
// List<String> trackNames = [];
List<String> owners = [];

// Add names, links , song_count , playlistURLs(for getting followers)

Expand All @@ -72,6 +68,15 @@ Future<Map> getData() async {
json.decode(specificPlaylistResponse.body).cast<String, dynamic>();

likes.add(specificPlaylistData['followers']['total']);
owners.add(specificPlaylistData['owner']['display_name']);
// for (var item in songCount) {
// print(item);
// for (var i = 1; i <= item; i++) {
// trackNames.add(specificPlaylistData['tracks']['items'][i - 1]['track']
// ['album']['name']);
// // debugPrint("song no: $item");
// }
// }
}

var dataForOutput = {
Expand All @@ -80,7 +85,10 @@ Future<Map> getData() async {
"likes": likes,
"song_count": songCount,
"img_link": imgLink,
"owner": owners,
// "track_names": trackNames,
};
debugPrint('data fetched');

return dataForOutput;
}
71 changes: 71 additions & 0 deletions lib/task_pages/components/detailsscreen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// ignore_for_file: prefer_const_constructors, unnecessary_new, camel_case_types, prefer_typing_uninitialized_variables, non_constant_identifier_names
import 'package:flutter/cupertino.dart';
import 'dart:io' show Platform;
import 'bodyForDetails.dart';
import 'package:flutter/material.dart';

class Details extends StatefulWidget {
const Details({
Key? key,
required this.count,
required this.playlistName,
required this.playlistImg,
required this.playlistCount,
required this.totalSongs,
required this.followers,
required this.owners,
}) : super(key: key);
final count;
final playlistName;
final playlistImg;
final playlistCount;
final totalSongs;
final followers;
final owners;

@override
_DetailsState createState() => _DetailsState();
}

class _DetailsState extends State<Details> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.amber,
appBar: AppBar(
backgroundColor: Color.fromARGB(255, 203, 13, 236),
elevation: 0,
leading: IconButton(
padding: EdgeInsets.symmetric(horizontal: 20),
onPressed: () {
Navigator.of(context).pop();
},
icon: Platform.isIOS
? Icon(
CupertinoIcons.chevron_left,
size: 25,
color: Colors.white,
)
: Icon(
Icons.arrow_back,
size: 25,
color: Colors.white,
),
),
centerTitle: true,
title: Text('${widget.playlistName[widget.count]}',
style: TextStyle(
color: Colors.white,
))),
body: bodyForDetails(
count: widget.count,
playlistName: widget.playlistName,
playlistImg: widget.playlistImg,
playlistCount: widget.playlistCount,
totalSongs: widget.totalSongs,
followers: widget.followers,
owners: widget.owners,
),
);
}
}
Loading