add cleanup url util for removing stuff like `www.` from urls
This commit is contained in:
parent
598200fa76
commit
a8ac98284a
|
@ -0,0 +1,10 @@
|
|||
String cleanUpUrl(String url) {
|
||||
if (url.startsWith('https://')) {
|
||||
url = url.substring(8);
|
||||
}
|
||||
if (url.startsWith('www.')) {
|
||||
url = url.substring(4);
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
|
@ -13,6 +13,7 @@ import '../hooks/delayed_loading.dart';
|
|||
import '../hooks/logged_in_action.dart';
|
||||
import '../pages/full_post.dart';
|
||||
import '../url_launcher.dart';
|
||||
import '../util/cleanup_url.dart';
|
||||
import '../util/extensions/api.dart';
|
||||
import '../util/goto.dart';
|
||||
import 'bottom_modal.dart';
|
||||
|
@ -209,7 +210,7 @@ class Post extends HookWidget {
|
|||
text: '@',
|
||||
style: TextStyle(fontWeight: FontWeight.w300)),
|
||||
TextSpan(
|
||||
text: instanceUrl,
|
||||
text: cleanUpUrl(instanceUrl),
|
||||
style: TextStyle(fontWeight: FontWeight.w600),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap =
|
||||
|
|
Loading…
Reference in New Issue