Skip to content

Commit

Permalink
Merge pull request #127 from DAB-Co/02-04-22
Browse files Browse the repository at this point in the history
02 04 22
  • Loading branch information
atillaturkmen authored Apr 2, 2022
2 parents cead162 + d8a18f9 commit 2e76a39
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 137 deletions.
5 changes: 1 addition & 4 deletions lib/models/track_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,14 @@ class Track {
@HiveField(2)
String spotifyUrl;
@HiveField(3)
String? previewUrl;
@HiveField(4)
String? albumName;
@HiveField(5)
@HiveField(4)
String? artist;

Track(
{required this.name,
required this.imageUrl,
required this.spotifyUrl,
this.previewUrl,
this.albumName,
this.artist});

Expand Down
11 changes: 4 additions & 7 deletions lib/models/track_model.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions lib/network/top_preferences.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ Future topPreferencesCall(
List<Track> otherUserTracks = otherUser[0];
List<Artist> otherUserArtists = otherUser[1];

print(otherUserArtists);
print(otherUserTracks);

List<List<Track>> tracks = [thisUserTracks, otherUserTracks];
List<Track> commonTracks = tracks
.fold<Set<Track>>(
Expand All @@ -62,6 +65,10 @@ Future topPreferencesCall(
List<Artist> otherArtists =
otherUserArtists.toSet().difference(commonArtists.toSet()).toList();

print(commonArtists);
print(otherTracks);
print(otherArtists);

// save to hive
await storeTracksAndArtists(userId, otherId, commonTracks, otherTracks,
commonArtists, otherArtists);
Expand All @@ -82,7 +89,6 @@ List<List> separateArtistAndTrack(l) {
name: name,
imageUrl: data["album"]["images"][2]["url"],
spotifyUrl: data["external_urls"]["spotify"],
previewUrl: data["preview_url"],
albumName: data["album"]["name"],
artist: data["album"]["artists"][0]["name"],
);
Expand All @@ -92,7 +98,7 @@ List<List> separateArtistAndTrack(l) {
name: name,
imageUrl: data["images"][2]["url"],
spotifyUrl: data["external_urls"]["spotify"],
genre: data["genres"],
genre: data["genres"].join(', '),
);
artists.add(cur);
}
Expand Down
82 changes: 47 additions & 35 deletions lib/pages/chat_language.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,38 +136,40 @@ class _ChatLanguageState extends State<ChatLanguage> {
body: Stack(children: [
Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
children: [
const Text(
"Your Languages:",
style: TextStyle(fontSize: 20),
),
SizedBox(height: 20),
languages == null || languages.length == 0
? Column(
children: [
Icon(
Icons.warning,
color: Colors.pinkAccent,
child: SingleChildScrollView(
child: Column(
children: [
const Text(
"Your Languages:",
style: TextStyle(fontSize: 20),
),
SizedBox(height: 20),
languages == null || languages.length == 0
? Column(
children: [
Icon(
Icons.warning,
color: Colors.pinkAccent,
),
SizedBox(height: 10),
const Text("You don't have any language preference."
"You have to select at least one language in order to match with other people."),
],
)
: Container(
margin: EdgeInsets.only(bottom: okVisible ? 80 : 40),
child: ListView.builder(
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemCount: languages.length,
itemBuilder: (context, index) {
return _circleListItem(languages[index]);
},
),
SizedBox(height: 10),
const Text("You don't have any language preference."
"You have to select at least one language in order to match with other people."),
],
)
: Container(
height: okVisible ? 450 : 500,
child: ListView.builder(
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemCount: languages.length,
itemBuilder: (context, index) {
return _circleListItem(languages[index]);
},
),
),
SizedBox(height: 20),
],
SizedBox(height: 20),
],
),
),
),
Padding(
Expand All @@ -178,14 +180,24 @@ class _ChatLanguageState extends State<ChatLanguage> {
mainAxisSize: MainAxisSize.min,
children: [
Visibility(
child: longButtons(
"OK",
() => Navigator.pushReplacementNamed(context, homepage),
color: Colors.green,
child: Column(
children: [
longButtons(
"OK",
() => Navigator.pushReplacementNamed(context, homepage),
color: Colors.green,
),
SizedBox(
height: 10,
width: double.infinity,
child: DecoratedBox(
decoration: BoxDecoration(color: Colors.white),
),
),
],
),
visible: okVisible,
),
SizedBox(height: 10),
longButtons(
"Add a language",
_openLanguagePickerDialog,
Expand Down
14 changes: 9 additions & 5 deletions lib/pages/homepage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,18 @@ class _HomepageState extends State<Homepage> {
RefreshIndicator(
onRefresh: _refreshTimer,
child: SingleChildScrollView(
physics: const BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics()),
physics: const BouncingScrollPhysics(
parent: AlwaysScrollableScrollPhysics()),
child: Column(
children: [
SizedBox(height: 30),
Center(
child: Text(user.username == null
? ""
: "${greetingsText()} ${user.username!}"),
child: Text(
user.username == null
? ""
: "${greetingsText()} ${user.username!}",
textAlign: TextAlign.center,
),
),
SizedBox(height: 20),
Center(
Expand All @@ -104,7 +108,7 @@ class _HomepageState extends State<Homepage> {
child: new LinearPercentIndicator(
width: MediaQuery.of(context).size.width - 50,
animation: true,
lineHeight: 20.0,
lineHeight: 25.0,
animationDuration: 1000,
percent: percent,
center: Text(timerText),
Expand Down
112 changes: 57 additions & 55 deletions lib/pages/profile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,67 +27,69 @@ class _ProfileState extends State<Profile> {
title: const Text("Your Profile"),
elevation: 0.1,
),
body: Column(
children: [
SizedBox(height: 30),
Container(
height: 200,
width: 200,
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.contain,
image: AssetImage('assets/avatar.png'),
body: SingleChildScrollView(
child: Column(
children: [
SizedBox(height: 30),
Container(
height: 200,
width: 200,
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.contain,
image: AssetImage('assets/avatar.png'),
),
),
),
),
SizedBox(height: 30),
Divider(color: Colors.grey),
Padding(
padding: const EdgeInsets.only(left: 10.0, right: 10.0),
child: Column(
children: [
ListTile(
leading: Icon(
Icons.language,
color: Colors.black,
SizedBox(height: 30),
Divider(color: Colors.grey),
Padding(
padding: const EdgeInsets.only(left: 10.0, right: 10.0),
child: Column(
children: [
ListTile(
leading: Icon(
Icons.language,
color: Colors.black,
),
title: const Text('Your languages'),
onTap: () {
Navigator.pushNamed(context, chatLanguages);
},
),
title: const Text('Your languages'),
onTap: () {
Navigator.pushNamed(context, chatLanguages);
},
),
Divider(color: Colors.grey),
ListTile(
leading: Icon(
Icons.block,
color: Colors.red,
Divider(color: Colors.grey),
ListTile(
leading: Icon(
Icons.block,
color: Colors.red,
),
title: const Text('Blocked users'),
onTap: () {
Navigator.pushNamed(context, blockedUsers);
},
),
title: const Text('Blocked users'),
onTap: () {
Navigator.pushNamed(context, blockedUsers);
},
),
Divider(color: Colors.grey),
ListTile(
leading: Icon(
Icons.logout,
color: Colors.red,
Divider(color: Colors.grey),
ListTile(
leading: Icon(
Icons.logout,
color: Colors.red,
),
title: const Text('Logout'),
onTap: () {
showDialog(
context: context,
builder: (BuildContext context) {
return alertDialog;
},
);
},
),
title: const Text('Logout'),
onTap: () {
showDialog(
context: context,
builder: (BuildContext context) {
return alertDialog;
},
);
},
),
],
],
),
),
),
Divider(color: Colors.grey),
],
Divider(color: Colors.grey),
],
),
),
);
}
Expand Down
Loading

0 comments on commit 2e76a39

Please sign in to comment.