mucke/lib/presentation/pages/currently_playing.dart

104 lines
3.3 KiB
Dart
Raw Normal View History

2020-03-20 16:17:02 +01:00
import 'package:flutter/material.dart';
2020-04-09 17:50:28 +02:00
import 'package:flutter_mobx/flutter_mobx.dart';
2020-09-19 20:30:41 +02:00
import 'package:logging/logging.dart';
2020-04-09 17:50:28 +02:00
import 'package:provider/provider.dart';
2020-03-25 17:00:00 +01:00
2020-04-09 17:50:28 +02:00
import '../../domain/entities/song.dart';
import '../state/audio_store.dart';
2020-03-25 17:00:00 +01:00
import '../widgets/album_art.dart';
2020-12-08 22:22:31 +01:00
import '../widgets/album_background.dart';
2020-08-12 20:59:00 +02:00
import '../widgets/next_indicator.dart';
import '../widgets/playback_control.dart';
2020-09-19 17:08:48 +02:00
import '../widgets/song_customization_buttons.dart';
2020-03-25 17:00:00 +01:00
import '../widgets/time_progress_indicator.dart';
2020-08-24 12:01:01 +02:00
import 'queue_page.dart';
2020-03-20 16:17:02 +01:00
2020-04-09 17:50:28 +02:00
class CurrentlyPlayingPage extends StatelessWidget {
const CurrentlyPlayingPage({Key key}) : super(key: key);
2020-03-20 16:17:02 +01:00
2020-09-19 20:30:41 +02:00
static final _log = Logger('CurrentlyPlayingPage');
2020-03-20 16:17:02 +01:00
@override
Widget build(BuildContext context) {
2020-09-19 20:30:41 +02:00
_log.info('build started');
2020-04-09 17:50:28 +02:00
final AudioStore audioStore = Provider.of<AudioStore>(context);
2020-03-20 16:17:02 +01:00
return Scaffold(
body: SafeArea(
child: LayoutBuilder(
2020-04-09 17:50:28 +02:00
builder: (BuildContext context, BoxConstraints constraints) =>
Observer(
builder: (BuildContext context) {
2020-09-19 20:30:41 +02:00
_log.info('Observer.build');
2020-11-15 16:36:50 +01:00
final Song song = audioStore.currentSong;
2020-07-12 18:25:34 +02:00
2020-12-08 22:22:31 +01:00
return AlbumBackground(
song: song,
child: Padding(
padding: const EdgeInsets.only(
left: 12.0,
right: 12.0,
top: 8.0,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
IconButton(
icon: const Icon(Icons.expand_more),
onPressed: () {
Navigator.pop(context);
},
),
IconButton(
icon: const Icon(Icons.more_vert),
onPressed: () {},
)
],
mainAxisAlignment: MainAxisAlignment.spaceBetween,
),
const Spacer(),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: AlbumArt(
song: song,
2020-05-09 19:46:06 +02:00
),
),
2020-12-08 22:22:31 +01:00
const Spacer(
flex: 4,
),
const SongCustomizationButtons(),
const Spacer(
flex: 3,
),
const TimeProgressIndicator(),
const Spacer(
flex: 3,
),
const PlaybackControl(),
const Spacer(),
NextIndicator(
onTapAction: openQueue,
),
],
),
2020-05-09 19:46:06 +02:00
),
2020-04-09 17:50:28 +02:00
);
},
2020-03-28 09:39:59 +01:00
),
2020-03-20 16:17:02 +01:00
),
),
);
}
2020-08-12 20:59:00 +02:00
void openQueue(BuildContext context) {
2020-08-24 12:01:01 +02:00
Navigator.push(
context,
MaterialPageRoute<Widget>(
builder: (BuildContext context) => const QueuePage(),
),
);
2020-08-12 20:59:00 +02:00
}
2020-03-20 16:17:02 +01:00
}