Skip to content

Commit

Permalink
fixes the lil url thingy that shows the second level domain
Browse files Browse the repository at this point in the history
  • Loading branch information
anima-regem committed Nov 11, 2024
1 parent 372c833 commit 4f53056
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions lib/screens/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,15 @@ class _HomeScreenState extends State<HomeScreen> {

String _getSecondLevelDomain(String url) {
final Uri uri = Uri.parse(url);
return uri.host.split('.').sublist(1).join('.');
// Get the second level domain
// only the second level domain
var secondLevelDomain = uri.host.split('.');
var sLD = secondLevelDomain[secondLevelDomain.length - 2];
sLD = sLD + '.' + secondLevelDomain[secondLevelDomain.length - 1];

print('secondLevelDomainName: $sLD');

return sLD;
}

Future<void> _showMetadataDialog(BuildContext context, LinkItem link) async {
Expand Down Expand Up @@ -804,6 +812,9 @@ class _HomeScreenState extends State<HomeScreen> {
.spaceBetween,
children: [
Container(
width: 100,
alignment:
Alignment.center,
decoration:
BoxDecoration(
color: Colors
Expand All @@ -825,7 +836,11 @@ class _HomeScreenState extends State<HomeScreen> {
style: const TextStyle(
fontWeight:
FontWeight
.bold),
.bold,
fontSize: 12),
overflow:
TextOverflow
.ellipsis,
)),
IconButton(
onPressed: () {
Expand Down

0 comments on commit 4f53056

Please sign in to comment.