Skip to content

Commit

Permalink
Fixed Showing Black screen #197
Browse files Browse the repository at this point in the history
  • Loading branch information
anandnet committed Apr 12, 2024
1 parent dd85c0d commit 3ac594c
Showing 1 changed file with 67 additions and 53 deletions.
120 changes: 67 additions & 53 deletions lib/ui/home.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import 'dart:io';
import 'package:audio_service/audio_service.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:harmonymusic/ui/screens/Home/home_screen_controller.dart';
import 'package:harmonymusic/ui/screens/Settings/settings_screen_controller.dart';
Expand Down Expand Up @@ -36,7 +39,7 @@ class Home extends StatelessWidget {
}
return PopScope(
canPop: false,
onPopInvoked: (didPop) {
onPopInvoked: (didPop) async {
if (didPop) return;
if (playerController.playerPanelController.isPanelOpen) {
playerController.playerPanelController.close();
Expand All @@ -46,7 +49,13 @@ class Home extends StatelessWidget {
.canPop()) {
Get.nestedKey(ScreenNavigationSetup.id)!.currentState!.pop();
} else {
Navigator.of(context).pop();
if (playerController.buttonState.value ==
PlayButtonState.playing) {
SystemNavigator.pop();
} else {
await Get.find<AudioHandler>().customAction("saveSession");
exit(0);
}
}
}
},
Expand All @@ -60,61 +69,66 @@ class Home extends StatelessWidget {
child: const BottomNavBar())
: null,
key: playerController.homeScaffoldkey,
endDrawer:GetPlatform.isDesktop? Container(
constraints: const BoxConstraints(maxWidth: 600),
decoration: BoxDecoration(
borderRadius:
const BorderRadius.only(topLeft: Radius.circular(10)),
border: Border(
left: BorderSide(
color: Theme.of(context).colorScheme.secondary),
top: BorderSide(
color: Theme.of(context).colorScheme.secondary),
),
),
margin: const EdgeInsets.only(
top: 5,
bottom: 106,
),
child: SizedBox(
child: Column(
children: [
SizedBox(
height: 60,
child: ColoredBox(
color: Theme.of(context).canvasColor,
child: Center(
child: Padding(
padding:
const EdgeInsets.only(left: 15.0, right: 15),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"${playerController.currentQueue.length} ${"songs".tr}"),
Text(
"upNext".tr,
style: Theme.of(context).textTheme.titleLarge,
),
IconButton(
onPressed: () {
playerController.shuffleQueue();
},
icon: const Icon(Icons.shuffle))
],
),
)),
endDrawer: GetPlatform.isDesktop
? Container(
constraints: const BoxConstraints(maxWidth: 600),
decoration: BoxDecoration(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(10)),
border: Border(
left: BorderSide(
color: Theme.of(context).colorScheme.secondary),
top: BorderSide(
color: Theme.of(context).colorScheme.secondary),
),
),
const Expanded(
child: UpNextQueue(
isQueueInSlidePanel: false,
margin: const EdgeInsets.only(
top: 5,
bottom: 106,
),
child: SizedBox(
child: Column(
children: [
SizedBox(
height: 60,
child: ColoredBox(
color: Theme.of(context).canvasColor,
child: Center(
child: Padding(
padding: const EdgeInsets.only(
left: 15.0, right: 15),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
"${playerController.currentQueue.length} ${"songs".tr}"),
Text(
"upNext".tr,
style: Theme.of(context)
.textTheme
.titleLarge,
),
IconButton(
onPressed: () {
playerController.shuffleQueue();
},
icon: const Icon(Icons.shuffle))
],
),
)),
),
),
const Expanded(
child: UpNextQueue(
isQueueInSlidePanel: false,
),
),
],
),
),
],
),
),
):null,
)
: null,
drawerScrimColor: Colors.transparent,
body: Obx(() => SlidingUpPanel(
onPanelSlide: playerController.panellistener,
Expand Down

0 comments on commit 3ac594c

Please sign in to comment.