Skip to content
This repository was archived by the owner on Jan 29, 2026. It is now read-only.

Commit b4757a8

Browse files
authored
Merge pull request #690 from lamarios/feature/fix-safe-area-issues
fix some layout issues
2 parents ccdd91e + b3c0b4c commit b4757a8

File tree

8 files changed

+225
-202
lines changed

8 files changed

+225
-202
lines changed

android/app/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ android {
9999
buildTypes {
100100
release {
101101
signingConfig signingConfigs.release
102+
minifyEnabled true
103+
shrinkResources true
104+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
102105
}
103106
}
104107
namespace 'com.github.lamarios.clipious'

android/app/proguard-rules.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-keep class com.antonkarpenko.ffmpegkit.** { *; }

lib/app/views/screens/main.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ class MainScreen extends StatelessWidget {
4444
left: playerHorizontalPosition.width,
4545
bottom: 0,
4646
right: playerHorizontalPosition.width,
47-
child: const PlayerPlaceHolder()),
47+
child: SafeArea(child: const PlayerPlaceHolder())),
4848
Player(constraints.maxHeight),
4949
if (globalLoading)
5050
Positioned(
5151
child: Container(
52-
color: colors.surface.withOpacity(0.5),
52+
color: colors.surface.withValues(alpha: 0.5),
5353
child: const Center(
5454
child: CircularProgressIndicator(),
5555
)))

lib/home/views/screens/home.dart

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -178,38 +178,34 @@ class _MainScreenState extends State<MainContentScreen> {
178178
),
179179
],
180180
),
181-
body: SafeArea(
182-
bottom: false,
183-
child: Row(
184-
children: [
185-
if (deviceType == DeviceType.tablet &&
186-
allowedPages.length > 2)
187-
OrientationBuilder(
188-
builder: (context, orientation) =>
189-
NavigationRail(
190-
extended: getOrientation() ==
191-
Orientation.landscape,
192-
onDestinationSelected:
193-
tabsRouter.setActiveIndex,
194-
destinations: allowedPages
195-
.map((e) =>
196-
e.getNavigationRailWidget(
197-
context))
198-
.toList(),
199-
selectedIndex: tabsRouter.activeIndex),
200-
),
201-
Expanded(
202-
child: Container(
203-
// home handles its own padding because we don't want to cut horizontal scroll lists on the right
204-
padding: EdgeInsets.symmetric(
205-
horizontal:
206-
selectedPage == HomeDataSource.home
207-
? 0
208-
: innerHorizontalPadding),
209-
child: child),
210-
),
211-
],
212-
)));
181+
body: Row(
182+
children: [
183+
if (deviceType == DeviceType.tablet &&
184+
allowedPages.length > 2)
185+
OrientationBuilder(
186+
builder: (context, orientation) => NavigationRail(
187+
extended:
188+
getOrientation() == Orientation.landscape,
189+
onDestinationSelected:
190+
tabsRouter.setActiveIndex,
191+
destinations: allowedPages
192+
.map((e) =>
193+
e.getNavigationRailWidget(context))
194+
.toList(),
195+
selectedIndex: tabsRouter.activeIndex),
196+
),
197+
Expanded(
198+
child: Container(
199+
// home handles its own padding because we don't want to cut horizontal scroll lists on the right
200+
padding: EdgeInsets.symmetric(
201+
horizontal:
202+
selectedPage == HomeDataSource.home
203+
? 0
204+
: innerHorizontalPadding),
205+
child: child),
206+
),
207+
],
208+
));
213209
});
214210
});
215211
}

lib/player/states/player.dart

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class PlayerCubit extends Cubit<PlayerState> with WidgetsBindingObserver {
5353
onReady();
5454
}
5555

