Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Ambient
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Daniel Furaev
Ambient
Commits
b325926f
Commit
b325926f
authored
2 years ago
by
Erik Hinkelmanns
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/main' into mergeHELL
parents
056ac1d2
8658f692
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/searchpage.dart
+19
-8
19 additions, 8 deletions
lib/searchpage.dart
lib/services/spotify.dart
+5
-3
5 additions, 3 deletions
lib/services/spotify.dart
with
24 additions
and
11 deletions
lib/searchpage.dart
+
19
−
8
View file @
b325926f
...
...
@@ -16,7 +16,7 @@ class StateSearcgPage extends StatefulWidget {
class
SearchPage
extends
State
<
StateSearcgPage
>
{
final
controller
=
TextEditingController
();
Spotify
spotifyApi
=
Spotify
();
final
List
<
Song
>
songs
=
List
.
empty
(
growable:
true
);
List
<
Song
>
songs
=
List
.
empty
(
growable:
true
);
@override
Widget
build
(
BuildContext
context
)
{
...
...
@@ -53,9 +53,17 @@ class SearchPage extends State<StateSearcgPage> {
padding:
const
EdgeInsets
.
all
(
10
),
child:
Row
(
children:
[
Text
(
song
.
id
),
Text
(
song
.
name
),
Text
(
song
.
artist
)
Image
.
network
(
song
.
image
,
height:
50
,
width:
50
,
fit:
BoxFit
.
fill
,
),
Container
(
width:
10
,
),
Expanded
(
child:
Text
(
song
.
name
)),
Expanded
(
child:
Text
(
song
.
artist
)),
],
),
),
...
...
@@ -67,11 +75,14 @@ class SearchPage extends State<StateSearcgPage> {
}
updateList
(
String
searchedString
)
async
{
log
(
"abb"
);
if
(
searchedString
.
length
>
=
3
)
{
var
searchList
=
await
spotifyApi
.
search
(
searchedString
);
for
(
var
element
in
searchList
)
{
songs
.
add
(
element
);
}
}
else
if
(
searchedString
.
isEmpty
)
{
songs
=
List
.
empty
(
growable:
true
);
}
}
}
This diff is collapsed.
Click to expand it.
lib/services/spotify.dart
+
5
−
3
View file @
b325926f
...
...
@@ -15,7 +15,7 @@ class Spotify {
'user-library-modify playlist-modify-private playlist-read-private user-follow-read user-read-current-playing user-library-read user-read-private user-top-read user-follow-modify user-read-recent-played'
;
var
authToken
=
'BQ
DXRnchqALaNiF-Sj8Gi2en29_RR_I4B5FxbCNVG2zk5gQygEQ3AWVGoWJm260tha8C09TtBt9nDr6oRPlQJYZoGgKN61EhNfCFiJMW4BC840NgoArcw1bTAUtP1s6RDbo8M4engY_-WxQKgr39m43z6wPuebCx6RrqBfFCY_NgCPYev-5405ob8ZPSKKdWwAwUhv3Yyv9FcfuQVk9pjBjcnv03XI51Yw
'
;
'BQ
CKZ8exFgahY4EapZjL54aFWG8z8QfddPfalLsh9whNrH3uwQdPt3llrq-bTyerIY1Rmngw4838QSS0pSyb3Vv2iyAtZUXEg1ErHLrVdqsaG_voEwPEE_js-d59yD2uDtLZh6Qnr_dkFxw4-xlIWqbEYUsPmuaf0rKA5cQDwgzr3P7T1hq5WfXSdv3q8zOzuXfB_HiLf6XT0LPizzLqFSX12uaU0oQ0PEZ1lILmA-mr
'
;
generateAuthToken
()
async
{
String
encoded
=
base64Url
.
encode
(
'
$clientId
:
$clientSecret
'
.
codeUnits
);
...
...
@@ -48,10 +48,9 @@ class Spotify {
headers:
{
// 'Authorization': 'Bearer $authToken',
'Authorization'
:
'Bearer BQ
DXRnchqALaNiF-Sj8Gi2en29_RR_I4B5FxbCNVG2zk5gQygEQ3AWVGoWJm260tha8C09TtBt9nDr6oRPlQJYZoGgKN61EhNfCFiJMW4BC840NgoArcw1bTAUtP1s6RDbo8M4engY_-WxQKgr39m43z6wPuebCx6RrqBfFCY_NgCPYev-5405ob8ZPSKKdWwAwUhv3Yyv9FcfuQVk9pjBjcnv03XI51Yw"
'
'Bearer BQ
CKZ8exFgahY4EapZjL54aFWG8z8QfddPfalLsh9whNrH3uwQdPt3llrq-bTyerIY1Rmngw4838QSS0pSyb3Vv2iyAtZUXEg1ErHLrVdqsaG_voEwPEE_js-d59yD2uDtLZh6Qnr_dkFxw4-xlIWqbEYUsPmuaf0rKA5cQDwgzr3P7T1hq5WfXSdv3q8zOzuXfB_HiLf6XT0LPizzLqFSX12uaU0oQ0PEZ1lILmA-mr
'
},
);
final
responseJson
=
json
.
decode
(
response
.
body
);
final
items
=
responseJson
[
'tracks'
][
'items'
]
as
List
;
...
...
@@ -202,12 +201,14 @@ class Song {
final
String
name
;
final
String
artist
;
final
String
album
;
final
String
image
;
Song
(
this
.
id
,
this
.
name
,
this
.
artist
,
this
.
album
,
this
.
image
,
);
factory
Song
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
...
...
@@ -216,6 +217,7 @@ class Song {
json
[
'name'
],
json
[
'artists'
][
0
][
'name'
],
json
[
'album'
][
'name'
],
json
[
'album'
][
'images'
][
0
][
'url'
],
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment