updates and HomePage mocking
This commit is contained in:
parent
3a3d0810f5
commit
ce8b2be1fe
9 changed files with 170 additions and 15 deletions
|
@ -39,7 +39,7 @@ android {
|
|||
defaultConfig {
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId "com.example.mucke"
|
||||
minSdkVersion 16
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 28
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:audio_session/audio_session.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
|
@ -18,6 +19,10 @@ import 'presentation/widgets/navbar.dart';
|
|||
Future<void> main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await setupGetIt();
|
||||
|
||||
final session = await AudioSession.instance;
|
||||
await session.configure(const AudioSessionConfiguration.music());
|
||||
|
||||
runApp(MyApp());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../widgets/highlight.dart';
|
||||
import '../widgets/shuffle_all_button.dart';
|
||||
|
||||
class HomePage extends StatefulWidget {
|
||||
|
@ -13,9 +14,31 @@ class _HomePageState extends State<HomePage> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
print('HomePage.build');
|
||||
return Container(
|
||||
child: const Center(
|
||||
child: ShuffleAllButton(),
|
||||
return SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8.0,
|
||||
horizontal: 12.0,
|
||||
),
|
||||
child: Text(
|
||||
'mucke',
|
||||
style: Theme.of(context).textTheme.headline1,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const Highlight(),
|
||||
const ShuffleAllButton(
|
||||
verticalPad: 10.0,
|
||||
horizontalPad: 12.0,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -19,10 +19,16 @@ ThemeData theme() => ThemeData(
|
|||
primaryColorBrightness: Brightness.dark,
|
||||
primaryColorLight: DARK2,
|
||||
accentColor: LIGHT1,
|
||||
highlightColor: TURQUOISE,
|
||||
scaffoldBackgroundColor: DARK2,
|
||||
// https://api.flutter.dev/flutter/material/TextTheme-class.html
|
||||
textTheme: const TextTheme(
|
||||
headline6: TextStyle(fontSize: 20.0),
|
||||
headline1: TextStyle(fontSize: 28.0, fontWeight: FontWeight.w900, color: LIGHT1),
|
||||
headline2: TextStyle(fontSize: 24.0, fontWeight: FontWeight.w900, color: Colors.white),
|
||||
headline3: TextStyle(fontSize: 20.0, fontWeight: FontWeight.w900, color: Colors.white),
|
||||
headline4: TextStyle(fontSize: 18.0, fontWeight: FontWeight.w600, color: Colors.white),
|
||||
headline5: TextStyle(fontSize: 18.0, fontWeight: FontWeight.w400, color: Colors.white70),
|
||||
headline6: TextStyle(fontSize: 18.0),
|
||||
),
|
||||
tabBarTheme: const TabBarTheme(
|
||||
labelColor: Colors.white,
|
||||
|
|
96
lib/presentation/widgets/highlight.dart
Normal file
96
lib/presentation/widgets/highlight.dart
Normal file
|
@ -0,0 +1,96 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class Highlight extends StatelessWidget {
|
||||
const Highlight({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 10.0,
|
||||
horizontal: 12.0,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 6.0),
|
||||
child: Text(
|
||||
'Album of the Day',
|
||||
style: Theme.of(context).textTheme.headline3,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: AspectRatio(
|
||||
aspectRatio: 1,
|
||||
child: Card(
|
||||
elevation: 2.0,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
margin: const EdgeInsets.all(0),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(6.0),
|
||||
),
|
||||
child: const Image(
|
||||
image: AssetImage('assets/no_cover.png'),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: AspectRatio(
|
||||
aspectRatio: 2 / 1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 8.0, right: 8.0, top: 0.0, bottom: 1.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'All Our Gods Have Abandoned Us',
|
||||
style: Theme.of(context).textTheme.headline4,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis
|
||||
),
|
||||
Text(
|
||||
'Architects',
|
||||
style: Theme.of(context).textTheme.headline5,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const Spacer(),
|
||||
Container(
|
||||
height: 36.0,
|
||||
child: OutlineButton.icon(
|
||||
onPressed: () {},
|
||||
icon: const Icon(Icons.play_arrow),
|
||||
label: const Text('PLAY'),
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).accentColor),
|
||||
padding: const EdgeInsets.all(0),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(6.0),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -4,16 +4,33 @@ import 'package:provider/provider.dart';
|
|||
import '../state/audio_store.dart';
|
||||
|
||||
class ShuffleAllButton extends StatelessWidget {
|
||||
const ShuffleAllButton({Key key}) : super(key: key);
|
||||
const ShuffleAllButton({Key key, this.verticalPad, this.horizontalPad}) : super(key: key);
|
||||
|
||||
final double verticalPad;
|
||||
final double horizontalPad;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final AudioStore audioStore = Provider.of<AudioStore>(context);
|
||||
|
||||
return RaisedButton(
|
||||
child: const Text('Shuffle All'),
|
||||
onPressed: () => audioStore.shuffleAll(),
|
||||
color: Theme.of(context).accentColor,
|
||||
return Container(
|
||||
constraints: BoxConstraints.expand(height: 40.0 + verticalPad * 2),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: verticalPad,
|
||||
horizontal: horizontalPad,
|
||||
),
|
||||
child: RaisedButton.icon(
|
||||
icon: const Icon(Icons.shuffle),
|
||||
label: const Text('SHUFFLE ALL'),
|
||||
onPressed: () => audioStore.shuffleAll(),
|
||||
color: Theme.of(context).accentColor,
|
||||
highlightColor: Theme.of(context).highlightColor,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(6.0),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ class AudioPlayerTask extends BackgroundAudioTask {
|
|||
print('AudioPlayerTask.init');
|
||||
audioPlayer.positionStream.listen((position) => handlePosition(position));
|
||||
audioPlayer.playerStateStream.listen((event) => handlePlayerState(event));
|
||||
audioPlayer.currentIndexStream.listen((event) => playbackIndex = event);
|
||||
audioPlayer.sequenceStateStream.listen((event) => playbackIndex = event.currentIndex);
|
||||
|
||||
final connectPort = IsolateNameServer.lookupPortByName(MOOR_ISOLATE);
|
||||
final MoorIsolate moorIsolate = MoorIsolate.fromConnectPort(connectPort);
|
||||
|
|
11
pubspec.lock
11
pubspec.lock
|
@ -42,7 +42,14 @@ packages:
|
|||
name: audio_service
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.13.0"
|
||||
version: "0.14.0"
|
||||
audio_session:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: audio_session
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.0.3"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -358,7 +365,7 @@ packages:
|
|||
name: just_audio
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.3.4"
|
||||
version: "0.4.0"
|
||||
logging:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
@ -17,8 +17,9 @@ dependencies:
|
|||
|
||||
flutter_audio_query: ^0.3.5
|
||||
|
||||
audio_service: ^0.13.0
|
||||
just_audio: ^0.3.0
|
||||
audio_service: ^0.14.0
|
||||
audio_session: ^0.0.3
|
||||
just_audio: ^0.4.0
|
||||
|
||||
get_it: ^4.0.2
|
||||
provider: ^4.0.4
|
||||
|
|
Loading…
Add table
Reference in a new issue