fix some stuff
This commit is contained in:
@@ -31,7 +31,7 @@ class WebExtensionsState extends _$WebExtensionsState {
|
||||
|
||||
state = {...state}..[extensionId] = current.copyWith(
|
||||
title: data.title,
|
||||
enabled: data.enabled,
|
||||
enabled: data.enabled ?? current.enabled,
|
||||
badgeText: data.badgeText,
|
||||
badgeTextColor: (data.badgeTextColor != null)
|
||||
? Color(data.badgeTextColor!)
|
||||
|
||||
@@ -7,7 +7,7 @@ part of 'web_extensions_state.dart';
|
||||
// **************************************************************************
|
||||
|
||||
String _$webExtensionsStateHash() =>
|
||||
r'9ac102b1d1740d69f9b0de590f08ff0774064845';
|
||||
r'bbaba8d27980046275858d2707bc66c6e349a537';
|
||||
|
||||
/// Copied from Dart SDK
|
||||
class _SystemHash {
|
||||
|
||||
+52
-44
@@ -35,55 +35,63 @@ class ContainerChips extends HookConsumerWidget {
|
||||
ref.watch(filteredContainersWithCountProvider(searchText));
|
||||
|
||||
return containersAsync.when(
|
||||
data: (availableContainers) => SizedBox(
|
||||
height: 48,
|
||||
child: Row(
|
||||
children: [
|
||||
if (selectedContainer != null || availableContainers.isNotEmpty)
|
||||
Expanded(
|
||||
child: SelectableChips(
|
||||
deleteIcon: false,
|
||||
itemId: (container) => container.id,
|
||||
itemAvatar: (container) => Container(
|
||||
width: 20.0,
|
||||
height: 20.0,
|
||||
decoration: BoxDecoration(
|
||||
color: container.color,
|
||||
shape: BoxShape.circle,
|
||||
data: (availableContainers) {
|
||||
if (selectedContainer == null &&
|
||||
availableContainers.isEmpty &&
|
||||
!displayMenu) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
return SizedBox(
|
||||
height: 48,
|
||||
child: Row(
|
||||
children: [
|
||||
if (selectedContainer != null || availableContainers.isNotEmpty)
|
||||
Expanded(
|
||||
child: SelectableChips(
|
||||
deleteIcon: false,
|
||||
itemId: (container) => container.id,
|
||||
itemAvatar: (container) => Container(
|
||||
width: 20.0,
|
||||
height: 20.0,
|
||||
decoration: BoxDecoration(
|
||||
color: container.color,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
itemLabel: (container) =>
|
||||
Text(container.name ?? 'New Container'),
|
||||
itemBadgeCount: (container) => container.tabCount,
|
||||
availableItems: availableContainers,
|
||||
selectedItem: selectedContainer,
|
||||
onSelected: onSelected,
|
||||
onDeleted: onDeleted,
|
||||
),
|
||||
itemLabel: (container) =>
|
||||
Text(container.name ?? 'New Container'),
|
||||
itemBadgeCount: (container) => container.tabCount,
|
||||
availableItems: availableContainers,
|
||||
selectedItem: selectedContainer,
|
||||
onSelected: onSelected,
|
||||
onDeleted: onDeleted,
|
||||
),
|
||||
)
|
||||
else
|
||||
Visibility(
|
||||
visible: displayMenu,
|
||||
child: Expanded(
|
||||
child: Text(
|
||||
"Press '>' to manage Containers.",
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).hintColor,
|
||||
fontStyle: FontStyle.italic,
|
||||
)
|
||||
else
|
||||
Visibility(
|
||||
visible: displayMenu,
|
||||
child: Expanded(
|
||||
child: Text(
|
||||
"Press '>' to manage Containers.",
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).hintColor,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (displayMenu)
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
await context.push(ContainerListRoute().location);
|
||||
},
|
||||
icon: const Icon(Icons.chevron_right),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (displayMenu)
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
await context.push(ContainerListRoute().location);
|
||||
},
|
||||
icon: const Icon(Icons.chevron_right),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
error: (error, stackTrace) => const SizedBox.shrink(),
|
||||
loading: () => const SizedBox(
|
||||
height: 48,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:lensai/data/models/equatable_iterable.dart';
|
||||
import 'package:lensai/features/bangs/data/models/bang_data.dart';
|
||||
@@ -15,9 +16,12 @@ import 'package:lensai/features/search/domain/providers/search_suggestions.dart'
|
||||
import 'package:lensai/features/search/presentation/widgets/bang_chips.dart';
|
||||
import 'package:lensai/features/search/presentation/widgets/search_field.dart';
|
||||
import 'package:lensai/presentation/hooks/listenable_callback.dart';
|
||||
import 'package:lensai/presentation/widgets/failure_widget.dart';
|
||||
import 'package:skeletonizer/skeletonizer.dart';
|
||||
|
||||
class SearchScreen extends HookConsumerWidget {
|
||||
static const _matchPrefix = '***';
|
||||
|
||||
final String? initialSearchText;
|
||||
|
||||
const SearchScreen({required this.initialSearchText});
|
||||
@@ -36,9 +40,13 @@ class SearchScreen extends HookConsumerWidget {
|
||||
.read(searchSuggestionsProvider().notifier)
|
||||
.addQuery(searchTextController.text);
|
||||
|
||||
await ref
|
||||
.read(tabSearchRepositoryProvider.notifier)
|
||||
.addQuery(searchTextController.text);
|
||||
await ref.read(tabSearchRepositoryProvider.notifier).addQuery(
|
||||
searchTextController.text,
|
||||
// ignore: avoid_redundant_argument_values
|
||||
matchPrefix: _matchPrefix,
|
||||
// ignore: avoid_redundant_argument_values
|
||||
matchSuffix: _matchPrefix,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -212,14 +220,50 @@ class SearchScreen extends HookConsumerWidget {
|
||||
enabled: tabs.isLoading,
|
||||
child: tabs.when(
|
||||
data: (data) {
|
||||
return SliverList.builder(itemBuilder: itemBuilder);
|
||||
return SliverList.builder(
|
||||
itemCount: data.length,
|
||||
itemBuilder: (context, index) {
|
||||
final result = data[index];
|
||||
|
||||
final headHasMatch =
|
||||
result.title.contains(_matchPrefix);
|
||||
final bodyResult =
|
||||
result.extractedContent ?? result.fullContent;
|
||||
|
||||
return ListTile(
|
||||
title: Markdown(
|
||||
shrinkWrap: true,
|
||||
padding: EdgeInsets.zero,
|
||||
data: result.title,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
),
|
||||
subtitle: (!headHasMatch && bodyResult != null)
|
||||
? Markdown(
|
||||
shrinkWrap: true,
|
||||
padding: EdgeInsets.zero,
|
||||
data: bodyResult,
|
||||
physics:
|
||||
const NeverScrollableScrollPhysics(),
|
||||
)
|
||||
: null,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
error: (error, stackTrace) {
|
||||
return FailureWidget(
|
||||
title: 'Could not load tabs',
|
||||
exception: error,
|
||||
);
|
||||
},
|
||||
error: error,
|
||||
loading: () => SliverList.builder(
|
||||
itemCount: tabs.valueOrNull?.length ?? 3,
|
||||
itemBuilder: (context, index) {
|
||||
return ListTile()
|
||||
},),
|
||||
return ListTile(
|
||||
title: Bone.text(),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user