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",
|
||||
"request": "launch",
|
||||
"type": "dart"
|
||||
"type": "dart",
|
||||
"args": [
|
||||
"--flavor",
|
||||
"dev",
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Test",
|
||||
"type": "dart",
|
||||
"request": "launch",
|
||||
"program": "./test/",
|
||||
"args": [
|
||||
"--flavor",
|
||||
"dev",
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Profile",
|
||||
"type": "dart",
|
||||
"request": "launch",
|
||||
"flutterMode": "profile"
|
||||
"flutterMode": "profile",
|
||||
"args": [
|
||||
"--flavor",
|
||||
"dev",
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Release",
|
||||
"type": "dart",
|
||||
"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 {
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId "rocks.mucke"
|
||||
// applicationId "rocks.mucke"
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 29
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
|
@ -47,6 +47,16 @@ android {
|
|||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
flavorDimensions "app"
|
||||
productFlavors {
|
||||
dev {
|
||||
applicationId = "rocks.mucke.dev"
|
||||
}
|
||||
prod {
|
||||
applicationId = "rocks.mucke"
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
// 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 MusicDataStore musicDataStore = GetIt.I<MusicDataStore>();
|
||||
final NavigationStore navStore = GetIt.I<NavigationStore>();
|
||||
|
@ -163,10 +163,10 @@ class CurrentlyPlayingPage extends StatelessWidget {
|
|||
if (song == null)
|
||||
return;
|
||||
// EXPLORATORY
|
||||
final albums = musicDataStore.albumStream.value ?? [];
|
||||
final albums = await musicDataStore.albumStream.first;
|
||||
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);
|
||||
|
||||
showModalBottomSheet(
|
||||
|
|
|
@ -4,6 +4,7 @@ import '../theming.dart';
|
|||
import '../widgets/header.dart';
|
||||
import '../widgets/highlight.dart';
|
||||
import '../widgets/shuffle_all_button.dart';
|
||||
import 'settings_page.dart';
|
||||
|
||||
class HomePage extends StatefulWidget {
|
||||
const HomePage({Key? key}) : super(key: key);
|
||||
|
@ -19,9 +20,18 @@ class _HomePageState extends State<HomePage> {
|
|||
return SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(top: 8.0, left: HORIZONTAL_PADDING),
|
||||
child: Header(title: 'Home'),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0, left: HORIZONTAL_PADDING),
|
||||
child: Header(
|
||||
title: 'Home',
|
||||
onPressed: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (BuildContext context) => const SettingsPage(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: HORIZONTAL_PADDING),
|
||||
|
|
|
@ -14,52 +14,56 @@ class SettingsPage extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
final MusicDataStore store = GetIt.I<MusicDataStore>();
|
||||
|
||||
return ListView(
|
||||
children: [
|
||||
Container(
|
||||
height: 12.0,
|
||||
return SafeArea(
|
||||
child: Material(
|
||||
child: ListView(
|
||||
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';
|
||||
|
||||
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 Function? onPressed;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
Text(title, style: TEXT_HEADER),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.more_vert),
|
||||
onPressed: () {},
|
||||
),
|
||||
if (onPressed != null)
|
||||
IconButton(
|
||||
icon: const Icon(Icons.more_vert),
|
||||
onPressed: () => onPressed!(),
|
||||
),
|
||||
],
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue