flavors
This commit is contained in:
parent
312c6df662
commit
e51d8b6c56
6 changed files with 112 additions and 60 deletions
32
.vscode/launch.json
vendored
32
.vscode/launch.json
vendored
|
@ -7,25 +7,51 @@
|
||||||
{
|
{
|
||||||
"name": "Debug",
|
"name": "Debug",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "dart"
|
"type": "dart",
|
||||||
|
"args": [
|
||||||
|
"--flavor",
|
||||||
|
"dev",
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Test",
|
"name": "Test",
|
||||||
"type": "dart",
|
"type": "dart",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"program": "./test/",
|
"program": "./test/",
|
||||||
|
"args": [
|
||||||
|
"--flavor",
|
||||||
|
"dev",
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Profile",
|
"name": "Profile",
|
||||||
"type": "dart",
|
"type": "dart",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"flutterMode": "profile"
|
"flutterMode": "profile",
|
||||||
|
"args": [
|
||||||
|
"--flavor",
|
||||||
|
"dev",
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Release",
|
"name": "Release",
|
||||||
"type": "dart",
|
"type": "dart",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"flutterMode": "release"
|
"flutterMode": "release",
|
||||||
|
"args": [
|
||||||
|
"--flavor",
|
||||||
|
"dev",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PRODUCTION",
|
||||||
|
"type": "dart",
|
||||||
|
"request": "launch",
|
||||||
|
"flutterMode": "release",
|
||||||
|
"args": [
|
||||||
|
"--flavor",
|
||||||
|
"prod",
|
||||||
|
],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -39,7 +39,7 @@ android {
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||||
applicationId "rocks.mucke"
|
// applicationId "rocks.mucke"
|
||||||
minSdkVersion 19
|
minSdkVersion 19
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
|
@ -47,6 +47,16 @@ android {
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flavorDimensions "app"
|
||||||
|
productFlavors {
|
||||||
|
dev {
|
||||||
|
applicationId = "rocks.mucke.dev"
|
||||||
|
}
|
||||||
|
prod {
|
||||||
|
applicationId = "rocks.mucke"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
// TODO: Add your own signing config for the release build.
|
// TODO: Add your own signing config for the release build.
|
||||||
|
|
|
@ -154,7 +154,7 @@ class CurrentlyPlayingPage extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _openMoreMenu(BuildContext context) {
|
Future<void> _openMoreMenu(BuildContext context) async {
|
||||||
final AudioStore audioStore = GetIt.I<AudioStore>();
|
final AudioStore audioStore = GetIt.I<AudioStore>();
|
||||||
final MusicDataStore musicDataStore = GetIt.I<MusicDataStore>();
|
final MusicDataStore musicDataStore = GetIt.I<MusicDataStore>();
|
||||||
final NavigationStore navStore = GetIt.I<NavigationStore>();
|
final NavigationStore navStore = GetIt.I<NavigationStore>();
|
||||||
|
@ -163,10 +163,10 @@ class CurrentlyPlayingPage extends StatelessWidget {
|
||||||
if (song == null)
|
if (song == null)
|
||||||
return;
|
return;
|
||||||
// EXPLORATORY
|
// EXPLORATORY
|
||||||
final albums = musicDataStore.albumStream.value ?? [];
|
final albums = await musicDataStore.albumStream.first;
|
||||||
final album = albums.singleWhere((a) => a.title == song.album);
|
final album = albums.singleWhere((a) => a.title == song.album);
|
||||||
|
|
||||||
final artists = musicDataStore.artistStream.value ?? [];
|
final artists = await musicDataStore.artistStream.first;
|
||||||
final artist = artists.singleWhere((a) => a.name == album.artist);
|
final artist = artists.singleWhere((a) => a.name == album.artist);
|
||||||
|
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
|
|
|
@ -4,6 +4,7 @@ import '../theming.dart';
|
||||||
import '../widgets/header.dart';
|
import '../widgets/header.dart';
|
||||||
import '../widgets/highlight.dart';
|
import '../widgets/highlight.dart';
|
||||||
import '../widgets/shuffle_all_button.dart';
|
import '../widgets/shuffle_all_button.dart';
|
||||||
|
import 'settings_page.dart';
|
||||||
|
|
||||||
class HomePage extends StatefulWidget {
|
class HomePage extends StatefulWidget {
|
||||||
const HomePage({Key? key}) : super(key: key);
|
const HomePage({Key? key}) : super(key: key);
|
||||||
|
@ -19,9 +20,18 @@ class _HomePageState extends State<HomePage> {
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
const Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(top: 8.0, left: HORIZONTAL_PADDING),
|
padding: const EdgeInsets.only(top: 8.0, left: HORIZONTAL_PADDING),
|
||||||
child: Header(title: 'Home'),
|
child: Header(
|
||||||
|
title: 'Home',
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).push(
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (BuildContext context) => const SettingsPage(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: HORIZONTAL_PADDING),
|
padding: const EdgeInsets.symmetric(horizontal: HORIZONTAL_PADDING),
|
||||||
|
|
|
@ -14,52 +14,56 @@ class SettingsPage extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final MusicDataStore store = GetIt.I<MusicDataStore>();
|
final MusicDataStore store = GetIt.I<MusicDataStore>();
|
||||||
|
|
||||||
return ListView(
|
return SafeArea(
|
||||||
children: [
|
child: Material(
|
||||||
Container(
|
child: ListView(
|
||||||
height: 12.0,
|
children: [
|
||||||
|
Container(
|
||||||
|
height: 12.0,
|
||||||
|
),
|
||||||
|
const Padding(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 16.0,
|
||||||
|
vertical: 4.0,
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'Library',
|
||||||
|
style: TEXT_HEADER,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
title: const Text('Update library'),
|
||||||
|
subtitle: Observer(builder: (_) {
|
||||||
|
final int artistCount = store.artistStream.value?.length ?? 0;
|
||||||
|
final int albumCount = store.albumStream.value?.length ?? 0;
|
||||||
|
final int songCount = store.songStream.value?.length ?? 0;
|
||||||
|
return Text('$artistCount artists, $albumCount albums, $songCount songs');
|
||||||
|
}),
|
||||||
|
onTap: () => store.updateDatabase(),
|
||||||
|
trailing: Observer(builder: (_) {
|
||||||
|
if (store.isUpdatingDatabase) {
|
||||||
|
return const CircularProgressIndicator();
|
||||||
|
}
|
||||||
|
return Container(
|
||||||
|
height: 0,
|
||||||
|
width: 0,
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
const Divider(
|
||||||
|
height: 4.0,
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
title: const Text('Select library folders'),
|
||||||
|
trailing: const Icon(Icons.chevron_right),
|
||||||
|
onTap: () => _openFilePicker(store),
|
||||||
|
),
|
||||||
|
const Divider(
|
||||||
|
height: 4.0,
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
const Padding(
|
),
|
||||||
padding: EdgeInsets.symmetric(
|
|
||||||
horizontal: 16.0,
|
|
||||||
vertical: 4.0,
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
'Library',
|
|
||||||
style: TEXT_HEADER,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
title: const Text('Update library'),
|
|
||||||
subtitle: Observer(builder: (_) {
|
|
||||||
final int artistCount = store.artistStream.value?.length ?? 0;
|
|
||||||
final int albumCount = store.albumStream.value?.length ?? 0;
|
|
||||||
final int songCount = store.songStream.value?.length ?? 0;
|
|
||||||
return Text('$artistCount artists, $albumCount albums, $songCount songs');
|
|
||||||
}),
|
|
||||||
onTap: () => store.updateDatabase(),
|
|
||||||
trailing: Observer(builder: (_) {
|
|
||||||
if (store.isUpdatingDatabase) {
|
|
||||||
return const CircularProgressIndicator();
|
|
||||||
}
|
|
||||||
return Container(
|
|
||||||
height: 0,
|
|
||||||
width: 0,
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
const Divider(
|
|
||||||
height: 4.0,
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
title: const Text('Select library folders'),
|
|
||||||
trailing: const Icon(Icons.chevron_right),
|
|
||||||
onTap: () => _openFilePicker(store),
|
|
||||||
),
|
|
||||||
const Divider(
|
|
||||||
height: 4.0,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,19 +3,21 @@ import 'package:flutter/material.dart';
|
||||||
import '../theming.dart';
|
import '../theming.dart';
|
||||||
|
|
||||||
class Header extends StatelessWidget {
|
class Header extends StatelessWidget {
|
||||||
const Header({Key? key, required this.title}) : super(key: key);
|
const Header({Key? key, required this.title, this.onPressed}) : super(key: key);
|
||||||
|
|
||||||
final String title;
|
final String title;
|
||||||
|
final Function? onPressed;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Row(
|
return Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(title, style: TEXT_HEADER),
|
Text(title, style: TEXT_HEADER),
|
||||||
IconButton(
|
if (onPressed != null)
|
||||||
icon: const Icon(Icons.more_vert),
|
IconButton(
|
||||||
onPressed: () {},
|
icon: const Icon(Icons.more_vert),
|
||||||
),
|
onPressed: () => onPressed!(),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue