Skip to content

Commit

Permalink
Got extendbody working without cutting things off. Added shadow to in…
Browse files Browse the repository at this point in the history
…crease clarity of now-playing bar. Added setting to disable now-playing bar floating and have it take up the full width.
  • Loading branch information
Komodo5197 committed Feb 15, 2024
1 parent 1def01d commit 533f885
Show file tree
Hide file tree
Showing 11 changed files with 490 additions and 382 deletions.
5 changes: 5 additions & 0 deletions lib/components/AlbumScreen/album_screen_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ class _AlbumScreenContentState extends State<AlbumScreenContent> {
parent: widget.parent,
onRemoveFromList: onDelete,
),
SliverToBoxAdapter(
child: Container(
height: MediaQuery.paddingOf(context).bottom,
),
)
],
),
);
Expand Down
5 changes: 5 additions & 0 deletions lib/components/ArtistScreen/artist_screen_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ class _ArtistScreenContentState extends State<ArtistScreenContent> {
childrenForList: albums,
parent: widget.parent,
),
SliverToBoxAdapter(
child: Container(
height: MediaQuery.paddingOf(context).bottom,
),
)
]));
});
}
Expand Down
5 changes: 4 additions & 1 deletion lib/components/MusicScreen/alphabet_item_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ class _AlphabetListState extends State<AlphabetList> {
Widget build(BuildContext context) {
return Container(
alignment: Alignment.centerRight,
padding: const EdgeInsets.symmetric(horizontal: 2),
child: SingleChildScrollView(
padding: EdgeInsets.only(
right: 2,
bottom: MediaQuery.paddingOf(context).bottom,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: List.generate(
Expand Down
785 changes: 416 additions & 369 deletions lib/components/now_playing_bar.dart

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -1175,5 +1175,13 @@
"redownloadSubtitle": "Automatically redownload songs which are expected to be at a different quality due to parent collection changes.",
"@redownloadSubtitle": {
"description": "subtitle for download transcode setting which redownloads songs with higher allowed qualities"
},
"floatNowPlayingTitle": "Float Now-Playing Bar",
"@floatNowPlayingTitle": {
"description": "Title for theme setting which changes now-playing bar from floating to rectangular"
},
"floatNowPlayingSubtitle": "Show Now-Playing bar floating on top of other content.",
"@floatNowPlayingSubtitle": {
"description": "Subtitle for theme setting which changes now-playing bar from floating to rectangular"
}
}
5 changes: 5 additions & 0 deletions lib/models/finamp_models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ const _defaultLoopMode = FinampLoopMode.all;
const _autoLoadLastQueueOnStartup = true;
const _shouldTranscodeDownloadsDefault = TranscodeDownloadsSetting.never;
const _shouldRedownloadTranscodesDefault = false;
const _floatNowPlayingDefault = true;

@HiveType(typeId: 28)
class FinampSettings {
Expand Down Expand Up @@ -129,6 +130,7 @@ class FinampSettings {
this.shouldTranscodeDownloads = _shouldTranscodeDownloadsDefault,
this.shouldRedownloadTranscodes = _shouldRedownloadTranscodesDefault,
this.swipeInsertQueueNext = _swipeInsertQueueNext,
this.floatNowPlaying = _floatNowPlayingDefault,
});

@HiveField(0, defaultValue: _isOfflineDefault)
Expand Down Expand Up @@ -272,6 +274,9 @@ class FinampSettings {
@HiveField(41, defaultValue: _autoLoadLastQueueOnStartup)
bool autoloadLastQueueOnStartup;

@HiveField(42, defaultValue: _floatNowPlayingDefault)
bool floatNowPlaying;

static Future<FinampSettings> create() async {
final downloadLocation = await DownloadLocation.create(
name: "Internal Storage",
Expand Down
7 changes: 5 additions & 2 deletions lib/models/finamp_models.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/screens/album_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class _AlbumScreenState extends State<AlbumScreen> {
ModalRoute.of(context)!.settings.arguments as BaseItemDto;

return Scaffold(
extendBody: true,
body: ValueListenableBuilder<Box<FinampSettings>>(
valueListenable: FinampSettingsHelper.finampSettingsListener,
builder: (context, box, widget) {
Expand Down
4 changes: 3 additions & 1 deletion lib/screens/artist_screen.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import 'package:flutter/material.dart';

import '../components/ArtistScreen/artist_screen_content.dart';
import '../models/jellyfin_models.dart';
import '../components/now_playing_bar.dart';
import '../models/jellyfin_models.dart';

class ArtistScreen extends StatelessWidget {
const ArtistScreen({
Expand All @@ -20,6 +21,7 @@ class ArtistScreen extends StatelessWidget {
ModalRoute.of(context)!.settings.arguments as BaseItemDto;

return Scaffold(
extendBody: true,
body: ArtistScreenContent(
parent: artist,
),
Expand Down
38 changes: 34 additions & 4 deletions lib/screens/layout_settings_screen.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:hive/hive.dart';

import '../components/LayoutSettingsScreen/theme_selector.dart';
import 'tabs_settings_screen.dart';
import '../components/LayoutSettingsScreen/content_grid_view_cross_axis_count_list_tile.dart';
import '../components/LayoutSettingsScreen/content_view_type_dropdown_list_tile.dart';
import '../components/LayoutSettingsScreen/show_text_on_grid_view_selector.dart';
import '../components/LayoutSettingsScreen/show_cover_as_player_background_selector.dart';
import '../components/LayoutSettingsScreen/hide_song_artists_if_same_as_album_artists_selector.dart';
import '../components/LayoutSettingsScreen/show_cover_as_player_background_selector.dart';
import '../components/LayoutSettingsScreen/show_text_on_grid_view_selector.dart';
import '../components/LayoutSettingsScreen/theme_selector.dart';
import '../models/finamp_models.dart';
import '../services/finamp_settings_helper.dart';
import 'tabs_settings_screen.dart';

class LayoutSettingsScreen extends StatelessWidget {
const LayoutSettingsScreen({Key? key}) : super(key: key);
Expand Down Expand Up @@ -36,8 +40,34 @@ class LayoutSettingsScreen extends StatelessWidget {
onTap: () =>
Navigator.of(context).pushNamed(TabsSettingsScreen.routeName),
),
const FloatNowPlayingSwitch(),
],
),
);
}
}

class FloatNowPlayingSwitch extends ConsumerWidget {
const FloatNowPlayingSwitch({super.key});

@override
Widget build(BuildContext context, WidgetRef ref) {
bool? floatBar = ref.watch(FinampSettingsHelper.finampSettingsProvider
.select((value) => value.valueOrNull?.floatNowPlaying));

return SwitchListTile.adaptive(
title: Text(AppLocalizations.of(context)!.floatNowPlayingTitle),
subtitle: Text(AppLocalizations.of(context)!.floatNowPlayingSubtitle),
value: floatBar ?? true,
onChanged: floatBar == null
? null
: (value) async {
FinampSettings finampSettingsTemp =
FinampSettingsHelper.finampSettings;
finampSettingsTemp.floatNowPlaying = value;
await Hive.box<FinampSettings>("FinampSettings")
.put("FinampSettings", finampSettingsTemp);
},
);
}
}
9 changes: 4 additions & 5 deletions lib/screens/music_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,15 @@ class _MusicScreenState extends ConsumerState<MusicScreen>
_buildTabController();
}

return WillPopScope(
onWillPop: () async {
return PopScope(
canPop: !isSearching,
onPopInvoked: (popped) {
if (isSearching) {
_stopSearching();
return false;
}
return true;
},
child: Scaffold(
//extendBody: true,
extendBody: true,
appBar: AppBar(
titleSpacing:
0, // The surrounding iconButtons provide enough padding
Expand Down

0 comments on commit 533f885

Please sign in to comment.