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
4005fe0f
Commit
4005fe0f
authored
2 years ago
by
Erik Hinkelmanns
Browse files
Options
Downloads
Patches
Plain Diff
- added music bar for all pages
parent
9313f55c
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/homepage.dart
+0
-17
0 additions, 17 deletions
lib/homepage.dart
lib/main.dart
+73
-16
73 additions, 16 deletions
lib/main.dart
lib/widgets/musicPlayerState.dart
+1
-1
1 addition, 1 deletion
lib/widgets/musicPlayerState.dart
with
74 additions
and
34 deletions
lib/homepage.dart
+
0
−
17
View file @
4005fe0f
...
...
@@ -4,7 +4,6 @@ import 'package:ambient/widgets/MusicPlayerState.dart';
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_dotenv/flutter_dotenv.dart'
;
import
'package:spotify_sdk/models/connection_status.dart'
;
import
'package:spotify_sdk/models/image_uri.dart'
;
import
'package:spotify_sdk/models/player_context.dart'
;
...
...
@@ -71,20 +70,6 @@ class HomePage extends StatelessWidget {
:
const
Center
(
child:
Text
(
'Not connected'
),
),
const
Divider
(),
/*const Text(
'Player Context',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
_connected
? _buildPlayerContextWidget()
: const Center(
child: Text('Not connected'),
),
_connected ? utilityBar(context) : Text("noUtilBar"),*/
],
),
MusicPlayerState
.
of
(
context
)
.
loading
...
...
@@ -103,7 +88,6 @@ class HomePage extends StatelessWidget {
var
track
=
snapshot
.
data
?.
track
;
MusicPlayerState
.
of
(
context
)
.
currentTrackImageUri
=
track
?.
imageUri
;
var
playerState
=
snapshot
.
data
;
if
(
playerState
==
null
||
track
==
null
)
{
return
const
Center
(
child:
Text
(
'Not connected'
),
...
...
@@ -303,7 +287,6 @@ class HomePage extends StatelessWidget {
}
}
//todo usage?
void
setStatus
(
String
code
,
{
String
?
message
})
{
var
text
=
message
??
''
;
printErr
(
text
);
...
...
This diff is collapsed.
Click to expand it.
lib/main.dart
+
73
−
16
View file @
4005fe0f
...
...
@@ -5,6 +5,9 @@ import 'package:ambient/searchpage.dart';
import
'package:ambient/widgets/navbars.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_dotenv/flutter_dotenv.dart'
;
import
'package:spotify_sdk/models/player_state.dart'
;
import
'package:spotify_sdk/spotify_sdk.dart'
;
import
'homepage.dart'
;
import
'moodpage.dart'
;
...
...
@@ -72,7 +75,57 @@ class _HUDState extends State<HUD> {
StateSearcgPage
(),
],
),
bottomNavigationBar:
BottomNavigationBar
(
bottomNavigationBar:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
[
_currentIndex
!=
0
?
StreamBuilder
<
PlayerState
>(
stream:
SpotifySdk
.
subscribePlayerState
(),
builder:
(
BuildContext
context
,
AsyncSnapshot
<
PlayerState
>
snapshot
)
{
var
track
=
snapshot
.
data
?.
track
;
MusicPlayerState
.
of
(
context
)
.
currentTrackImageUri
=
track
?.
imageUri
;
var
playerState
=
snapshot
.
data
;
if
(
playerState
==
null
||
track
==
null
)
{
return
const
Center
(
child:
Text
(
'Not connected'
),
);
}
return
Row
(
children:
[
Container
(
height:
80
,
color:
Colors
.
grey
,
child:
Row
(
children:
[
Container
(
alignment:
Alignment
.
centerRight
,
width:
100
,
color:
Colors
.
blue
,
),
playerState
.
isPaused
?
const
IconButton
(
icon:
Icon
(
Icons
.
play_arrow_outlined
),
iconSize:
50
,
onPressed:
SpotifySdk
.
resume
,
)
:
const
IconButton
(
icon:
Icon
(
Icons
.
pause_outlined
),
iconSize:
50
,
color:
primaryColor
,
onPressed:
SpotifySdk
.
pause
,
),
],
),
),
],
);
})
:
const
Center
(
child:
Text
(
'Moin'
),
),
BottomNavigationBar
(
currentIndex:
_currentIndex
,
backgroundColor:
ligten
(
primaryContainer
),
selectedItemColor:
primaryColor
,
...
...
@@ -83,14 +136,18 @@ class _HUDState extends State<HUD> {
label:
"Play"
,
),
BottomNavigationBarItem
(
icon:
Icon
(
Icons
.
mood
),
label:
"Moods"
),
BottomNavigationBarItem
(
icon:
Icon
(
Icons
.
search
),
label:
"Suchen"
),
BottomNavigationBarItem
(
icon:
Icon
(
Icons
.
search
),
label:
"Suchen"
),
],
onTap:
(
newIndex
)
{
_pageController
.
animateToPage
(
newIndex
,
duration:
const
Duration
(
milliseconds:
500
),
curve:
Curves
.
ease
);
duration:
const
Duration
(
milliseconds:
500
),
curve:
Curves
.
ease
);
_title
=
_titleList
[
newIndex
];
},
),
],
),
);
}
}
This diff is collapsed.
Click to expand it.
lib/widgets/musicPlayerState.dart
+
1
−
1
View file @
4005fe0f
...
...
@@ -5,7 +5,6 @@ import 'package:flutter/services.dart';
import
'package:flutter/widgets.dart'
;
import
'package:flutter_dotenv/flutter_dotenv.dart'
;
import
'package:spotify_sdk/models/image_uri.dart'
;
import
'package:logger/logger.dart'
;
import
'package:spotify_sdk/spotify_sdk.dart'
;
class
MusicPlayerState
extends
InheritedWidget
{
...
...
@@ -30,6 +29,7 @@ class MusicPlayerState extends InheritedWidget {
rebuildStream
.
sink
.
add
(
Null
);
}
Future
<
void
>
disconnect
()
async
{
try
{
setLoading
(
true
);
...
...
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