constrain images to a max size
This commit is contained in:
parent
b71ebe5fee
commit
b9e42ec51b
1 changed files with 82 additions and 82 deletions
|
|
@ -96,17 +96,7 @@ class RenderEvent extends ConsumerWidget {
|
||||||
Flexible(child: timestamp),
|
Flexible(child: timestamp),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
ClipRRect(
|
Card(
|
||||||
borderRadius: textOnly
|
|
||||||
? BorderRadius.zero
|
|
||||||
: BorderRadius.all(Radius.circular(8)),
|
|
||||||
child: Container(
|
|
||||||
padding: textOnly
|
|
||||||
? EdgeInsets.zero
|
|
||||||
: EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
|
||||||
decoration: textOnly
|
|
||||||
? null
|
|
||||||
: BoxDecoration(
|
|
||||||
color:
|
color:
|
||||||
ref.watch(
|
ref.watch(
|
||||||
ClientStateController.provider.select(
|
ClientStateController.provider.select(
|
||||||
|
|
@ -118,7 +108,9 @@ class RenderEvent extends ConsumerWidget {
|
||||||
? colorScheme.onPrimary
|
? colorScheme.onPrimary
|
||||||
: colorScheme.primaryContainer)
|
: colorScheme.primaryContainer)
|
||||||
: colorScheme.surfaceContainer,
|
: colorScheme.surfaceContainer,
|
||||||
),
|
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
|
@ -185,6 +177,8 @@ class RenderEvent extends ConsumerWidget {
|
||||||
).colorScheme.primary,
|
).colorScheme.primary,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
if (!textOnly)
|
||||||
if (event.content case ImageMessageContent(
|
if (event.content case ImageMessageContent(
|
||||||
:final url,
|
:final url,
|
||||||
:final info,
|
:final info,
|
||||||
|
|
@ -196,7 +190,11 @@ class RenderEvent extends ConsumerWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)) {
|
)) {
|
||||||
final url? => ExpandableImage(
|
final url? => ConstrainedBox(
|
||||||
|
constraints: BoxConstraints.loose(
|
||||||
|
Size.fromWidth(500),
|
||||||
|
),
|
||||||
|
child: ExpandableImage(
|
||||||
url.toString(),
|
url.toString(),
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
borderRadius: BorderRadius.all(
|
borderRadius: BorderRadius.all(
|
||||||
|
|
@ -216,7 +214,8 @@ class RenderEvent extends ConsumerWidget {
|
||||||
loadingProgress == null
|
loadingProgress == null
|
||||||
? child
|
? child
|
||||||
: switch (info?.blurHash) {
|
: switch (info?.blurHash) {
|
||||||
final blurHash? => SizedBox(
|
final blurHash? =>
|
||||||
|
SizedBox(
|
||||||
width:
|
width:
|
||||||
info?.width ??
|
info?.width ??
|
||||||
info?.height ??
|
info?.height ??
|
||||||
|
|
@ -246,6 +245,7 @@ class RenderEvent extends ConsumerWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
_ => Text(
|
_ => Text(
|
||||||
"Nexus currently cannot handle encrypted media",
|
"Nexus currently cannot handle encrypted media",
|
||||||
style: errorStyle,
|
style: errorStyle,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue