mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 09:28:41 +00:00
improve layout for smaller devices
Some checks are pending
Flutter analyze & test / flutter_analyze_and_test (push) Waiting to run
Some checks are pending
Flutter analyze & test / flutter_analyze_and_test (push) Waiting to run
This commit is contained in:
parent
38ab86f5e8
commit
35a90ace0a
6 changed files with 33 additions and 20 deletions
|
|
@ -52,7 +52,7 @@
|
|||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Release"
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ class HomeViewCameraPreview extends StatelessWidget {
|
|||
}
|
||||
return Positioned.fill(
|
||||
child: MediaViewSizing(
|
||||
requiredHeight: 80,
|
||||
requiredHeight: 0,
|
||||
additionalPadding: 59,
|
||||
bottomNavigation: Container(),
|
||||
child: Screenshot(
|
||||
controller: screenshotController,
|
||||
|
|
@ -60,8 +61,8 @@ class SendToCameraPreview extends StatelessWidget {
|
|||
}
|
||||
return Positioned.fill(
|
||||
child: MediaViewSizing(
|
||||
requiredHeight: 80,
|
||||
bottomNavigation: Container(),
|
||||
requiredHeight: 0,
|
||||
additionalPadding: 59,
|
||||
child: Screenshot(
|
||||
controller: screenshotController,
|
||||
child: AspectRatio(
|
||||
|
|
|
|||
|
|
@ -598,7 +598,8 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
|
|||
return Container();
|
||||
}
|
||||
return MediaViewSizing(
|
||||
requiredHeight: 80,
|
||||
requiredHeight: 0,
|
||||
additionalPadding: 59,
|
||||
bottomNavigation: Container(),
|
||||
child: GestureDetector(
|
||||
onPanStart: (details) async {
|
||||
|
|
|
|||
|
|
@ -533,7 +533,7 @@ class _ShareImageEditorView extends State<ShareImageEditorView> {
|
|||
setState(() {});
|
||||
},
|
||||
child: MediaViewSizing(
|
||||
requiredHeight: 80,
|
||||
requiredHeight: 59,
|
||||
bottomNavigation: ColoredBox(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Row(
|
||||
|
|
|
|||
|
|
@ -518,7 +518,7 @@ class _MediaViewerViewState extends State<MediaViewerView> {
|
|||
},
|
||||
child: MediaViewSizing(
|
||||
bottomNavigation: bottomNavigation(),
|
||||
requiredHeight: 80,
|
||||
requiredHeight: 55,
|
||||
child: Stack(
|
||||
children: [
|
||||
if (videoController != null)
|
||||
|
|
|
|||
|
|
@ -6,9 +6,11 @@ class MediaViewSizing extends StatefulWidget {
|
|||
super.key,
|
||||
this.requiredHeight,
|
||||
this.bottomNavigation,
|
||||
this.additionalPadding,
|
||||
});
|
||||
|
||||
final double? requiredHeight;
|
||||
final double? additionalPadding;
|
||||
final Widget? bottomNavigation;
|
||||
final Widget child;
|
||||
|
||||
|
|
@ -20,19 +22,22 @@ class _MediaViewSizingState extends State<MediaViewSizing> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var needToDownSizeImage = false;
|
||||
var availableHeight = MediaQuery.of(context).size.height;
|
||||
|
||||
if (widget.requiredHeight != null) {
|
||||
// Get the screen size and safe area padding
|
||||
final screenSize = MediaQuery.of(context).size;
|
||||
final safeAreaPadding = MediaQuery.of(context).padding;
|
||||
|
||||
// Calculate the available width and height
|
||||
final availableWidth = screenSize.width;
|
||||
final availableHeight =
|
||||
screenSize.height - safeAreaPadding.top - safeAreaPadding.bottom;
|
||||
availableHeight = screenSize.height -
|
||||
safeAreaPadding.top -
|
||||
safeAreaPadding.bottom -
|
||||
(widget.additionalPadding ?? 0);
|
||||
|
||||
final aspectRatioWidth = availableWidth;
|
||||
final aspectRatioHeight = (aspectRatioWidth * 16) / 9;
|
||||
if (widget.requiredHeight != null) {
|
||||
if (aspectRatioHeight < availableHeight) {
|
||||
if ((screenSize.height - widget.requiredHeight!) < aspectRatioHeight) {
|
||||
needToDownSizeImage = true;
|
||||
|
|
@ -43,6 +48,7 @@ class _MediaViewSizingState extends State<MediaViewSizing> {
|
|||
Widget imageChild = Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: SizedBox(
|
||||
height: availableHeight,
|
||||
child: AspectRatio(
|
||||
aspectRatio: 9 / 16,
|
||||
child: ClipRRect(
|
||||
|
|
@ -68,9 +74,14 @@ class _MediaViewSizingState extends State<MediaViewSizing> {
|
|||
}
|
||||
|
||||
return SafeArea(
|
||||
child: Container(
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: availableHeight,
|
||||
),
|
||||
child: Column(
|
||||
children: [imageChild, bottomNavigation],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue