Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 66 additions & 64 deletions lib/features/player/car_player_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,78 +35,80 @@ class CarPlayerPage extends ConsumerWidget {
)
],
),
body: Center(
child: SingleChildScrollView(
child: Container(
constraints: const BoxConstraints(maxWidth: 600),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 16),
Container(
height: 200,
width: 200,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
color: Colors.grey[300],
body: SafeArea(
child: Center(
child: SingleChildScrollView(
child: Container(
constraints: const BoxConstraints(maxWidth: 600),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 16),
Container(
height: 200,
width: 200,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
color: Colors.grey[300],
),
child: AlbumImage(player.audioService.mediaItem.value!
.extras!['libraryItemId']),
),
const SizedBox(height: 16),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
PlatformText(
player.audioService.mediaItem.value?.title ?? '',
style: Theme.of(context)
.textTheme
.titleLarge
?.copyWith(fontSize: 28),
)
],
),
),
child: AlbumImage(player
.audioService.mediaItem.value!.extras!['libraryItemId']),
),
const SizedBox(height: 16),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
const SizedBox(height: 16),
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
PlatformText(
player.audioService.mediaItem.value?.title ?? '',
style: Theme.of(context)
.textTheme
.titleLarge
?.copyWith(fontSize: 28),
)
SeekingButtons(
positionStream: positionStream,
player: player,
size: size,
isForward: false,
),
PlayButton(
size: size, playerStatusProvider: playerStatus),
SeekingButtons(
positionStream: positionStream,
player: player,
size: size,
isForward: true,
),
],
),
),
const SizedBox(height: 16),
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
SeekingButtons(
positionStream: positionStream,
player: player,
size: size,
isForward: false,
),
PlayButton(size: size, playerStatusProvider: playerStatus),
SeekingButtons(
const SizedBox(height: 32),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16, vertical: 32),
child: ProgressBar(
positionStream: positionStream,
player: player,
showPerChapter: false,
size: size,
isForward: true,
currentChapter: currentChapter,
bufferStream: bufferStream,
disabled: true,
hideChapter: true,
),
],
),
const SizedBox(
height: 32), // Replace Spacer with SizedBox for spacing
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 16, vertical: 32),
child: ProgressBar(
positionStream: positionStream,
player: player,
showPerChapter: false,
size: size,
currentChapter: currentChapter,
bufferStream: bufferStream,
disabled: true,
hideChapter: true,
),
)
],
)
],
),
),
),
),
Expand Down
5 changes: 4 additions & 1 deletion lib/features/player/modules/speed_control.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ class SpeedControl extends ConsumerWidget {
useState(ref.read(settingsProvider)[Constants.PLAYBACK_SPEED]);
customSpeedController.text = speed.value.toString();
return Padding(
padding: const EdgeInsets.only(bottom: 16, left: 16, right: 16),
padding: EdgeInsets.only(
bottom: 16 + MediaQuery.of(context).padding.bottom,
left: 16,
right: 16),
child: Container(
decoration: BoxDecoration(
border: Border.all(color: Theme.of(context).dividerColor),
Expand Down
132 changes: 67 additions & 65 deletions lib/features/player/player_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,79 +41,81 @@ class PlayerPage extends ConsumerWidget {
)
],
),
body: LayoutBuilder(
builder: (context, constraints) {
return SingleChildScrollView(
child: Center(
child: ConstrainedBox(
constraints: BoxConstraints(
maxWidth: 600,
minHeight: constraints
.maxHeight, // Ensure the column takes up the full height
),
child: IntrinsicHeight(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
AlbumImage(
player.audioService.mediaItem.value!
.extras!['libraryItemId'],
size: 200),
const SizedBox(height: 16),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: PlatformText(
player.audioService.mediaItem.value?.title ?? '',
style: Theme.of(context).textTheme.titleLarge,
)),
const SizedBox(height: 16),
PlatformText(
player.audioService.mediaItem.value?.artist ?? '',
style: const TextStyle(fontSize: 16),
),
const SizedBox(height: 16),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
PlayBar(
body: SafeArea(
child: LayoutBuilder(
builder: (context, constraints) {
return SingleChildScrollView(
child: Center(
child: ConstrainedBox(
constraints: BoxConstraints(
maxWidth: 600,
minHeight: constraints.maxHeight,
),
child: IntrinsicHeight(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
AlbumImage(
player.audioService.mediaItem.value!
.extras!['libraryItemId'],
size: 200),
const SizedBox(height: 16),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: PlatformText(
player.audioService.mediaItem.value?.title ??
'',
style: Theme.of(context).textTheme.titleLarge,
)),
const SizedBox(height: 16),
PlatformText(
player.audioService.mediaItem.value?.artist ?? '',
style: const TextStyle(fontSize: 16),
),
const SizedBox(height: 16),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
PlayBar(
positionStream: positionStream,
player: player,
playerStatus: playerStatus,
currentChapter: currentChapter,
size: size),
ProgressBar(
positionStream: positionStream,
player: player,
showPerChapter: user?.setting
?.settings['progressAsChapters'] ??
false,
currentChapter: currentChapter,
bufferStream: bufferStream,
size: size,
),
const SizedBox(height: 16),
PlayerButtonMenu(
size: size,
speedStream: speedStream,
player: player,
libraryItemId: libraryItemId,
playerStatus: playerStatus,
currentChapter: currentChapter,
size: size),
ProgressBar(
positionStream: positionStream,
player: player,
showPerChapter: user?.setting
?.settings['progressAsChapters'] ??
false,
currentChapter: currentChapter,
bufferStream: bufferStream,
size: size,
),
const SizedBox(height: 16),
PlayerButtonMenu(
size: size,
speedStream: speedStream,
player: player,
libraryItemId: libraryItemId,
playerStatus: playerStatus,
currentChapter: currentChapter,
)
],
),
)
],
)
],
),
)
],
),
),
),
),
),
),
);
},
);
},
),
),
);
}
Expand Down
32 changes: 27 additions & 5 deletions lib/features/player/player_wrapper.dart
Original file line number Diff line number Diff line change
@@ -1,20 +1,42 @@
import 'package:abs_flutter/features/player/player_minified.dart';
import 'package:abs_flutter/provider/player_provider.dart';
import 'package:abs_flutter/provider/player_status_provider.dart';
import 'package:abs_flutter/util/helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';

