mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-07 21:48:14 -08:00
[Bugfix] Wrap body in SafeArea for improved layout (#9)
Wrapped the `body` widget in a `SafeArea` widget to prevent content from being obscured by notches, status bars, or other screen intrusions. #6 --------- Co-authored-by: PartyDonut <42371342+PartyDonut@users.noreply.github.com>
This commit is contained in:
parent
dddf72241d
commit
4b846f4a51
1 changed files with 182 additions and 180 deletions
|
|
@ -55,200 +55,202 @@ class _SyncItemDetailsState extends ConsumerState<SyncItemDetails> {
|
|||
|
||||
return SyncMarkedForDelete(
|
||||
syncedItem: syncedItem,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Card(
|
||||
elevation: 1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(baseItem?.type.label(context) ?? ""),
|
||||
)),
|
||||
Text(
|
||||
context.localized.navigationSync,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
icon: const Icon(IconsaxBold.close_circle),
|
||||
)
|
||||
],
|
||||
),
|
||||
if (baseItem != null) ...{
|
||||
const Divider(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: (AdaptiveLayout.poster(context).size *
|
||||
ref.watch(clientSettingsProvider.select((value) => value.posterSize))) *
|
||||
0.6,
|
||||
child: IgnorePointer(
|
||||
child: PosterWidget(
|
||||
aspectRatio: 0.7,
|
||||
poster: baseItem,
|
||||
inlineTitle: true,
|
||||
child: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Card(
|
||||
elevation: 1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(baseItem?.type.label(context) ?? ""),
|
||||
)),
|
||||
Text(
|
||||
context.localized.navigationSync,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
icon: const Icon(IconsaxBold.close_circle),
|
||||
)
|
||||
],
|
||||
),
|
||||
if (baseItem != null) ...{
|
||||
const Divider(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: (AdaptiveLayout.poster(context).size *
|
||||
ref.watch(clientSettingsProvider.select((value) => value.posterSize))) *
|
||||
0.6,
|
||||
child: IgnorePointer(
|
||||
child: PosterWidget(
|
||||
aspectRatio: 0.7,
|
||||
poster: baseItem,
|
||||
inlineTitle: true,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: SyncProgressBuilder(
|
||||
item: syncedItem,
|
||||
builder: (context, combinedStream) {
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
baseItem.detailedName(context) ?? "",
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
SyncSubtitle(syncItem: syncedItem),
|
||||
SyncLabel(
|
||||
label: context.localized
|
||||
.totalSize(ref.watch(syncSizeProvider(syncedItem)).byteFormat ?? '--'),
|
||||
status: ref.watch(syncStatusesProvider(syncedItem)).value ?? SyncStatus.partially,
|
||||
),
|
||||
].addInBetween(const SizedBox(height: 8)),
|
||||
Expanded(
|
||||
child: SyncProgressBuilder(
|
||||
item: syncedItem,
|
||||
builder: (context, combinedStream) {
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
baseItem.detailedName(context) ?? "",
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
SyncSubtitle(syncItem: syncedItem),
|
||||
SyncLabel(
|
||||
label: context.localized
|
||||
.totalSize(ref.watch(syncSizeProvider(syncedItem)).byteFormat ?? '--'),
|
||||
status: ref.watch(syncStatusesProvider(syncedItem)).value ?? SyncStatus.partially,
|
||||
),
|
||||
].addInBetween(const SizedBox(height: 8)),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (combinedStream?.task != null) ...{
|
||||
if (combinedStream?.status != TaskStatus.paused)
|
||||
IconButton(
|
||||
onPressed: () =>
|
||||
ref.read(backgroundDownloaderProvider).pause(combinedStream!.task!),
|
||||
icon: const Icon(IconsaxBold.pause),
|
||||
),
|
||||
if (combinedStream?.status == TaskStatus.paused) ...[
|
||||
IconButton(
|
||||
onPressed: () =>
|
||||
ref.read(backgroundDownloaderProvider).resume(combinedStream!.task!),
|
||||
icon: const Icon(IconsaxBold.play),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () => ref.read(syncProvider.notifier).deleteFullSyncFiles(syncedItem),
|
||||
icon: const Icon(IconsaxBold.stop),
|
||||
),
|
||||
],
|
||||
const SizedBox(width: 16)
|
||||
},
|
||||
if (combinedStream != null && combinedStream.hasDownload)
|
||||
SizedBox.fromSize(
|
||||
size: const Size.fromRadius(35),
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
CircularProgressIndicator(
|
||||
value: combinedStream.progress,
|
||||
strokeWidth: 8,
|
||||
backgroundColor: Theme.of(context).colorScheme.surface.withOpacity(0.5),
|
||||
strokeCap: StrokeCap.round,
|
||||
color: combinedStream.status.color(context),
|
||||
),
|
||||
Center(child: Text("${((combinedStream.progress) * 100).toStringAsFixed(0)}%"))
|
||||
],
|
||||
)),
|
||||
],
|
||||
);
|
||||
},
|
||||
if (combinedStream?.task != null) ...{
|
||||
if (combinedStream?.status != TaskStatus.paused)
|
||||
IconButton(
|
||||
onPressed: () =>
|
||||
ref.read(backgroundDownloaderProvider).pause(combinedStream!.task!),
|
||||
icon: const Icon(IconsaxBold.pause),
|
||||
),
|
||||
if (combinedStream?.status == TaskStatus.paused) ...[
|
||||
IconButton(
|
||||
onPressed: () =>
|
||||
ref.read(backgroundDownloaderProvider).resume(combinedStream!.task!),
|
||||
icon: const Icon(IconsaxBold.play),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () => ref.read(syncProvider.notifier).deleteFullSyncFiles(syncedItem),
|
||||
icon: const Icon(IconsaxBold.stop),
|
||||
),
|
||||
],
|
||||
const SizedBox(width: 16)
|
||||
},
|
||||
if (combinedStream != null && combinedStream.hasDownload)
|
||||
SizedBox.fromSize(
|
||||
size: const Size.fromRadius(35),
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
CircularProgressIndicator(
|
||||
value: combinedStream.progress,
|
||||
strokeWidth: 8,
|
||||
backgroundColor: Theme.of(context).colorScheme.surface.withOpacity(0.5),
|
||||
strokeCap: StrokeCap.round,
|
||||
color: combinedStream.status.color(context),
|
||||
),
|
||||
Center(child: Text("${((combinedStream.progress) * 100).toStringAsFixed(0)}%"))
|
||||
],
|
||||
)),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
if (!hasFile && !downloadTask.hasDownload && syncedItem.hasVideoFile)
|
||||
IconButtonAwait(
|
||||
onPressed: () async => await ref.read(syncProvider.notifier).syncVideoFile(syncedItem, false),
|
||||
icon: const Icon(IconsaxOutline.cloud_change),
|
||||
)
|
||||
else if (hasFile)
|
||||
IconButtonAwait(
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
if (!hasFile && !downloadTask.hasDownload && syncedItem.hasVideoFile)
|
||||
IconButtonAwait(
|
||||
onPressed: () async => await ref.read(syncProvider.notifier).syncVideoFile(syncedItem, false),
|
||||
icon: const Icon(IconsaxOutline.cloud_change),
|
||||
)
|
||||
else if (hasFile)
|
||||
IconButtonAwait(
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
onPressed: () {
|
||||
showDefaultAlertDialog(
|
||||
context,
|
||||
context.localized.syncRemoveDataTitle,
|
||||
context.localized.syncRemoveDataDesc,
|
||||
(context) {
|
||||
ref.read(syncProvider.notifier).deleteFullSyncFiles(syncedItem);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
context.localized.delete,
|
||||
(context) => Navigator.of(context).pop(),
|
||||
context.localized.cancel,
|
||||
);
|
||||
},
|
||||
icon: const Icon(IconsaxOutline.trash),
|
||||
),
|
||||
].addInBetween(const SizedBox(width: 16)),
|
||||
),
|
||||
),
|
||||
},
|
||||
const Divider(),
|
||||
if (syncChildren.isNotEmpty == true)
|
||||
Flexible(
|
||||
child: ListView(
|
||||
shrinkWrap: true,
|
||||
children: [
|
||||
...syncChildren.map(
|
||||
(e) => ChildSyncWidget(syncedChild: e),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 16),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
if (baseItem is! EpisodeModel)
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Theme.of(context).colorScheme.errorContainer,
|
||||
foregroundColor: Theme.of(context).colorScheme.onErrorContainer,
|
||||
),
|
||||
onPressed: () {
|
||||
showDefaultAlertDialog(
|
||||
context,
|
||||
context.localized.syncRemoveDataTitle,
|
||||
context.localized.syncRemoveDataDesc,
|
||||
(context) {
|
||||
ref.read(syncProvider.notifier).deleteFullSyncFiles(syncedItem);
|
||||
Navigator.of(context).pop();
|
||||
context.localized.syncDeleteItemTitle,
|
||||
context.localized.syncDeleteItemDesc(baseItem?.detailedName(context) ?? ""),
|
||||
(context) async {
|
||||
await ref.read(syncProvider.notifier).removeSync(syncedItem);
|
||||
Navigator.pop(context);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
context.localized.delete,
|
||||
(context) => Navigator.of(context).pop(),
|
||||
(context) => Navigator.pop(context),
|
||||
context.localized.cancel,
|
||||
);
|
||||
},
|
||||
icon: const Icon(IconsaxOutline.trash),
|
||||
),
|
||||
].addInBetween(const SizedBox(width: 16)),
|
||||
),
|
||||
),
|
||||
},
|
||||
const Divider(),
|
||||
if (syncChildren.isNotEmpty == true)
|
||||
Flexible(
|
||||
child: ListView(
|
||||
shrinkWrap: true,
|
||||
children: [
|
||||
...syncChildren.map(
|
||||
(e) => ChildSyncWidget(syncedChild: e),
|
||||
),
|
||||
child: Text(context.localized.delete),
|
||||
)
|
||||
else if (syncedItem.parentId != null)
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
final parentItem = ref.read(syncProvider.notifier).getParentItem(syncedItem.parentId!);
|
||||
setState(() {
|
||||
if (parentItem != null) {
|
||||
syncedItem = parentItem;
|
||||
}
|
||||
});
|
||||
},
|
||||
child: Text(context.localized.syncOpenParent),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 16),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
if (baseItem is! EpisodeModel)
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Theme.of(context).colorScheme.errorContainer,
|
||||
foregroundColor: Theme.of(context).colorScheme.onErrorContainer,
|
||||
),
|
||||
onPressed: () {
|
||||
showDefaultAlertDialog(
|
||||
context,
|
||||
context.localized.syncDeleteItemTitle,
|
||||
context.localized.syncDeleteItemDesc(baseItem?.detailedName(context) ?? ""),
|
||||
(context) async {
|
||||
await ref.read(syncProvider.notifier).removeSync(syncedItem);
|
||||
Navigator.pop(context);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
context.localized.delete,
|
||||
(context) => Navigator.pop(context),
|
||||
context.localized.cancel,
|
||||
);
|
||||
},
|
||||
child: Text(context.localized.delete),
|
||||
)
|
||||
else if (syncedItem.parentId != null)
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
final parentItem = ref.read(syncProvider.notifier).getParentItem(syncedItem.parentId!);
|
||||
setState(() {
|
||||
if (parentItem != null) {
|
||||
syncedItem = parentItem;
|
||||
}
|
||||
});
|
||||
},
|
||||
child: Text(context.localized.syncOpenParent),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue