From 0683c4ff8e80479339dbf367c23f7190cd8ae42a Mon Sep 17 00:00:00 2001 From: Tommy Chow Date: Tue, 24 May 2022 13:18:55 -0400 Subject: [PATCH 1/2] Fix chat overlay button showing in portrait (#116) --- lib/screens/channel/chat/chat.dart | 3 ++- lib/screens/channel/video/video_overlay.dart | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/screens/channel/chat/chat.dart b/lib/screens/channel/chat/chat.dart index 4af73766..b1145686 100644 --- a/lib/screens/channel/chat/chat.dart +++ b/lib/screens/channel/chat/chat.dart @@ -108,7 +108,8 @@ class Chat extends StatelessWidget { ), ), ), - if (chatStore.settings.showBottomBar && !chatStore.settings.fullScreen) ChatBottomBar(chatStore: chatStore), + if (chatStore.settings.showBottomBar && (!chatStore.settings.fullScreen || MediaQuery.of(context).orientation == Orientation.portrait)) + ChatBottomBar(chatStore: chatStore), if (chatStore.assetsStore.showEmoteMenu) SizedBox( height: MediaQuery.of(context).size.height / 3, diff --git a/lib/screens/channel/video/video_overlay.dart b/lib/screens/channel/video/video_overlay.dart index e5562de8..74d31351 100644 --- a/lib/screens/channel/video/video_overlay.dart +++ b/lib/screens/channel/video/video_overlay.dart @@ -300,7 +300,7 @@ class VideoOverlay extends StatelessWidget { ), ), ), - if (videoStore.settingsStore.fullScreen) chatOverlayButton, + if (videoStore.settingsStore.fullScreen && orientation == Orientation.landscape) chatOverlayButton, refreshButton, if (Platform.isIOS && videoStore.settingsStore.pictureInPicture) IconButton( From f711ef6458a2ea37f38606cc6056a1ad9fc8f4e6 Mon Sep 17 00:00:00 2001 From: Tommy Chow Date: Tue, 24 May 2022 15:09:21 -0400 Subject: [PATCH 2/2] Fix video overlay not updating properly (#116) --- lib/screens/channel/stores/video_store.dart | 1 - lib/screens/channel/video/video_overlay.dart | 295 ++++++++++--------- 2 files changed, 148 insertions(+), 148 deletions(-) diff --git a/lib/screens/channel/stores/video_store.dart b/lib/screens/channel/stores/video_store.dart index 15731507..32ea9382 100644 --- a/lib/screens/channel/stores/video_store.dart +++ b/lib/screens/channel/stores/video_store.dart @@ -108,7 +108,6 @@ abstract class VideoStoreBase with Store { _streamInfo = null; _overlayTimer.cancel(); - _overlayVisible = true; } } diff --git a/lib/screens/channel/video/video_overlay.dart b/lib/screens/channel/video/video_overlay.dart index 74d31351..40dfb12c 100644 --- a/lib/screens/channel/video/video_overlay.dart +++ b/lib/screens/channel/video/video_overlay.dart @@ -156,167 +156,168 @@ class VideoOverlay extends StatelessWidget { onPressed: () => _showSleepTimerDialog(context), ); - final streamInfo = videoStore.streamInfo; - - if (streamInfo == null) { - return Stack( - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.start, + return Observer( + builder: (context) { + final streamInfo = videoStore.streamInfo; + if (streamInfo == null) { + return Stack( children: [ - backButton, - const Spacer(), - settingsButton, + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + backButton, + const Spacer(), + settingsButton, + ], + ), + Align( + alignment: Alignment.bottomRight, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + if (videoStore.settingsStore.fullScreen && orientation == Orientation.landscape) chatOverlayButton, + refreshButton, + if (orientation == Orientation.landscape) fullScreenButton, + ], + ), + ), ], - ), - Align( - alignment: Alignment.bottomRight, - child: Row( - mainAxisAlignment: MainAxisAlignment.end, + ); + } + + final streamerName = regexEnglish.hasMatch(streamInfo.userName) ? streamInfo.userName : '${streamInfo.userName} (${streamInfo.userLogin})'; + final streamer = Row( + children: [ + ProfilePicture( + userLogin: streamInfo.userLogin, + radius: 10.0, + ), + const SizedBox(width: 5.0), + Flexible( + child: Tooltip( + message: streamerName, + preferBelow: false, + child: Text( + streamerName, + style: const TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + overflow: TextOverflow.ellipsis, + ), + ), + ), + ], + ); + + return Stack( + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (videoStore.settingsStore.fullScreen && orientation == Orientation.landscape) chatOverlayButton, - refreshButton, - if (orientation == Orientation.landscape) fullScreenButton, + backButton, + const Spacer(), + sleepTimerButton, + settingsButton, ], ), - ), - ], - ); - } - final streamerName = regexEnglish.hasMatch(streamInfo.userName) ? streamInfo.userName : '${streamInfo.userName} (${streamInfo.userLogin})'; - - final streamer = Row( - children: [ - ProfilePicture( - userLogin: streamInfo.userLogin, - radius: 10.0, - ), - const SizedBox(width: 5.0), - Flexible( - child: Tooltip( - message: streamerName, - preferBelow: false, - child: Text( - streamerName, - style: const TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold, - color: Colors.white, - ), - overflow: TextOverflow.ellipsis, - ), - ), - ), - ], - ); - - return Observer( - builder: (context) => Stack( - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - backButton, - const Spacer(), - sleepTimerButton, - settingsButton, - ], - ), - // Add a play button when paused for Android - // When an ad is paused on Android there is no way to unpause, so a play button is necessary. - if (Platform.isAndroid) - Center( - child: IconButton( - tooltip: videoStore.paused ? 'Play' : 'Pause', - iconSize: 50.0, - icon: videoStore.paused - ? const Icon( - Icons.play_arrow, - color: Colors.white, - ) - : const Icon( - Icons.pause, - color: Colors.white, - ), - onPressed: videoStore.handlePausePlay, - ), - ) - else if (!videoStore.paused) - Center( - child: IconButton( - tooltip: 'Pause', - iconSize: 50.0, - icon: const Icon( - Icons.pause, - color: Colors.white, + // Add a play button when paused for Android + // When an ad is paused on Android there is no way to unpause, so a play button is necessary. + if (Platform.isAndroid) + Center( + child: IconButton( + tooltip: videoStore.paused ? 'Play' : 'Pause', + iconSize: 50.0, + icon: videoStore.paused + ? const Icon( + Icons.play_arrow, + color: Colors.white, + ) + : const Icon( + Icons.pause, + color: Colors.white, + ), + onPressed: videoStore.handlePausePlay, + ), + ) + else if (!videoStore.paused) + Center( + child: IconButton( + tooltip: 'Pause', + iconSize: 50.0, + icon: const Icon( + Icons.pause, + color: Colors.white, + ), + onPressed: videoStore.handlePausePlay, ), - onPressed: videoStore.handlePausePlay, ), - ), - Align( - alignment: Alignment.bottomLeft, - child: Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Expanded( - child: GestureDetector( - onTap: videoStore.handleExpand, - child: Padding( - padding: const EdgeInsets.all(10.0), - child: videoStore.settingsStore.expandInfo - ? Column( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - streamer, - const SizedBox(height: 5.0), - Tooltip( - message: videoStore.streamInfo!.title.trim(), - preferBelow: false, - padding: const EdgeInsets.all(10.0), - child: Text( - videoStore.streamInfo!.title.trim(), - maxLines: orientation == Orientation.portrait ? 1 : 5, - overflow: TextOverflow.ellipsis, - style: const TextStyle( - color: Colors.white, - fontWeight: FontWeight.w500, + Align( + alignment: Alignment.bottomLeft, + child: Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Expanded( + child: GestureDetector( + onTap: videoStore.handleExpand, + child: Padding( + padding: const EdgeInsets.all(10.0), + child: videoStore.settingsStore.expandInfo + ? Column( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + streamer, + const SizedBox(height: 5.0), + Tooltip( + message: videoStore.streamInfo!.title.trim(), + preferBelow: false, + padding: const EdgeInsets.all(10.0), + child: Text( + videoStore.streamInfo!.title.trim(), + maxLines: orientation == Orientation.portrait ? 1 : 5, + overflow: TextOverflow.ellipsis, + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.w500, + ), ), ), - ), - const SizedBox(height: 5.0), - Text( - '${videoStore.streamInfo?.gameName} \u2022 ${NumberFormat().format(videoStore.streamInfo?.viewerCount)} viewers', - style: const TextStyle( - fontSize: 12.0, - color: Colors.white, - fontWeight: FontWeight.w300, + const SizedBox(height: 5.0), + Text( + '${videoStore.streamInfo?.gameName} \u2022 ${NumberFormat().format(videoStore.streamInfo?.viewerCount)} viewers', + style: const TextStyle( + fontSize: 12.0, + color: Colors.white, + fontWeight: FontWeight.w300, + ), ), - ), - ], - ) - : streamer, + ], + ) + : streamer, + ), ), ), - ), - if (videoStore.settingsStore.fullScreen && orientation == Orientation.landscape) chatOverlayButton, - refreshButton, - if (Platform.isIOS && videoStore.settingsStore.pictureInPicture) - IconButton( - tooltip: 'Picture-in-Picture', - icon: const Icon( - Icons.picture_in_picture_alt_rounded, - color: Colors.white, + if (videoStore.settingsStore.fullScreen && orientation == Orientation.landscape) chatOverlayButton, + refreshButton, + if (Platform.isIOS && videoStore.settingsStore.pictureInPicture) + IconButton( + tooltip: 'Picture-in-Picture', + icon: const Icon( + Icons.picture_in_picture_alt_rounded, + color: Colors.white, + ), + onPressed: videoStore.requestPictureInPicture, ), - onPressed: videoStore.requestPictureInPicture, - ), - if (orientation == Orientation.landscape) fullScreenButton - ], - ), - ) - ], - ), + if (orientation == Orientation.landscape) fullScreenButton + ], + ), + ) + ], + ); + }, ); } }