chore: Minor code clean up

This commit is contained in:
Krille 2023-05-15 18:55:27 +02:00
commit cb0fe173d9
7 changed files with 24 additions and 12 deletions

View file

@ -260,7 +260,10 @@ class MessageContent extends StatelessWidget {
decoration: TextDecoration.underline,
decorationColor: textColor.withAlpha(150),
),
onLinkTap: (url) => UrlLauncher(context, url).launchUrl(),
beforeLaunch: (url) {
UrlLauncher(context, url.toString()).launchUrl();
return false;
},
);
},
);

View file

@ -126,8 +126,10 @@ class PinnedEvents extends StatelessWidget {
decorationColor:
Theme.of(context).colorScheme.onSurfaceVariant,
),
onLinkTap: (url) =>
UrlLauncher(context, url).launchUrl(),
beforeLaunch: (url) {
UrlLauncher(context, url.toString()).launchUrl();
return false;
},
);
},
),

View file

@ -142,8 +142,11 @@ class ChatDetailsView extends StatelessWidget {
.bodyMedium!
.color,
),
onLinkTap: (url) =>
UrlLauncher(context, url).launchUrl(),
beforeLaunch: (url) {
UrlLauncher(context, url.toString())
.launchUrl();
return false;
},
),
),
const SizedBox(height: 8),

View file

@ -278,7 +278,10 @@ class StoryView extends StatelessWidget {
? L10n.of(context)!.loadingPleaseWait
: event.content.tryGet<String>('body') ?? '',
textAlign: TextAlign.center,
onLinkTap: (url) => UrlLauncher(context, url).launchUrl(),
beforeLaunch: (url) {
UrlLauncher(context, url.toString()).launchUrl();
return false;
},
linkStyle: TextStyle(
fontSize: 24,
color: Colors.blue.shade50,

View file

@ -160,7 +160,10 @@ class PublicRoomBottomSheet extends StatelessWidget {
fontSize: 14,
color: Theme.of(context).textTheme.bodyMedium!.color,
),
onLinkTap: (url) => UrlLauncher(context, url).launchUrl(),
beforeLaunch: (url) {
UrlLauncher(context, url.toString()).launchUrl();
return false;
},
),
),
],