class PlayerWrapper extends StatelessWidget {
class PlayerWrapper extends ConsumerWidget {
final Widget child;

const PlayerWrapper({super.key, required this.child});

@override
Widget build(BuildContext context) {
Widget build(BuildContext context, WidgetRef ref) {
final playerStatus = ref.watch(playStatusProvider).playStatus;
final player = ref.watch(playerProvider);
final showMiniPlayer = playerStatus != PlayerStatus.stopped &&
player.audioService.mediaItem.value != null &&
Helper.getCurrentRoute(GoRouter.of(context)) != '/player';

return Column(
children: <Widget>[
Expanded(child: child),
if (Helper.getCurrentRoute(GoRouter.of(context)) != '/player')
const PlayerMinified()
Expanded(
child: MediaQuery.removePadding(
context: context,
removeBottom: showMiniPlayer,
child: showMiniPlayer
? child
: SafeArea(top: false, bottom: true, child: child),
),
),
if (showMiniPlayer)
Container(
color: Theme.of(context).colorScheme.surface,
padding:
EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
child: const PlayerMinified(),
),
],
);
}
Expand Down
6 changes: 6 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ import 'package:window_manager/window_manager.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();

SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
systemNavigationBarColor: Colors.transparent,
statusBarColor: Colors.transparent,
));

// Secure storage - sensitive data
AndroidOptions getAndroidOptions() => const AndroidOptions(
encryptedSharedPreferences: true,
Expand Down