56-
setEvent(MediaEvent event) {
56+
void setEvent(MediaEvent event) {
5757
handleMediaEvent(event);
5858
mapMediaEventToMediaHandler(event);
5959

@@ -70,7 +70,7 @@ class PlayerCubit extends Cubit<PlayerState> with WidgetsBindingObserver {
7070
}
7171
}
7272

73-
mapMediaEventToMediaHandler(MediaEvent event) {
73+
void mapMediaEventToMediaHandler(MediaEvent event) {
7474
if (!isTv && event.type != MediaEventType.progress) {
7575
log.fine("Event state: ${event.state}, ${event.type}");
7676
var playbackState = PlaybackState(
@@ -118,7 +118,7 @@ class PlayerCubit extends Cubit<PlayerState> with WidgetsBindingObserver {
118118
.indexWhere((element) => element.videoId == currentVideoId);
119119
}
120120

121-
onReady() async {
121+
Future<void> onReady() async {
122122
emit(state.copyWith(
123123
orientation: getOrientation(),
124124
forwardStep: settings.state.skipStep,
@@ -154,7 +154,7 @@ class PlayerCubit extends Cubit<PlayerState> with WidgetsBindingObserver {
154154
}
155155
}
156156

157-
handleMediaEvent(MediaEvent event) {
157+
void handleMediaEvent(MediaEvent event) {
158158
switch (event.state) {
159159
case MediaState.completed:
160160
if (state.currentlyPlaying != null) {
@@ -194,11 +194,11 @@ class PlayerCubit extends Cubit<PlayerState> with WidgetsBindingObserver {
194194
}
195195
}
196196

197-
_setPip(bool pip) {
197+
void _setPip(bool pip) {
198198
emit(state.copyWith(isPip: pip));
199199
}
200200

201-
_setMuted(bool muted) {
201+
void _setMuted(bool muted) {
202202
emit(state.copyWith(muted: muted));
203203
}
204204

@@ -222,20 +222,20 @@ class PlayerCubit extends Cubit<PlayerState> with WidgetsBindingObserver {
222222
}
223223
}
224224

225-
setVideos(List<Video> videos) {
225+
void setVideos(List<Video> videos) {
226226
var newVideos = videos.where((element) => !element.filtered).toList();
227227
emit(state.copyWith(videos: newVideos, offlineVideos: []));
228228
}
229229

230-
selectTab(int index) {
230+
void selectTab(int index) {
231231
emit(state.copyWith(selectedFullScreenIndex: index));
232232
}
233233

234-
setAudio(bool? newValue) {
234+
void setAudio(bool? newValue) {
235235
emit(state.copyWith(isAudio: newValue ?? false));
236236
}
237237

238-
hide() {
238+
void hide() {
239239
var mediaEvent = MediaEvent(
240240
state: MediaState.playing,
241241
type: MediaEventType.miniDisplayChanged,
@@ -274,7 +274,7 @@ class PlayerCubit extends Cubit<PlayerState> with WidgetsBindingObserver {
274274
}
275275
*/
276276

277-
saveProgress(int timeInSeconds) async {
277+
Future<void> saveProgress(int timeInSeconds) async {
278278
if (state.currentlyPlaying != null) {
279279
int currentPosition = timeInSeconds;
280280
// saving progress
@@ -300,7 +300,7 @@ class PlayerCubit extends Cubit<PlayerState> with WidgetsBindingObserver {
300300
}
301301
}
302302

303-
queueVideos(List<Video> videos) {
303+
void queueVideos(List<Video> videos) {
304304
var stateVideos = List<Video>.from(state.videos);
305305
if (videos.isNotEmpty) {
306306
//removing videos that are already in the queue
@@ -316,7 +316,7 @@ class PlayerCubit extends Cubit<PlayerState> with WidgetsBindingObserver {
316316
generatePlayQueue();
317317
}
318318

319-
showBigPlayer() {
319+
void showBigPlayer() {
320320
var mediaEvent = MediaEvent(
321321
state: MediaState.playing,
322322
type: MediaEventType.miniDisplayChanged,
@@ -327,7 +327,7 @@ class PlayerCubit extends Cubit<PlayerState> with WidgetsBindingObserver {
327327
onOrientationChange();
328328
}
329329

330-
showMiniPlayer() {
330+
void showMiniPlayer() {
331331
if (state.currentlyPlaying != null ||
332332
state.offlineCurrentlyPlaying != null) {
333333
var mediaEvent = MediaEvent(
@@ -343,7 +343,7 @@ class PlayerCubit extends Cubit<PlayerState> with WidgetsBindingObserver {
343343
}
344344
}
345345

346-
onProgress(Duration? position) async {
346+
Future<void> onProgress(Duration? position) async {
347347
var newPosition = position ?? Duration.zero;
348348
int currentPosition = newPosition.inSeconds;
349349
await saveProgress(currentPosition);
@@ -390,7 +390,7 @@ class PlayerCubit extends Cubit<PlayerState> with WidgetsBindingObserver {
390390
}
391391
}
392392

393-
_playNextNow() async {
393+
Future<void> _playNextNow() async {
394394
if (settings.state.playerRepeatMode == PlayerRepeat.repeatOne) {
395395
seek(Duration.zero);
396396
play();
@@ -426,12 +426,12 @@ class PlayerCubit extends Cubit<PlayerState> with WidgetsBindingObserver {
426426
}
427427
}
428428

429-
playNext() {
429+
void playNext() {
430430
EasyThrottle.throttle(
431431
skipToVideoThrottleName, const Duration(seconds: 1), _playNextNow);
432432
}
433433

434-
playPrevious() {
434+
void playPrevious() {
435435
EasyThrottle.throttle(skipToVideoThrottleName, const Duration(seconds: 1),
436436
() async {
437437
if (state.playedVideos.isNotEmpty) {
@@ -462,11 +462,11 @@ class PlayerCubit extends Cubit<PlayerState> with WidgetsBindingObserver {
462462
});
463463
}
464464

465-
_setPlaying(bool playing) {
465+
void _setPlaying(bool playing) {
466466
emit(state.copyWith(isPlaying: playing));
467467
}
468468

469-
_playVideos(List<IdedVideo> vids, {Duration? startAt}) async {
469+
Future<void> _playVideos(List<IdedVideo> vids, {Duration? startAt}) async {
470470
if (vids.isNotEmpty) {
471471
bool isOffline = vids[0] is DownloadedVideo;
472472

@@ -507,7 +507,7 @@ class PlayerCubit extends Cubit<PlayerState> with WidgetsBindingObserver {
507507

508508
/// skip to queue video of index
509509
/// if we're not shuffling, we also rebuild the playnext and played previously queue
510-
skipToVideo(int index) {
510+
void skipToVideo(int index) {
511511
var listToCheckAgainst =
512512
state.videos.isNotEmpty ? state.videos : state.offlineVideos;
513513
if (index < 0 || index >= listToCheckAgainst.length) {
@@ -533,7 +533,7 @@ class PlayerCubit extends Cubit<PlayerState> with WidgetsBindingObserver {
533533
}
534534

535535
/// Switches to a video without changing the queue
536-
_switchToVideo(IdedVideo video, {Duration? startAt}) async {
536+
Future<void> _switchToVideo(IdedVideo video, {Duration? startAt}) async {
537537
try {
538538
// we move the existing video to the stack of played video
539539
await audioSession.setActive(true);
@@ -617,12 +617,13 @@ class PlayerCubit extends Cubit<PlayerState> with WidgetsBindingObserver {
617617
}
618618
}
619619

620-
playOfflineVideos(List<DownloadedVideo> offlineVids) async {
620+
Future<void> playOfflineVideos(List<DownloadedVideo> offlineVids) async {
621621
log.fine('Playing ${offlineVids.length} offline videos');
622622
await _playVideos(offlineVids);
623623
}
624624

625-
playVideo(List<Video> v, {bool? audio, Duration? startAt}) async {
625+
Future<void> playVideo(List<Video> v,
626+
{bool? audio, Duration? startAt}) async {
626627
List<Video> videos = v.where((element) => !element.filtered).toList();
627628
// TODO: find how to do this with auto router
628629
log.fine('Playing ${videos.length} videos');
@@ -632,29 +633,29 @@ class PlayerCubit extends Cubit<PlayerState> with WidgetsBindingObserver {
632633
await _playVideos(videos, startAt: startAt);
633634
}
634635

635-
switchToOfflineVideo(DownloadedVideo video) async {
636+
Future<void> switchToOfflineVideo(DownloadedVideo video) async {
636637
await _switchToVideo(video);
637638
}
638639

639-
switchToVideo(Video video, {Duration? startAt}) async {
640+
Future<void> switchToVideo(Video video, {Duration? startAt}) async {
640641
await _switchToVideo(video, startAt: startAt);
641642
}
642643

643644
void togglePlaying() {
644645
state.isPlaying ? pause() : play();
645646
}
646647

647-
play() {
648+
void play() {
648649
emit(state.copyWith(
649650
mediaCommand: const MediaCommand(MediaCommandType.play)));
650651
}
651652

652-
pause() {
653+
void pause() {
653654
emit(state.copyWith(
654655
mediaCommand: const MediaCommand(MediaCommandType.pause)));
655656
}
656657

657-
removeVideoFromQueue(String videoId) {
658+
void removeVideoFromQueue(String videoId) {
658659
var videos = List<Video>.from(state.videos);
659660
var offlineVideos = List<DownloadedVideo>.from(state.offlineVideos);
660661
var listToUpdate = videos.isNotEmpty ? videos : offlineVideos;
@@ -716,12 +717,12 @@ class PlayerCubit extends Cubit<PlayerState> with WidgetsBindingObserver {
716717
}
717718

718719
bool isVideoInQueue(Video video) {
719-
return state.videos.indexWhere(
720-
(element) => (element.videoId ?? '') == video.videoId) >=
720+
return state.videos
721+
.indexWhere((element) => element.videoId == video.videoId) >=
721722
0;
722723
}
723724

724-
onQueueReorder(int oldItemIndex, int newItemIndex) {
725+
void onQueueReorder(int oldItemIndex, int newItemIndex) {
725726
log.fine('Dragged video');
726727
var videos = List<Video>.from(state.videos);
727728
var offlineVideos = List<DownloadedVideo>.from(state.offlineVideos);
@@ -763,7 +764,7 @@ class PlayerCubit extends Cubit<PlayerState> with WidgetsBindingObserver {
763764
}
764765
}
765766

766-
setSponsorBlock() async {
767+
Future<void> setSponsorBlock() async {
767768
List<Pair<int>> newSegments = [];
768769
if (state.currentlyPlaying != null) {
769770
List<SponsorSegmentType> types = SponsorSegmentType.values
@@ -787,7 +788,7 @@ class PlayerCubit extends Cubit<PlayerState> with WidgetsBindingObserver {
787788
emit(state.copyWith(sponsorSegments: newSegments));
788789
}
789790

790-
seek(Duration duration) {
791+
void seek(Duration duration) {
791792
if (duration.inSeconds < 0) {
792793
duration = Duration.zero;
793794
}

lib/player/views/components/mini_player_aware.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class MiniPlayerAware extends StatelessWidget {
2525
bottom: !isHidden && isMini && !isClosing ? targetHeight : 0),
2626
duration: animationDuration,
2727
curve: Curves.easeInOutQuad,
28-
child: child,
28+
child: SafeArea(bottom: !isHidden && isMini, child: child),
2929
);
3030
},
3131
);

0 commit comments

Comments
 (0)