use uri breadcrumb representation wherever possible
This commit is contained in:
+3
-2
@@ -25,6 +25,7 @@ import 'package:skeletonizer/skeletonizer.dart';
|
||||
import 'package:text_scroll/text_scroll.dart';
|
||||
import 'package:weblibre/features/geckoview/domain/providers/tab_state.dart';
|
||||
import 'package:weblibre/features/geckoview/features/browser/presentation/widgets/tab_icon.dart';
|
||||
import 'package:weblibre/presentation/widgets/uri_breadcrumb.dart';
|
||||
|
||||
class AppBarTitle extends HookConsumerWidget {
|
||||
const AppBarTitle({super.key});
|
||||
@@ -100,8 +101,8 @@ class AppBarTitle extends HookConsumerWidget {
|
||||
icon,
|
||||
const SizedBox(width: 4),
|
||||
Expanded(
|
||||
child: Text(
|
||||
tabState.url.authority,
|
||||
child: UriBreadcrumb(
|
||||
uri: tabState.url,
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
color: theme.colorScheme.onSurface,
|
||||
),
|
||||
|
||||
+2
-5
@@ -36,6 +36,7 @@ import 'package:weblibre/features/geckoview/features/tabs/domain/providers/selec
|
||||
import 'package:weblibre/features/geckoview/features/tabs/domain/repositories/tab_search.dart';
|
||||
import 'package:weblibre/features/geckoview/features/tabs/presentation/widgets/container_chips.dart';
|
||||
import 'package:weblibre/presentation/hooks/listenable_callback.dart';
|
||||
import 'package:weblibre/presentation/widgets/uri_breadcrumb.dart';
|
||||
import 'package:weblibre/presentation/widgets/url_icon.dart';
|
||||
|
||||
class TabSearch extends HookConsumerWidget {
|
||||
@@ -152,11 +153,7 @@ class TabSearch extends HookConsumerWidget {
|
||||
),
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
result.url.toString(),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
: UriBreadcrumb(uri: result.url),
|
||||
onTap: () async {
|
||||
await ref
|
||||
.read(tabRepositoryProvider.notifier)
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:fading_scroll/fading_scroll.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class UriBreadcrumb extends StatelessWidget {
|
||||
final Uri uri;
|
||||
final Widget? icon;
|
||||
final TextStyle? style;
|
||||
|
||||
const UriBreadcrumb({super.key, required this.uri, this.icon, this.style});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Tooltip(
|
||||
message: uri.toString(),
|
||||
child: DefaultTextStyle(
|
||||
style: style ?? DefaultTextStyle.of(context).style,
|
||||
child: FadingScroll(
|
||||
fadingSize: 15,
|
||||
builder: (context, controller) {
|
||||
return SingleChildScrollView(
|
||||
controller: controller,
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
?icon,
|
||||
Text(
|
||||
uri.authority,
|
||||
maxLines: 1,
|
||||
softWrap: false,
|
||||
overflow: TextOverflow.visible,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
if (uri.pathSegments.any((s) => s.isNotEmpty))
|
||||
Text(
|
||||
' › ${uri.pathSegments.whereNot((s) => s.isEmpty).join(' › ')}',
|
||||
maxLines: 1,
|
||||
softWrap: false,
|
||||
overflow: TextOverflow.visible,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@ import 'package:skeletonizer/skeletonizer.dart';
|
||||
import 'package:weblibre/features/geckoview/domain/entities/states/tab.dart';
|
||||
import 'package:weblibre/presentation/controllers/website_title.dart';
|
||||
import 'package:weblibre/presentation/widgets/failure_widget.dart';
|
||||
import 'package:weblibre/presentation/widgets/uri_breadcrumb.dart';
|
||||
|
||||
class WebsiteTitleTile extends HookConsumerWidget {
|
||||
final TabState initialTabState;
|
||||
@@ -58,7 +59,7 @@ class WebsiteTitleTile extends HookConsumerWidget {
|
||||
maxLines: 6,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
subtitle: Text(initialTabState.url.authority),
|
||||
subtitle: UriBreadcrumb(uri: initialTabState.url),
|
||||
);
|
||||
},
|
||||
error: (error, stackTrace) {
|
||||
@@ -77,7 +78,7 @@ class WebsiteTitleTile extends HookConsumerWidget {
|
||||
),
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: Text(initialTabState.title.whenNotEmpty ?? 'Untitled'),
|
||||
subtitle: Text(initialTabState.url.authority),
|
||||
subtitle: UriBreadcrumb(uri: initialTabState.url),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user