design: Better paddings in tablet mode

This commit is contained in:
krille-chan 2024-01-07 10:43:51 +01:00
parent 4994db663f
commit 7332e533d0
No known key found for this signature in database
4 changed files with 28 additions and 16 deletions

View file

@ -53,6 +53,7 @@ class ChatMembersView extends StatelessWidget {
),
body: MaxWidthBody(
withScrolling: false,
innerPadding: const EdgeInsets.symmetric(vertical: 8),
child: error != null
? Center(
child: Padding(

View file

@ -36,6 +36,7 @@ class InvitationSelectionView extends StatelessWidget {
title: Text(L10n.of(context)!.inviteContact),
),
body: MaxWidthBody(
innerPadding: const EdgeInsets.symmetric(vertical: 8),
child: Column(
children: [
Padding(

View file

@ -39,6 +39,7 @@ class NewPrivateChatView extends StatelessWidget {
),
body: MaxWidthBody(
withScrolling: false,
innerPadding: const EdgeInsets.symmetric(vertical: 8),
child: Column(
children: [
Padding(
@ -151,18 +152,21 @@ class NewPrivateChatView extends StatelessWidget {
Center(
child: Padding(
padding: const EdgeInsets.all(64.0),
child: Material(
borderRadius: BorderRadius.circular(12),
elevation: 10,
color: Colors.white,
shadowColor:
Theme.of(context).appBarTheme.shadowColor,
clipBehavior: Clip.hardEdge,
child: QrImageView(
data:
'https://matrix.to/#/${Matrix.of(context).client.userID}',
version: QrVersions.auto,
// size: qrCodeSize,
child: ConstrainedBox(
constraints: const BoxConstraints(maxHeight: 256),
child: Material(
borderRadius: BorderRadius.circular(12),
elevation: 10,
color: Colors.white,
shadowColor:
Theme.of(context).appBarTheme.shadowColor,
clipBehavior: Clip.hardEdge,
child: QrImageView(
data:
'https://matrix.to/#/${Matrix.of(context).client.userID}',
version: QrVersions.auto,
// size: qrCodeSize,
),
),
),
),

View file

@ -9,12 +9,14 @@ class MaxWidthBody extends StatelessWidget {
final double maxWidth;
final bool withFrame;
final bool withScrolling;
final EdgeInsets? innerPadding;
const MaxWidthBody({
this.child,
this.maxWidth = 600,
this.withFrame = true,
this.withScrolling = true,
this.innerPadding,
super.key,
});
@override
@ -36,16 +38,20 @@ class MaxWidthBody extends StatelessWidget {
Theme.of(context).appBarTheme.scrolledUnderElevation ??
4,
clipBehavior: Clip.hardEdge,
borderRadius: BorderRadius.circular(
AppConfig.borderRadius,
),
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
shadowColor: Theme.of(context).appBarTheme.shadowColor,
child: child,
)
: child,
);
if (!withScrolling) return childWithPadding;
if (!withScrolling) {
return Padding(
padding: innerPadding ?? EdgeInsets.zero,
child: childWithPadding,
);
}
return SingleChildScrollView(
padding: innerPadding,
physics: const ScrollPhysics(),
child: childWithPadding,
);