📱 Fix some layout issues on device which has no safe area

This commit is contained in:
LittleSheep 2024-12-02 22:01:02 +08:00
parent 441df4090f
commit 7a617a4f8c
3 changed files with 122 additions and 132 deletions

View File

@ -1,4 +1,5 @@
import 'dart:ui';
import 'dart:math' as math;
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
@ -396,7 +397,7 @@ class _PostPublisherScreenState extends State<PostPublisherScreen>
],
),
SliverToBoxAdapter(child: const Divider(height: 1)),
Gap(MediaQuery.of(context).padding.top),
Gap(math.max(MediaQuery.of(context).padding.top, 50)),
],
),
),

View File

@ -142,11 +142,7 @@ class _AttachmentZoomViewState extends State<AttachmentZoomView> {
Positioned(
left: 16,
right: 16,
bottom: MediaQuery.of(context).padding.bottom > 16
? -MediaQuery.of(context).padding.bottom
: 16,
child: SizedBox(
height: 180,
bottom: 16,
child: Material(
color: Colors.transparent,
child: Builder(builder: (context) {
@ -183,9 +179,8 @@ class _AttachmentZoomViewState extends State<AttachmentZoomView> {
),
Text(
account.nick,
style: Theme.of(context)
.textTheme
.bodyMedium,
style:
Theme.of(context).textTheme.bodyMedium,
),
],
),
@ -277,7 +272,6 @@ class _AttachmentZoomViewState extends State<AttachmentZoomView> {
}),
),
),
),
],
),
);

View File

@ -1,3 +1,5 @@
import 'dart:math' as math;
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
@ -277,7 +279,7 @@ class _PostContentHeader extends StatelessWidget {
context: context,
transition: PopoverTransition.other,
bodyBuilder: (context) => SizedBox(
width: 400,
width: math.min(400, MediaQuery.of(context).size.width - 10),
child: PublisherPopoverCard(
data: data.publisher,
),
@ -507,16 +509,9 @@ class _PostTruncatedHint extends StatelessWidget {
const Gap(4),
Text(
'postTotalLength'.plural(data.body['content_length']),
).padding(right: 12)
)
],
),
Row(
children: [
const Icon(Symbols.unfold_more, size: 20),
const Gap(4),
Text('postReadMore').tr(),
],
)
],
).opacity(0.75);
}