| 
									
										
										
										
											2019-12-02 21:05:49 +01:00
										 |  |  | import 'package:flutter/material.dart'; | 
					
						
							| 
									
										
										
										
											2020-05-04 21:49:44 +02:00
										 |  |  | import 'package:musicus_common/musicus_common.dart'; | 
					
						
							| 
									
										
										
										
											2020-04-24 22:41:52 +02:00
										 |  |  | import 'package:musicus_database/musicus_database.dart'; | 
					
						
							| 
									
										
										
										
											2019-12-02 21:05:49 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | import '../screens/program.dart'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import 'play_pause_button.dart'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class PlayerBar extends StatelessWidget { | 
					
						
							|  |  |  |   @override | 
					
						
							|  |  |  |   Widget build(BuildContext context) { | 
					
						
							| 
									
										
										
										
											2020-05-04 21:49:44 +02:00
										 |  |  |     final backend = MusicusBackend.of(context); | 
					
						
							| 
									
										
										
										
											2019-12-02 21:05:49 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     return BottomAppBar( | 
					
						
							|  |  |  |       child: InkWell( | 
					
						
							|  |  |  |         child: Column( | 
					
						
							|  |  |  |           mainAxisSize: MainAxisSize.min, | 
					
						
							|  |  |  |           children: <Widget>[ | 
					
						
							|  |  |  |             StreamBuilder( | 
					
						
							| 
									
										
										
										
											2020-05-04 21:49:44 +02:00
										 |  |  |               stream: backend.playback.normalizedPosition, | 
					
						
							| 
									
										
										
										
											2019-12-02 21:05:49 +01:00
										 |  |  |               builder: (context, snapshot) => LinearProgressIndicator( | 
					
						
							|  |  |  |                 value: snapshot.data, | 
					
						
							|  |  |  |               ), | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |             Row( | 
					
						
							|  |  |  |               children: <Widget>[ | 
					
						
							|  |  |  |                 Padding( | 
					
						
							|  |  |  |                   padding: const EdgeInsets.all(8.0), | 
					
						
							|  |  |  |                   child: Icon(Icons.keyboard_arrow_up), | 
					
						
							|  |  |  |                 ), | 
					
						
							|  |  |  |                 Expanded( | 
					
						
							| 
									
										
										
										
											2020-04-22 10:32:36 +02:00
										 |  |  |                   child: StreamBuilder<InternalTrack>( | 
					
						
							| 
									
										
										
										
											2020-05-04 21:49:44 +02:00
										 |  |  |                     stream: backend.playback.currentTrack, | 
					
						
							| 
									
										
										
										
											2020-04-22 10:32:36 +02:00
										 |  |  |                     builder: (context, snapshot) { | 
					
						
							|  |  |  |                       if (snapshot.data != null) { | 
					
						
							|  |  |  |                         final recordingId = snapshot.data.track.recordingId; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                         return FutureBuilder<Recording>( | 
					
						
							|  |  |  |                           future: | 
					
						
							|  |  |  |                               backend.db.recordingById(recordingId).getSingle(), | 
					
						
							|  |  |  |                           builder: (context, snapshot) { | 
					
						
							|  |  |  |                             if (snapshot.hasData) { | 
					
						
							|  |  |  |                               final workId = snapshot.data.work; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                               return Column( | 
					
						
							|  |  |  |                                 crossAxisAlignment: CrossAxisAlignment.start, | 
					
						
							|  |  |  |                                 children: <Widget>[ | 
					
						
							|  |  |  |                                   DefaultTextStyle.merge( | 
					
						
							|  |  |  |                                     style: | 
					
						
							|  |  |  |                                         TextStyle(fontWeight: FontWeight.bold), | 
					
						
							|  |  |  |                                     child: ComposersText(workId), | 
					
						
							|  |  |  |                                   ), | 
					
						
							|  |  |  |                                   WorkText(workId), | 
					
						
							|  |  |  |                                 ], | 
					
						
							|  |  |  |                               ); | 
					
						
							|  |  |  |                             } else { | 
					
						
							|  |  |  |                               return Container(); | 
					
						
							|  |  |  |                             } | 
					
						
							|  |  |  |                           }, | 
					
						
							|  |  |  |                         ); | 
					
						
							|  |  |  |                       } else { | 
					
						
							|  |  |  |                         return Container(); | 
					
						
							|  |  |  |                       } | 
					
						
							|  |  |  |                     }, | 
					
						
							| 
									
										
										
										
											2019-12-02 21:05:49 +01:00
										 |  |  |                   ), | 
					
						
							|  |  |  |                 ), | 
					
						
							|  |  |  |                 PlayPauseButton(), | 
					
						
							|  |  |  |               ], | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |           ], | 
					
						
							|  |  |  |         ), | 
					
						
							|  |  |  |         onTap: () => Navigator.push( | 
					
						
							|  |  |  |           context, | 
					
						
							|  |  |  |           MaterialPageRoute( | 
					
						
							|  |  |  |             builder: (context) => ProgramScreen(), | 
					
						
							|  |  |  |           ), | 
					
						
							|  |  |  |         ), | 
					
						
							|  |  |  |       ), | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } |