Realm responsive

This commit is contained in:
LittleSheep 2024-12-08 17:17:08 +08:00
parent afc49a7a2a
commit 772a33896d

View File

@ -185,63 +185,66 @@ class _RealmScreenState extends State<RealmScreen> {
); );
} }
return Card( return Container(
margin: const EdgeInsets.all(12), constraints: BoxConstraints(maxWidth: 640),
child: InkWell( child: Card(
borderRadius: const BorderRadius.all(Radius.circular(8)), margin: const EdgeInsets.all(12),
child: Column( child: InkWell(
crossAxisAlignment: CrossAxisAlignment.start, borderRadius: const BorderRadius.all(Radius.circular(8)),
children: [ child: Column(
AspectRatio( crossAxisAlignment: CrossAxisAlignment.start,
aspectRatio: 16 / 7, children: [
child: Stack( AspectRatio(
clipBehavior: Clip.none, aspectRatio: 16 / 7,
fit: StackFit.expand, child: Stack(
children: [ clipBehavior: Clip.none,
Container( fit: StackFit.expand,
color: Theme.of(context) children: [
.colorScheme Container(
.surfaceContainer, color: Theme.of(context)
child: (realm.banner?.isEmpty ?? true) .colorScheme
? const SizedBox.shrink() .surfaceContainer,
: AutoResizeUniversalImage( child: (realm.banner?.isEmpty ?? true)
sn.getAttachmentUrl(realm.banner!), ? const SizedBox.shrink()
fit: BoxFit.cover, : AutoResizeUniversalImage(
), sn.getAttachmentUrl(realm.banner!),
), fit: BoxFit.cover,
Positioned( ),
bottom: -30,
left: 18,
child: AccountImage(
content: realm.avatar,
radius: 24,
fallbackWidget:
const Icon(Symbols.group, size: 24),
), ),
), Positioned(
], bottom: -30,
left: 18,
child: AccountImage(
content: realm.avatar,
radius: 24,
fallbackWidget:
const Icon(Symbols.group, size: 24),
),
),
],
),
), ),
), const Gap(20 + 12),
const Gap(20 + 12), Column(
Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ Text(realm.name).textStyle(
Text(realm.name).textStyle( Theme.of(context).textTheme.titleMedium!),
Theme.of(context).textTheme.titleMedium!), Text(realm.description).textStyle(
Text(realm.description).textStyle( Theme.of(context).textTheme.bodySmall!),
Theme.of(context).textTheme.bodySmall!), ],
], ).padding(horizontal: 24, bottom: 14),
).padding(horizontal: 24, bottom: 14), ],
], ),
onTap: () {
GoRouter.of(context).pushNamed(
'realmDetail',
pathParameters: {'alias': realm.alias},
);
},
), ),
onTap: () {
GoRouter.of(context).pushNamed(
'realmDetail',
pathParameters: {'alias': realm.alias},
);
},
), ),
); ).center();
}, },
), ),
), ),