increase min sdk and apply new formatter
This commit is contained in:
1 parent
f7885fc829
commit
a1ee8bef35
266 files changed
+11329
-10058
No files matched your search
@@ -40,15 +40,16 @@ class SelectedBangData extends _$SelectedBangData {
|
||||
@override
|
||||
BangData? build({String? domain}) {
|
||||
final repository = ref.watch(bangDataRepositoryProvider.notifier);
|
||||
final selectedBangTrigger =
|
||||
ref.watch(selectedBangTriggerProvider(domain: domain));
|
||||
|
||||
final subscription = repository.watchBang(selectedBangTrigger).listen(
|
||||
(value) {
|
||||
state = value;
|
||||
},
|
||||
final selectedBangTrigger = ref.watch(
|
||||
selectedBangTriggerProvider(domain: domain),
|
||||
);
|
||||
|
||||
final subscription = repository.watchBang(selectedBangTrigger).listen((
|
||||
value,
|
||||
) {
|
||||
state = value;
|
||||
});
|
||||
|
||||
ref.onDispose(() {
|
||||
unawaited(subscription.cancel());
|
||||
});
|
||||
@@ -111,8 +112,9 @@ EquatableCollection<List<String>> availableTabIds(
|
||||
ContainerFilter containerFilter,
|
||||
) {
|
||||
final containerTabs = ref.watch(
|
||||
containerTabIdsProvider(containerFilter)
|
||||
.select((value) => value.valueOrNull),
|
||||
containerTabIdsProvider(
|
||||
containerFilter,
|
||||
).select((value) => value.valueOrNull),
|
||||
);
|
||||
final tabList = ref.watch(tabListProvider);
|
||||
|
||||
@@ -130,13 +132,10 @@ EquatableCollection<Map<String, TabState>> availableTabStates(
|
||||
final availableTabs = ref.watch(availableTabIdsProvider(containerFilter));
|
||||
final tabStates = ref.watch(tabStatesProvider);
|
||||
|
||||
return EquatableCollection(
|
||||
{
|
||||
for (final tabId in availableTabs.collection)
|
||||
if (tabStates.containsKey(tabId)) tabId: tabStates[tabId]!,
|
||||
},
|
||||
immutable: true,
|
||||
);
|
||||
return EquatableCollection({
|
||||
for (final tabId in availableTabs.collection)
|
||||
if (tabStates.containsKey(tabId)) tabId: tabStates[tabId]!,
|
||||
}, immutable: true);
|
||||
}
|
||||
|
||||
@Riverpod()
|
||||
@@ -145,16 +144,17 @@ EquatableCollection<List<String>> seamlessFilteredTabIds(
|
||||
TabSearchPartition searchPartition,
|
||||
ContainerFilter containerFilter,
|
||||
) {
|
||||
final tabSearchResults = ref
|
||||
.watch(
|
||||
tabSearchRepositoryProvider(searchPartition).select(
|
||||
(value) => EquatableCollection(
|
||||
value.valueOrNull?.map((tab) => tab.id).toList(),
|
||||
immutable: true,
|
||||
),
|
||||
),
|
||||
)
|
||||
.collection;
|
||||
final tabSearchResults =
|
||||
ref
|
||||
.watch(
|
||||
tabSearchRepositoryProvider(searchPartition).select(
|
||||
(value) => EquatableCollection(
|
||||
value.valueOrNull?.map((tab) => tab.id).toList(),
|
||||
immutable: true,
|
||||
),
|
||||
),
|
||||
)
|
||||
.collection;
|
||||
|
||||
final availableTabs = ref.watch(availableTabIdsProvider(containerFilter));
|
||||
|
||||
@@ -176,19 +176,19 @@ EquatableCollection<List<TabPreview>> seamlessFilteredTabPreviews(
|
||||
TabSearchPartition searchPartition,
|
||||
ContainerFilter containerFilter,
|
||||
) {
|
||||
final tabSearchResults = ref
|
||||
.watch(
|
||||
tabSearchRepositoryProvider(searchPartition).select(
|
||||
(value) => EquatableCollection(
|
||||
value.valueOrNull,
|
||||
immutable: true,
|
||||
),
|
||||
),
|
||||
)
|
||||
.collection;
|
||||
final tabSearchResults =
|
||||
ref
|
||||
.watch(
|
||||
tabSearchRepositoryProvider(searchPartition).select(
|
||||
(value) =>
|
||||
EquatableCollection(value.valueOrNull, immutable: true),
|
||||
),
|
||||
)
|
||||
.collection;
|
||||
|
||||
final availableTabStates =
|
||||
ref.watch(availableTabStatesProvider(containerFilter));
|
||||
final availableTabStates = ref.watch(
|
||||
availableTabStatesProvider(containerFilter),
|
||||
);
|
||||
|
||||
if (tabSearchResults == null) {
|
||||
return EquatableCollection(
|
||||
@@ -216,7 +216,8 @@ EquatableCollection<List<TabPreview>> seamlessFilteredTabPreviews(
|
||||
id: tab.id,
|
||||
title: tab.title ?? availableTabStates.collection[tab.id]!.title,
|
||||
icon: null,
|
||||
url: tab.cleanUrl.mapNotNull(Uri.tryParse) ??
|
||||
url:
|
||||
tab.cleanUrl.mapNotNull(Uri.tryParse) ??
|
||||
availableTabStates.collection[tab.id]!.url,
|
||||
highlightedUrl: tab.url,
|
||||
content: tab.extractedContent ?? tab.fullContent,
|
||||
|
||||
@@ -39,21 +39,15 @@ class AvailableTabIdsFamily extends Family<EquatableCollection<List<String>>> {
|
||||
const AvailableTabIdsFamily();
|
||||
|
||||
/// See also [availableTabIds].
|
||||
AvailableTabIdsProvider call(
|
||||
ContainerFilter containerFilter,
|
||||
) {
|
||||
return AvailableTabIdsProvider(
|
||||
containerFilter,
|
||||
);
|
||||
AvailableTabIdsProvider call(ContainerFilter containerFilter) {
|
||||
return AvailableTabIdsProvider(containerFilter);
|
||||
}
|
||||
|
||||
@override
|
||||
AvailableTabIdsProvider getProviderOverride(
|
||||
covariant AvailableTabIdsProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.containerFilter,
|
||||
);
|
||||
return call(provider.containerFilter);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -75,24 +69,20 @@ class AvailableTabIdsFamily extends Family<EquatableCollection<List<String>>> {
|
||||
class AvailableTabIdsProvider
|
||||
extends AutoDisposeProvider<EquatableCollection<List<String>>> {
|
||||
/// See also [availableTabIds].
|
||||
AvailableTabIdsProvider(
|
||||
ContainerFilter containerFilter,
|
||||
) : this._internal(
|
||||
(ref) => availableTabIds(
|
||||
ref as AvailableTabIdsRef,
|
||||
containerFilter,
|
||||
),
|
||||
from: availableTabIdsProvider,
|
||||
name: r'availableTabIdsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$availableTabIdsHash,
|
||||
dependencies: AvailableTabIdsFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
AvailableTabIdsFamily._allTransitiveDependencies,
|
||||
containerFilter: containerFilter,
|
||||
);
|
||||
AvailableTabIdsProvider(ContainerFilter containerFilter)
|
||||
: this._internal(
|
||||
(ref) => availableTabIds(ref as AvailableTabIdsRef, containerFilter),
|
||||
from: availableTabIdsProvider,
|
||||
name: r'availableTabIdsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$availableTabIdsHash,
|
||||
dependencies: AvailableTabIdsFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
AvailableTabIdsFamily._allTransitiveDependencies,
|
||||
containerFilter: containerFilter,
|
||||
);
|
||||
|
||||
AvailableTabIdsProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -109,7 +99,7 @@ class AvailableTabIdsProvider
|
||||
@override
|
||||
Override overrideWith(
|
||||
EquatableCollection<List<String>> Function(AvailableTabIdsRef provider)
|
||||
create,
|
||||
create,
|
||||
) {
|
||||
return ProviderOverride(
|
||||
origin: this,
|
||||
@@ -127,7 +117,7 @@ class AvailableTabIdsProvider
|
||||
|
||||
@override
|
||||
AutoDisposeProviderElement<EquatableCollection<List<String>>>
|
||||
createElement() {
|
||||
createElement() {
|
||||
return _AvailableTabIdsProviderElement(this);
|
||||
}
|
||||
|
||||
@@ -178,21 +168,15 @@ class AvailableTabStatesFamily
|
||||
const AvailableTabStatesFamily();
|
||||
|
||||
/// See also [availableTabStates].
|
||||
AvailableTabStatesProvider call(
|
||||
ContainerFilter containerFilter,
|
||||
) {
|
||||
return AvailableTabStatesProvider(
|
||||
containerFilter,
|
||||
);
|
||||
AvailableTabStatesProvider call(ContainerFilter containerFilter) {
|
||||
return AvailableTabStatesProvider(containerFilter);
|
||||
}
|
||||
|
||||
@override
|
||||
AvailableTabStatesProvider getProviderOverride(
|
||||
covariant AvailableTabStatesProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.containerFilter,
|
||||
);
|
||||
return call(provider.containerFilter);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -214,24 +198,21 @@ class AvailableTabStatesFamily
|
||||
class AvailableTabStatesProvider
|
||||
extends AutoDisposeProvider<EquatableCollection<Map<String, TabState>>> {
|
||||
/// See also [availableTabStates].
|
||||
AvailableTabStatesProvider(
|
||||
ContainerFilter containerFilter,
|
||||
) : this._internal(
|
||||
(ref) => availableTabStates(
|
||||
ref as AvailableTabStatesRef,
|
||||
containerFilter,
|
||||
),
|
||||
from: availableTabStatesProvider,
|
||||
name: r'availableTabStatesProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$availableTabStatesHash,
|
||||
dependencies: AvailableTabStatesFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
AvailableTabStatesFamily._allTransitiveDependencies,
|
||||
containerFilter: containerFilter,
|
||||
);
|
||||
AvailableTabStatesProvider(ContainerFilter containerFilter)
|
||||
: this._internal(
|
||||
(ref) =>
|
||||
availableTabStates(ref as AvailableTabStatesRef, containerFilter),
|
||||
from: availableTabStatesProvider,
|
||||
name: r'availableTabStatesProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$availableTabStatesHash,
|
||||
dependencies: AvailableTabStatesFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
AvailableTabStatesFamily._allTransitiveDependencies,
|
||||
containerFilter: containerFilter,
|
||||
);
|
||||
|
||||
AvailableTabStatesProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -248,8 +229,9 @@ class AvailableTabStatesProvider
|
||||
@override
|
||||
Override overrideWith(
|
||||
EquatableCollection<Map<String, TabState>> Function(
|
||||
AvailableTabStatesRef provider)
|
||||
create,
|
||||
AvailableTabStatesRef provider,
|
||||
)
|
||||
create,
|
||||
) {
|
||||
return ProviderOverride(
|
||||
origin: this,
|
||||
@@ -267,7 +249,7 @@ class AvailableTabStatesProvider
|
||||
|
||||
@override
|
||||
AutoDisposeProviderElement<EquatableCollection<Map<String, TabState>>>
|
||||
createElement() {
|
||||
createElement() {
|
||||
return _AvailableTabStatesProviderElement(this);
|
||||
}
|
||||
|
||||
@@ -294,8 +276,10 @@ mixin AvailableTabStatesRef
|
||||
ContainerFilter get containerFilter;
|
||||
}
|
||||
|
||||
class _AvailableTabStatesProviderElement extends AutoDisposeProviderElement<
|
||||
EquatableCollection<Map<String, TabState>>> with AvailableTabStatesRef {
|
||||
class _AvailableTabStatesProviderElement
|
||||
extends
|
||||
AutoDisposeProviderElement<EquatableCollection<Map<String, TabState>>>
|
||||
with AvailableTabStatesRef {
|
||||
_AvailableTabStatesProviderElement(super.provider);
|
||||
|
||||
@override
|
||||
@@ -321,20 +305,14 @@ class SeamlessFilteredTabIdsFamily
|
||||
TabSearchPartition searchPartition,
|
||||
ContainerFilter containerFilter,
|
||||
) {
|
||||
return SeamlessFilteredTabIdsProvider(
|
||||
searchPartition,
|
||||
containerFilter,
|
||||
);
|
||||
return SeamlessFilteredTabIdsProvider(searchPartition, containerFilter);
|
||||
}
|
||||
|
||||
@override
|
||||
SeamlessFilteredTabIdsProvider getProviderOverride(
|
||||
covariant SeamlessFilteredTabIdsProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.searchPartition,
|
||||
provider.containerFilter,
|
||||
);
|
||||
return call(provider.searchPartition, provider.containerFilter);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -360,23 +338,23 @@ class SeamlessFilteredTabIdsProvider
|
||||
TabSearchPartition searchPartition,
|
||||
ContainerFilter containerFilter,
|
||||
) : this._internal(
|
||||
(ref) => seamlessFilteredTabIds(
|
||||
ref as SeamlessFilteredTabIdsRef,
|
||||
searchPartition,
|
||||
containerFilter,
|
||||
),
|
||||
from: seamlessFilteredTabIdsProvider,
|
||||
name: r'seamlessFilteredTabIdsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$seamlessFilteredTabIdsHash,
|
||||
dependencies: SeamlessFilteredTabIdsFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
SeamlessFilteredTabIdsFamily._allTransitiveDependencies,
|
||||
searchPartition: searchPartition,
|
||||
containerFilter: containerFilter,
|
||||
);
|
||||
(ref) => seamlessFilteredTabIds(
|
||||
ref as SeamlessFilteredTabIdsRef,
|
||||
searchPartition,
|
||||
containerFilter,
|
||||
),
|
||||
from: seamlessFilteredTabIdsProvider,
|
||||
name: r'seamlessFilteredTabIdsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$seamlessFilteredTabIdsHash,
|
||||
dependencies: SeamlessFilteredTabIdsFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
SeamlessFilteredTabIdsFamily._allTransitiveDependencies,
|
||||
searchPartition: searchPartition,
|
||||
containerFilter: containerFilter,
|
||||
);
|
||||
|
||||
SeamlessFilteredTabIdsProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -395,8 +373,9 @@ class SeamlessFilteredTabIdsProvider
|
||||
@override
|
||||
Override overrideWith(
|
||||
EquatableCollection<List<String>> Function(
|
||||
SeamlessFilteredTabIdsRef provider)
|
||||
create,
|
||||
SeamlessFilteredTabIdsRef provider,
|
||||
)
|
||||
create,
|
||||
) {
|
||||
return ProviderOverride(
|
||||
origin: this,
|
||||
@@ -415,7 +394,7 @@ class SeamlessFilteredTabIdsProvider
|
||||
|
||||
@override
|
||||
AutoDisposeProviderElement<EquatableCollection<List<String>>>
|
||||
createElement() {
|
||||
createElement() {
|
||||
return _SeamlessFilteredTabIdsProviderElement(this);
|
||||
}
|
||||
|
||||
@@ -488,10 +467,7 @@ class SeamlessFilteredTabPreviewsFamily
|
||||
SeamlessFilteredTabPreviewsProvider getProviderOverride(
|
||||
covariant SeamlessFilteredTabPreviewsProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.searchPartition,
|
||||
provider.containerFilter,
|
||||
);
|
||||
return call(provider.searchPartition, provider.containerFilter);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -517,23 +493,23 @@ class SeamlessFilteredTabPreviewsProvider
|
||||
TabSearchPartition searchPartition,
|
||||
ContainerFilter containerFilter,
|
||||
) : this._internal(
|
||||
(ref) => seamlessFilteredTabPreviews(
|
||||
ref as SeamlessFilteredTabPreviewsRef,
|
||||
searchPartition,
|
||||
containerFilter,
|
||||
),
|
||||
from: seamlessFilteredTabPreviewsProvider,
|
||||
name: r'seamlessFilteredTabPreviewsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$seamlessFilteredTabPreviewsHash,
|
||||
dependencies: SeamlessFilteredTabPreviewsFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
SeamlessFilteredTabPreviewsFamily._allTransitiveDependencies,
|
||||
searchPartition: searchPartition,
|
||||
containerFilter: containerFilter,
|
||||
);
|
||||
(ref) => seamlessFilteredTabPreviews(
|
||||
ref as SeamlessFilteredTabPreviewsRef,
|
||||
searchPartition,
|
||||
containerFilter,
|
||||
),
|
||||
from: seamlessFilteredTabPreviewsProvider,
|
||||
name: r'seamlessFilteredTabPreviewsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$seamlessFilteredTabPreviewsHash,
|
||||
dependencies: SeamlessFilteredTabPreviewsFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
SeamlessFilteredTabPreviewsFamily._allTransitiveDependencies,
|
||||
searchPartition: searchPartition,
|
||||
containerFilter: containerFilter,
|
||||
);
|
||||
|
||||
SeamlessFilteredTabPreviewsProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -552,8 +528,9 @@ class SeamlessFilteredTabPreviewsProvider
|
||||
@override
|
||||
Override overrideWith(
|
||||
EquatableCollection<List<TabPreview>> Function(
|
||||
SeamlessFilteredTabPreviewsRef provider)
|
||||
create,
|
||||
SeamlessFilteredTabPreviewsRef provider,
|
||||
)
|
||||
create,
|
||||
) {
|
||||
return ProviderOverride(
|
||||
origin: this,
|
||||
@@ -572,7 +549,7 @@ class SeamlessFilteredTabPreviewsProvider
|
||||
|
||||
@override
|
||||
AutoDisposeProviderElement<EquatableCollection<List<TabPreview>>>
|
||||
createElement() {
|
||||
createElement() {
|
||||
return _SeamlessFilteredTabPreviewsProviderElement(this);
|
||||
}
|
||||
|
||||
@@ -623,9 +600,7 @@ String _$selectedBangTriggerHash() =>
|
||||
abstract class _$SelectedBangTrigger extends BuildlessNotifier<String?> {
|
||||
late final String? domain;
|
||||
|
||||
String? build({
|
||||
String? domain,
|
||||
});
|
||||
String? build({String? domain});
|
||||
}
|
||||
|
||||
/// See also [SelectedBangTrigger].
|
||||
@@ -638,21 +613,15 @@ class SelectedBangTriggerFamily extends Family<String?> {
|
||||
const SelectedBangTriggerFamily();
|
||||
|
||||
/// See also [SelectedBangTrigger].
|
||||
SelectedBangTriggerProvider call({
|
||||
String? domain,
|
||||
}) {
|
||||
return SelectedBangTriggerProvider(
|
||||
domain: domain,
|
||||
);
|
||||
SelectedBangTriggerProvider call({String? domain}) {
|
||||
return SelectedBangTriggerProvider(domain: domain);
|
||||
}
|
||||
|
||||
@override
|
||||
SelectedBangTriggerProvider getProviderOverride(
|
||||
covariant SelectedBangTriggerProvider provider,
|
||||
) {
|
||||
return call(
|
||||
domain: provider.domain,
|
||||
);
|
||||
return call(domain: provider.domain);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -674,21 +643,20 @@ class SelectedBangTriggerFamily extends Family<String?> {
|
||||
class SelectedBangTriggerProvider
|
||||
extends NotifierProviderImpl<SelectedBangTrigger, String?> {
|
||||
/// See also [SelectedBangTrigger].
|
||||
SelectedBangTriggerProvider({
|
||||
String? domain,
|
||||
}) : this._internal(
|
||||
() => SelectedBangTrigger()..domain = domain,
|
||||
from: selectedBangTriggerProvider,
|
||||
name: r'selectedBangTriggerProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedBangTriggerHash,
|
||||
dependencies: SelectedBangTriggerFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
SelectedBangTriggerFamily._allTransitiveDependencies,
|
||||
domain: domain,
|
||||
);
|
||||
SelectedBangTriggerProvider({String? domain})
|
||||
: this._internal(
|
||||
() => SelectedBangTrigger()..domain = domain,
|
||||
from: selectedBangTriggerProvider,
|
||||
name: r'selectedBangTriggerProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedBangTriggerHash,
|
||||
dependencies: SelectedBangTriggerFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
SelectedBangTriggerFamily._allTransitiveDependencies,
|
||||
domain: domain,
|
||||
);
|
||||
|
||||
SelectedBangTriggerProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -703,12 +671,8 @@ class SelectedBangTriggerProvider
|
||||
final String? domain;
|
||||
|
||||
@override
|
||||
String? runNotifierBuild(
|
||||
covariant SelectedBangTrigger notifier,
|
||||
) {
|
||||
return notifier.build(
|
||||
domain: domain,
|
||||
);
|
||||
String? runNotifierBuild(covariant SelectedBangTrigger notifier) {
|
||||
return notifier.build(domain: domain);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -768,9 +732,7 @@ abstract class _$SelectedBangData
|
||||
extends BuildlessAutoDisposeNotifier<BangData?> {
|
||||
late final String? domain;
|
||||
|
||||
BangData? build({
|
||||
String? domain,
|
||||
});
|
||||
BangData? build({String? domain});
|
||||
}
|
||||
|
||||
/// See also [SelectedBangData].
|
||||
@@ -783,21 +745,15 @@ class SelectedBangDataFamily extends Family<BangData?> {
|
||||
const SelectedBangDataFamily();
|
||||
|
||||
/// See also [SelectedBangData].
|
||||
SelectedBangDataProvider call({
|
||||
String? domain,
|
||||
}) {
|
||||
return SelectedBangDataProvider(
|
||||
domain: domain,
|
||||
);
|
||||
SelectedBangDataProvider call({String? domain}) {
|
||||
return SelectedBangDataProvider(domain: domain);
|
||||
}
|
||||
|
||||
@override
|
||||
SelectedBangDataProvider getProviderOverride(
|
||||
covariant SelectedBangDataProvider provider,
|
||||
) {
|
||||
return call(
|
||||
domain: provider.domain,
|
||||
);
|
||||
return call(domain: provider.domain);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -819,21 +775,20 @@ class SelectedBangDataFamily extends Family<BangData?> {
|
||||
class SelectedBangDataProvider
|
||||
extends AutoDisposeNotifierProviderImpl<SelectedBangData, BangData?> {
|
||||
/// See also [SelectedBangData].
|
||||
SelectedBangDataProvider({
|
||||
String? domain,
|
||||
}) : this._internal(
|
||||
() => SelectedBangData()..domain = domain,
|
||||
from: selectedBangDataProvider,
|
||||
name: r'selectedBangDataProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedBangDataHash,
|
||||
dependencies: SelectedBangDataFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
SelectedBangDataFamily._allTransitiveDependencies,
|
||||
domain: domain,
|
||||
);
|
||||
SelectedBangDataProvider({String? domain})
|
||||
: this._internal(
|
||||
() => SelectedBangData()..domain = domain,
|
||||
from: selectedBangDataProvider,
|
||||
name: r'selectedBangDataProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedBangDataHash,
|
||||
dependencies: SelectedBangDataFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
SelectedBangDataFamily._allTransitiveDependencies,
|
||||
domain: domain,
|
||||
);
|
||||
|
||||
SelectedBangDataProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -848,12 +803,8 @@ class SelectedBangDataProvider
|
||||
final String? domain;
|
||||
|
||||
@override
|
||||
BangData? runNotifierBuild(
|
||||
covariant SelectedBangData notifier,
|
||||
) {
|
||||
return notifier.build(
|
||||
domain: domain,
|
||||
);
|
||||
BangData? runNotifierBuild(covariant SelectedBangData notifier) {
|
||||
return notifier.build(domain: domain);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -874,7 +825,7 @@ class SelectedBangDataProvider
|
||||
|
||||
@override
|
||||
AutoDisposeNotifierProviderElement<SelectedBangData, BangData?>
|
||||
createElement() {
|
||||
createElement() {
|
||||
return _SelectedBangDataProviderElement(this);
|
||||
}
|
||||
|
||||
@@ -915,14 +866,15 @@ String _$lastUsedAssistantModeHash() =>
|
||||
@ProviderFor(LastUsedAssistantMode)
|
||||
final lastUsedAssistantModeProvider =
|
||||
NotifierProvider<LastUsedAssistantMode, AssistantMode>.internal(
|
||||
LastUsedAssistantMode.new,
|
||||
name: r'lastUsedAssistantModeProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$lastUsedAssistantModeHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
LastUsedAssistantMode.new,
|
||||
name: r'lastUsedAssistantModeProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$lastUsedAssistantModeHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$LastUsedAssistantMode = Notifier<AssistantMode>;
|
||||
String _$activeResearchVariantHash() =>
|
||||
@@ -932,14 +884,15 @@ String _$activeResearchVariantHash() =>
|
||||
@ProviderFor(ActiveResearchVariant)
|
||||
final activeResearchVariantProvider =
|
||||
NotifierProvider<ActiveResearchVariant, ResearchVariant>.internal(
|
||||
ActiveResearchVariant.new,
|
||||
name: r'activeResearchVariantProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$activeResearchVariantHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
ActiveResearchVariant.new,
|
||||
name: r'activeResearchVariantProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$activeResearchVariantHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$ActiveResearchVariant = Notifier<ResearchVariant>;
|
||||
String _$activeChatModelHash() => r'675f406af8b4aa92699d59e37b5805a81d03a799';
|
||||
@@ -948,14 +901,15 @@ String _$activeChatModelHash() => r'675f406af8b4aa92699d59e37b5805a81d03a799';
|
||||
@ProviderFor(ActiveChatModel)
|
||||
final activeChatModelProvider =
|
||||
NotifierProvider<ActiveChatModel, ChatModel>.internal(
|
||||
ActiveChatModel.new,
|
||||
name: r'activeChatModelProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$activeChatModelHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
ActiveChatModel.new,
|
||||
name: r'activeChatModelProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$activeChatModelHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$ActiveChatModel = Notifier<ChatModel>;
|
||||
String _$showFindInPageHash() => r'7ee5703f7d0c7e8a8dd6b0849d7b1e0a41fe24d9';
|
||||
@@ -965,9 +919,10 @@ String _$showFindInPageHash() => r'7ee5703f7d0c7e8a8dd6b0849d7b1e0a41fe24d9';
|
||||
final showFindInPageProvider = NotifierProvider<ShowFindInPage, bool>.internal(
|
||||
ShowFindInPage.new,
|
||||
name: r'showFindInPageProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$showFindInPageHash,
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$showFindInPageHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@@ -13,18 +13,19 @@ part 'create_tab.g.dart';
|
||||
|
||||
final _parameterToCreateTabSheetTransformer =
|
||||
StreamTransformer<ReceivedParameter, CreateTabSheet>.fromHandlers(
|
||||
handleData: (parameter, sink) {
|
||||
final createTab = CreateTabSheet(
|
||||
preferredTool: KagiTool.values
|
||||
.firstWhereOrNull((tool) => tool.name == parameter.tool),
|
||||
content: parameter.content,
|
||||
);
|
||||
handleData: (parameter, sink) {
|
||||
final createTab = CreateTabSheet(
|
||||
preferredTool: KagiTool.values.firstWhereOrNull(
|
||||
(tool) => tool.name == parameter.tool,
|
||||
),
|
||||
content: parameter.content,
|
||||
);
|
||||
|
||||
if (createTab.hasParameters) {
|
||||
sink.add(createTab);
|
||||
}
|
||||
},
|
||||
);
|
||||
if (createTab.hasParameters) {
|
||||
sink.add(createTab);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
@Riverpod()
|
||||
class CreateTabStream extends _$CreateTabStream {
|
||||
|
||||
@@ -12,14 +12,15 @@ String _$createTabStreamHash() => r'2e802a10ecaf1862074f32b76e89c26997bdd7b2';
|
||||
@ProviderFor(CreateTabStream)
|
||||
final createTabStreamProvider =
|
||||
AutoDisposeStreamNotifierProvider<CreateTabStream, CreateTabSheet>.internal(
|
||||
CreateTabStream.new,
|
||||
name: r'createTabStreamProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$createTabStreamHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
CreateTabStream.new,
|
||||
name: r'createTabStreamProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$createTabStreamHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$CreateTabStream = AutoDisposeStreamNotifier<CreateTabSheet>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
+9
-8
@@ -13,14 +13,15 @@ String _$deleteBrowserDataServiceHash() =>
|
||||
@ProviderFor(DeleteBrowserDataService)
|
||||
final deleteBrowserDataServiceProvider =
|
||||
AutoDisposeNotifierProvider<DeleteBrowserDataService, void>.internal(
|
||||
DeleteBrowserDataService.new,
|
||||
name: r'deleteBrowserDataServiceProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$deleteBrowserDataServiceHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
DeleteBrowserDataService.new,
|
||||
name: r'deleteBrowserDataServiceProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$deleteBrowserDataServiceHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$DeleteBrowserDataService = AutoDisposeNotifier<void>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
+60
-58
@@ -16,8 +16,9 @@ class EngineSettingsReplicationService
|
||||
var initialSettingsSent = false;
|
||||
|
||||
ref.listen(
|
||||
generalSettingsRepositoryProvider
|
||||
.select((settings) => settings.themeMode),
|
||||
generalSettingsRepositoryProvider.select(
|
||||
(settings) => settings.themeMode,
|
||||
),
|
||||
(previous, next) async {
|
||||
final theme = switch (next) {
|
||||
ThemeMode.system => ColorScheme.system,
|
||||
@@ -29,62 +30,63 @@ class EngineSettingsReplicationService
|
||||
},
|
||||
);
|
||||
|
||||
ref.listen(
|
||||
engineSettingsRepositoryProvider,
|
||||
(previous, next) async {
|
||||
if (initialSettingsSent && previous != null) {
|
||||
if (previous.javascriptEnabled != next.javascriptEnabled) {
|
||||
await _service.javascriptEnabled(next.javascriptEnabled);
|
||||
}
|
||||
if (previous.trackingProtectionPolicy !=
|
||||
next.trackingProtectionPolicy) {
|
||||
await _service
|
||||
.trackingProtectionPolicy(next.trackingProtectionPolicy);
|
||||
}
|
||||
if (previous.httpsOnlyMode != next.httpsOnlyMode) {
|
||||
await _service.httpsOnlyMode(next.httpsOnlyMode);
|
||||
}
|
||||
if (previous.globalPrivacyControlEnabled !=
|
||||
next.globalPrivacyControlEnabled) {
|
||||
await _service
|
||||
.globalPrivacyControlEnabled(next.globalPrivacyControlEnabled);
|
||||
}
|
||||
if (previous.preferredColorScheme != next.preferredColorScheme) {
|
||||
await _service.preferredColorScheme(next.preferredColorScheme);
|
||||
}
|
||||
if (previous.cookieBannerHandlingMode !=
|
||||
next.cookieBannerHandlingMode) {
|
||||
await _service
|
||||
.cookieBannerHandlingMode(next.cookieBannerHandlingMode);
|
||||
}
|
||||
if (previous.cookieBannerHandlingModePrivateBrowsing !=
|
||||
next.cookieBannerHandlingModePrivateBrowsing) {
|
||||
await _service.cookieBannerHandlingModePrivateBrowsing(
|
||||
next.cookieBannerHandlingModePrivateBrowsing,
|
||||
);
|
||||
}
|
||||
if (previous.cookieBannerHandlingGlobalRules !=
|
||||
next.cookieBannerHandlingGlobalRules) {
|
||||
await _service.cookieBannerHandlingGlobalRules(
|
||||
next.cookieBannerHandlingGlobalRules,
|
||||
);
|
||||
}
|
||||
if (previous.cookieBannerHandlingGlobalRulesSubFrames !=
|
||||
next.cookieBannerHandlingGlobalRulesSubFrames) {
|
||||
await _service.cookieBannerHandlingGlobalRulesSubFrames(
|
||||
next.cookieBannerHandlingGlobalRulesSubFrames,
|
||||
);
|
||||
}
|
||||
if (previous.webContentIsolationStrategy !=
|
||||
next.webContentIsolationStrategy) {
|
||||
await _service
|
||||
.webContentIsolationStrategy(next.webContentIsolationStrategy);
|
||||
}
|
||||
} else {
|
||||
await _service.setDefaultSettings(next);
|
||||
initialSettingsSent = true;
|
||||
ref.listen(engineSettingsRepositoryProvider, (previous, next) async {
|
||||
if (initialSettingsSent && previous != null) {
|
||||
if (previous.javascriptEnabled != next.javascriptEnabled) {
|
||||
await _service.javascriptEnabled(next.javascriptEnabled);
|
||||
}
|
||||
},
|
||||
);
|
||||
if (previous.trackingProtectionPolicy !=
|
||||
next.trackingProtectionPolicy) {
|
||||
await _service.trackingProtectionPolicy(
|
||||
next.trackingProtectionPolicy,
|
||||
);
|
||||
}
|
||||
if (previous.httpsOnlyMode != next.httpsOnlyMode) {
|
||||
await _service.httpsOnlyMode(next.httpsOnlyMode);
|
||||
}
|
||||
if (previous.globalPrivacyControlEnabled !=
|
||||
next.globalPrivacyControlEnabled) {
|
||||
await _service.globalPrivacyControlEnabled(
|
||||
next.globalPrivacyControlEnabled,
|
||||
);
|
||||
}
|
||||
if (previous.preferredColorScheme != next.preferredColorScheme) {
|
||||
await _service.preferredColorScheme(next.preferredColorScheme);
|
||||
}
|
||||
if (previous.cookieBannerHandlingMode !=
|
||||
next.cookieBannerHandlingMode) {
|
||||
await _service.cookieBannerHandlingMode(
|
||||
next.cookieBannerHandlingMode,
|
||||
);
|
||||
}
|
||||
if (previous.cookieBannerHandlingModePrivateBrowsing !=
|
||||
next.cookieBannerHandlingModePrivateBrowsing) {
|
||||
await _service.cookieBannerHandlingModePrivateBrowsing(
|
||||
next.cookieBannerHandlingModePrivateBrowsing,
|
||||
);
|
||||
}
|
||||
if (previous.cookieBannerHandlingGlobalRules !=
|
||||
next.cookieBannerHandlingGlobalRules) {
|
||||
await _service.cookieBannerHandlingGlobalRules(
|
||||
next.cookieBannerHandlingGlobalRules,
|
||||
);
|
||||
}
|
||||
if (previous.cookieBannerHandlingGlobalRulesSubFrames !=
|
||||
next.cookieBannerHandlingGlobalRulesSubFrames) {
|
||||
await _service.cookieBannerHandlingGlobalRulesSubFrames(
|
||||
next.cookieBannerHandlingGlobalRulesSubFrames,
|
||||
);
|
||||
}
|
||||
if (previous.webContentIsolationStrategy !=
|
||||
next.webContentIsolationStrategy) {
|
||||
await _service.webContentIsolationStrategy(
|
||||
next.webContentIsolationStrategy,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
await _service.setDefaultSettings(next);
|
||||
initialSettingsSent = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
+9
-8
@@ -13,14 +13,15 @@ String _$engineSettingsReplicationServiceHash() =>
|
||||
@ProviderFor(EngineSettingsReplicationService)
|
||||
final engineSettingsReplicationServiceProvider =
|
||||
NotifierProvider<EngineSettingsReplicationService, void>.internal(
|
||||
EngineSettingsReplicationService.new,
|
||||
name: r'engineSettingsReplicationServiceProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$engineSettingsReplicationServiceHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
EngineSettingsReplicationService.new,
|
||||
name: r'engineSettingsReplicationServiceProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$engineSettingsReplicationServiceHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$EngineSettingsReplicationService = Notifier<void>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
+8
-8
@@ -12,14 +12,14 @@ class ProxySettingsReplucation extends _$ProxySettingsReplucation {
|
||||
|
||||
@override
|
||||
void build() {
|
||||
ref.listen(
|
||||
torProxyServiceProvider.select((data) => data.valueOrNull),
|
||||
(previous, next) async {
|
||||
if (next != null) {
|
||||
await _service.setProxyPort(next);
|
||||
}
|
||||
},
|
||||
);
|
||||
ref.listen(torProxyServiceProvider.select((data) => data.valueOrNull), (
|
||||
previous,
|
||||
next,
|
||||
) async {
|
||||
if (next != null) {
|
||||
await _service.setProxyPort(next);
|
||||
}
|
||||
});
|
||||
|
||||
ref.listen(
|
||||
containersWithCountProvider.select(
|
||||
|
||||
+9
-8
@@ -13,14 +13,15 @@ String _$proxySettingsReplucationHash() =>
|
||||
@ProviderFor(ProxySettingsReplucation)
|
||||
final proxySettingsReplucationProvider =
|
||||
NotifierProvider<ProxySettingsReplucation, void>.internal(
|
||||
ProxySettingsReplucation.new,
|
||||
name: r'proxySettingsReplucationProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$proxySettingsReplucationHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
ProxySettingsReplucation.new,
|
||||
name: r'proxySettingsReplucationProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$proxySettingsReplucationHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$ProxySettingsReplucation = Notifier<void>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
+62
-64
@@ -36,11 +36,7 @@ class WebPageDialog extends HookConsumerWidget {
|
||||
final Uri url;
|
||||
final WebPageInfo? precachedInfo;
|
||||
|
||||
const WebPageDialog({
|
||||
required this.url,
|
||||
this.precachedInfo,
|
||||
super.key,
|
||||
});
|
||||
const WebPageDialog({required this.url, this.precachedInfo, super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@@ -63,8 +59,10 @@ class WebPageDialog extends HookConsumerWidget {
|
||||
context: context,
|
||||
removeBottom: true,
|
||||
child: Dialog(
|
||||
insetPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 64.0),
|
||||
insetPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 16.0,
|
||||
vertical: 64.0,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@@ -79,26 +77,24 @@ class WebPageDialog extends HookConsumerWidget {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: HookConsumer(
|
||||
builder: (context, ref, child) {
|
||||
final addressTextController =
|
||||
useTextEditingController(text: url.toString());
|
||||
final addressTextController = useTextEditingController(
|
||||
text: url.toString(),
|
||||
);
|
||||
final addressTextFocusNode = useFocusNode();
|
||||
|
||||
final suggestion = useState<String?>(null);
|
||||
|
||||
useListenableCallback(
|
||||
addressTextController,
|
||||
() async {
|
||||
if (addressTextController.text.isNotEmpty) {
|
||||
final result = await ref
|
||||
.read(engineSuggestionsProvider.notifier)
|
||||
.getAutocompleteSuggestion(
|
||||
addressTextController.text,
|
||||
);
|
||||
useListenableCallback(addressTextController, () async {
|
||||
if (addressTextController.text.isNotEmpty) {
|
||||
final result = await ref
|
||||
.read(engineSuggestionsProvider.notifier)
|
||||
.getAutocompleteSuggestion(
|
||||
addressTextController.text,
|
||||
);
|
||||
|
||||
suggestion.value = result;
|
||||
}
|
||||
},
|
||||
);
|
||||
suggestion.value = result;
|
||||
}
|
||||
});
|
||||
|
||||
return AutoSuggestTextField(
|
||||
controller: addressTextController,
|
||||
@@ -121,12 +117,15 @@ class WebPageDialog extends HookConsumerWidget {
|
||||
},
|
||||
onSubmitted: (value) async {
|
||||
if (value.isNotEmpty) {
|
||||
var newUrl =
|
||||
uri_parser.tryParseUrl(value, eagerParsing: true);
|
||||
var newUrl = uri_parser.tryParseUrl(
|
||||
value,
|
||||
eagerParsing: true,
|
||||
);
|
||||
|
||||
if (newUrl == null) {
|
||||
final defaultSearchBang = await ref
|
||||
.read(defaultSearchBangDataProvider.future);
|
||||
final defaultSearchBang = await ref.read(
|
||||
defaultSearchBangDataProvider.future,
|
||||
);
|
||||
|
||||
newUrl = defaultSearchBang?.getUrl(value);
|
||||
}
|
||||
@@ -147,9 +146,7 @@ class WebPageDialog extends HookConsumerWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
const Divider(),
|
||||
Flexible(
|
||||
child: FadingScroll(
|
||||
@@ -173,21 +170,23 @@ class WebPageDialog extends HookConsumerWidget {
|
||||
availableBangs: availableBangs,
|
||||
);
|
||||
},
|
||||
error: (error, stackTrace) => FailureWidget(
|
||||
title: 'Could not load bangs',
|
||||
exception: error,
|
||||
),
|
||||
loading: () => SiteSearch(
|
||||
domain: url.host,
|
||||
availableBangs: [
|
||||
BangData(
|
||||
websiteName: 'websiteName',
|
||||
domain: 'domain',
|
||||
trigger: 'trigger',
|
||||
urlTemplate: 'urlTemplate',
|
||||
error:
|
||||
(error, stackTrace) => FailureWidget(
|
||||
title: 'Could not load bangs',
|
||||
exception: error,
|
||||
),
|
||||
loading:
|
||||
() => SiteSearch(
|
||||
domain: url.host,
|
||||
availableBangs: [
|
||||
BangData(
|
||||
websiteName: 'websiteName',
|
||||
domain: 'domain',
|
||||
trigger: 'trigger',
|
||||
urlTemplate: 'urlTemplate',
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
if (availableBangsAsync.isLoading ||
|
||||
@@ -241,31 +240,30 @@ class WebPageDialog extends HookConsumerWidget {
|
||||
leading: const Icon(Icons.mobile_screen_share),
|
||||
title: const Text('Share screenshot'),
|
||||
onTap: () async {
|
||||
final screenshot = await ref
|
||||
.read(selectedTabSessionNotifierProvider)
|
||||
.requestScreenshot();
|
||||
final screenshot =
|
||||
await ref
|
||||
.read(selectedTabSessionNotifierProvider)
|
||||
.requestScreenshot();
|
||||
|
||||
if (screenshot != null) {
|
||||
ui.decodeImageFromList(
|
||||
screenshot,
|
||||
(result) async {
|
||||
final png = await result.toByteData(
|
||||
format: ui.ImageByteFormat.png,
|
||||
ui.decodeImageFromList(screenshot, (
|
||||
result,
|
||||
) async {
|
||||
final png = await result.toByteData(
|
||||
format: ui.ImageByteFormat.png,
|
||||
);
|
||||
|
||||
if (png != null) {
|
||||
final file = XFile.fromData(
|
||||
png.buffer.asUint8List(),
|
||||
mimeType: 'image/png',
|
||||
);
|
||||
|
||||
if (png != null) {
|
||||
final file = XFile.fromData(
|
||||
png.buffer.asUint8List(),
|
||||
mimeType: 'image/png',
|
||||
);
|
||||
|
||||
await Share.shareXFiles(
|
||||
[file],
|
||||
subject: precachedInfo?.title,
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
await Share.shareXFiles([
|
||||
file,
|
||||
], subject: precachedInfo?.title);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (context.mounted) {
|
||||
|
||||
@@ -53,8 +53,9 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
final displayedSheet = ref.watch(bottomSheetControllerProvider);
|
||||
final displayedOverlayDialog = ref.watch(overlayDialogControllerProvider);
|
||||
|
||||
final selectedTabId =
|
||||
ref.watch(selectedTabStateProvider.select((value) => value?.id));
|
||||
final selectedTabId = ref.watch(
|
||||
selectedTabStateProvider.select((value) => value?.id),
|
||||
);
|
||||
|
||||
final trippleDotMenuController = useMenuController();
|
||||
final tabMenuController = useMenuController();
|
||||
@@ -65,16 +66,13 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
|
||||
final activeKagiTool = useValueNotifier<KagiTool?>(null, [displayedSheet]);
|
||||
|
||||
ref.listen(
|
||||
overlayDialogControllerProvider,
|
||||
(previous, next) {
|
||||
if (next != null) {
|
||||
overlayController.show();
|
||||
} else {
|
||||
overlayController.hide();
|
||||
}
|
||||
},
|
||||
);
|
||||
ref.listen(overlayDialogControllerProvider, (previous, next) {
|
||||
if (next != null) {
|
||||
overlayController.show();
|
||||
} else {
|
||||
overlayController.hide();
|
||||
}
|
||||
});
|
||||
|
||||
// ref.listen(
|
||||
// generalSettingsRepositoryProvider
|
||||
@@ -96,8 +94,9 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
bottomNavigationBar: Consumer(
|
||||
builder: (context, ref, child) {
|
||||
final tabInFullScreen = ref.watch(
|
||||
selectedTabStateProvider
|
||||
.select((value) => value?.isFullScreen ?? false),
|
||||
selectedTabStateProvider.select(
|
||||
(value) => value?.isFullScreen ?? false,
|
||||
),
|
||||
);
|
||||
|
||||
return Visibility(
|
||||
@@ -108,15 +107,17 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
child: AppBar(
|
||||
automaticallyImplyLeading: false,
|
||||
titleSpacing: 8.0,
|
||||
title: (selectedTabId != null &&
|
||||
displayedSheet is! ViewTabsSheet)
|
||||
? Consumer(
|
||||
builder: (context, ref, child) {
|
||||
final tabState =
|
||||
ref.watch(tabStateProvider(selectedTabId));
|
||||
title:
|
||||
(selectedTabId != null &&
|
||||
displayedSheet is! ViewTabsSheet)
|
||||
? Consumer(
|
||||
builder: (context, ref, child) {
|
||||
final tabState = ref.watch(
|
||||
tabStateProvider(selectedTabId),
|
||||
);
|
||||
|
||||
return (tabState != null)
|
||||
? AppBarTitle(
|
||||
return (tabState != null)
|
||||
? AppBarTitle(
|
||||
tab: tabState,
|
||||
onTap: () async {
|
||||
await context.push(
|
||||
@@ -129,93 +130,95 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
onDoubleTap: () async {
|
||||
final newUrl = await showDialog<Uri?>(
|
||||
context: context,
|
||||
builder: (context) => EditUrlDialog(
|
||||
initialUrl: tabState.url,
|
||||
),
|
||||
builder:
|
||||
(context) => EditUrlDialog(
|
||||
initialUrl: tabState.url,
|
||||
),
|
||||
);
|
||||
|
||||
if (newUrl != null) {
|
||||
await ref
|
||||
.read(
|
||||
tabSessionProvider(tabId: null)
|
||||
.notifier,
|
||||
tabSessionProvider(
|
||||
tabId: null,
|
||||
).notifier,
|
||||
)
|
||||
.loadUrl(url: newUrl);
|
||||
}
|
||||
},
|
||||
)
|
||||
: const SizedBox.shrink();
|
||||
},
|
||||
)
|
||||
: HookBuilder(
|
||||
builder: (context) {
|
||||
// final activeTool = useListenableSelector(
|
||||
// activeKagiTool,
|
||||
// () {
|
||||
// if (displayedSheet is CreateTabSheetWidget) {
|
||||
// return null;
|
||||
// }
|
||||
: const SizedBox.shrink();
|
||||
},
|
||||
)
|
||||
: HookBuilder(
|
||||
builder: (context) {
|
||||
// final activeTool = useListenableSelector(
|
||||
// activeKagiTool,
|
||||
// () {
|
||||
// if (displayedSheet is CreateTabSheetWidget) {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
// return activeKagiTool.value;
|
||||
// },
|
||||
// );
|
||||
// return activeKagiTool.value;
|
||||
// },
|
||||
// );
|
||||
|
||||
return Row(
|
||||
children: [
|
||||
// IconButton(
|
||||
// color: (activeTool == KagiTool.search)
|
||||
// ? Theme.of(context).colorScheme.primary
|
||||
// : null,
|
||||
// onPressed: () async {
|
||||
// // ref
|
||||
// // .read(createTabStreamProvider.notifier)
|
||||
// // .createTab(
|
||||
// // CreateTabSheet(
|
||||
// // preferredTool: KagiTool.search,
|
||||
// // ),
|
||||
// // );
|
||||
// await context
|
||||
// .push(const SearchRoute().location);
|
||||
// },
|
||||
// icon: Icon(KagiTool.search.icon),
|
||||
// ),
|
||||
// IconButton(
|
||||
// color: (activeTool == KagiTool.summarizer)
|
||||
// ? Theme.of(context).colorScheme.primary
|
||||
// : null,
|
||||
// onPressed: () {
|
||||
// ref
|
||||
// .read(createTabStreamProvider.notifier)
|
||||
// .createTab(
|
||||
// CreateTabSheet(
|
||||
// preferredTool: KagiTool.summarizer,
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// icon: Icon(KagiTool.summarizer.icon),
|
||||
// ),
|
||||
// if (showEarlyAccessFeatures)
|
||||
// IconButton(
|
||||
// color: (activeTool == KagiTool.assistant)
|
||||
// ? Theme.of(context).colorScheme.primary
|
||||
// : null,
|
||||
// onPressed: () {
|
||||
// ref
|
||||
// .read(
|
||||
// createTabStreamProvider.notifier,
|
||||
// )
|
||||
// .createTab(
|
||||
// CreateTabSheet(
|
||||
// preferredTool: KagiTool.assistant,
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// icon: Icon(KagiTool.assistant.icon),
|
||||
// ),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
return Row(
|
||||
children: [
|
||||
// IconButton(
|
||||
// color: (activeTool == KagiTool.search)
|
||||
// ? Theme.of(context).colorScheme.primary
|
||||
// : null,
|
||||
// onPressed: () async {
|
||||
// // ref
|
||||
// // .read(createTabStreamProvider.notifier)
|
||||
// // .createTab(
|
||||
// // CreateTabSheet(
|
||||
// // preferredTool: KagiTool.search,
|
||||
// // ),
|
||||
// // );
|
||||
// await context
|
||||
// .push(const SearchRoute().location);
|
||||
// },
|
||||
// icon: Icon(KagiTool.search.icon),
|
||||
// ),
|
||||
// IconButton(
|
||||
// color: (activeTool == KagiTool.summarizer)
|
||||
// ? Theme.of(context).colorScheme.primary
|
||||
// : null,
|
||||
// onPressed: () {
|
||||
// ref
|
||||
// .read(createTabStreamProvider.notifier)
|
||||
// .createTab(
|
||||
// CreateTabSheet(
|
||||
// preferredTool: KagiTool.summarizer,
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// icon: Icon(KagiTool.summarizer.icon),
|
||||
// ),
|
||||
// if (showEarlyAccessFeatures)
|
||||
// IconButton(
|
||||
// color: (activeTool == KagiTool.assistant)
|
||||
// ? Theme.of(context).colorScheme.primary
|
||||
// : null,
|
||||
// onPressed: () {
|
||||
// ref
|
||||
// .read(
|
||||
// createTabStreamProvider.notifier,
|
||||
// )
|
||||
// .createTab(
|
||||
// CreateTabSheet(
|
||||
// preferredTool: KagiTool.assistant,
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// icon: Icon(KagiTool.assistant.icon),
|
||||
// ),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
actions: [
|
||||
if (selectedTabId != null &&
|
||||
displayedSheet is! ViewTabsSheet)
|
||||
@@ -278,9 +281,7 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
MenuItemButton(
|
||||
onPressed: () async {
|
||||
await ref
|
||||
.read(
|
||||
tabRepositoryProvider.notifier,
|
||||
)
|
||||
.read(tabRepositoryProvider.notifier)
|
||||
.closeTab(selectedTabId);
|
||||
},
|
||||
leadingIcon: const Icon(Icons.close),
|
||||
@@ -488,8 +489,9 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
if (selectedTabId != null)
|
||||
MenuItemButton(
|
||||
onPressed: () async {
|
||||
final tabState =
|
||||
ref.read(tabStateProvider(selectedTabId));
|
||||
final tabState = ref.read(
|
||||
tabStateProvider(selectedTabId),
|
||||
);
|
||||
|
||||
if (tabState?.url case final Uri url) {
|
||||
await ui_helper.launchUrlFeedback(context, url);
|
||||
@@ -501,8 +503,9 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
if (selectedTabId != null)
|
||||
MenuItemButton(
|
||||
onPressed: () async {
|
||||
final tabState =
|
||||
ref.read(tabStateProvider(selectedTabId));
|
||||
final tabState = ref.read(
|
||||
tabStateProvider(selectedTabId),
|
||||
);
|
||||
|
||||
if (tabState?.url case final Uri url) {
|
||||
await Share.shareUri(url);
|
||||
@@ -530,8 +533,9 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
MenuItemButton(
|
||||
onPressed: () async {
|
||||
final controller = ref.read(
|
||||
tabSessionProvider(tabId: selectedTabId)
|
||||
.notifier,
|
||||
tabSessionProvider(
|
||||
tabId: selectedTabId,
|
||||
).notifier,
|
||||
);
|
||||
|
||||
await controller.reload();
|
||||
@@ -545,39 +549,45 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
Consumer(
|
||||
builder: (context, ref, child) {
|
||||
final history = ref.watch(
|
||||
tabStateProvider(selectedTabId)
|
||||
.select((value) => value?.historyState),
|
||||
tabStateProvider(
|
||||
selectedTabId,
|
||||
).select((value) => value?.historyState),
|
||||
);
|
||||
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: (history?.canGoBack == true)
|
||||
? IconButton(
|
||||
onPressed: () async {
|
||||
final controller = ref.read(
|
||||
tabSessionProvider(
|
||||
tabId: selectedTabId,
|
||||
).notifier,
|
||||
);
|
||||
child:
|
||||
(history?.canGoBack == true)
|
||||
? IconButton(
|
||||
onPressed: () async {
|
||||
final controller = ref.read(
|
||||
tabSessionProvider(
|
||||
tabId: selectedTabId,
|
||||
).notifier,
|
||||
);
|
||||
|
||||
await controller.goBack();
|
||||
trippleDotMenuController.close();
|
||||
},
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
)
|
||||
: IconButton(
|
||||
onPressed: () async {
|
||||
await ref
|
||||
.read(
|
||||
tabRepositoryProvider
|
||||
.notifier,
|
||||
)
|
||||
.closeTab(selectedTabId);
|
||||
trippleDotMenuController.close();
|
||||
},
|
||||
icon: const Icon(Icons.close),
|
||||
),
|
||||
await controller.goBack();
|
||||
trippleDotMenuController
|
||||
.close();
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.arrow_back,
|
||||
),
|
||||
)
|
||||
: IconButton(
|
||||
onPressed: () async {
|
||||
await ref
|
||||
.read(
|
||||
tabRepositoryProvider
|
||||
.notifier,
|
||||
)
|
||||
.closeTab(selectedTabId);
|
||||
trippleDotMenuController
|
||||
.close();
|
||||
},
|
||||
icon: const Icon(Icons.close),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 48,
|
||||
@@ -585,18 +595,20 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
),
|
||||
Expanded(
|
||||
child: IconButton(
|
||||
onPressed: (history?.canGoForward == true)
|
||||
? () async {
|
||||
final controller = ref.read(
|
||||
tabSessionProvider(
|
||||
tabId: selectedTabId,
|
||||
).notifier,
|
||||
);
|
||||
onPressed:
|
||||
(history?.canGoForward == true)
|
||||
? () async {
|
||||
final controller = ref.read(
|
||||
tabSessionProvider(
|
||||
tabId: selectedTabId,
|
||||
).notifier,
|
||||
);
|
||||
|
||||
await controller.goForward();
|
||||
trippleDotMenuController.close();
|
||||
}
|
||||
: null,
|
||||
await controller.goForward();
|
||||
trippleDotMenuController
|
||||
.close();
|
||||
}
|
||||
: null,
|
||||
icon: const Icon(Icons.arrow_forward),
|
||||
),
|
||||
),
|
||||
@@ -640,20 +652,22 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
return displayedOverlayDialog!;
|
||||
},
|
||||
child: Listener(
|
||||
onPointerDown: (displayedSheet != null)
|
||||
? (_) {
|
||||
ref
|
||||
.read(bottomSheetControllerProvider.notifier)
|
||||
.dismiss();
|
||||
}
|
||||
: null,
|
||||
onPointerDown:
|
||||
(displayedSheet != null)
|
||||
? (_) {
|
||||
ref
|
||||
.read(bottomSheetControllerProvider.notifier)
|
||||
.dismiss();
|
||||
}
|
||||
: null,
|
||||
child: HookConsumer(
|
||||
builder: (context, ref, child) {
|
||||
return BackButtonListener(
|
||||
onBackButtonPressed: () async {
|
||||
final tabState = (selectedTabId != null)
|
||||
? ref.read(tabStateProvider(selectedTabId))
|
||||
: null;
|
||||
final tabState =
|
||||
(selectedTabId != null)
|
||||
? ref.read(tabStateProvider(selectedTabId))
|
||||
: null;
|
||||
|
||||
final tabCount = ref.read(
|
||||
tabListProvider.select((tabs) => tabs.length),
|
||||
@@ -698,8 +712,9 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
}
|
||||
|
||||
if (lastBackButtonPress.value != null &&
|
||||
DateTime.now()
|
||||
.difference(lastBackButtonPress.value!) <
|
||||
DateTime.now().difference(
|
||||
lastBackButtonPress.value!,
|
||||
) <
|
||||
const Duration(seconds: 2)) {
|
||||
lastBackButtonPress.value = null;
|
||||
|
||||
@@ -718,13 +733,14 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
..clearSnackBars()
|
||||
..showSnackBar(
|
||||
SnackBar(
|
||||
content: (tabCount > 1)
|
||||
? const Text(
|
||||
'Please click BACK again to close current tab',
|
||||
)
|
||||
: const Text(
|
||||
'Please click BACK again to exit app',
|
||||
),
|
||||
content:
|
||||
(tabCount > 1)
|
||||
? const Text(
|
||||
'Please click BACK again to close current tab',
|
||||
)
|
||||
: const Text(
|
||||
'Please click BACK again to exit app',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -744,16 +760,16 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
child: Consumer(
|
||||
builder: (context, ref, child) {
|
||||
final value = ref.watch(
|
||||
selectedTabStateProvider.select(
|
||||
(state) {
|
||||
if (state?.isLoading == true) {
|
||||
return state?.progress ?? 100;
|
||||
}
|
||||
selectedTabStateProvider.select((
|
||||
state,
|
||||
) {
|
||||
if (state?.isLoading == true) {
|
||||
return state?.progress ?? 100;
|
||||
}
|
||||
|
||||
//When not loading we assumed finished
|
||||
return 100;
|
||||
},
|
||||
),
|
||||
//When not loading we assumed finished
|
||||
return 100;
|
||||
}),
|
||||
);
|
||||
|
||||
return Visibility(
|
||||
@@ -774,11 +790,13 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
final value = ref.watch(
|
||||
selectedTabStateProvider.select(
|
||||
(state) => EdgeInsets.only(
|
||||
bottom: (state?.isLoading == true &&
|
||||
state?.progress != null &&
|
||||
state!.progress < 100)
|
||||
? 4.0
|
||||
: 0.0,
|
||||
bottom:
|
||||
(state?.isLoading == true &&
|
||||
state?.progress !=
|
||||
null &&
|
||||
state!.progress < 100)
|
||||
? 4.0
|
||||
: 0.0,
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -794,7 +812,7 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
ModalBarrier(
|
||||
color:
|
||||
Theme.of(context).dialogTheme.barrierColor ??
|
||||
Colors.black54,
|
||||
Colors.black54,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -806,22 +824,25 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
},
|
||||
),
|
||||
floatingActionButton: ReaderAppearanceButton(),
|
||||
bottomSheet: (displayedSheet != null)
|
||||
? NotificationListener<DraggableScrollableNotification>(
|
||||
onNotification: (notification) {
|
||||
if (notification.extent <= 0.1) {
|
||||
ref.read(bottomSheetControllerProvider.notifier).dismiss();
|
||||
return true;
|
||||
} else {
|
||||
ref
|
||||
.read(bottomSheetExtendProvider.notifier)
|
||||
.add(notification.extent);
|
||||
}
|
||||
bottomSheet:
|
||||
(displayedSheet != null)
|
||||
? NotificationListener<DraggableScrollableNotification>(
|
||||
onNotification: (notification) {
|
||||
if (notification.extent <= 0.1) {
|
||||
ref
|
||||
.read(bottomSheetControllerProvider.notifier)
|
||||
.dismiss();
|
||||
return true;
|
||||
} else {
|
||||
ref
|
||||
.read(bottomSheetExtendProvider.notifier)
|
||||
.add(notification.extent);
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
child: switch (displayedSheet) {
|
||||
ViewTabsSheet() => HookBuilder(
|
||||
return false;
|
||||
},
|
||||
child: switch (displayedSheet) {
|
||||
ViewTabsSheet() => HookBuilder(
|
||||
builder: (localContext) {
|
||||
final draggableScrollableController =
|
||||
useDraggableScrollableController();
|
||||
@@ -855,7 +876,7 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
final CreateTabSheet parameter => DraggableScrollableSheet(
|
||||
final CreateTabSheet parameter => DraggableScrollableSheet(
|
||||
key: ValueKey(displayedSheet),
|
||||
expand: false,
|
||||
initialChildSize: 0.8,
|
||||
@@ -883,7 +904,7 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
final TabQaChatSheet parameter => HookBuilder(
|
||||
final TabQaChatSheet parameter => HookBuilder(
|
||||
builder: (localContext) {
|
||||
final draggableScrollableController =
|
||||
useDraggableScrollableController();
|
||||
@@ -937,9 +958,9 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
},
|
||||
)
|
||||
: null,
|
||||
},
|
||||
)
|
||||
: null,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
+12
-26
@@ -31,15 +31,9 @@ class AppBarTitle extends StatelessWidget {
|
||||
size: 14,
|
||||
);
|
||||
} else if (!tab.isLoading) {
|
||||
return const Icon(
|
||||
MdiIcons.lock,
|
||||
size: 14,
|
||||
);
|
||||
return const Icon(MdiIcons.lock, size: 14);
|
||||
} else {
|
||||
return const Icon(
|
||||
MdiIcons.timerSand,
|
||||
size: 14,
|
||||
);
|
||||
return const Icon(MdiIcons.timerSand, size: 14);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,19 +48,11 @@ class AppBarTitle extends StatelessWidget {
|
||||
Skeletonizer(
|
||||
enabled: tab.icon == null,
|
||||
child: Skeleton.replace(
|
||||
replacement: const Bone.icon(
|
||||
size: 16,
|
||||
),
|
||||
child: RawImage(
|
||||
image: tab.icon?.value,
|
||||
height: 16,
|
||||
width: 16,
|
||||
),
|
||||
replacement: const Bone.icon(size: 16),
|
||||
child: RawImage(image: tab.icon?.value, height: 16, width: 16),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -82,8 +68,9 @@ class AppBarTitle extends StatelessWidget {
|
||||
child: TextScroll(
|
||||
key: ValueKey(tab.title),
|
||||
tab.title,
|
||||
style: theme.textTheme.bodyLarge
|
||||
?.copyWith(color: theme.colorScheme.onSurface),
|
||||
style: theme.textTheme.bodyLarge?.copyWith(
|
||||
color: theme.colorScheme.onSurface,
|
||||
),
|
||||
// mode: TextScrollMode.bouncing,
|
||||
velocity: const Velocity(pixelsPerSecond: Offset(75, 0)),
|
||||
delayBefore: const Duration(milliseconds: 500),
|
||||
@@ -99,14 +86,13 @@ class AppBarTitle extends StatelessWidget {
|
||||
Row(
|
||||
children: [
|
||||
_securityStatusIcon(context),
|
||||
const SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Expanded(
|
||||
child: Text(
|
||||
tab.url.authority,
|
||||
style: theme.textTheme.bodyMedium
|
||||
?.copyWith(color: theme.colorScheme.onSurface),
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
color: theme.colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
+30
-38
@@ -42,17 +42,18 @@ class _BrowserViewState extends ConsumerState<BrowserView>
|
||||
.read(selectedTabSessionNotifierProvider)
|
||||
.requestScreenshot(requireImageResult: false)
|
||||
.onError((error, stackTrace) {
|
||||
logger.e(error, stackTrace: stackTrace);
|
||||
timer.cancel();
|
||||
logger.e(error, stackTrace: stackTrace);
|
||||
timer.cancel();
|
||||
|
||||
return null;
|
||||
});
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final hasTab =
|
||||
ref.watch(selectedTabProvider.select((value) => value != null));
|
||||
final hasTab = ref.watch(
|
||||
selectedTabProvider.select((value) => value != null),
|
||||
);
|
||||
|
||||
ref.listen(
|
||||
selectedTabStateProvider.select(
|
||||
@@ -68,43 +69,41 @@ class _BrowserViewState extends ConsumerState<BrowserView>
|
||||
if (next.isLoading == false &&
|
||||
(_periodicScreenshotUpdate?.isActive ?? false) == false) {
|
||||
_timerPaused = false;
|
||||
_periodicScreenshotUpdate =
|
||||
Timer.periodic(widget.screenshotPeriod, _timerTick);
|
||||
_periodicScreenshotUpdate = Timer.periodic(
|
||||
widget.screenshotPeriod,
|
||||
_timerTick,
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
return Visibility(
|
||||
visible: hasTab,
|
||||
replacement: SizedBox.expand(
|
||||
child: Container(
|
||||
color: Colors.grey[800],
|
||||
),
|
||||
),
|
||||
replacement: SizedBox.expand(child: Container(color: Colors.grey[800])),
|
||||
child: GeckoView(
|
||||
preInitializationStep: () async {
|
||||
await ref
|
||||
.read(generalSettingsRepositoryProvider.notifier)
|
||||
.fetch()
|
||||
.then((settings) {
|
||||
ref
|
||||
.read(deleteBrowserDataServiceProvider.notifier)
|
||||
.deleteData(settings.deleteBrowsingDataOnQuit);
|
||||
});
|
||||
ref
|
||||
.read(deleteBrowserDataServiceProvider.notifier)
|
||||
.deleteData(settings.deleteBrowsingDataOnQuit);
|
||||
});
|
||||
|
||||
await ref
|
||||
.read(eventServiceProvider)
|
||||
.viewReadyStateEvents
|
||||
.firstWhere((state) => state == true)
|
||||
.timeout(
|
||||
const Duration(seconds: 3),
|
||||
onTimeout: () {
|
||||
logger.e(
|
||||
'Browser fragement not reported ready, trying to intitialize anyways',
|
||||
const Duration(seconds: 3),
|
||||
onTimeout: () {
|
||||
logger.e(
|
||||
'Browser fragement not reported ready, trying to intitialize anyways',
|
||||
);
|
||||
return true;
|
||||
},
|
||||
);
|
||||
return true;
|
||||
},
|
||||
);
|
||||
},
|
||||
postInitializationStep: () async {
|
||||
await widget.postInitializationStep?.call();
|
||||
@@ -123,10 +122,7 @@ class _BrowserViewState extends ConsumerState<BrowserView>
|
||||
ref.listenManual(tabRepositoryProvider, (previous, next) {});
|
||||
ref.listenManual(documentRepositoryProvider, (previous, next) {});
|
||||
|
||||
ref.listenManual(
|
||||
selectionActionServiceProvider,
|
||||
(previous, next) {},
|
||||
);
|
||||
ref.listenManual(selectionActionServiceProvider, (previous, next) {});
|
||||
|
||||
ref.listenManual(
|
||||
webExtensionsStateProvider(WebExtensionActionType.browser),
|
||||
@@ -138,20 +134,14 @@ class _BrowserViewState extends ConsumerState<BrowserView>
|
||||
(previous, next) {},
|
||||
);
|
||||
|
||||
ref.listenManual(
|
||||
cacheRepositoryProvider,
|
||||
(previous, next) {},
|
||||
);
|
||||
ref.listenManual(cacheRepositoryProvider, (previous, next) {});
|
||||
|
||||
ref.listenManual(
|
||||
engineSettingsReplicationServiceProvider,
|
||||
(previous, next) {},
|
||||
);
|
||||
|
||||
ref.listenManual(
|
||||
proxySettingsReplucationProvider,
|
||||
(previous, next) {},
|
||||
);
|
||||
ref.listenManual(proxySettingsReplucationProvider, (previous, next) {});
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -173,8 +163,10 @@ class _BrowserViewState extends ConsumerState<BrowserView>
|
||||
.evictCacheOnBackground();
|
||||
case AppLifecycleState.resumed:
|
||||
if (_timerPaused) {
|
||||
_periodicScreenshotUpdate =
|
||||
Timer.periodic(widget.screenshotPeriod, _timerTick);
|
||||
_periodicScreenshotUpdate = Timer.periodic(
|
||||
widget.screenshotPeriod,
|
||||
_timerTick,
|
||||
);
|
||||
_timerPaused = false;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-6
@@ -18,12 +18,7 @@ class DraggableScrollableHeader extends StatelessWidget {
|
||||
onVerticalDragUpdate: (details) {
|
||||
// Use the DraggableScrollableSheet's controller
|
||||
controller.jumpTo(
|
||||
min(
|
||||
1,
|
||||
controller.pixelsToSize(
|
||||
controller.pixels - details.delta.dy,
|
||||
),
|
||||
),
|
||||
min(1, controller.pixelsToSize(controller.pixels - details.delta.dy)),
|
||||
);
|
||||
},
|
||||
child: child,
|
||||
|
||||
+1
-3
@@ -20,9 +20,7 @@ class EditUrlDialog extends HookWidget {
|
||||
controller: urlController,
|
||||
maxLines: null,
|
||||
keyboardType: TextInputType.url,
|
||||
decoration: const InputDecoration(
|
||||
hintText: 'Enter URL',
|
||||
),
|
||||
decoration: const InputDecoration(hintText: 'Enter URL'),
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Please enter a URL';
|
||||
|
||||
+1
-3
@@ -25,9 +25,7 @@ class ErrorContainer extends StatelessWidget {
|
||||
color: theme.colorScheme.onErrorContainer,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: content,
|
||||
),
|
||||
Expanded(child: content),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
+1
-5
@@ -15,11 +15,7 @@ class ExtensionBadgeIcon extends StatelessWidget {
|
||||
label: hasBadge ? Text(state.badgeText!) : null,
|
||||
textColor: state.badgeTextColor,
|
||||
backgroundColor: state.badgeBackgroundColor,
|
||||
child: RawImage(
|
||||
image: state.icon?.value,
|
||||
width: 24,
|
||||
height: 24,
|
||||
),
|
||||
child: RawImage(image: state.icon?.value, width: 24, height: 24),
|
||||
);
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -28,7 +28,8 @@ class LandingAction extends HookConsumerWidget {
|
||||
await context.push(SettingsRoute().location);
|
||||
}
|
||||
},
|
||||
data: '## No Kagi Session Provided\n'
|
||||
data:
|
||||
'## No Kagi Session Provided\n'
|
||||
'Please navigate to [Settings](settings) and enter your Kagi Session Token.\n'
|
||||
"You must provide a valid session in order to use Kagi's features.",
|
||||
),
|
||||
|
||||
+42
-46
@@ -33,8 +33,9 @@ class LandingContent extends HookConsumerWidget {
|
||||
children: [
|
||||
Text(
|
||||
'Lensai',
|
||||
style:
|
||||
textTheme.titleLarge?.copyWith(fontWeight: FontWeight.bold),
|
||||
style: textTheme.titleLarge?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
Padding(
|
||||
@@ -52,16 +53,17 @@ class LandingContent extends HookConsumerWidget {
|
||||
const LandingAction(),
|
||||
Consumer(
|
||||
builder: (context, ref, child) {
|
||||
final errors = ref
|
||||
.watch(
|
||||
appInitializationServiceProvider.select(
|
||||
(result) => EquatableCollection(
|
||||
result.valueOrNull?.errors,
|
||||
immutable: false,
|
||||
),
|
||||
),
|
||||
)
|
||||
.collection;
|
||||
final errors =
|
||||
ref
|
||||
.watch(
|
||||
appInitializationServiceProvider.select(
|
||||
(result) => EquatableCollection(
|
||||
result.valueOrNull?.errors,
|
||||
immutable: false,
|
||||
),
|
||||
),
|
||||
)
|
||||
.collection;
|
||||
|
||||
if (errors == null || errors.isEmpty) {
|
||||
return const SizedBox.shrink();
|
||||
@@ -70,35 +72,31 @@ class LandingContent extends HookConsumerWidget {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
...errors.map(
|
||||
(error) {
|
||||
final theme = Theme.of(context);
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: ErrorContainer(
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Error during App Initialization!',
|
||||
style: theme.textTheme.titleMedium,
|
||||
),
|
||||
Text(
|
||||
error.message,
|
||||
style: theme.textTheme.titleSmall,
|
||||
),
|
||||
if (error.details != null)
|
||||
Text(error.details.toString()),
|
||||
],
|
||||
),
|
||||
...errors.map((error) {
|
||||
final theme = Theme.of(context);
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: ErrorContainer(
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Error during App Initialization!',
|
||||
style: theme.textTheme.titleMedium,
|
||||
),
|
||||
Text(
|
||||
error.message,
|
||||
style: theme.textTheme.titleSmall,
|
||||
),
|
||||
if (error.details != null)
|
||||
Text(error.details.toString()),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
const SizedBox(height: 8),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: SizedBox(
|
||||
@@ -138,14 +136,12 @@ class LandingContent extends HookConsumerWidget {
|
||||
),
|
||||
Text(
|
||||
'Changelog',
|
||||
style:
|
||||
textTheme.titleLarge?.copyWith(fontWeight: FontWeight.bold),
|
||||
style: textTheme.titleLarge?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
MarkdownBody(
|
||||
data: changelogAsset.data ?? '',
|
||||
selectable: true,
|
||||
),
|
||||
MarkdownBody(data: changelogAsset.data ?? '', selectable: true),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
+13
-22
@@ -25,8 +25,9 @@ class CreateTabSheetWidget extends HookConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final sharedContent = useMemoized(
|
||||
() => parameter.content
|
||||
.mapNotNull((content) => SharedContent.parse(content)),
|
||||
() => parameter.content.mapNotNull(
|
||||
(content) => SharedContent.parse(content),
|
||||
),
|
||||
[parameter],
|
||||
);
|
||||
|
||||
@@ -34,13 +35,12 @@ class CreateTabSheetWidget extends HookConsumerWidget {
|
||||
() =>
|
||||
parameter.preferredTool?.index ??
|
||||
switch (sharedContent) {
|
||||
SharedText(text: final _) => KagiTool.search.index
|
||||
SharedText(text: final _) => KagiTool.search.index,
|
||||
// (showEarlyAccessFeatures && text.length > 25)
|
||||
// ? KagiTool.assistant.index
|
||||
// : KagiTool.search.index,
|
||||
,
|
||||
SharedUrl() => KagiTool.summarizer.index,
|
||||
null => KagiTool.search.index
|
||||
null => KagiTool.search.index,
|
||||
// showEarlyAccessFeatures
|
||||
// ? KagiTool.assistant.index
|
||||
// : KagiTool.search.index,
|
||||
@@ -62,15 +62,12 @@ class CreateTabSheetWidget extends HookConsumerWidget {
|
||||
},
|
||||
);
|
||||
|
||||
useEffect(
|
||||
() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
onActiveToolChanged?.call(KagiTool.values[initialIndex]);
|
||||
});
|
||||
return null;
|
||||
},
|
||||
[initialIndex],
|
||||
);
|
||||
useEffect(() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
onActiveToolChanged?.call(KagiTool.values[initialIndex]);
|
||||
});
|
||||
return null;
|
||||
}, [initialIndex]);
|
||||
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -82,10 +79,7 @@ class CreateTabSheetWidget extends HookConsumerWidget {
|
||||
// icon: Icon(KagiTool.search.icon),
|
||||
// text: 'Search',
|
||||
// ),
|
||||
Tab(
|
||||
icon: Icon(KagiTool.summarizer.icon),
|
||||
text: 'Summarize',
|
||||
),
|
||||
Tab(icon: Icon(KagiTool.summarizer.icon), text: 'Summarize'),
|
||||
// if (showEarlyAccessFeatures)
|
||||
// Tab(
|
||||
// icon: Icon(KagiTool.assistant.icon),
|
||||
@@ -102,10 +96,7 @@ class CreateTabSheetWidget extends HookConsumerWidget {
|
||||
// sharedContent: sharedContent,
|
||||
// onSubmit: onSubmit,
|
||||
// ),
|
||||
SummarizeTab(
|
||||
sharedContent: sharedContent,
|
||||
onSubmit: onSubmit,
|
||||
),
|
||||
SummarizeTab(sharedContent: sharedContent, onSubmit: onSubmit),
|
||||
// if (showEarlyAccessFeatures)
|
||||
// AssistantTab(
|
||||
// sharedContent: sharedContent,
|
||||
|
||||
+93
-109
@@ -91,26 +91,19 @@ class _Tab extends HookConsumerWidget {
|
||||
() => searchTextController.text.isNotEmpty,
|
||||
);
|
||||
|
||||
useListenableCallback(
|
||||
searchTextController,
|
||||
() async {
|
||||
await ref
|
||||
.read(
|
||||
tabSearchRepositoryProvider(TabSearchPartition.preview).notifier,
|
||||
)
|
||||
.addQuery(searchTextController.text);
|
||||
},
|
||||
);
|
||||
useListenableCallback(searchTextController, () async {
|
||||
await ref
|
||||
.read(
|
||||
tabSearchRepositoryProvider(TabSearchPartition.preview).notifier,
|
||||
)
|
||||
.addQuery(searchTextController.text);
|
||||
});
|
||||
|
||||
return Material(
|
||||
//Fix layout issue https://github.com/flutter/flutter/issues/78748#issuecomment-1194680555
|
||||
child: Align(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
right: 8.0,
|
||||
left: 8.0,
|
||||
top: 8.0,
|
||||
),
|
||||
padding: const EdgeInsets.only(right: 8.0, left: 8.0, top: 8.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@@ -175,8 +168,9 @@ class _Tab extends HookConsumerWidget {
|
||||
child: Consumer(
|
||||
builder: (context, ref, child) {
|
||||
final selectedContainer = ref.watch(
|
||||
selectedContainerDataProvider
|
||||
.select((value) => value.valueOrNull),
|
||||
selectedContainerDataProvider.select(
|
||||
(value) => value.valueOrNull,
|
||||
),
|
||||
);
|
||||
|
||||
return ContainerChips(
|
||||
@@ -280,89 +274,79 @@ class ViewTabsSheetWidget extends HookConsumerWidget {
|
||||
[MediaQuery.of(context).size.width],
|
||||
);
|
||||
|
||||
useEffect(
|
||||
() {
|
||||
final index = filteredTabIds.collection
|
||||
.indexWhere((webView) => webView == activeTab);
|
||||
useEffect(() {
|
||||
final index = filteredTabIds.collection.indexWhere(
|
||||
(webView) => webView == activeTab,
|
||||
);
|
||||
|
||||
if (index > -1) {
|
||||
final offset = (index ~/ 2) * itemHeight;
|
||||
if (index > -1) {
|
||||
final offset = (index ~/ 2) * itemHeight;
|
||||
|
||||
if (offset != sheetScrollController.offset) {
|
||||
unawaited(
|
||||
sheetScrollController.animateTo(
|
||||
offset,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
curve: Curves.easeInOut,
|
||||
),
|
||||
);
|
||||
}
|
||||
if (offset != sheetScrollController.offset) {
|
||||
unawaited(
|
||||
sheetScrollController.animateTo(
|
||||
offset,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
curve: Curves.easeInOut,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
[filteredTabIds, activeTab],
|
||||
);
|
||||
return null;
|
||||
}, [filteredTabIds, activeTab]);
|
||||
|
||||
final tabs = useMemoized(
|
||||
() {
|
||||
return filteredTabIds.collection
|
||||
.mapIndexed(
|
||||
(index, tabId) => CustomDraggable(
|
||||
key: Key(tabId),
|
||||
data: TabDragData(tabId),
|
||||
child: Consumer(
|
||||
child: _TabDraggable(
|
||||
tabId: tabId,
|
||||
activeTabId: activeTab,
|
||||
onClose: onClose,
|
||||
),
|
||||
builder: (context, ref, child) {
|
||||
final dragData = ref.watch(
|
||||
willAcceptDropProvider.select((value) {
|
||||
final dragTabId = switch (value) {
|
||||
ContainerDropData() => value.tabId,
|
||||
DeleteDropData() => value.tabId,
|
||||
null => null,
|
||||
};
|
||||
|
||||
return (dragTabId == tabId)
|
||||
? value
|
||||
: null;
|
||||
}),
|
||||
);
|
||||
|
||||
return switch (dragData) {
|
||||
ContainerDropData() => Opacity(
|
||||
opacity: 0.3,
|
||||
child: Transform.scale(
|
||||
scale: 0.9,
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
DeleteDropData() => Opacity(
|
||||
opacity: 0.3,
|
||||
child: ColorFiltered(
|
||||
colorFilter: const ColorFilter.mode(
|
||||
Colors.red,
|
||||
BlendMode.modulate,
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
null => child!,
|
||||
};
|
||||
},
|
||||
final tabs = useMemoized(() {
|
||||
return filteredTabIds.collection
|
||||
.mapIndexed(
|
||||
(index, tabId) => CustomDraggable(
|
||||
key: Key(tabId),
|
||||
data: TabDragData(tabId),
|
||||
child: Consumer(
|
||||
child: _TabDraggable(
|
||||
tabId: tabId,
|
||||
activeTabId: activeTab,
|
||||
onClose: onClose,
|
||||
),
|
||||
builder: (context, ref, child) {
|
||||
final dragData = ref.watch(
|
||||
willAcceptDropProvider.select((value) {
|
||||
final dragTabId = switch (value) {
|
||||
ContainerDropData() => value.tabId,
|
||||
DeleteDropData() => value.tabId,
|
||||
null => null,
|
||||
};
|
||||
|
||||
return (dragTabId == tabId) ? value : null;
|
||||
}),
|
||||
);
|
||||
|
||||
return switch (dragData) {
|
||||
ContainerDropData() => Opacity(
|
||||
opacity: 0.3,
|
||||
child: Transform.scale(
|
||||
scale: 0.9,
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
DeleteDropData() => Opacity(
|
||||
opacity: 0.3,
|
||||
child: ColorFiltered(
|
||||
colorFilter: const ColorFilter.mode(
|
||||
Colors.red,
|
||||
BlendMode.modulate,
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
null => child!,
|
||||
};
|
||||
},
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
},
|
||||
[
|
||||
filteredTabIds,
|
||||
activeTab,
|
||||
],
|
||||
);
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
}, [filteredTabIds, activeTab]);
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
||||
@@ -381,8 +365,9 @@ class ViewTabsSheetWidget extends HookConsumerWidget {
|
||||
final oldIndex = positions.first.oldIndex;
|
||||
final newIndex = positions.first.newIndex;
|
||||
|
||||
final containerRepository =
|
||||
ref.read(containerRepositoryProvider.notifier);
|
||||
final containerRepository = ref.read(
|
||||
containerRepositoryProvider.notifier,
|
||||
);
|
||||
|
||||
final tabId = filteredTabIds.collection[oldIndex];
|
||||
final containerId = await ref
|
||||
@@ -391,12 +376,14 @@ class ViewTabsSheetWidget extends HookConsumerWidget {
|
||||
|
||||
final String key;
|
||||
if (newIndex <= 0) {
|
||||
key = await containerRepository
|
||||
.getLeadingOrderKey(containerId);
|
||||
key = await containerRepository.getLeadingOrderKey(
|
||||
containerId,
|
||||
);
|
||||
} else if (newIndex >=
|
||||
filteredTabIds.collection.length - 1) {
|
||||
key = await containerRepository
|
||||
.getTrailingOrderKey(containerId);
|
||||
key = await containerRepository.getTrailingOrderKey(
|
||||
containerId,
|
||||
);
|
||||
} else {
|
||||
final orderAfterIndex = newIndex;
|
||||
key = await containerRepository.getOrderKeyAfterTab(
|
||||
@@ -414,12 +401,12 @@ class ViewTabsSheetWidget extends HookConsumerWidget {
|
||||
controller: sheetScrollController,
|
||||
gridDelegate:
|
||||
const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
//Sync values for itemHeight calculation _calculateItemHeight
|
||||
childAspectRatio: 0.75,
|
||||
mainAxisSpacing: 8.0,
|
||||
crossAxisSpacing: 8.0,
|
||||
crossAxisCount: 2,
|
||||
),
|
||||
//Sync values for itemHeight calculation _calculateItemHeight
|
||||
childAspectRatio: 0.75,
|
||||
mainAxisSpacing: 8.0,
|
||||
crossAxisSpacing: 8.0,
|
||||
crossAxisCount: 2,
|
||||
),
|
||||
itemCount: children.length,
|
||||
itemBuilder: (context, index) => children[index],
|
||||
);
|
||||
@@ -432,10 +419,7 @@ class ViewTabsSheetWidget extends HookConsumerWidget {
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: _Tab.headerSize + 4,
|
||||
right: 4,
|
||||
),
|
||||
padding: const EdgeInsets.only(top: _Tab.headerSize + 4, right: 4),
|
||||
child: FloatingActionButton.small(
|
||||
onPressed: () async {
|
||||
await context.push(const SearchRoute().location);
|
||||
|
||||
@@ -51,8 +51,10 @@ class TabPreview extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
visualDensity:
|
||||
const VisualDensity(horizontal: -4.0, vertical: -4.0),
|
||||
visualDensity: const VisualDensity(
|
||||
horizontal: -4.0,
|
||||
vertical: -4.0,
|
||||
),
|
||||
onPressed: onDelete,
|
||||
icon: const Icon(Icons.close),
|
||||
),
|
||||
@@ -60,17 +62,9 @@ class TabPreview extends StatelessWidget {
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: 6.0,
|
||||
),
|
||||
RawImage(
|
||||
image: tab.icon?.value,
|
||||
height: 16,
|
||||
width: 16,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 6.0,
|
||||
),
|
||||
const SizedBox(width: 6.0),
|
||||
RawImage(image: tab.icon?.value, height: 16, width: 16),
|
||||
const SizedBox(width: 6.0),
|
||||
Expanded(
|
||||
child: Text(
|
||||
tab.url.authority,
|
||||
@@ -79,9 +73,7 @@ class TabPreview extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 6,
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
if (tab.thumbnail != null)
|
||||
Expanded(
|
||||
child: ClipRRect(
|
||||
|
||||
+5
-7
@@ -24,17 +24,15 @@ class TabsActionButton extends HookConsumerWidget {
|
||||
onTap: onTap,
|
||||
onLongPress: onLongPress,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8.0,
|
||||
vertical: 15.0,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 15.0),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
width: 2.0,
|
||||
color: isActive
|
||||
? theme.colorScheme.primary
|
||||
: DefaultTextStyle.of(context).style.color!,
|
||||
color:
|
||||
isActive
|
||||
? theme.colorScheme.primary
|
||||
: DefaultTextStyle.of(context).style.color!,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
),
|
||||
|
||||
+4
-3
@@ -9,9 +9,10 @@ class FindInPageRepository extends _$FindInPageRepository {
|
||||
|
||||
@override
|
||||
void build(String? tabId) {
|
||||
_service = (tabId != null)
|
||||
? GeckoFindInPageService(tabId: tabId)
|
||||
: GeckoFindInPageService.forActiveTab();
|
||||
_service =
|
||||
(tabId != null)
|
||||
? GeckoFindInPageService(tabId: tabId)
|
||||
: GeckoFindInPageService.forActiveTab();
|
||||
}
|
||||
|
||||
Future<void> findAll({required String text}) {
|
||||
|
||||
+22
-34
@@ -34,9 +34,7 @@ abstract class _$FindInPageRepository
|
||||
extends BuildlessAutoDisposeNotifier<void> {
|
||||
late final String? tabId;
|
||||
|
||||
void build(
|
||||
String? tabId,
|
||||
);
|
||||
void build(String? tabId);
|
||||
}
|
||||
|
||||
/// See also [FindInPageRepository].
|
||||
@@ -49,21 +47,15 @@ class FindInPageRepositoryFamily extends Family<void> {
|
||||
const FindInPageRepositoryFamily();
|
||||
|
||||
/// See also [FindInPageRepository].
|
||||
FindInPageRepositoryProvider call(
|
||||
String? tabId,
|
||||
) {
|
||||
return FindInPageRepositoryProvider(
|
||||
tabId,
|
||||
);
|
||||
FindInPageRepositoryProvider call(String? tabId) {
|
||||
return FindInPageRepositoryProvider(tabId);
|
||||
}
|
||||
|
||||
@override
|
||||
FindInPageRepositoryProvider getProviderOverride(
|
||||
covariant FindInPageRepositoryProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.tabId,
|
||||
);
|
||||
return call(provider.tabId);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -85,21 +77,20 @@ class FindInPageRepositoryFamily extends Family<void> {
|
||||
class FindInPageRepositoryProvider
|
||||
extends AutoDisposeNotifierProviderImpl<FindInPageRepository, void> {
|
||||
/// See also [FindInPageRepository].
|
||||
FindInPageRepositoryProvider(
|
||||
String? tabId,
|
||||
) : this._internal(
|
||||
() => FindInPageRepository()..tabId = tabId,
|
||||
from: findInPageRepositoryProvider,
|
||||
name: r'findInPageRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$findInPageRepositoryHash,
|
||||
dependencies: FindInPageRepositoryFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
FindInPageRepositoryFamily._allTransitiveDependencies,
|
||||
tabId: tabId,
|
||||
);
|
||||
FindInPageRepositoryProvider(String? tabId)
|
||||
: this._internal(
|
||||
() => FindInPageRepository()..tabId = tabId,
|
||||
from: findInPageRepositoryProvider,
|
||||
name: r'findInPageRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$findInPageRepositoryHash,
|
||||
dependencies: FindInPageRepositoryFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
FindInPageRepositoryFamily._allTransitiveDependencies,
|
||||
tabId: tabId,
|
||||
);
|
||||
|
||||
FindInPageRepositoryProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -114,12 +105,8 @@ class FindInPageRepositoryProvider
|
||||
final String? tabId;
|
||||
|
||||
@override
|
||||
void runNotifierBuild(
|
||||
covariant FindInPageRepository notifier,
|
||||
) {
|
||||
return notifier.build(
|
||||
tabId,
|
||||
);
|
||||
void runNotifierBuild(covariant FindInPageRepository notifier) {
|
||||
return notifier.build(tabId);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -140,7 +127,7 @@ class FindInPageRepositoryProvider
|
||||
|
||||
@override
|
||||
AutoDisposeNotifierProviderElement<FindInPageRepository, void>
|
||||
createElement() {
|
||||
createElement() {
|
||||
return _FindInPageRepositoryProviderElement(this);
|
||||
}
|
||||
|
||||
@@ -173,5 +160,6 @@ class _FindInPageRepositoryProviderElement
|
||||
@override
|
||||
String? get tabId => (origin as FindInPageRepositoryProvider).tabId;
|
||||
}
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
+9
-8
@@ -13,14 +13,15 @@ String _$findInPageVisibilityControllerHash() =>
|
||||
@ProviderFor(FindInPageVisibilityController)
|
||||
final findInPageVisibilityControllerProvider =
|
||||
AutoDisposeNotifierProvider<FindInPageVisibilityController, bool>.internal(
|
||||
FindInPageVisibilityController.new,
|
||||
name: r'findInPageVisibilityControllerProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$findInPageVisibilityControllerHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
FindInPageVisibilityController.new,
|
||||
name: r'findInPageVisibilityControllerProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$findInPageVisibilityControllerHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$FindInPageVisibilityController = AutoDisposeNotifier<bool>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
+6
-4
@@ -13,8 +13,9 @@ class FindInPageWidget extends HookConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final showFindInPage = ref.watch(findInPageVisibilityControllerProvider);
|
||||
final findInteractionController =
|
||||
ref.watch(findInPageRepositoryProvider(null).notifier);
|
||||
final findInteractionController = ref.watch(
|
||||
findInPageRepositoryProvider(null).notifier,
|
||||
);
|
||||
|
||||
final textController = useTextEditingController();
|
||||
|
||||
@@ -47,8 +48,9 @@ class FindInPageWidget extends HookConsumerWidget {
|
||||
HookConsumer(
|
||||
builder: (context, ref, child) {
|
||||
final searchResult = ref.watch(
|
||||
selectedTabStateProvider
|
||||
.select((state) => state?.findResultState),
|
||||
selectedTabStateProvider.select(
|
||||
(state) => state?.findResultState,
|
||||
),
|
||||
);
|
||||
|
||||
if (searchResult != null) {
|
||||
|
||||
+12
-17
@@ -10,24 +10,19 @@ class PreferenceSettingGroup with FastEquatable {
|
||||
|
||||
final Map<String, PreferenceSetting> settings;
|
||||
|
||||
bool get isActive => settings.values
|
||||
.every((setting) => setting.requireUserOptIn || setting.isActive);
|
||||
bool get isActive => settings.values.every(
|
||||
(setting) => setting.requireUserOptIn || setting.isActive,
|
||||
);
|
||||
|
||||
bool get isPartlyActive => settings.values.any((setting) => setting.isActive);
|
||||
|
||||
PreferenceSettingGroup({
|
||||
required this.description,
|
||||
required this.settings,
|
||||
});
|
||||
PreferenceSettingGroup({required this.description, required this.settings});
|
||||
|
||||
@override
|
||||
bool get cacheHash => true;
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters => [
|
||||
description,
|
||||
settings,
|
||||
];
|
||||
List<Object?> get hashParameters => [description, settings];
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
@@ -65,11 +60,11 @@ class PreferenceSetting with FastEquatable {
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters => [
|
||||
value,
|
||||
actualValue,
|
||||
title,
|
||||
description,
|
||||
requireUserOptIn,
|
||||
shouldBeDefault,
|
||||
];
|
||||
value,
|
||||
actualValue,
|
||||
title,
|
||||
description,
|
||||
requireUserOptIn,
|
||||
shouldBeDefault,
|
||||
];
|
||||
}
|
||||
+40
-34
@@ -39,7 +39,6 @@ class _$PreferenceSettingGroupCWProxyImpl
|
||||
this(settings: settings);
|
||||
|
||||
@override
|
||||
|
||||
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `PreferenceSettingGroup(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
|
||||
///
|
||||
/// Usage
|
||||
@@ -51,14 +50,16 @@ class _$PreferenceSettingGroupCWProxyImpl
|
||||
Object? settings = const $CopyWithPlaceholder(),
|
||||
}) {
|
||||
return PreferenceSettingGroup(
|
||||
description: description == const $CopyWithPlaceholder()
|
||||
? _value.description
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: description as String?,
|
||||
settings: settings == const $CopyWithPlaceholder()
|
||||
? _value.settings
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: settings as Map<String, PreferenceSetting>,
|
||||
description:
|
||||
description == const $CopyWithPlaceholder()
|
||||
? _value.description
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: description as String?,
|
||||
settings:
|
||||
settings == const $CopyWithPlaceholder()
|
||||
? _value.settings
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: settings as Map<String, PreferenceSetting>,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -128,7 +129,6 @@ class _$PreferenceSettingCWProxyImpl implements _$PreferenceSettingCWProxy {
|
||||
this(shouldBeDefault: shouldBeDefault);
|
||||
|
||||
@override
|
||||
|
||||
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `PreferenceSetting(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
|
||||
///
|
||||
/// Usage
|
||||
@@ -144,30 +144,36 @@ class _$PreferenceSettingCWProxyImpl implements _$PreferenceSettingCWProxy {
|
||||
Object? shouldBeDefault = const $CopyWithPlaceholder(),
|
||||
}) {
|
||||
return PreferenceSetting(
|
||||
value: value == const $CopyWithPlaceholder()
|
||||
? _value.value
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: value as Object,
|
||||
title: title == const $CopyWithPlaceholder()
|
||||
? _value.title
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: title as String?,
|
||||
description: description == const $CopyWithPlaceholder()
|
||||
? _value.description
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: description as String?,
|
||||
actualValue: actualValue == const $CopyWithPlaceholder()
|
||||
? _value.actualValue
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: actualValue as Object?,
|
||||
requireUserOptIn: requireUserOptIn == const $CopyWithPlaceholder()
|
||||
? _value.requireUserOptIn
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: requireUserOptIn as bool,
|
||||
shouldBeDefault: shouldBeDefault == const $CopyWithPlaceholder()
|
||||
? _value.shouldBeDefault
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: shouldBeDefault as bool,
|
||||
value:
|
||||
value == const $CopyWithPlaceholder()
|
||||
? _value.value
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: value as Object,
|
||||
title:
|
||||
title == const $CopyWithPlaceholder()
|
||||
? _value.title
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: title as String?,
|
||||
description:
|
||||
description == const $CopyWithPlaceholder()
|
||||
? _value.description
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: description as String?,
|
||||
actualValue:
|
||||
actualValue == const $CopyWithPlaceholder()
|
||||
? _value.actualValue
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: actualValue as Object?,
|
||||
requireUserOptIn:
|
||||
requireUserOptIn == const $CopyWithPlaceholder()
|
||||
? _value.requireUserOptIn
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: requireUserOptIn as bool,
|
||||
shouldBeDefault:
|
||||
shouldBeDefault == const $CopyWithPlaceholder()
|
||||
? _value.shouldBeDefault
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: shouldBeDefault as bool,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+26
-18
@@ -15,8 +15,9 @@ part 'preference_settings.g.dart';
|
||||
@Riverpod(keepAlive: true)
|
||||
Future<Map<String, dynamic>> _preferenceSettingContent(Ref ref) async {
|
||||
return await rootBundle
|
||||
.loadString('assets/preferences/settings.json')
|
||||
.then(jsonDecode) as Map<String, dynamic>;
|
||||
.loadString('assets/preferences/settings.json')
|
||||
.then(jsonDecode)
|
||||
as Map<String, dynamic>;
|
||||
}
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
@@ -85,8 +86,9 @@ class UnifiedPreferenceSettingsRepository
|
||||
Map<String, PreferenceSettingGroup>? _statelessGroups;
|
||||
|
||||
Future<void> apply() async {
|
||||
_statelessGroups =
|
||||
await ref.read(_preferenceSettingGroupsProvider(partition).future);
|
||||
_statelessGroups = await ref.read(
|
||||
_preferenceSettingGroupsProvider(partition).future,
|
||||
);
|
||||
|
||||
final prefs = {
|
||||
for (final group in _statelessGroups!.values)
|
||||
@@ -101,13 +103,15 @@ class UnifiedPreferenceSettingsRepository
|
||||
}
|
||||
|
||||
Future<void> reset() async {
|
||||
_statelessGroups =
|
||||
await ref.read(_preferenceSettingGroupsProvider(partition).future);
|
||||
_statelessGroups = await ref.read(
|
||||
_preferenceSettingGroupsProvider(partition).future,
|
||||
);
|
||||
|
||||
final prefs = _statelessGroups!.values
|
||||
.map((group) => group.settings.keys)
|
||||
.flattened
|
||||
.toList();
|
||||
final prefs =
|
||||
_statelessGroups!.values
|
||||
.map((group) => group.settings.keys)
|
||||
.flattened
|
||||
.toList();
|
||||
|
||||
await ref.read(_preferenceRepositoryProvider.notifier).resetPrefs(prefs);
|
||||
}
|
||||
@@ -116,8 +120,9 @@ class UnifiedPreferenceSettingsRepository
|
||||
Stream<Map<String, PreferenceSettingGroup>> build(
|
||||
PreferencePartition partition,
|
||||
) async* {
|
||||
_statelessGroups =
|
||||
await ref.watch(_preferenceSettingGroupsProvider(partition).future);
|
||||
_statelessGroups = await ref.watch(
|
||||
_preferenceSettingGroupsProvider(partition).future,
|
||||
);
|
||||
|
||||
final prefStream = ref.watch(_preferenceRepositoryProvider);
|
||||
|
||||
@@ -145,8 +150,9 @@ class PreferenceSettingsGroupRepository
|
||||
PreferenceSettingGroup? _statelessSettingGroup;
|
||||
|
||||
Future<void> apply({List<String>? filter}) async {
|
||||
_statelessSettingGroup ??= await ref
|
||||
.read(_preferenceSettingGroupProvider(partition, groupName).future);
|
||||
_statelessSettingGroup ??= await ref.read(
|
||||
_preferenceSettingGroupProvider(partition, groupName).future,
|
||||
);
|
||||
|
||||
final prefs = Map.fromEntries(
|
||||
filter?.map(
|
||||
@@ -165,8 +171,9 @@ class PreferenceSettingsGroupRepository
|
||||
}
|
||||
|
||||
Future<void> reset({List<String>? filter}) async {
|
||||
_statelessSettingGroup ??= await ref
|
||||
.read(_preferenceSettingGroupProvider(partition, groupName).future);
|
||||
_statelessSettingGroup ??= await ref.read(
|
||||
_preferenceSettingGroupProvider(partition, groupName).future,
|
||||
);
|
||||
|
||||
if (filter != null &&
|
||||
filter.any(
|
||||
@@ -185,8 +192,9 @@ class PreferenceSettingsGroupRepository
|
||||
PreferencePartition partition,
|
||||
String groupName,
|
||||
) async* {
|
||||
_statelessSettingGroup = await ref
|
||||
.watch(_preferenceSettingGroupProvider(partition, groupName).future);
|
||||
_statelessSettingGroup = await ref.watch(
|
||||
_preferenceSettingGroupProvider(partition, groupName).future,
|
||||
);
|
||||
|
||||
final prefStream = ref.watch(_preferenceRepositoryProvider);
|
||||
|
||||
|
||||
+144
-143
@@ -13,14 +13,15 @@ String _$preferenceSettingContentHash() =>
|
||||
@ProviderFor(_preferenceSettingContent)
|
||||
final _preferenceSettingContentProvider =
|
||||
FutureProvider<Map<String, dynamic>>.internal(
|
||||
_preferenceSettingContent,
|
||||
name: r'_preferenceSettingContentProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$preferenceSettingContentHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
_preferenceSettingContent,
|
||||
name: r'_preferenceSettingContentProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$preferenceSettingContentHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
@@ -60,21 +61,15 @@ class _PreferenceSettingGroupsFamily
|
||||
const _PreferenceSettingGroupsFamily();
|
||||
|
||||
/// See also [_preferenceSettingGroups].
|
||||
_PreferenceSettingGroupsProvider call(
|
||||
PreferencePartition partition,
|
||||
) {
|
||||
return _PreferenceSettingGroupsProvider(
|
||||
partition,
|
||||
);
|
||||
_PreferenceSettingGroupsProvider call(PreferencePartition partition) {
|
||||
return _PreferenceSettingGroupsProvider(partition);
|
||||
}
|
||||
|
||||
@override
|
||||
_PreferenceSettingGroupsProvider getProviderOverride(
|
||||
covariant _PreferenceSettingGroupsProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.partition,
|
||||
);
|
||||
return call(provider.partition);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -96,24 +91,23 @@ class _PreferenceSettingGroupsFamily
|
||||
class _PreferenceSettingGroupsProvider
|
||||
extends FutureProvider<Map<String, PreferenceSettingGroup>> {
|
||||
/// See also [_preferenceSettingGroups].
|
||||
_PreferenceSettingGroupsProvider(
|
||||
PreferencePartition partition,
|
||||
) : this._internal(
|
||||
(ref) => _preferenceSettingGroups(
|
||||
ref as _PreferenceSettingGroupsRef,
|
||||
partition,
|
||||
),
|
||||
from: _preferenceSettingGroupsProvider,
|
||||
name: r'_preferenceSettingGroupsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$preferenceSettingGroupsHash,
|
||||
dependencies: _PreferenceSettingGroupsFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
_PreferenceSettingGroupsFamily._allTransitiveDependencies,
|
||||
partition: partition,
|
||||
);
|
||||
_PreferenceSettingGroupsProvider(PreferencePartition partition)
|
||||
: this._internal(
|
||||
(ref) => _preferenceSettingGroups(
|
||||
ref as _PreferenceSettingGroupsRef,
|
||||
partition,
|
||||
),
|
||||
from: _preferenceSettingGroupsProvider,
|
||||
name: r'_preferenceSettingGroupsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$preferenceSettingGroupsHash,
|
||||
dependencies: _PreferenceSettingGroupsFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
_PreferenceSettingGroupsFamily._allTransitiveDependencies,
|
||||
partition: partition,
|
||||
);
|
||||
|
||||
_PreferenceSettingGroupsProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -130,8 +124,9 @@ class _PreferenceSettingGroupsProvider
|
||||
@override
|
||||
Override overrideWith(
|
||||
FutureOr<Map<String, PreferenceSettingGroup>> Function(
|
||||
_PreferenceSettingGroupsRef provider)
|
||||
create,
|
||||
_PreferenceSettingGroupsRef provider,
|
||||
)
|
||||
create,
|
||||
) {
|
||||
return ProviderOverride(
|
||||
origin: this,
|
||||
@@ -203,20 +198,14 @@ class _PreferenceSettingGroupFamily
|
||||
PreferencePartition partition,
|
||||
String groupName,
|
||||
) {
|
||||
return _PreferenceSettingGroupProvider(
|
||||
partition,
|
||||
groupName,
|
||||
);
|
||||
return _PreferenceSettingGroupProvider(partition, groupName);
|
||||
}
|
||||
|
||||
@override
|
||||
_PreferenceSettingGroupProvider getProviderOverride(
|
||||
covariant _PreferenceSettingGroupProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.partition,
|
||||
provider.groupName,
|
||||
);
|
||||
return call(provider.partition, provider.groupName);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -242,23 +231,23 @@ class _PreferenceSettingGroupProvider
|
||||
PreferencePartition partition,
|
||||
String groupName,
|
||||
) : this._internal(
|
||||
(ref) => _preferenceSettingGroup(
|
||||
ref as _PreferenceSettingGroupRef,
|
||||
partition,
|
||||
groupName,
|
||||
),
|
||||
from: _preferenceSettingGroupProvider,
|
||||
name: r'_preferenceSettingGroupProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$preferenceSettingGroupHash,
|
||||
dependencies: _PreferenceSettingGroupFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
_PreferenceSettingGroupFamily._allTransitiveDependencies,
|
||||
partition: partition,
|
||||
groupName: groupName,
|
||||
);
|
||||
(ref) => _preferenceSettingGroup(
|
||||
ref as _PreferenceSettingGroupRef,
|
||||
partition,
|
||||
groupName,
|
||||
),
|
||||
from: _preferenceSettingGroupProvider,
|
||||
name: r'_preferenceSettingGroupProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$preferenceSettingGroupHash,
|
||||
dependencies: _PreferenceSettingGroupFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
_PreferenceSettingGroupFamily._allTransitiveDependencies,
|
||||
partition: partition,
|
||||
groupName: groupName,
|
||||
);
|
||||
|
||||
_PreferenceSettingGroupProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -277,8 +266,9 @@ class _PreferenceSettingGroupProvider
|
||||
@override
|
||||
Override overrideWith(
|
||||
FutureOr<PreferenceSettingGroup> Function(
|
||||
_PreferenceSettingGroupRef provider)
|
||||
create,
|
||||
_PreferenceSettingGroupRef provider,
|
||||
)
|
||||
create,
|
||||
) {
|
||||
return ProviderOverride(
|
||||
origin: this,
|
||||
@@ -345,24 +335,29 @@ String _$preferenceRepositoryHash() =>
|
||||
/// See also [_PreferenceRepository].
|
||||
@ProviderFor(_PreferenceRepository)
|
||||
final _preferenceRepositoryProvider = AutoDisposeNotifierProvider<
|
||||
_PreferenceRepository, Raw<Stream<Map<String, Object>>>>.internal(
|
||||
_PreferenceRepository,
|
||||
Raw<Stream<Map<String, Object>>>
|
||||
>.internal(
|
||||
_PreferenceRepository.new,
|
||||
name: r'_preferenceRepositoryProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$preferenceRepositoryHash,
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$preferenceRepositoryHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$PreferenceRepository
|
||||
= AutoDisposeNotifier<Raw<Stream<Map<String, Object>>>>;
|
||||
typedef _$PreferenceRepository =
|
||||
AutoDisposeNotifier<Raw<Stream<Map<String, Object>>>>;
|
||||
String _$unifiedPreferenceSettingsRepositoryHash() =>
|
||||
r'35aa16ffa7aa1453c8331ed7470ef85a68d27178';
|
||||
|
||||
abstract class _$UnifiedPreferenceSettingsRepository
|
||||
extends BuildlessAutoDisposeStreamNotifier<
|
||||
Map<String, PreferenceSettingGroup>> {
|
||||
extends
|
||||
BuildlessAutoDisposeStreamNotifier<
|
||||
Map<String, PreferenceSettingGroup>
|
||||
> {
|
||||
late final PreferencePartition partition;
|
||||
|
||||
Stream<Map<String, PreferenceSettingGroup>> build(
|
||||
@@ -385,18 +380,14 @@ class UnifiedPreferenceSettingsRepositoryFamily
|
||||
UnifiedPreferenceSettingsRepositoryProvider call(
|
||||
PreferencePartition partition,
|
||||
) {
|
||||
return UnifiedPreferenceSettingsRepositoryProvider(
|
||||
partition,
|
||||
);
|
||||
return UnifiedPreferenceSettingsRepositoryProvider(partition);
|
||||
}
|
||||
|
||||
@override
|
||||
UnifiedPreferenceSettingsRepositoryProvider getProviderOverride(
|
||||
covariant UnifiedPreferenceSettingsRepositoryProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.partition,
|
||||
);
|
||||
return call(provider.partition);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -416,25 +407,27 @@ class UnifiedPreferenceSettingsRepositoryFamily
|
||||
|
||||
/// See also [UnifiedPreferenceSettingsRepository].
|
||||
class UnifiedPreferenceSettingsRepositoryProvider
|
||||
extends AutoDisposeStreamNotifierProviderImpl<
|
||||
UnifiedPreferenceSettingsRepository,
|
||||
Map<String, PreferenceSettingGroup>> {
|
||||
extends
|
||||
AutoDisposeStreamNotifierProviderImpl<
|
||||
UnifiedPreferenceSettingsRepository,
|
||||
Map<String, PreferenceSettingGroup>
|
||||
> {
|
||||
/// See also [UnifiedPreferenceSettingsRepository].
|
||||
UnifiedPreferenceSettingsRepositoryProvider(
|
||||
PreferencePartition partition,
|
||||
) : this._internal(
|
||||
() => UnifiedPreferenceSettingsRepository()..partition = partition,
|
||||
from: unifiedPreferenceSettingsRepositoryProvider,
|
||||
name: r'unifiedPreferenceSettingsRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$unifiedPreferenceSettingsRepositoryHash,
|
||||
dependencies: UnifiedPreferenceSettingsRepositoryFamily._dependencies,
|
||||
allTransitiveDependencies: UnifiedPreferenceSettingsRepositoryFamily
|
||||
._allTransitiveDependencies,
|
||||
partition: partition,
|
||||
);
|
||||
UnifiedPreferenceSettingsRepositoryProvider(PreferencePartition partition)
|
||||
: this._internal(
|
||||
() => UnifiedPreferenceSettingsRepository()..partition = partition,
|
||||
from: unifiedPreferenceSettingsRepositoryProvider,
|
||||
name: r'unifiedPreferenceSettingsRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$unifiedPreferenceSettingsRepositoryHash,
|
||||
dependencies: UnifiedPreferenceSettingsRepositoryFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
UnifiedPreferenceSettingsRepositoryFamily
|
||||
._allTransitiveDependencies,
|
||||
partition: partition,
|
||||
);
|
||||
|
||||
UnifiedPreferenceSettingsRepositoryProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -452,9 +445,7 @@ class UnifiedPreferenceSettingsRepositoryProvider
|
||||
Stream<Map<String, PreferenceSettingGroup>> runNotifierBuild(
|
||||
covariant UnifiedPreferenceSettingsRepository notifier,
|
||||
) {
|
||||
return notifier.build(
|
||||
partition,
|
||||
);
|
||||
return notifier.build(partition);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -474,8 +465,11 @@ class UnifiedPreferenceSettingsRepositoryProvider
|
||||
}
|
||||
|
||||
@override
|
||||
AutoDisposeStreamNotifierProviderElement<UnifiedPreferenceSettingsRepository,
|
||||
Map<String, PreferenceSettingGroup>> createElement() {
|
||||
AutoDisposeStreamNotifierProviderElement<
|
||||
UnifiedPreferenceSettingsRepository,
|
||||
Map<String, PreferenceSettingGroup>
|
||||
>
|
||||
createElement() {
|
||||
return _UnifiedPreferenceSettingsRepositoryProviderElement(this);
|
||||
}
|
||||
|
||||
@@ -497,16 +491,20 @@ class UnifiedPreferenceSettingsRepositoryProvider
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
mixin UnifiedPreferenceSettingsRepositoryRef
|
||||
on AutoDisposeStreamNotifierProviderRef<
|
||||
Map<String, PreferenceSettingGroup>> {
|
||||
on
|
||||
AutoDisposeStreamNotifierProviderRef<
|
||||
Map<String, PreferenceSettingGroup>
|
||||
> {
|
||||
/// The parameter `partition` of this provider.
|
||||
PreferencePartition get partition;
|
||||
}
|
||||
|
||||
class _UnifiedPreferenceSettingsRepositoryProviderElement
|
||||
extends AutoDisposeStreamNotifierProviderElement<
|
||||
UnifiedPreferenceSettingsRepository,
|
||||
Map<String, PreferenceSettingGroup>>
|
||||
extends
|
||||
AutoDisposeStreamNotifierProviderElement<
|
||||
UnifiedPreferenceSettingsRepository,
|
||||
Map<String, PreferenceSettingGroup>
|
||||
>
|
||||
with UnifiedPreferenceSettingsRepositoryRef {
|
||||
_UnifiedPreferenceSettingsRepositoryProviderElement(super.provider);
|
||||
|
||||
@@ -545,20 +543,14 @@ class PreferenceSettingsGroupRepositoryFamily
|
||||
PreferencePartition partition,
|
||||
String groupName,
|
||||
) {
|
||||
return PreferenceSettingsGroupRepositoryProvider(
|
||||
partition,
|
||||
groupName,
|
||||
);
|
||||
return PreferenceSettingsGroupRepositoryProvider(partition, groupName);
|
||||
}
|
||||
|
||||
@override
|
||||
PreferenceSettingsGroupRepositoryProvider getProviderOverride(
|
||||
covariant PreferenceSettingsGroupRepositoryProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.partition,
|
||||
provider.groupName,
|
||||
);
|
||||
return call(provider.partition, provider.groupName);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -578,28 +570,32 @@ class PreferenceSettingsGroupRepositoryFamily
|
||||
|
||||
/// See also [PreferenceSettingsGroupRepository].
|
||||
class PreferenceSettingsGroupRepositoryProvider
|
||||
extends AutoDisposeStreamNotifierProviderImpl<
|
||||
PreferenceSettingsGroupRepository, PreferenceSettingGroup> {
|
||||
extends
|
||||
AutoDisposeStreamNotifierProviderImpl<
|
||||
PreferenceSettingsGroupRepository,
|
||||
PreferenceSettingGroup
|
||||
> {
|
||||
/// See also [PreferenceSettingsGroupRepository].
|
||||
PreferenceSettingsGroupRepositoryProvider(
|
||||
PreferencePartition partition,
|
||||
String groupName,
|
||||
) : this._internal(
|
||||
() => PreferenceSettingsGroupRepository()
|
||||
..partition = partition
|
||||
..groupName = groupName,
|
||||
from: preferenceSettingsGroupRepositoryProvider,
|
||||
name: r'preferenceSettingsGroupRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$preferenceSettingsGroupRepositoryHash,
|
||||
dependencies: PreferenceSettingsGroupRepositoryFamily._dependencies,
|
||||
allTransitiveDependencies: PreferenceSettingsGroupRepositoryFamily
|
||||
._allTransitiveDependencies,
|
||||
partition: partition,
|
||||
groupName: groupName,
|
||||
);
|
||||
() =>
|
||||
PreferenceSettingsGroupRepository()
|
||||
..partition = partition
|
||||
..groupName = groupName,
|
||||
from: preferenceSettingsGroupRepositoryProvider,
|
||||
name: r'preferenceSettingsGroupRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$preferenceSettingsGroupRepositoryHash,
|
||||
dependencies: PreferenceSettingsGroupRepositoryFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
PreferenceSettingsGroupRepositoryFamily._allTransitiveDependencies,
|
||||
partition: partition,
|
||||
groupName: groupName,
|
||||
);
|
||||
|
||||
PreferenceSettingsGroupRepositoryProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -619,10 +615,7 @@ class PreferenceSettingsGroupRepositoryProvider
|
||||
Stream<PreferenceSettingGroup> runNotifierBuild(
|
||||
covariant PreferenceSettingsGroupRepository notifier,
|
||||
) {
|
||||
return notifier.build(
|
||||
partition,
|
||||
groupName,
|
||||
);
|
||||
return notifier.build(partition, groupName);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -630,9 +623,10 @@ class PreferenceSettingsGroupRepositoryProvider
|
||||
return ProviderOverride(
|
||||
origin: this,
|
||||
override: PreferenceSettingsGroupRepositoryProvider._internal(
|
||||
() => create()
|
||||
..partition = partition
|
||||
..groupName = groupName,
|
||||
() =>
|
||||
create()
|
||||
..partition = partition
|
||||
..groupName = groupName,
|
||||
from: from,
|
||||
name: null,
|
||||
dependencies: null,
|
||||
@@ -645,8 +639,11 @@ class PreferenceSettingsGroupRepositoryProvider
|
||||
}
|
||||
|
||||
@override
|
||||
AutoDisposeStreamNotifierProviderElement<PreferenceSettingsGroupRepository,
|
||||
PreferenceSettingGroup> createElement() {
|
||||
AutoDisposeStreamNotifierProviderElement<
|
||||
PreferenceSettingsGroupRepository,
|
||||
PreferenceSettingGroup
|
||||
>
|
||||
createElement() {
|
||||
return _PreferenceSettingsGroupRepositoryProviderElement(this);
|
||||
}
|
||||
|
||||
@@ -679,9 +676,12 @@ mixin PreferenceSettingsGroupRepositoryRef
|
||||
}
|
||||
|
||||
class _PreferenceSettingsGroupRepositoryProviderElement
|
||||
extends AutoDisposeStreamNotifierProviderElement<
|
||||
PreferenceSettingsGroupRepository,
|
||||
PreferenceSettingGroup> with PreferenceSettingsGroupRepositoryRef {
|
||||
extends
|
||||
AutoDisposeStreamNotifierProviderElement<
|
||||
PreferenceSettingsGroupRepository,
|
||||
PreferenceSettingGroup
|
||||
>
|
||||
with PreferenceSettingsGroupRepositoryRef {
|
||||
_PreferenceSettingsGroupRepositoryProviderElement(super.provider);
|
||||
|
||||
@override
|
||||
@@ -691,5 +691,6 @@ class _PreferenceSettingsGroupRepositoryProviderElement
|
||||
String get groupName =>
|
||||
(origin as PreferenceSettingsGroupRepositoryProvider).groupName;
|
||||
}
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
@@ -13,9 +13,10 @@ String _$readerableServiceHash() => r'03182c8afc41f5184322a3206473cbfa96df5819';
|
||||
final readerableServiceProvider = Provider<GeckoReaderableService>.internal(
|
||||
readerableService,
|
||||
name: r'readerableServiceProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$readerableServiceHash,
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$readerableServiceHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
@@ -30,14 +31,15 @@ String _$appearanceButtonVisibilityHash() =>
|
||||
@ProviderFor(appearanceButtonVisibility)
|
||||
final appearanceButtonVisibilityProvider =
|
||||
AutoDisposeStreamProvider<bool>.internal(
|
||||
appearanceButtonVisibility,
|
||||
name: r'appearanceButtonVisibilityProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$appearanceButtonVisibilityHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
appearanceButtonVisibility,
|
||||
name: r'appearanceButtonVisibilityProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$appearanceButtonVisibilityHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
|
||||
+9
-8
@@ -13,14 +13,15 @@ String _$readerableScreenControllerHash() =>
|
||||
@ProviderFor(ReaderableScreenController)
|
||||
final readerableScreenControllerProvider =
|
||||
AsyncNotifierProvider<ReaderableScreenController, void>.internal(
|
||||
ReaderableScreenController.new,
|
||||
name: r'readerableScreenControllerProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$readerableScreenControllerHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
ReaderableScreenController.new,
|
||||
name: r'readerableScreenControllerProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$readerableScreenControllerHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$ReaderableScreenController = AsyncNotifier<void>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
+3
-2
@@ -9,8 +9,9 @@ class ReaderAppearanceButton extends HookConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final buttonVisible = ref.watch(
|
||||
appearanceButtonVisibilityProvider
|
||||
.select((value) => value.valueOrNull ?? false),
|
||||
appearanceButtonVisibilityProvider.select(
|
||||
(value) => value.valueOrNull ?? false,
|
||||
),
|
||||
);
|
||||
|
||||
final readerabilityState = ref.watch(
|
||||
|
||||
+45
-43
@@ -16,8 +16,9 @@ class ReaderButton extends HookConsumerWidget {
|
||||
final readerChanging = ref.watch(readerableScreenControllerProvider);
|
||||
|
||||
final enableReadability = ref.watch(
|
||||
generalSettingsRepositoryProvider
|
||||
.select((value) => value.enableReadability),
|
||||
generalSettingsRepositoryProvider.select(
|
||||
(value) => value.enableReadability,
|
||||
),
|
||||
);
|
||||
|
||||
final readerabilityState = ref.watch(
|
||||
@@ -27,55 +28,56 @@ class ReaderButton extends HookConsumerWidget {
|
||||
);
|
||||
|
||||
final icon = useMemoized(
|
||||
() => readerabilityState.active
|
||||
? Icon(
|
||||
MdiIcons.bookOpen,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
)
|
||||
: const Icon(
|
||||
MdiIcons.bookOpenOutline,
|
||||
color: Colors.white,
|
||||
),
|
||||
() =>
|
||||
readerabilityState.active
|
||||
? Icon(
|
||||
MdiIcons.bookOpen,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
)
|
||||
: const Icon(MdiIcons.bookOpenOutline, color: Colors.white),
|
||||
[readerabilityState.active],
|
||||
);
|
||||
|
||||
return Visibility(
|
||||
visible: readerabilityState.readerable &&
|
||||
visible:
|
||||
readerabilityState.readerable &&
|
||||
(enableReadability || readerabilityState.active),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 15.0,
|
||||
horizontal: 8.0,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 8.0),
|
||||
child: readerChanging.when(
|
||||
data: (_) => Visibility(
|
||||
visible: readerabilityState.readerable,
|
||||
child: InkWell(
|
||||
onTap: readerChanging.isLoading
|
||||
? null
|
||||
: () async {
|
||||
await ref
|
||||
.read(readerableScreenControllerProvider.notifier)
|
||||
.toggleReaderView(!readerabilityState.active);
|
||||
},
|
||||
child: icon,
|
||||
),
|
||||
),
|
||||
data:
|
||||
(_) => Visibility(
|
||||
visible: readerabilityState.readerable,
|
||||
child: InkWell(
|
||||
onTap:
|
||||
readerChanging.isLoading
|
||||
? null
|
||||
: () async {
|
||||
await ref
|
||||
.read(
|
||||
readerableScreenControllerProvider.notifier,
|
||||
)
|
||||
.toggleReaderView(!readerabilityState.active);
|
||||
},
|
||||
child: icon,
|
||||
),
|
||||
),
|
||||
error: (error, stackTrace) => SizedBox.shrink(),
|
||||
loading: () => AnimateGradientShader(
|
||||
duration: const Duration(milliseconds: 500),
|
||||
primaryEnd: Alignment.bottomLeft,
|
||||
secondaryEnd: Alignment.topRight,
|
||||
primaryColors: [
|
||||
colorScheme.primary,
|
||||
colorScheme.primaryContainer,
|
||||
],
|
||||
secondaryColors: [
|
||||
colorScheme.secondary,
|
||||
colorScheme.secondaryContainer,
|
||||
],
|
||||
child: icon,
|
||||
),
|
||||
loading:
|
||||
() => AnimateGradientShader(
|
||||
duration: const Duration(milliseconds: 500),
|
||||
primaryEnd: Alignment.bottomLeft,
|
||||
secondaryEnd: Alignment.topRight,
|
||||
primaryColors: [
|
||||
colorScheme.primary,
|
||||
colorScheme.primaryContainer,
|
||||
],
|
||||
secondaryColors: [
|
||||
colorScheme.secondary,
|
||||
colorScheme.secondaryContainer,
|
||||
],
|
||||
child: icon,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -23,13 +23,13 @@ class TabPreview with FastEquatable {
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters => [
|
||||
id,
|
||||
title,
|
||||
icon,
|
||||
url,
|
||||
highlightedUrl,
|
||||
content,
|
||||
];
|
||||
id,
|
||||
title,
|
||||
icon,
|
||||
url,
|
||||
highlightedUrl,
|
||||
content,
|
||||
];
|
||||
|
||||
@override
|
||||
bool get cacheHash => true;
|
||||
|
||||
+13
-13
@@ -18,9 +18,7 @@ class EngineSuggestions extends _$EngineSuggestions {
|
||||
|
||||
Future<void> addQuery(
|
||||
String query, {
|
||||
List<GeckoSuggestionType> providers = const [
|
||||
GeckoSuggestionType.history,
|
||||
],
|
||||
List<GeckoSuggestionType> providers = const [GeckoSuggestionType.history],
|
||||
}) {
|
||||
return ref
|
||||
.read(engineSuggestionsServiceProvider)
|
||||
@@ -39,16 +37,18 @@ AsyncValue<List<GeckoSuggestion>> engineHistorySuggestions(Ref ref) {
|
||||
return ref.watch(
|
||||
engineSuggestionsProvider.select(
|
||||
(suggestions) => suggestions.whenData(
|
||||
(suggestions) => suggestions
|
||||
.where(
|
||||
(suggestion) =>
|
||||
suggestion.type == GeckoSuggestionType.history &&
|
||||
(suggestion.title?.isNotEmpty ?? false) &&
|
||||
(suggestion.description
|
||||
.mapNotNull((url) => Uri.tryParse(url)) !=
|
||||
null),
|
||||
)
|
||||
.toList(),
|
||||
(suggestions) =>
|
||||
suggestions
|
||||
.where(
|
||||
(suggestion) =>
|
||||
suggestion.type == GeckoSuggestionType.history &&
|
||||
(suggestion.title?.isNotEmpty ?? false) &&
|
||||
(suggestion.description.mapNotNull(
|
||||
(url) => Uri.tryParse(url),
|
||||
) !=
|
||||
null),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
+18
-14
@@ -13,30 +13,34 @@ String _$engineHistorySuggestionsHash() =>
|
||||
@ProviderFor(engineHistorySuggestions)
|
||||
final engineHistorySuggestionsProvider =
|
||||
AutoDisposeProvider<AsyncValue<List<GeckoSuggestion>>>.internal(
|
||||
engineHistorySuggestions,
|
||||
name: r'engineHistorySuggestionsProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$engineHistorySuggestionsHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
engineHistorySuggestions,
|
||||
name: r'engineHistorySuggestionsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$engineHistorySuggestionsHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
typedef EngineHistorySuggestionsRef
|
||||
= AutoDisposeProviderRef<AsyncValue<List<GeckoSuggestion>>>;
|
||||
typedef EngineHistorySuggestionsRef =
|
||||
AutoDisposeProviderRef<AsyncValue<List<GeckoSuggestion>>>;
|
||||
String _$engineSuggestionsHash() => r'ba2c2d7f0a5e99fd9e639acd020b8cf3016c6126';
|
||||
|
||||
/// See also [EngineSuggestions].
|
||||
@ProviderFor(EngineSuggestions)
|
||||
final engineSuggestionsProvider = AutoDisposeStreamNotifierProvider<
|
||||
EngineSuggestions, List<GeckoSuggestion>>.internal(
|
||||
EngineSuggestions,
|
||||
List<GeckoSuggestion>
|
||||
>.internal(
|
||||
EngineSuggestions.new,
|
||||
name: r'engineSuggestionsProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$engineSuggestionsHash,
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$engineSuggestionsHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@@ -18,18 +18,17 @@ class SearchSuggestions extends _$SearchSuggestions {
|
||||
void addQuery(String query) => _addQueryBinding(query);
|
||||
|
||||
@override
|
||||
Stream<List<String>> build({
|
||||
ISearchSuggestionProvider? suggestionsProvider,
|
||||
}) {
|
||||
Stream<List<String>> build({ISearchSuggestionProvider? suggestionsProvider}) {
|
||||
final defaultProvider = ref.watch(defaultSearchSuggestionsProvider);
|
||||
final resolvedProvider = suggestionsProvider ?? defaultProvider;
|
||||
|
||||
_addQueryBinding = ref
|
||||
.watch(searchSuggestionsRepositoryProvider(resolvedProvider).notifier)
|
||||
.addQuery;
|
||||
_addQueryBinding =
|
||||
ref
|
||||
.watch(
|
||||
searchSuggestionsRepositoryProvider(resolvedProvider).notifier,
|
||||
)
|
||||
.addQuery;
|
||||
|
||||
return ref.watch(
|
||||
searchSuggestionsRepositoryProvider(resolvedProvider),
|
||||
);
|
||||
return ref.watch(searchSuggestionsRepositoryProvider(resolvedProvider));
|
||||
}
|
||||
}
|
||||
+39
-43
@@ -13,14 +13,15 @@ String _$defaultSearchSuggestionsHash() =>
|
||||
@ProviderFor(defaultSearchSuggestions)
|
||||
final defaultSearchSuggestionsProvider =
|
||||
Provider<ISearchSuggestionProvider>.internal(
|
||||
defaultSearchSuggestions,
|
||||
name: r'defaultSearchSuggestionsProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$defaultSearchSuggestionsHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
defaultSearchSuggestions,
|
||||
name: r'defaultSearchSuggestionsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$defaultSearchSuggestionsHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
@@ -52,9 +53,7 @@ abstract class _$SearchSuggestions
|
||||
extends BuildlessAutoDisposeStreamNotifier<List<String>> {
|
||||
late final ISearchSuggestionProvider? suggestionsProvider;
|
||||
|
||||
Stream<List<String>> build({
|
||||
ISearchSuggestionProvider? suggestionsProvider,
|
||||
});
|
||||
Stream<List<String>> build({ISearchSuggestionProvider? suggestionsProvider});
|
||||
}
|
||||
|
||||
/// See also [SearchSuggestions].
|
||||
@@ -70,18 +69,14 @@ class SearchSuggestionsFamily extends Family<AsyncValue<List<String>>> {
|
||||
SearchSuggestionsProvider call({
|
||||
ISearchSuggestionProvider? suggestionsProvider,
|
||||
}) {
|
||||
return SearchSuggestionsProvider(
|
||||
suggestionsProvider: suggestionsProvider,
|
||||
);
|
||||
return SearchSuggestionsProvider(suggestionsProvider: suggestionsProvider);
|
||||
}
|
||||
|
||||
@override
|
||||
SearchSuggestionsProvider getProviderOverride(
|
||||
covariant SearchSuggestionsProvider provider,
|
||||
) {
|
||||
return call(
|
||||
suggestionsProvider: provider.suggestionsProvider,
|
||||
);
|
||||
return call(suggestionsProvider: provider.suggestionsProvider);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -100,24 +95,24 @@ class SearchSuggestionsFamily extends Family<AsyncValue<List<String>>> {
|
||||
}
|
||||
|
||||
/// See also [SearchSuggestions].
|
||||
class SearchSuggestionsProvider extends AutoDisposeStreamNotifierProviderImpl<
|
||||
SearchSuggestions, List<String>> {
|
||||
class SearchSuggestionsProvider
|
||||
extends
|
||||
AutoDisposeStreamNotifierProviderImpl<SearchSuggestions, List<String>> {
|
||||
/// See also [SearchSuggestions].
|
||||
SearchSuggestionsProvider({
|
||||
ISearchSuggestionProvider? suggestionsProvider,
|
||||
}) : this._internal(
|
||||
() => SearchSuggestions()..suggestionsProvider = suggestionsProvider,
|
||||
from: searchSuggestionsProvider,
|
||||
name: r'searchSuggestionsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$searchSuggestionsHash,
|
||||
dependencies: SearchSuggestionsFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
SearchSuggestionsFamily._allTransitiveDependencies,
|
||||
suggestionsProvider: suggestionsProvider,
|
||||
);
|
||||
SearchSuggestionsProvider({ISearchSuggestionProvider? suggestionsProvider})
|
||||
: this._internal(
|
||||
() => SearchSuggestions()..suggestionsProvider = suggestionsProvider,
|
||||
from: searchSuggestionsProvider,
|
||||
name: r'searchSuggestionsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$searchSuggestionsHash,
|
||||
dependencies: SearchSuggestionsFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
SearchSuggestionsFamily._allTransitiveDependencies,
|
||||
suggestionsProvider: suggestionsProvider,
|
||||
);
|
||||
|
||||
SearchSuggestionsProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -132,12 +127,8 @@ class SearchSuggestionsProvider extends AutoDisposeStreamNotifierProviderImpl<
|
||||
final ISearchSuggestionProvider? suggestionsProvider;
|
||||
|
||||
@override
|
||||
Stream<List<String>> runNotifierBuild(
|
||||
covariant SearchSuggestions notifier,
|
||||
) {
|
||||
return notifier.build(
|
||||
suggestionsProvider: suggestionsProvider,
|
||||
);
|
||||
Stream<List<String>> runNotifierBuild(covariant SearchSuggestions notifier) {
|
||||
return notifier.build(suggestionsProvider: suggestionsProvider);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -158,7 +149,7 @@ class SearchSuggestionsProvider extends AutoDisposeStreamNotifierProviderImpl<
|
||||
|
||||
@override
|
||||
AutoDisposeStreamNotifierProviderElement<SearchSuggestions, List<String>>
|
||||
createElement() {
|
||||
createElement() {
|
||||
return _SearchSuggestionsProviderElement(this);
|
||||
}
|
||||
|
||||
@@ -186,13 +177,18 @@ mixin SearchSuggestionsRef
|
||||
}
|
||||
|
||||
class _SearchSuggestionsProviderElement
|
||||
extends AutoDisposeStreamNotifierProviderElement<SearchSuggestions,
|
||||
List<String>> with SearchSuggestionsRef {
|
||||
extends
|
||||
AutoDisposeStreamNotifierProviderElement<
|
||||
SearchSuggestions,
|
||||
List<String>
|
||||
>
|
||||
with SearchSuggestionsRef {
|
||||
_SearchSuggestionsProviderElement(super.provider);
|
||||
|
||||
@override
|
||||
ISearchSuggestionProvider? get suggestionsProvider =>
|
||||
(origin as SearchSuggestionsProvider).suggestionsProvider;
|
||||
}
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
@@ -23,8 +23,9 @@ class SearchScreen extends HookConsumerWidget {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final formKey = useMemoized(() => GlobalKey<FormState>());
|
||||
|
||||
final searchTextController =
|
||||
useTextEditingController(text: initialSearchText);
|
||||
final searchTextController = useTextEditingController(
|
||||
text: initialSearchText,
|
||||
);
|
||||
final searchFocusNode = useFocusNode();
|
||||
|
||||
final defaultSearchBang = ref.watch(
|
||||
@@ -35,16 +36,13 @@ class SearchScreen extends HookConsumerWidget {
|
||||
final activeBang = selectedBang.value ?? defaultSearchBang;
|
||||
final showBangIcon = useState(false);
|
||||
|
||||
ref.listen(
|
||||
selectedBangDataProvider(),
|
||||
(previous, next) {
|
||||
if (previous != next) {
|
||||
showBangIcon.value = true;
|
||||
}
|
||||
ref.listen(selectedBangDataProvider(), (previous, next) {
|
||||
if (previous != next) {
|
||||
showBangIcon.value = true;
|
||||
}
|
||||
|
||||
selectedBang.value = next;
|
||||
},
|
||||
);
|
||||
selectedBang.value = next;
|
||||
});
|
||||
|
||||
Future<void> submitSearch(String query) async {
|
||||
if (activeBang != null && (formKey.currentState?.validate() == true)) {
|
||||
@@ -78,12 +76,14 @@ class SearchScreen extends HookConsumerWidget {
|
||||
autofocus: true,
|
||||
onSubmitted: (value) async {
|
||||
if (value.isNotEmpty) {
|
||||
var newUrl =
|
||||
uri_parser.tryParseUrl(value, eagerParsing: true);
|
||||
var newUrl = uri_parser.tryParseUrl(
|
||||
value,
|
||||
eagerParsing: true,
|
||||
);
|
||||
|
||||
if (newUrl == null) {
|
||||
final defaultSearchBang = ref
|
||||
.read(selectedBangDataProvider()) ??
|
||||
final defaultSearchBang =
|
||||
ref.read(selectedBangDataProvider()) ??
|
||||
await ref.read(defaultSearchBangDataProvider.future);
|
||||
|
||||
newUrl = defaultSearchBang?.getUrl(value);
|
||||
@@ -108,23 +108,15 @@ class SearchScreen extends HookConsumerWidget {
|
||||
showSuggestions: true,
|
||||
),
|
||||
),
|
||||
const SliverToBoxAdapter(
|
||||
child: Divider(),
|
||||
),
|
||||
const SliverToBoxAdapter(child: Divider()),
|
||||
SearchTermSuggestions(
|
||||
searchTextController: searchTextController,
|
||||
activeBang: activeBang,
|
||||
submitSearch: submitSearch,
|
||||
),
|
||||
const SliverToBoxAdapter(
|
||||
child: Divider(),
|
||||
),
|
||||
TabSearch(
|
||||
searchTextController: searchTextController,
|
||||
),
|
||||
HistorySuggestions(
|
||||
searchTextController: searchTextController,
|
||||
),
|
||||
const SliverToBoxAdapter(child: Divider()),
|
||||
TabSearch(searchTextController: searchTextController),
|
||||
HistorySuggestions(searchTextController: searchTextController),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -31,24 +31,21 @@ class BangChips extends HookConsumerWidget {
|
||||
) {
|
||||
return showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text(
|
||||
'Reset usage frequency of $triggerName?',
|
||||
),
|
||||
content: const Text(
|
||||
'This will remove the Bang from quick select.',
|
||||
),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, false),
|
||||
child: const Text('Cancel'),
|
||||
builder:
|
||||
(context) => AlertDialog(
|
||||
title: Text('Reset usage frequency of $triggerName?'),
|
||||
content: const Text('This will remove the Bang from quick select.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, false),
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, true),
|
||||
child: const Text('Reset'),
|
||||
),
|
||||
],
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, true),
|
||||
child: const Text('Reset'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -56,14 +53,11 @@ class BangChips extends HookConsumerWidget {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final availableBangs = ref.watch(seamlessBangProviderProvider);
|
||||
|
||||
useListenableCallback(
|
||||
searchTextController,
|
||||
() {
|
||||
ref
|
||||
.read(seamlessBangProviderProvider.notifier)
|
||||
.search(searchTextController!.text);
|
||||
},
|
||||
);
|
||||
useListenableCallback(searchTextController, () {
|
||||
ref
|
||||
.read(seamlessBangProviderProvider.notifier)
|
||||
.search(searchTextController!.text);
|
||||
});
|
||||
|
||||
return availableBangs.when(
|
||||
data: (availableBangs) {
|
||||
@@ -75,8 +69,8 @@ class BangChips extends HookConsumerWidget {
|
||||
Expanded(
|
||||
child: SelectableChips(
|
||||
itemId: (bang) => bang.trigger,
|
||||
itemAvatar: (bang) =>
|
||||
UrlIcon(bang.getUrl(''), iconSize: 20),
|
||||
itemAvatar:
|
||||
(bang) => UrlIcon(bang.getUrl(''), iconSize: 20),
|
||||
itemLabel: (bang) => Text(bang.websiteName),
|
||||
availableItems: availableBangs,
|
||||
selectedItem: activeBang,
|
||||
@@ -104,9 +98,10 @@ class BangChips extends HookConsumerWidget {
|
||||
|
||||
await context.push(
|
||||
BangSearchRoute(
|
||||
searchText: (searchText?.isEmpty ?? true)
|
||||
? BangSearchRoute.emptySearchText
|
||||
: searchText!,
|
||||
searchText:
|
||||
(searchText?.isEmpty ?? true)
|
||||
? BangSearchRoute.emptySearchText
|
||||
: searchText!,
|
||||
).location,
|
||||
);
|
||||
},
|
||||
@@ -117,10 +112,7 @@ class BangChips extends HookConsumerWidget {
|
||||
);
|
||||
},
|
||||
error: (error, stackTrace) => const SizedBox.shrink(),
|
||||
loading: () => const SizedBox(
|
||||
height: 48,
|
||||
width: double.infinity,
|
||||
),
|
||||
loading: () => const SizedBox(height: 48, width: double.infinity),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -44,18 +44,15 @@ class SearchField extends HookConsumerWidget {
|
||||
final suggestion = useState<String?>(null);
|
||||
|
||||
if (showSuggestions) {
|
||||
useListenableCallback(
|
||||
textEditingController,
|
||||
() async {
|
||||
if (textEditingController.text.isNotEmpty) {
|
||||
final result = await ref
|
||||
.read(engineSuggestionsProvider.notifier)
|
||||
.getAutocompleteSuggestion(textEditingController.text);
|
||||
useListenableCallback(textEditingController, () async {
|
||||
if (textEditingController.text.isNotEmpty) {
|
||||
final result = await ref
|
||||
.read(engineSuggestionsProvider.notifier)
|
||||
.getAutocompleteSuggestion(textEditingController.text);
|
||||
|
||||
suggestion.value = result;
|
||||
}
|
||||
},
|
||||
);
|
||||
suggestion.value = result;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return AutoSuggestTextField(
|
||||
@@ -66,33 +63,36 @@ class SearchField extends HookConsumerWidget {
|
||||
autofocus: autofocus,
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
prefixIcon: (showBangIcon && activeBang != null)
|
||||
? Padding(
|
||||
padding: const EdgeInsetsDirectional.all(12.0),
|
||||
child: UrlIcon(activeBang!.getUrl(''), iconSize: 24.0),
|
||||
)
|
||||
: null,
|
||||
prefixIcon:
|
||||
(showBangIcon && activeBang != null)
|
||||
? Padding(
|
||||
padding: const EdgeInsetsDirectional.all(12.0),
|
||||
child: UrlIcon(activeBang!.getUrl(''), iconSize: 24.0),
|
||||
)
|
||||
: null,
|
||||
label: label ?? const Text('Search'),
|
||||
// hintText: 'Ask anything...',
|
||||
floatingLabelBehavior: FloatingLabelBehavior.always,
|
||||
suffixIcon: hasText
|
||||
? IconButton(
|
||||
onPressed: () {
|
||||
textEditingController.clear();
|
||||
},
|
||||
icon: const Icon(Icons.clear),
|
||||
)
|
||||
: SpeechToTextButton(
|
||||
onTextReceived: (data) {
|
||||
textEditingController.text = data.toString();
|
||||
},
|
||||
),
|
||||
suffixIcon:
|
||||
hasText
|
||||
? IconButton(
|
||||
onPressed: () {
|
||||
textEditingController.clear();
|
||||
},
|
||||
icon: const Icon(Icons.clear),
|
||||
)
|
||||
: SpeechToTextButton(
|
||||
onTextReceived: (data) {
|
||||
textEditingController.text = data.toString();
|
||||
},
|
||||
),
|
||||
),
|
||||
onTapOutside: (focusNode != null)
|
||||
? (event) {
|
||||
focusNode!.unfocus();
|
||||
}
|
||||
: null,
|
||||
onTapOutside:
|
||||
(focusNode != null)
|
||||
? (event) {
|
||||
focusNode!.unfocus();
|
||||
}
|
||||
: null,
|
||||
onSubmitted: onSubmitted,
|
||||
);
|
||||
}
|
||||
|
||||
+16
-21
@@ -22,14 +22,11 @@ class HistorySuggestions extends HookConsumerWidget {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final historySuggestions = ref.watch(engineHistorySuggestionsProvider);
|
||||
|
||||
useListenableCallback(
|
||||
searchTextController,
|
||||
() async {
|
||||
await ref
|
||||
.watch(engineSuggestionsProvider.notifier)
|
||||
.addQuery(searchTextController.text);
|
||||
},
|
||||
);
|
||||
useListenableCallback(searchTextController, () async {
|
||||
await ref
|
||||
.watch(engineSuggestionsProvider.notifier)
|
||||
.addQuery(searchTextController.text);
|
||||
});
|
||||
|
||||
if (historySuggestions.hasValue &&
|
||||
(historySuggestions.valueOrNull?.isEmpty ?? true)) {
|
||||
@@ -38,9 +35,7 @@ class HistorySuggestions extends HookConsumerWidget {
|
||||
|
||||
return MultiSliver(
|
||||
children: [
|
||||
const SliverToBoxAdapter(
|
||||
child: Divider(),
|
||||
),
|
||||
const SliverToBoxAdapter(child: Divider()),
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 16.0),
|
||||
@@ -76,8 +71,9 @@ class HistorySuggestions extends HookConsumerWidget {
|
||||
width: 24,
|
||||
),
|
||||
),
|
||||
title:
|
||||
suggestion.title.mapNotNull((title) => Text(title)),
|
||||
title: suggestion.title.mapNotNull(
|
||||
(title) => Text(title),
|
||||
),
|
||||
subtitle: suggestion.description.mapNotNull(
|
||||
(description) => Text(
|
||||
description,
|
||||
@@ -117,14 +113,13 @@ class HistorySuggestions extends HookConsumerWidget {
|
||||
exception: error,
|
||||
);
|
||||
},
|
||||
loading: () => SliverList.builder(
|
||||
itemCount: historySuggestions.valueOrNull?.length ?? 3,
|
||||
itemBuilder: (context, index) {
|
||||
return const ListTile(
|
||||
title: Bone.text(),
|
||||
);
|
||||
},
|
||||
),
|
||||
loading:
|
||||
() => SliverList.builder(
|
||||
itemCount: historySuggestions.valueOrNull?.length ?? 3,
|
||||
itemBuilder: (context, index) {
|
||||
return const ListTile(title: Bone.text());
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
+7
-14
@@ -40,14 +40,11 @@ class SearchTermSuggestions extends HookConsumerWidget {
|
||||
|
||||
final searchHistory = ref.watch(searchHistoryProvider);
|
||||
|
||||
useListenableCallback(
|
||||
searchTextController,
|
||||
() async {
|
||||
ref
|
||||
.read(searchSuggestionsProvider().notifier)
|
||||
.addQuery(searchTextController.text);
|
||||
},
|
||||
);
|
||||
useListenableCallback(searchTextController, () async {
|
||||
ref
|
||||
.read(searchSuggestionsProvider().notifier)
|
||||
.addQuery(searchTextController.text);
|
||||
});
|
||||
|
||||
final Widget listSliver;
|
||||
|
||||
@@ -135,9 +132,7 @@ class SearchTermSuggestions extends HookConsumerWidget {
|
||||
if (ref.read(selectedBangTriggerProvider()) ==
|
||||
bang.trigger) {
|
||||
ref
|
||||
.read(
|
||||
selectedBangTriggerProvider().notifier,
|
||||
)
|
||||
.read(selectedBangTriggerProvider().notifier)
|
||||
.clearTrigger();
|
||||
} else {
|
||||
final dialogResult = await BangChips.resetBangDialog(
|
||||
@@ -167,9 +162,7 @@ class SearchTermSuggestions extends HookConsumerWidget {
|
||||
return CustomScrollView(
|
||||
shrinkWrap: true,
|
||||
controller: controller,
|
||||
slivers: [
|
||||
listSliver,
|
||||
],
|
||||
slivers: [listSliver],
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
+58
-62
@@ -32,33 +32,31 @@ class TabSearch extends HookConsumerWidget {
|
||||
),
|
||||
);
|
||||
|
||||
final tabs = ref
|
||||
.watch(
|
||||
seamlessFilteredTabPreviewsProvider(
|
||||
TabSearchPartition.search,
|
||||
(selectedContainer.value != null)
|
||||
? ContainerFilterById(containerId: selectedContainer.value!.id)
|
||||
: ContainerFilterDisabled(),
|
||||
),
|
||||
)
|
||||
.collection;
|
||||
|
||||
useListenableCallback(
|
||||
searchTextController,
|
||||
() async {
|
||||
await ref
|
||||
.read(
|
||||
tabSearchRepositoryProvider(TabSearchPartition.search).notifier,
|
||||
final tabs =
|
||||
ref
|
||||
.watch(
|
||||
seamlessFilteredTabPreviewsProvider(
|
||||
TabSearchPartition.search,
|
||||
(selectedContainer.value != null)
|
||||
? ContainerFilterById(
|
||||
containerId: selectedContainer.value!.id,
|
||||
)
|
||||
: ContainerFilterDisabled(),
|
||||
),
|
||||
)
|
||||
.addQuery(
|
||||
searchTextController.text,
|
||||
// ignore: avoid_redundant_argument_values
|
||||
matchPrefix: _matchPrefix,
|
||||
// ignore: avoid_redundant_argument_values
|
||||
matchSuffix: _matchSuffix,
|
||||
);
|
||||
},
|
||||
);
|
||||
.collection;
|
||||
|
||||
useListenableCallback(searchTextController, () async {
|
||||
await ref
|
||||
.read(tabSearchRepositoryProvider(TabSearchPartition.search).notifier)
|
||||
.addQuery(
|
||||
searchTextController.text,
|
||||
// ignore: avoid_redundant_argument_values
|
||||
matchPrefix: _matchPrefix,
|
||||
// ignore: avoid_redundant_argument_values
|
||||
matchSuffix: _matchSuffix,
|
||||
);
|
||||
});
|
||||
|
||||
return MultiSliver(
|
||||
children: [
|
||||
@@ -68,10 +66,7 @@ class TabSearch extends HookConsumerWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Tabs',
|
||||
style: Theme.of(context).textTheme.labelSmall,
|
||||
),
|
||||
Text('Tabs', style: Theme.of(context).textTheme.labelSmall),
|
||||
ContainerChips(
|
||||
displayMenu: false,
|
||||
selectedContainer: selectedContainer.value,
|
||||
@@ -100,48 +95,49 @@ class TabSearch extends HookConsumerWidget {
|
||||
|
||||
return ListTile(
|
||||
leading: RepaintBoundary(
|
||||
child: (result.icon != null)
|
||||
? RawImage(
|
||||
image: result.icon?.value,
|
||||
height: 24,
|
||||
width: 24,
|
||||
)
|
||||
: UrlIcon(result.url, iconSize: 24),
|
||||
child:
|
||||
(result.icon != null)
|
||||
? RawImage(
|
||||
image: result.icon?.value,
|
||||
height: 24,
|
||||
width: 24,
|
||||
)
|
||||
: UrlIcon(result.url, iconSize: 24),
|
||||
),
|
||||
title: result.title.mapNotNull(
|
||||
(title) => MarkdownBody(
|
||||
data: title,
|
||||
styleSheet: MarkdownStyleSheet(
|
||||
p: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
subtitle: (bodyHasMatch || urlHasMatch)
|
||||
? MarkdownBody(
|
||||
data: bodyHasMatch
|
||||
? result.content!
|
||||
: result.highlightedUrl!,
|
||||
styleSheet: MarkdownStyleSheet(
|
||||
p: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSurfaceVariant,
|
||||
),
|
||||
a: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSurfaceVariant,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
subtitle:
|
||||
(bodyHasMatch || urlHasMatch)
|
||||
? MarkdownBody(
|
||||
data:
|
||||
bodyHasMatch
|
||||
? result.content!
|
||||
: result.highlightedUrl!,
|
||||
styleSheet: MarkdownStyleSheet(
|
||||
p: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color:
|
||||
Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
a: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color:
|
||||
Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
result.url.toString(),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
result.url.toString(),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
onTap: () async {
|
||||
await ref
|
||||
.read(tabRepositoryProvider.notifier)
|
||||
|
||||
@@ -42,12 +42,14 @@ class ContainerDao extends DatabaseAccessor<TabDatabase>
|
||||
}
|
||||
|
||||
Selectable<Color> getDistinctColors() {
|
||||
final query = db.selectOnly(db.container, distinct: true)
|
||||
..addColumns([db.container.color])
|
||||
..where(db.container.color.isNotNull());
|
||||
final query =
|
||||
db.selectOnly(db.container, distinct: true)
|
||||
..addColumns([db.container.color])
|
||||
..where(db.container.color.isNotNull());
|
||||
|
||||
return query
|
||||
.map((row) => row.readWithConverter<Color?, int>(db.container.color)!);
|
||||
return query.map(
|
||||
(row) => row.readWithConverter<Color?, int>(db.container.color)!,
|
||||
);
|
||||
}
|
||||
|
||||
SingleSelectable<String> generateLeadingOrderKey(
|
||||
|
||||
@@ -21,30 +21,33 @@ class TabDao extends DatabaseAccessor<TabDatabase> with _$TabDaoMixin {
|
||||
db.tab.select()..where((t) => t.id.equals(id));
|
||||
|
||||
Selectable<String> containerTabIds(String? containerId) {
|
||||
final query = selectOnly(db.tab)
|
||||
..addColumns([db.tab.id])
|
||||
..where(
|
||||
(containerId != null)
|
||||
? db.tab.containerId.equals(containerId)
|
||||
: db.tab.containerId.isNull(),
|
||||
)
|
||||
..orderBy([OrderingTerm.asc(db.tab.orderKey)]);
|
||||
final query =
|
||||
selectOnly(db.tab)
|
||||
..addColumns([db.tab.id])
|
||||
..where(
|
||||
(containerId != null)
|
||||
? db.tab.containerId.equals(containerId)
|
||||
: db.tab.containerId.isNull(),
|
||||
)
|
||||
..orderBy([OrderingTerm.asc(db.tab.orderKey)]);
|
||||
|
||||
return query.map((row) => row.read(db.tab.id)!);
|
||||
}
|
||||
|
||||
Selectable<String> allTabIds() {
|
||||
final query = selectOnly(db.tab)
|
||||
..addColumns([db.tab.id])
|
||||
..orderBy([OrderingTerm.asc(db.tab.orderKey)]);
|
||||
final query =
|
||||
selectOnly(db.tab)
|
||||
..addColumns([db.tab.id])
|
||||
..orderBy([OrderingTerm.asc(db.tab.orderKey)]);
|
||||
|
||||
return query.map((row) => row.read(db.tab.id)!);
|
||||
}
|
||||
|
||||
SingleOrNullSelectable<String?> tabContainerId(String tabId) {
|
||||
final query = selectOnly(db.tab)
|
||||
..addColumns([db.tab.containerId])
|
||||
..where(db.tab.id.equals(tabId));
|
||||
final query =
|
||||
selectOnly(db.tab)
|
||||
..addColumns([db.tab.containerId])
|
||||
..where(db.tab.id.equals(tabId));
|
||||
|
||||
return query.map((row) => row.read(db.tab.containerId));
|
||||
}
|
||||
@@ -57,7 +60,8 @@ class TabDao extends DatabaseAccessor<TabDatabase> with _$TabDaoMixin {
|
||||
return db.transaction(() async {
|
||||
final tabId = await createTab();
|
||||
|
||||
final currentOrderKey = orderKey.value ??
|
||||
final currentOrderKey =
|
||||
orderKey.value ??
|
||||
await db.containerDao
|
||||
.generateLeadingOrderKey(containerId.value)
|
||||
.getSingle();
|
||||
@@ -89,7 +93,8 @@ class TabDao extends DatabaseAccessor<TabDatabase> with _$TabDaoMixin {
|
||||
Value<String?> orderKey = const Value.absent(),
|
||||
}) {
|
||||
return db.transaction(() async {
|
||||
final currentOrderKey = orderKey.value ??
|
||||
final currentOrderKey =
|
||||
orderKey.value ??
|
||||
await db.containerDao
|
||||
.generateLeadingOrderKey(containerId.value)
|
||||
.getSingle();
|
||||
@@ -115,34 +120,19 @@ class TabDao extends DatabaseAccessor<TabDatabase> with _$TabDaoMixin {
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> assignContainer(
|
||||
String id, {
|
||||
required String? containerId,
|
||||
}) {
|
||||
Future<void> assignContainer(String id, {required String? containerId}) {
|
||||
final statement = _updateByIdStatement(id);
|
||||
return statement.write(
|
||||
TabCompanion(containerId: Value(containerId)),
|
||||
);
|
||||
return statement.write(TabCompanion(containerId: Value(containerId)));
|
||||
}
|
||||
|
||||
Future<void> assignOrderKey(
|
||||
String id, {
|
||||
required String orderKey,
|
||||
}) {
|
||||
Future<void> assignOrderKey(String id, {required String orderKey}) {
|
||||
final statement = _updateByIdStatement(id);
|
||||
return statement.write(
|
||||
TabCompanion(orderKey: Value(orderKey)),
|
||||
);
|
||||
return statement.write(TabCompanion(orderKey: Value(orderKey)));
|
||||
}
|
||||
|
||||
Future<void> touchTab(
|
||||
String id, {
|
||||
required DateTime timestamp,
|
||||
}) {
|
||||
Future<void> touchTab(String id, {required DateTime timestamp}) {
|
||||
final statement = _updateByIdStatement(id);
|
||||
return statement.write(
|
||||
TabCompanion(timestamp: Value(timestamp)),
|
||||
);
|
||||
return statement.write(TabCompanion(timestamp: Value(timestamp)));
|
||||
}
|
||||
|
||||
Future<void> updateTabContent(
|
||||
@@ -180,12 +170,14 @@ class TabDao extends DatabaseAccessor<TabDatabase> with _$TabDaoMixin {
|
||||
batch.update(
|
||||
db.tab,
|
||||
TabCompanion(
|
||||
url: (previousState?.url != state.url)
|
||||
? Value(state.url.toString())
|
||||
: const Value.absent(),
|
||||
title: (previousState?.title != state.title)
|
||||
? Value(state.title)
|
||||
: const Value.absent(),
|
||||
url:
|
||||
(previousState?.url != state.url)
|
||||
? Value(state.url.toString())
|
||||
: const Value.absent(),
|
||||
title:
|
||||
(previousState?.title != state.title)
|
||||
? Value(state.title)
|
||||
: const Value.absent(),
|
||||
),
|
||||
where: (t) => t.id.equals(state.id),
|
||||
);
|
||||
@@ -202,19 +194,17 @@ class TabDao extends DatabaseAccessor<TabDatabase> with _$TabDaoMixin {
|
||||
await db.containerDao.generateLeadingOrderKey(null).getSingle();
|
||||
|
||||
await db.tab.insertAll(
|
||||
retainTabIds.map(
|
||||
(id) {
|
||||
final insertable = TabCompanion.insert(
|
||||
id: id,
|
||||
orderKey: currentOrderKey,
|
||||
timestamp: DateTime.now(),
|
||||
);
|
||||
retainTabIds.map((id) {
|
||||
final insertable = TabCompanion.insert(
|
||||
id: id,
|
||||
orderKey: currentOrderKey,
|
||||
timestamp: DateTime.now(),
|
||||
);
|
||||
|
||||
currentOrderKey = LexoRank.parse(currentOrderKey).genPrev().value;
|
||||
currentOrderKey = LexoRank.parse(currentOrderKey).genPrev().value;
|
||||
|
||||
return insertable;
|
||||
},
|
||||
),
|
||||
return insertable;
|
||||
}),
|
||||
mode: InsertMode.insertOrIgnore,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -30,23 +30,23 @@ class TabDatabase extends _$TabDatabase with TrigramQueryBuilderMixin {
|
||||
|
||||
@override
|
||||
MigrationStrategy get migration => MigrationStrategy(
|
||||
onCreate: (m) async {
|
||||
final migrator =
|
||||
VectorDatabaseMigrator(dimensions: embeddingDimensions);
|
||||
onCreate: (m) async {
|
||||
final migrator = VectorDatabaseMigrator(dimensions: embeddingDimensions);
|
||||
|
||||
await m.database.customStatement(migrator.vectorTableDefinition);
|
||||
await m.database.customStatement(migrator.vectorTableDefinition);
|
||||
|
||||
//instead of m.createAll(); we igoner vec0 table
|
||||
for (final entity
|
||||
in allSchemaEntities.where((entity) => entity is! DocumentVec)) {
|
||||
await m.create(entity);
|
||||
}
|
||||
},
|
||||
beforeOpen: (details) async {
|
||||
await customStatement('PRAGMA foreign_keys = ON;');
|
||||
await optimizeFtsIndex();
|
||||
},
|
||||
);
|
||||
//instead of m.createAll(); we igoner vec0 table
|
||||
for (final entity in allSchemaEntities.where(
|
||||
(entity) => entity is! DocumentVec,
|
||||
)) {
|
||||
await m.create(entity);
|
||||
}
|
||||
},
|
||||
beforeOpen: (details) async {
|
||||
await customStatement('PRAGMA foreign_keys = ON;');
|
||||
await optimizeFtsIndex();
|
||||
},
|
||||
);
|
||||
|
||||
TabDatabase(super.e, {required this.embeddingDimensions});
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -24,10 +24,10 @@ class ContainerAuthSettings with FastEquatable {
|
||||
bool? lockOnAppBackground,
|
||||
Duration? lockTimeout,
|
||||
}) : this(
|
||||
authenticationRequired: authenticationRequired ?? false,
|
||||
lockOnAppBackground: lockOnAppBackground ?? false,
|
||||
lockTimeout: lockTimeout,
|
||||
);
|
||||
authenticationRequired: authenticationRequired ?? false,
|
||||
lockOnAppBackground: lockOnAppBackground ?? false,
|
||||
lockTimeout: lockTimeout,
|
||||
);
|
||||
|
||||
factory ContainerAuthSettings.fromJson(Map<String, dynamic> json) =>
|
||||
_$ContainerAuthSettingsFromJson(json);
|
||||
@@ -36,10 +36,10 @@ class ContainerAuthSettings with FastEquatable {
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters => [
|
||||
authenticationRequired,
|
||||
lockOnAppBackground,
|
||||
lockTimeout,
|
||||
];
|
||||
authenticationRequired,
|
||||
lockOnAppBackground,
|
||||
lockTimeout,
|
||||
];
|
||||
|
||||
@override
|
||||
bool get cacheHash => true;
|
||||
@@ -69,11 +69,11 @@ class ContainerMetadata with FastEquatable {
|
||||
ContainerAuthSettings? authSettings,
|
||||
bool? useProxy,
|
||||
}) : this(
|
||||
iconData: iconData,
|
||||
contextualIdentity: contextualIdentity,
|
||||
authSettings: authSettings ?? ContainerAuthSettings.withDefaults(),
|
||||
useProxy: useProxy ?? false,
|
||||
);
|
||||
iconData: iconData,
|
||||
contextualIdentity: contextualIdentity,
|
||||
authSettings: authSettings ?? ContainerAuthSettings.withDefaults(),
|
||||
useProxy: useProxy ?? false,
|
||||
);
|
||||
|
||||
factory ContainerMetadata.fromJson(Map<String, dynamic> json) =>
|
||||
_$ContainerMetadataFromJson(json);
|
||||
@@ -82,11 +82,11 @@ class ContainerMetadata with FastEquatable {
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters => [
|
||||
iconData,
|
||||
contextualIdentity,
|
||||
authSettings,
|
||||
useProxy,
|
||||
];
|
||||
iconData,
|
||||
contextualIdentity,
|
||||
authSettings,
|
||||
useProxy,
|
||||
];
|
||||
|
||||
@override
|
||||
bool get cacheHash => true;
|
||||
@@ -110,12 +110,7 @@ class ContainerData with FastEquatable {
|
||||
bool get cacheHash => true;
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters => [
|
||||
id,
|
||||
name,
|
||||
color,
|
||||
metadata,
|
||||
];
|
||||
List<Object?> get hashParameters => [id, name, color, metadata];
|
||||
}
|
||||
|
||||
class ContainerDataWithCount extends ContainerData {
|
||||
@@ -133,8 +128,5 @@ class ContainerDataWithCount extends ContainerData {
|
||||
bool get cacheHash => true;
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters => [
|
||||
...super.hashParameters,
|
||||
tabCount,
|
||||
];
|
||||
List<Object?> get hashParameters => [...super.hashParameters, tabCount];
|
||||
}
|
||||
@@ -46,7 +46,6 @@ class _$ContainerAuthSettingsCWProxyImpl
|
||||
this(lockTimeout: lockTimeout);
|
||||
|
||||
@override
|
||||
|
||||
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `ContainerAuthSettings(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
|
||||
///
|
||||
/// Usage
|
||||
@@ -64,14 +63,16 @@ class _$ContainerAuthSettingsCWProxyImpl
|
||||
? _value.authenticationRequired
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: authenticationRequired as bool,
|
||||
lockOnAppBackground: lockOnAppBackground == const $CopyWithPlaceholder()
|
||||
? _value.lockOnAppBackground
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: lockOnAppBackground as bool,
|
||||
lockTimeout: lockTimeout == const $CopyWithPlaceholder()
|
||||
? _value.lockTimeout
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: lockTimeout as Duration?,
|
||||
lockOnAppBackground:
|
||||
lockOnAppBackground == const $CopyWithPlaceholder()
|
||||
? _value.lockOnAppBackground
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: lockOnAppBackground as bool,
|
||||
lockTimeout:
|
||||
lockTimeout == const $CopyWithPlaceholder()
|
||||
? _value.lockTimeout
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: lockTimeout as Duration?,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -127,7 +128,6 @@ class _$ContainerMetadataCWProxyImpl implements _$ContainerMetadataCWProxy {
|
||||
ContainerMetadata useProxy(bool useProxy) => this(useProxy: useProxy);
|
||||
|
||||
@override
|
||||
|
||||
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `ContainerMetadata(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
|
||||
///
|
||||
/// Usage
|
||||
@@ -141,22 +141,26 @@ class _$ContainerMetadataCWProxyImpl implements _$ContainerMetadataCWProxy {
|
||||
Object? useProxy = const $CopyWithPlaceholder(),
|
||||
}) {
|
||||
return ContainerMetadata(
|
||||
iconData: iconData == const $CopyWithPlaceholder()
|
||||
? _value.iconData
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: iconData as IconData?,
|
||||
contextualIdentity: contextualIdentity == const $CopyWithPlaceholder()
|
||||
? _value.contextualIdentity
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: contextualIdentity as String?,
|
||||
authSettings: authSettings == const $CopyWithPlaceholder()
|
||||
? _value.authSettings
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: authSettings as ContainerAuthSettings,
|
||||
useProxy: useProxy == const $CopyWithPlaceholder()
|
||||
? _value.useProxy
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: useProxy as bool,
|
||||
iconData:
|
||||
iconData == const $CopyWithPlaceholder()
|
||||
? _value.iconData
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: iconData as IconData?,
|
||||
contextualIdentity:
|
||||
contextualIdentity == const $CopyWithPlaceholder()
|
||||
? _value.contextualIdentity
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: contextualIdentity as String?,
|
||||
authSettings:
|
||||
authSettings == const $CopyWithPlaceholder()
|
||||
? _value.authSettings
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: authSettings as ContainerAuthSettings,
|
||||
useProxy:
|
||||
useProxy == const $CopyWithPlaceholder()
|
||||
? _value.useProxy
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: useProxy as bool,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -211,7 +215,6 @@ class _$ContainerDataCWProxyImpl implements _$ContainerDataCWProxy {
|
||||
this(metadata: metadata);
|
||||
|
||||
@override
|
||||
|
||||
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `ContainerData(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
|
||||
///
|
||||
/// Usage
|
||||
@@ -225,22 +228,26 @@ class _$ContainerDataCWProxyImpl implements _$ContainerDataCWProxy {
|
||||
Object? metadata = const $CopyWithPlaceholder(),
|
||||
}) {
|
||||
return ContainerData(
|
||||
id: id == const $CopyWithPlaceholder()
|
||||
? _value.id
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: id as String,
|
||||
name: name == const $CopyWithPlaceholder()
|
||||
? _value.name
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: name as String?,
|
||||
color: color == const $CopyWithPlaceholder()
|
||||
? _value.color
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: color as Color,
|
||||
metadata: metadata == const $CopyWithPlaceholder()
|
||||
? _value.metadata
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: metadata as ContainerMetadata?,
|
||||
id:
|
||||
id == const $CopyWithPlaceholder()
|
||||
? _value.id
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: id as String,
|
||||
name:
|
||||
name == const $CopyWithPlaceholder()
|
||||
? _value.name
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: name as String?,
|
||||
color:
|
||||
color == const $CopyWithPlaceholder()
|
||||
? _value.color
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: color as Color,
|
||||
metadata:
|
||||
metadata == const $CopyWithPlaceholder()
|
||||
? _value.metadata
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: metadata as ContainerMetadata?,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -256,39 +263,46 @@ extension $ContainerDataCopyWith on ContainerData {
|
||||
// **************************************************************************
|
||||
|
||||
ContainerAuthSettings _$ContainerAuthSettingsFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
ContainerAuthSettings(
|
||||
authenticationRequired: json['authenticationRequired'] as bool,
|
||||
lockOnAppBackground: json['lockOnAppBackground'] as bool,
|
||||
lockTimeout: json['lockTimeout'] == null
|
||||
Map<String, dynamic> json,
|
||||
) => ContainerAuthSettings(
|
||||
authenticationRequired: json['authenticationRequired'] as bool,
|
||||
lockOnAppBackground: json['lockOnAppBackground'] as bool,
|
||||
lockTimeout:
|
||||
json['lockTimeout'] == null
|
||||
? null
|
||||
: Duration(microseconds: (json['lockTimeout'] as num).toInt()),
|
||||
);
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$ContainerAuthSettingsToJson(
|
||||
ContainerAuthSettings instance) =>
|
||||
<String, dynamic>{
|
||||
'authenticationRequired': instance.authenticationRequired,
|
||||
'lockOnAppBackground': instance.lockOnAppBackground,
|
||||
'lockTimeout': instance.lockTimeout?.inMicroseconds,
|
||||
};
|
||||
ContainerAuthSettings instance,
|
||||
) => <String, dynamic>{
|
||||
'authenticationRequired': instance.authenticationRequired,
|
||||
'lockOnAppBackground': instance.lockOnAppBackground,
|
||||
'lockTimeout': instance.lockTimeout?.inMicroseconds,
|
||||
};
|
||||
|
||||
ContainerMetadata _$ContainerMetadataFromJson(Map<String, dynamic> json) =>
|
||||
ContainerMetadata.withDefaults(
|
||||
iconData: _$JsonConverterFromJson<Map<String, dynamic>, IconData>(
|
||||
json['iconData'], const IconDataJsonConverter().fromJson),
|
||||
json['iconData'],
|
||||
const IconDataJsonConverter().fromJson,
|
||||
),
|
||||
contextualIdentity: json['contextualIdentity'] as String?,
|
||||
authSettings: json['authSettings'] == null
|
||||
? null
|
||||
: ContainerAuthSettings.fromJson(
|
||||
json['authSettings'] as Map<String, dynamic>),
|
||||
authSettings:
|
||||
json['authSettings'] == null
|
||||
? null
|
||||
: ContainerAuthSettings.fromJson(
|
||||
json['authSettings'] as Map<String, dynamic>,
|
||||
),
|
||||
useProxy: json['useProxy'] as bool? ?? false,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$ContainerMetadataToJson(ContainerMetadata instance) =>
|
||||
<String, dynamic>{
|
||||
'iconData': _$JsonConverterToJson<Map<String, dynamic>, IconData>(
|
||||
instance.iconData, const IconDataJsonConverter().toJson),
|
||||
instance.iconData,
|
||||
const IconDataJsonConverter().toJson,
|
||||
),
|
||||
'contextualIdentity': instance.contextualIdentity,
|
||||
'authSettings': instance.authSettings,
|
||||
'useProxy': instance.useProxy,
|
||||
@@ -297,11 +311,9 @@ Map<String, dynamic> _$ContainerMetadataToJson(ContainerMetadata instance) =>
|
||||
Value? _$JsonConverterFromJson<Json, Value>(
|
||||
Object? json,
|
||||
Value? Function(Json json) fromJson,
|
||||
) =>
|
||||
json == null ? null : fromJson(json as Json);
|
||||
) => json == null ? null : fromJson(json as Json);
|
||||
|
||||
Json? _$JsonConverterToJson<Json, Value>(
|
||||
Value? value,
|
||||
Json? Function(Value value) toJson,
|
||||
) =>
|
||||
value == null ? null : toJson(value);
|
||||
) => value == null ? null : toJson(value);
|
||||
@@ -13,9 +13,7 @@ import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
part 'providers.g.dart';
|
||||
|
||||
@Riverpod()
|
||||
Future<Color> unusedRandomContainerColor(
|
||||
Ref ref,
|
||||
) async {
|
||||
Future<Color> unusedRandomContainerColor(Ref ref) async {
|
||||
final repository = ref.watch(containerRepositoryProvider.notifier);
|
||||
|
||||
final allColors = colorTypes.flattened.toList();
|
||||
@@ -30,9 +28,7 @@ Future<Color> unusedRandomContainerColor(
|
||||
}
|
||||
|
||||
@Riverpod()
|
||||
Stream<List<ContainerDataWithCount>> containersWithCount(
|
||||
Ref ref,
|
||||
) {
|
||||
Stream<List<ContainerDataWithCount>> containersWithCount(Ref ref) {
|
||||
final db = ref.watch(tabDatabaseProvider);
|
||||
return db.containersWithCount().watch();
|
||||
}
|
||||
@@ -49,21 +45,19 @@ AsyncValue<List<ContainerDataWithCount>> matchSortedContainersWithCount(
|
||||
}
|
||||
|
||||
return value.whenData(
|
||||
(cb) => TokenizedFilter.sort(
|
||||
items: cb,
|
||||
toString: (item) => item.name,
|
||||
query: searchText!,
|
||||
).filtered,
|
||||
(cb) =>
|
||||
TokenizedFilter.sort(
|
||||
items: cb,
|
||||
toString: (item) => item.name,
|
||||
query: searchText!,
|
||||
).filtered,
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@Riverpod()
|
||||
Stream<List<String>> containerTabIds(
|
||||
Ref ref,
|
||||
ContainerFilter containerFilter,
|
||||
) {
|
||||
Stream<List<String>> containerTabIds(Ref ref, ContainerFilter containerFilter) {
|
||||
final db = ref.watch(tabDatabaseProvider);
|
||||
|
||||
switch (containerFilter) {
|
||||
|
||||
@@ -13,14 +13,15 @@ String _$unusedRandomContainerColorHash() =>
|
||||
@ProviderFor(unusedRandomContainerColor)
|
||||
final unusedRandomContainerColorProvider =
|
||||
AutoDisposeFutureProvider<Color>.internal(
|
||||
unusedRandomContainerColor,
|
||||
name: r'unusedRandomContainerColorProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$unusedRandomContainerColorHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
unusedRandomContainerColor,
|
||||
name: r'unusedRandomContainerColorProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$unusedRandomContainerColorHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
@@ -32,19 +33,20 @@ String _$containersWithCountHash() =>
|
||||
@ProviderFor(containersWithCount)
|
||||
final containersWithCountProvider =
|
||||
AutoDisposeStreamProvider<List<ContainerDataWithCount>>.internal(
|
||||
containersWithCount,
|
||||
name: r'containersWithCountProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$containersWithCountHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
containersWithCount,
|
||||
name: r'containersWithCountProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$containersWithCountHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
typedef ContainersWithCountRef
|
||||
= AutoDisposeStreamProviderRef<List<ContainerDataWithCount>>;
|
||||
typedef ContainersWithCountRef =
|
||||
AutoDisposeStreamProviderRef<List<ContainerDataWithCount>>;
|
||||
String _$matchSortedContainersWithCountHash() =>
|
||||
r'0ed555f0cb72f4990a2841114d72f57d8178d5c3';
|
||||
|
||||
@@ -81,21 +83,15 @@ class MatchSortedContainersWithCountFamily
|
||||
const MatchSortedContainersWithCountFamily();
|
||||
|
||||
/// See also [matchSortedContainersWithCount].
|
||||
MatchSortedContainersWithCountProvider call(
|
||||
String? searchText,
|
||||
) {
|
||||
return MatchSortedContainersWithCountProvider(
|
||||
searchText,
|
||||
);
|
||||
MatchSortedContainersWithCountProvider call(String? searchText) {
|
||||
return MatchSortedContainersWithCountProvider(searchText);
|
||||
}
|
||||
|
||||
@override
|
||||
MatchSortedContainersWithCountProvider getProviderOverride(
|
||||
covariant MatchSortedContainersWithCountProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.searchText,
|
||||
);
|
||||
return call(provider.searchText);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -117,24 +113,23 @@ class MatchSortedContainersWithCountFamily
|
||||
class MatchSortedContainersWithCountProvider
|
||||
extends AutoDisposeProvider<AsyncValue<List<ContainerDataWithCount>>> {
|
||||
/// See also [matchSortedContainersWithCount].
|
||||
MatchSortedContainersWithCountProvider(
|
||||
String? searchText,
|
||||
) : this._internal(
|
||||
(ref) => matchSortedContainersWithCount(
|
||||
ref as MatchSortedContainersWithCountRef,
|
||||
searchText,
|
||||
),
|
||||
from: matchSortedContainersWithCountProvider,
|
||||
name: r'matchSortedContainersWithCountProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$matchSortedContainersWithCountHash,
|
||||
dependencies: MatchSortedContainersWithCountFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
MatchSortedContainersWithCountFamily._allTransitiveDependencies,
|
||||
searchText: searchText,
|
||||
);
|
||||
MatchSortedContainersWithCountProvider(String? searchText)
|
||||
: this._internal(
|
||||
(ref) => matchSortedContainersWithCount(
|
||||
ref as MatchSortedContainersWithCountRef,
|
||||
searchText,
|
||||
),
|
||||
from: matchSortedContainersWithCountProvider,
|
||||
name: r'matchSortedContainersWithCountProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$matchSortedContainersWithCountHash,
|
||||
dependencies: MatchSortedContainersWithCountFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
MatchSortedContainersWithCountFamily._allTransitiveDependencies,
|
||||
searchText: searchText,
|
||||
);
|
||||
|
||||
MatchSortedContainersWithCountProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -151,8 +146,9 @@ class MatchSortedContainersWithCountProvider
|
||||
@override
|
||||
Override overrideWith(
|
||||
AsyncValue<List<ContainerDataWithCount>> Function(
|
||||
MatchSortedContainersWithCountRef provider)
|
||||
create,
|
||||
MatchSortedContainersWithCountRef provider,
|
||||
)
|
||||
create,
|
||||
) {
|
||||
return ProviderOverride(
|
||||
origin: this,
|
||||
@@ -170,7 +166,7 @@ class MatchSortedContainersWithCountProvider
|
||||
|
||||
@override
|
||||
AutoDisposeProviderElement<AsyncValue<List<ContainerDataWithCount>>>
|
||||
createElement() {
|
||||
createElement() {
|
||||
return _MatchSortedContainersWithCountProviderElement(this);
|
||||
}
|
||||
|
||||
@@ -219,21 +215,15 @@ class ContainerTabIdsFamily extends Family<AsyncValue<List<String>>> {
|
||||
const ContainerTabIdsFamily();
|
||||
|
||||
/// See also [containerTabIds].
|
||||
ContainerTabIdsProvider call(
|
||||
ContainerFilter containerFilter,
|
||||
) {
|
||||
return ContainerTabIdsProvider(
|
||||
containerFilter,
|
||||
);
|
||||
ContainerTabIdsProvider call(ContainerFilter containerFilter) {
|
||||
return ContainerTabIdsProvider(containerFilter);
|
||||
}
|
||||
|
||||
@override
|
||||
ContainerTabIdsProvider getProviderOverride(
|
||||
covariant ContainerTabIdsProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.containerFilter,
|
||||
);
|
||||
return call(provider.containerFilter);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -254,24 +244,20 @@ class ContainerTabIdsFamily extends Family<AsyncValue<List<String>>> {
|
||||
/// See also [containerTabIds].
|
||||
class ContainerTabIdsProvider extends AutoDisposeStreamProvider<List<String>> {
|
||||
/// See also [containerTabIds].
|
||||
ContainerTabIdsProvider(
|
||||
ContainerFilter containerFilter,
|
||||
) : this._internal(
|
||||
(ref) => containerTabIds(
|
||||
ref as ContainerTabIdsRef,
|
||||
containerFilter,
|
||||
),
|
||||
from: containerTabIdsProvider,
|
||||
name: r'containerTabIdsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$containerTabIdsHash,
|
||||
dependencies: ContainerTabIdsFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
ContainerTabIdsFamily._allTransitiveDependencies,
|
||||
containerFilter: containerFilter,
|
||||
);
|
||||
ContainerTabIdsProvider(ContainerFilter containerFilter)
|
||||
: this._internal(
|
||||
(ref) => containerTabIds(ref as ContainerTabIdsRef, containerFilter),
|
||||
from: containerTabIdsProvider,
|
||||
name: r'containerTabIdsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$containerTabIdsHash,
|
||||
dependencies: ContainerTabIdsFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
ContainerTabIdsFamily._allTransitiveDependencies,
|
||||
containerFilter: containerFilter,
|
||||
);
|
||||
|
||||
ContainerTabIdsProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -339,5 +325,6 @@ class _ContainerTabIdsProviderElement
|
||||
ContainerFilter get containerFilter =>
|
||||
(origin as ContainerTabIdsProvider).containerFilter;
|
||||
}
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
@@ -8,11 +8,7 @@ import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
part 'selected_container.g.dart';
|
||||
|
||||
enum SetContainerResult {
|
||||
failed,
|
||||
success,
|
||||
successHasProxy,
|
||||
}
|
||||
enum SetContainerResult { failed, success, successHasProxy }
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
class SelectedContainer extends _$SelectedContainer {
|
||||
@@ -71,16 +67,13 @@ class SelectedContainer extends _$SelectedContainer {
|
||||
|
||||
@override
|
||||
String? build() {
|
||||
ref.listen(
|
||||
containersWithCountProvider,
|
||||
(previous, next) {
|
||||
if (state != null && next.valueOrNull != null) {
|
||||
if (!next.value!.any((container) => container.id == state)) {
|
||||
clearContainer();
|
||||
}
|
||||
ref.listen(containersWithCountProvider, (previous, next) {
|
||||
if (state != null && next.valueOrNull != null) {
|
||||
if (!next.value!.any((container) => container.id == state)) {
|
||||
clearContainer();
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
+18
-16
@@ -13,14 +13,15 @@ String _$selectedContainerDataHash() =>
|
||||
@ProviderFor(selectedContainerData)
|
||||
final selectedContainerDataProvider =
|
||||
AutoDisposeStreamProvider<ContainerData?>.internal(
|
||||
selectedContainerData,
|
||||
name: r'selectedContainerDataProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedContainerDataHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
selectedContainerData,
|
||||
name: r'selectedContainerDataProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedContainerDataHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
@@ -31,14 +32,15 @@ String _$selectedContainerHash() => r'f3dab491337396b8d56daed37a0d85c85aa8d64a';
|
||||
@ProviderFor(SelectedContainer)
|
||||
final selectedContainerProvider =
|
||||
NotifierProvider<SelectedContainer, String?>.internal(
|
||||
SelectedContainer.new,
|
||||
name: r'selectedContainerProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedContainerHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
SelectedContainer.new,
|
||||
name: r'selectedContainerProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedContainerHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$SelectedContainer = Notifier<String?>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
@@ -12,14 +12,15 @@ String _$selectedTopicDataHash() => r'fa450784052498014f592c356bde4ff5ec675281';
|
||||
@ProviderFor(selectedTopicData)
|
||||
final selectedTopicDataProvider =
|
||||
AutoDisposeStreamProvider<TopicData?>.internal(
|
||||
selectedTopicData,
|
||||
name: r'selectedTopicDataProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedTopicDataHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
selectedTopicData,
|
||||
name: r'selectedTopicDataProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedTopicDataHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef SelectedTopicDataRef = AutoDisposeStreamProviderRef<TopicData?>;
|
||||
String _$selectedTopicHash() => r'f4e1c0620971a0b7501ee9aff0d5b41da3130ba0';
|
||||
@@ -29,9 +30,10 @@ String _$selectedTopicHash() => r'f4e1c0620971a0b7501ee9aff0d5b41da3130ba0';
|
||||
final selectedTopicProvider = NotifierProvider<SelectedTopic, String?>.internal(
|
||||
SelectedTopic.new,
|
||||
name: r'selectedTopicProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedTopicHash,
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedTopicHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@@ -13,14 +13,15 @@ String _$containerRepositoryHash() =>
|
||||
@ProviderFor(ContainerRepository)
|
||||
final containerRepositoryProvider =
|
||||
NotifierProvider<ContainerRepository, void>.internal(
|
||||
ContainerRepository.new,
|
||||
name: r'containerRepositoryProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$containerRepositoryHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
ContainerRepository.new,
|
||||
name: r'containerRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$containerRepositoryHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$ContainerRepository = Notifier<void>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
@@ -10,25 +10,26 @@ class TabDataRepository extends _$TabDataRepository {
|
||||
void build() {}
|
||||
|
||||
Future<void> assignContainer(String tabId, String? containerId) {
|
||||
return ref.read(tabDatabaseProvider).tabDao.assignContainer(
|
||||
tabId,
|
||||
containerId: containerId,
|
||||
);
|
||||
return ref
|
||||
.read(tabDatabaseProvider)
|
||||
.tabDao
|
||||
.assignContainer(tabId, containerId: containerId);
|
||||
}
|
||||
|
||||
Future<void> assignOrderKey(String tabId, String orderKey) {
|
||||
return ref.read(tabDatabaseProvider).tabDao.assignOrderKey(
|
||||
tabId,
|
||||
orderKey: orderKey,
|
||||
);
|
||||
return ref
|
||||
.read(tabDatabaseProvider)
|
||||
.tabDao
|
||||
.assignOrderKey(tabId, orderKey: orderKey);
|
||||
}
|
||||
|
||||
Future<void> closeAllTabs(String? containerId) async {
|
||||
final tabIds = await ref
|
||||
.read(tabDatabaseProvider)
|
||||
.tabDao
|
||||
.containerTabIds(containerId)
|
||||
.get();
|
||||
final tabIds =
|
||||
await ref
|
||||
.read(tabDatabaseProvider)
|
||||
.tabDao
|
||||
.containerTabIds(containerId)
|
||||
.get();
|
||||
|
||||
if (tabIds.isNotEmpty) {
|
||||
await ref.read(tabRepositoryProvider.notifier).closeTabs(tabIds);
|
||||
|
||||
@@ -12,14 +12,15 @@ String _$tabDataRepositoryHash() => r'30ae87fbcb37facd565cb28de605814cd7db4ce8';
|
||||
@ProviderFor(TabDataRepository)
|
||||
final tabDataRepositoryProvider =
|
||||
NotifierProvider<TabDataRepository, void>.internal(
|
||||
TabDataRepository.new,
|
||||
name: r'tabDataRepositoryProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$tabDataRepositoryHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
TabDataRepository.new,
|
||||
name: r'tabDataRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$tabDataRepositoryHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$TabDataRepository = Notifier<void>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
@@ -19,17 +19,18 @@ class TabSearchRepository extends _$TabSearchRepository {
|
||||
}) async {
|
||||
if (input.isNotEmpty) {
|
||||
state = await AsyncValue.guard(
|
||||
() => ref
|
||||
.read(tabDatabaseProvider)
|
||||
.tabDao
|
||||
.queryTabs(
|
||||
matchPrefix: matchPrefix,
|
||||
matchSuffix: matchSuffix,
|
||||
ellipsis: ellipsis,
|
||||
snippetLength: snippetLength,
|
||||
searchString: input,
|
||||
)
|
||||
.get(),
|
||||
() =>
|
||||
ref
|
||||
.read(tabDatabaseProvider)
|
||||
.tabDao
|
||||
.queryTabs(
|
||||
matchPrefix: matchPrefix,
|
||||
matchSuffix: matchSuffix,
|
||||
ellipsis: ellipsis,
|
||||
snippetLength: snippetLength,
|
||||
searchString: input,
|
||||
)
|
||||
.get(),
|
||||
);
|
||||
} else {
|
||||
state = const AsyncValue.data(null);
|
||||
|
||||
@@ -34,9 +34,7 @@ abstract class _$TabSearchRepository
|
||||
extends BuildlessAutoDisposeAsyncNotifier<List<TabQueryResult>?> {
|
||||
late final TabSearchPartition partition;
|
||||
|
||||
FutureOr<List<TabQueryResult>?> build(
|
||||
TabSearchPartition partition,
|
||||
);
|
||||
FutureOr<List<TabQueryResult>?> build(TabSearchPartition partition);
|
||||
}
|
||||
|
||||
/// See also [TabSearchRepository].
|
||||
@@ -50,21 +48,15 @@ class TabSearchRepositoryFamily
|
||||
const TabSearchRepositoryFamily();
|
||||
|
||||
/// See also [TabSearchRepository].
|
||||
TabSearchRepositoryProvider call(
|
||||
TabSearchPartition partition,
|
||||
) {
|
||||
return TabSearchRepositoryProvider(
|
||||
partition,
|
||||
);
|
||||
TabSearchRepositoryProvider call(TabSearchPartition partition) {
|
||||
return TabSearchRepositoryProvider(partition);
|
||||
}
|
||||
|
||||
@override
|
||||
TabSearchRepositoryProvider getProviderOverride(
|
||||
covariant TabSearchRepositoryProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.partition,
|
||||
);
|
||||
return call(provider.partition);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -83,24 +75,27 @@ class TabSearchRepositoryFamily
|
||||
}
|
||||
|
||||
/// See also [TabSearchRepository].
|
||||
class TabSearchRepositoryProvider extends AutoDisposeAsyncNotifierProviderImpl<
|
||||
TabSearchRepository, List<TabQueryResult>?> {
|
||||
class TabSearchRepositoryProvider
|
||||
extends
|
||||
AutoDisposeAsyncNotifierProviderImpl<
|
||||
TabSearchRepository,
|
||||
List<TabQueryResult>?
|
||||
> {
|
||||
/// See also [TabSearchRepository].
|
||||
TabSearchRepositoryProvider(
|
||||
TabSearchPartition partition,
|
||||
) : this._internal(
|
||||
() => TabSearchRepository()..partition = partition,
|
||||
from: tabSearchRepositoryProvider,
|
||||
name: r'tabSearchRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$tabSearchRepositoryHash,
|
||||
dependencies: TabSearchRepositoryFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
TabSearchRepositoryFamily._allTransitiveDependencies,
|
||||
partition: partition,
|
||||
);
|
||||
TabSearchRepositoryProvider(TabSearchPartition partition)
|
||||
: this._internal(
|
||||
() => TabSearchRepository()..partition = partition,
|
||||
from: tabSearchRepositoryProvider,
|
||||
name: r'tabSearchRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$tabSearchRepositoryHash,
|
||||
dependencies: TabSearchRepositoryFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
TabSearchRepositoryFamily._allTransitiveDependencies,
|
||||
partition: partition,
|
||||
);
|
||||
|
||||
TabSearchRepositoryProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -118,9 +113,7 @@ class TabSearchRepositoryProvider extends AutoDisposeAsyncNotifierProviderImpl<
|
||||
FutureOr<List<TabQueryResult>?> runNotifierBuild(
|
||||
covariant TabSearchRepository notifier,
|
||||
) {
|
||||
return notifier.build(
|
||||
partition,
|
||||
);
|
||||
return notifier.build(partition);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -140,8 +133,11 @@ class TabSearchRepositoryProvider extends AutoDisposeAsyncNotifierProviderImpl<
|
||||
}
|
||||
|
||||
@override
|
||||
AutoDisposeAsyncNotifierProviderElement<TabSearchRepository,
|
||||
List<TabQueryResult>?> createElement() {
|
||||
AutoDisposeAsyncNotifierProviderElement<
|
||||
TabSearchRepository,
|
||||
List<TabQueryResult>?
|
||||
>
|
||||
createElement() {
|
||||
return _TabSearchRepositoryProviderElement(this);
|
||||
}
|
||||
|
||||
@@ -168,13 +164,18 @@ mixin TabSearchRepositoryRef
|
||||
}
|
||||
|
||||
class _TabSearchRepositoryProviderElement
|
||||
extends AutoDisposeAsyncNotifierProviderElement<TabSearchRepository,
|
||||
List<TabQueryResult>?> with TabSearchRepositoryRef {
|
||||
extends
|
||||
AutoDisposeAsyncNotifierProviderElement<
|
||||
TabSearchRepository,
|
||||
List<TabQueryResult>?
|
||||
>
|
||||
with TabSearchRepositoryRef {
|
||||
_TabSearchRepositoryProviderElement(super.provider);
|
||||
|
||||
@override
|
||||
TabSearchPartition get partition =>
|
||||
(origin as TabSearchRepositoryProvider).partition;
|
||||
}
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
@@ -25,11 +25,12 @@ class ChatBackend extends _$ChatBackend {
|
||||
return _embeddingsUpdate!;
|
||||
}
|
||||
|
||||
_embeddingsUpdate =
|
||||
ref.read(documentRepositoryProvider.notifier).updateEmbeddings(
|
||||
mainDocumentId: _metadata?.mainDocumentId,
|
||||
contextId: _metadata?.contextId,
|
||||
);
|
||||
_embeddingsUpdate = ref
|
||||
.read(documentRepositoryProvider.notifier)
|
||||
.updateEmbeddings(
|
||||
mainDocumentId: _metadata?.mainDocumentId,
|
||||
contextId: _metadata?.contextId,
|
||||
);
|
||||
|
||||
_embeddingsUpdate!.whenComplete(() => _embeddingsUpdate = null);
|
||||
|
||||
@@ -47,16 +48,10 @@ class ChatBackend extends _$ChatBackend {
|
||||
await prepareEmbeddings();
|
||||
|
||||
return humanMessageResult.flatMapAsync((humanMessage) async {
|
||||
await _chatRepository.setTyping(
|
||||
author: MessageAuthor.ai,
|
||||
typing: true,
|
||||
);
|
||||
await _chatRepository.setTyping(author: MessageAuthor.ai, typing: true);
|
||||
|
||||
final result = await _qaMemoryChain.processQuestion(humanMessage.text);
|
||||
await _chatRepository.setTyping(
|
||||
author: MessageAuthor.ai,
|
||||
typing: false,
|
||||
);
|
||||
await _chatRepository.setTyping(author: MessageAuthor.ai, typing: false);
|
||||
|
||||
await _chatRepository.insertTextMessage(
|
||||
author: MessageAuthor.ai,
|
||||
|
||||
@@ -32,9 +32,7 @@ class _SystemHash {
|
||||
abstract class _$ChatBackend extends BuildlessAutoDisposeNotifier<void> {
|
||||
late final String chatId;
|
||||
|
||||
void build(
|
||||
String chatId,
|
||||
);
|
||||
void build(String chatId);
|
||||
}
|
||||
|
||||
/// See also [ChatBackend].
|
||||
@@ -47,21 +45,15 @@ class ChatBackendFamily extends Family<void> {
|
||||
const ChatBackendFamily();
|
||||
|
||||
/// See also [ChatBackend].
|
||||
ChatBackendProvider call(
|
||||
String chatId,
|
||||
) {
|
||||
return ChatBackendProvider(
|
||||
chatId,
|
||||
);
|
||||
ChatBackendProvider call(String chatId) {
|
||||
return ChatBackendProvider(chatId);
|
||||
}
|
||||
|
||||
@override
|
||||
ChatBackendProvider getProviderOverride(
|
||||
covariant ChatBackendProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.chatId,
|
||||
);
|
||||
return call(provider.chatId);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -83,21 +75,19 @@ class ChatBackendFamily extends Family<void> {
|
||||
class ChatBackendProvider
|
||||
extends AutoDisposeNotifierProviderImpl<ChatBackend, void> {
|
||||
/// See also [ChatBackend].
|
||||
ChatBackendProvider(
|
||||
String chatId,
|
||||
) : this._internal(
|
||||
() => ChatBackend()..chatId = chatId,
|
||||
from: chatBackendProvider,
|
||||
name: r'chatBackendProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$chatBackendHash,
|
||||
dependencies: ChatBackendFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
ChatBackendFamily._allTransitiveDependencies,
|
||||
chatId: chatId,
|
||||
);
|
||||
ChatBackendProvider(String chatId)
|
||||
: this._internal(
|
||||
() => ChatBackend()..chatId = chatId,
|
||||
from: chatBackendProvider,
|
||||
name: r'chatBackendProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$chatBackendHash,
|
||||
dependencies: ChatBackendFamily._dependencies,
|
||||
allTransitiveDependencies: ChatBackendFamily._allTransitiveDependencies,
|
||||
chatId: chatId,
|
||||
);
|
||||
|
||||
ChatBackendProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -112,12 +102,8 @@ class ChatBackendProvider
|
||||
final String chatId;
|
||||
|
||||
@override
|
||||
void runNotifierBuild(
|
||||
covariant ChatBackend notifier,
|
||||
) {
|
||||
return notifier.build(
|
||||
chatId,
|
||||
);
|
||||
void runNotifierBuild(covariant ChatBackend notifier) {
|
||||
return notifier.build(chatId);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -170,5 +156,6 @@ class _ChatBackendProviderElement
|
||||
@override
|
||||
String get chatId => (origin as ChatBackendProvider).chatId;
|
||||
}
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
+22
-20
@@ -14,40 +14,42 @@ class ChatTextMessage extends StatelessWidget {
|
||||
super.key,
|
||||
required this.message,
|
||||
required this.index,
|
||||
this.padding = const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 10,
|
||||
),
|
||||
this.padding = const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
this.borderRadius = const BorderRadius.all(Radius.circular(12)),
|
||||
this.onlyEmojiFontSize = 48,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final textMessageTheme =
|
||||
context.select((ChatTheme theme) => theme.textMessageTheme);
|
||||
final textMessageTheme = context.select(
|
||||
(ChatTheme theme) => theme.textMessageTheme,
|
||||
);
|
||||
final isSentByMe = context.watch<String>() == message.authorId;
|
||||
final paragraphStyle = isSentByMe
|
||||
? textMessageTheme.sentTextStyle
|
||||
: textMessageTheme.receivedTextStyle;
|
||||
final paragraphStyle =
|
||||
isSentByMe
|
||||
? textMessageTheme.sentTextStyle
|
||||
: textMessageTheme.receivedTextStyle;
|
||||
|
||||
return Container(
|
||||
padding: padding,
|
||||
decoration: message.isOnlyEmoji == true
|
||||
? null
|
||||
: BoxDecoration(
|
||||
color: isSentByMe
|
||||
? textMessageTheme.sentBackgroundColor
|
||||
: textMessageTheme.receivedBackgroundColor,
|
||||
borderRadius: borderRadius,
|
||||
),
|
||||
decoration:
|
||||
message.isOnlyEmoji == true
|
||||
? null
|
||||
: BoxDecoration(
|
||||
color:
|
||||
isSentByMe
|
||||
? textMessageTheme.sentBackgroundColor
|
||||
: textMessageTheme.receivedBackgroundColor,
|
||||
borderRadius: borderRadius,
|
||||
),
|
||||
child: MarkdownBody(
|
||||
data: message.text,
|
||||
selectable: true,
|
||||
styleSheet: MarkdownStyleSheet(
|
||||
p: message.isOnlyEmoji == true
|
||||
? paragraphStyle?.copyWith(fontSize: onlyEmojiFontSize)
|
||||
: paragraphStyle,
|
||||
p:
|
||||
message.isOnlyEmoji == true
|
||||
? paragraphStyle?.copyWith(fontSize: onlyEmojiFontSize)
|
||||
: paragraphStyle,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
+16
-13
@@ -75,9 +75,10 @@ class _QaChatInputState extends State<QaChatInput> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final bottomSafeArea = widget.handleSafeArea == true
|
||||
? MediaQuery.of(context).padding.bottom
|
||||
: 0.0;
|
||||
final bottomSafeArea =
|
||||
widget.handleSafeArea == true
|
||||
? MediaQuery.of(context).padding.bottom
|
||||
: 0.0;
|
||||
final inputTheme = context.select((ChatTheme theme) => theme.inputTheme);
|
||||
final onAttachmentTap = context.read<OnAttachmentTapCallback?>();
|
||||
|
||||
@@ -100,11 +101,13 @@ class _QaChatInputState extends State<QaChatInput> {
|
||||
children: [
|
||||
if (widget.topWidget != null) widget.topWidget!,
|
||||
Padding(
|
||||
padding: widget.handleSafeArea == true
|
||||
? (widget.padding
|
||||
?.add(EdgeInsets.only(bottom: bottomSafeArea)) ??
|
||||
EdgeInsets.only(bottom: bottomSafeArea))
|
||||
: (widget.padding ?? EdgeInsets.zero),
|
||||
padding:
|
||||
widget.handleSafeArea == true
|
||||
? (widget.padding?.add(
|
||||
EdgeInsets.only(bottom: bottomSafeArea),
|
||||
) ??
|
||||
EdgeInsets.only(bottom: bottomSafeArea))
|
||||
: (widget.padding ?? EdgeInsets.zero),
|
||||
child: Row(
|
||||
children: [
|
||||
if (widget.attachmentIcon != null)
|
||||
@@ -142,8 +145,8 @@ class _QaChatInputState extends State<QaChatInput> {
|
||||
IconButton(
|
||||
icon: widget.sendIcon!,
|
||||
color: inputTheme.hintStyle?.color,
|
||||
onPressed: () =>
|
||||
_handleSubmitted(_textController.text),
|
||||
onPressed:
|
||||
() => _handleSubmitted(_textController.text),
|
||||
)
|
||||
else
|
||||
const SizedBox.shrink(),
|
||||
@@ -168,9 +171,9 @@ class _QaChatInputState extends State<QaChatInput> {
|
||||
final bottomSafeArea = MediaQuery.of(context).padding.bottom;
|
||||
|
||||
context.read<ChatInputHeightNotifier>().updateHeight(
|
||||
// only set real height of the input, ignoring safe area
|
||||
widget.handleSafeArea == true ? height - bottomSafeArea : height,
|
||||
);
|
||||
// only set real height of the input, ignoring safe area
|
||||
widget.handleSafeArea == true ? height - bottomSafeArea : height,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+19
-21
@@ -40,22 +40,19 @@ class TabQaChat extends HookConsumerWidget {
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
),
|
||||
builders: Builders(
|
||||
textMessageBuilder: (context, message, index) =>
|
||||
ChatTextMessage(message: message, index: index),
|
||||
customMessageBuilder: (context, message, index) => Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 10,
|
||||
),
|
||||
decoration: const BoxDecoration(
|
||||
color: Color(0xFFF0F0F0),
|
||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||
),
|
||||
child: const IsTypingIndicator(),
|
||||
),
|
||||
inputBuilder: (context) => const QaChatInput(
|
||||
attachmentIcon: null,
|
||||
),
|
||||
textMessageBuilder:
|
||||
(context, message, index) =>
|
||||
ChatTextMessage(message: message, index: index),
|
||||
customMessageBuilder:
|
||||
(context, message, index) => Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
decoration: const BoxDecoration(
|
||||
color: Color(0xFFF0F0F0),
|
||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||
),
|
||||
child: const IsTypingIndicator(),
|
||||
),
|
||||
inputBuilder: (context) => const QaChatInput(attachmentIcon: null),
|
||||
),
|
||||
chatController: chatController,
|
||||
// crossCache: crossCache,
|
||||
@@ -64,11 +61,12 @@ class TabQaChat extends HookConsumerWidget {
|
||||
await chatBackend.processQAMessage(text);
|
||||
},
|
||||
currentUserId: MessageAuthor.human.user.id,
|
||||
resolveUser: (id) => Future.value(
|
||||
MessageAuthor.values
|
||||
.firstWhereOrNull((user) => user.user.id == id)
|
||||
?.user,
|
||||
),
|
||||
resolveUser:
|
||||
(id) => Future.value(
|
||||
MessageAuthor.values
|
||||
.firstWhereOrNull((user) => user.user.id == id)
|
||||
?.user,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
+25
-24
@@ -98,23 +98,24 @@ class QAMemoryChainProvider
|
||||
String? mainDocumentId,
|
||||
String? contextId,
|
||||
}) : this._internal(
|
||||
() => QAMemoryChain()
|
||||
..chatId = chatId
|
||||
..mainDocumentId = mainDocumentId
|
||||
..contextId = contextId,
|
||||
from: qAMemoryChainProvider,
|
||||
name: r'qAMemoryChainProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$qAMemoryChainHash,
|
||||
dependencies: QAMemoryChainFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
QAMemoryChainFamily._allTransitiveDependencies,
|
||||
chatId: chatId,
|
||||
mainDocumentId: mainDocumentId,
|
||||
contextId: contextId,
|
||||
);
|
||||
() =>
|
||||
QAMemoryChain()
|
||||
..chatId = chatId
|
||||
..mainDocumentId = mainDocumentId
|
||||
..contextId = contextId,
|
||||
from: qAMemoryChainProvider,
|
||||
name: r'qAMemoryChainProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$qAMemoryChainHash,
|
||||
dependencies: QAMemoryChainFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
QAMemoryChainFamily._allTransitiveDependencies,
|
||||
chatId: chatId,
|
||||
mainDocumentId: mainDocumentId,
|
||||
contextId: contextId,
|
||||
);
|
||||
|
||||
QAMemoryChainProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -133,9 +134,7 @@ class QAMemoryChainProvider
|
||||
final String? contextId;
|
||||
|
||||
@override
|
||||
void runNotifierBuild(
|
||||
covariant QAMemoryChain notifier,
|
||||
) {
|
||||
void runNotifierBuild(covariant QAMemoryChain notifier) {
|
||||
return notifier.build(
|
||||
chatId: chatId,
|
||||
mainDocumentId: mainDocumentId,
|
||||
@@ -148,10 +147,11 @@ class QAMemoryChainProvider
|
||||
return ProviderOverride(
|
||||
origin: this,
|
||||
override: QAMemoryChainProvider._internal(
|
||||
() => create()
|
||||
..chatId = chatId
|
||||
..mainDocumentId = mainDocumentId
|
||||
..contextId = contextId,
|
||||
() =>
|
||||
create()
|
||||
..chatId = chatId
|
||||
..mainDocumentId = mainDocumentId
|
||||
..contextId = contextId,
|
||||
from: from,
|
||||
name: null,
|
||||
dependencies: null,
|
||||
@@ -214,5 +214,6 @@ class _QAMemoryChainProviderElement
|
||||
@override
|
||||
String? get contextId => (origin as QAMemoryChainProvider).contextId;
|
||||
}
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
+21
-20
@@ -19,8 +19,9 @@ class VectorDao extends DatabaseAccessor<TabDatabase> with _$VectorDaoMixin {
|
||||
}
|
||||
|
||||
Future<int> deleteDocumentsByMainDocumentId(String mainDocumentId) {
|
||||
return db.document
|
||||
.deleteWhere((doc) => doc.mainDocumentId.equals(mainDocumentId));
|
||||
return db.document.deleteWhere(
|
||||
(doc) => doc.mainDocumentId.equals(mainDocumentId),
|
||||
);
|
||||
}
|
||||
|
||||
SingleOrNullSelectable<DocumentData> getDocumentById(String documentId) {
|
||||
@@ -70,9 +71,10 @@ class VectorDao extends DatabaseAccessor<TabDatabase> with _$VectorDaoMixin {
|
||||
mainDocumentId: Value.absentIfNull(mainDocumentId),
|
||||
contextId: Value.absentIfNull(contextId),
|
||||
content: document.pageContent,
|
||||
metadata: (document.metadata.isNotEmpty)
|
||||
? Value(jsonEncode(document.metadata))
|
||||
: const Value.absent(),
|
||||
metadata:
|
||||
(document.metadata.isNotEmpty)
|
||||
? Value(jsonEncode(document.metadata))
|
||||
: const Value.absent(),
|
||||
contentHash: contentHash,
|
||||
);
|
||||
}),
|
||||
@@ -82,19 +84,17 @@ class VectorDao extends DatabaseAccessor<TabDatabase> with _$VectorDaoMixin {
|
||||
|
||||
Future<void> insertEmbeddings(List<(DocumentData, List<double>)> documents) {
|
||||
return db.documentVec.insertAll(
|
||||
documents.map(
|
||||
(doc) {
|
||||
final (document, vector) = doc;
|
||||
documents.map((doc) {
|
||||
final (document, vector) = doc;
|
||||
|
||||
return DocumentVecCompanion.insert(
|
||||
id: document.documentId,
|
||||
embedding: serializeVector(vector),
|
||||
mainDocumentId: Value.absentIfNull(document.mainDocumentId),
|
||||
contextId: Value.absentIfNull(document.contextId),
|
||||
contentHash: document.contentHash,
|
||||
);
|
||||
},
|
||||
),
|
||||
return DocumentVecCompanion.insert(
|
||||
id: document.documentId,
|
||||
embedding: serializeVector(vector),
|
||||
mainDocumentId: Value.absentIfNull(document.mainDocumentId),
|
||||
contextId: Value.absentIfNull(document.contextId),
|
||||
contentHash: document.contentHash,
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -121,9 +121,10 @@ class VectorDao extends DatabaseAccessor<TabDatabase> with _$VectorDaoMixin {
|
||||
mainDocumentId: Value.absentIfNull(mainDocumentId),
|
||||
contextId: Value.absentIfNull(contextId),
|
||||
content: document.pageContent,
|
||||
metadata: (document.metadata.isNotEmpty)
|
||||
? Value(jsonEncode(document.metadata))
|
||||
: const Value.absent(),
|
||||
metadata:
|
||||
(document.metadata.isNotEmpty)
|
||||
? Value(jsonEncode(document.metadata))
|
||||
: const Value.absent(),
|
||||
contentHash: contentHash,
|
||||
),
|
||||
);
|
||||
|
||||
+6
-9
@@ -17,16 +17,13 @@ class VectorResult {
|
||||
required this.content,
|
||||
required String? metadata,
|
||||
required double? distance,
|
||||
}) : metadata = (metadata != null)
|
||||
? jsonDecode(metadata) as Map<String, dynamic>
|
||||
: const {},
|
||||
distance = distance!;
|
||||
}) : metadata =
|
||||
(metadata != null)
|
||||
? jsonDecode(metadata) as Map<String, dynamic>
|
||||
: const {},
|
||||
distance = distance!;
|
||||
|
||||
Document toDocument() {
|
||||
return Document(
|
||||
id: id,
|
||||
pageContent: content,
|
||||
metadata: metadata,
|
||||
);
|
||||
return Document(id: id, pageContent: content, metadata: metadata);
|
||||
}
|
||||
}
|
||||
+26
-28
@@ -45,16 +45,14 @@ class DocumentRepository extends _$DocumentRepository {
|
||||
final splittedWithSource = splitted.mapNotNull(
|
||||
(splitted) => (
|
||||
mainDocumentId: splitted.mainDocumentId,
|
||||
parts: splitted.parts
|
||||
.map(
|
||||
(part) => part.copyWith(
|
||||
metadata: {
|
||||
...part.metadata,
|
||||
'source': part.id,
|
||||
},
|
||||
),
|
||||
)
|
||||
.toList()
|
||||
parts:
|
||||
splitted.parts
|
||||
.map(
|
||||
(part) => part.copyWith(
|
||||
metadata: {...part.metadata, 'source': part.id},
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -66,17 +64,15 @@ class DocumentRepository extends _$DocumentRepository {
|
||||
});
|
||||
}
|
||||
|
||||
Future<Result> updateEmbeddings({
|
||||
String? mainDocumentId,
|
||||
String? contextId,
|
||||
}) {
|
||||
Future<Result> updateEmbeddings({String? mainDocumentId, String? contextId}) {
|
||||
return Result.fromAsync(() async {
|
||||
final missing = await _vectorDao
|
||||
.getDocumentsWithMissingEmbeddings(
|
||||
mainDocumentId: mainDocumentId,
|
||||
contextId: contextId,
|
||||
)
|
||||
.get();
|
||||
final missing =
|
||||
await _vectorDao
|
||||
.getDocumentsWithMissingEmbeddings(
|
||||
mainDocumentId: mainDocumentId,
|
||||
contextId: contextId,
|
||||
)
|
||||
.get();
|
||||
|
||||
final documentEmbeddings = await _embeddings.embedDocuments(
|
||||
missing
|
||||
@@ -97,16 +93,18 @@ class DocumentRepository extends _$DocumentRepository {
|
||||
|
||||
final tabContentService = ref.watch(tabContentServiceProvider);
|
||||
|
||||
final tabContentSub =
|
||||
tabContentService.tabContentStream.listen((content) async {
|
||||
final bestContent = content.isProbablyReaderable
|
||||
? content.extractedContentMarkdown
|
||||
: content.fullContentMarkdown;
|
||||
final tabContentSub = tabContentService.tabContentStream.listen((
|
||||
content,
|
||||
) async {
|
||||
final bestContent =
|
||||
content.isProbablyReaderable
|
||||
? content.extractedContentMarkdown
|
||||
: content.fullContentMarkdown;
|
||||
|
||||
if (bestContent != null) {
|
||||
await _insertMarkdownDocumentsSplitted(
|
||||
[Document(id: content.tabId, pageContent: bestContent)],
|
||||
);
|
||||
await _insertMarkdownDocumentsSplitted([
|
||||
Document(id: content.tabId, pageContent: bestContent),
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+9
-8
@@ -13,14 +13,15 @@ String _$documentRepositoryHash() =>
|
||||
@ProviderFor(DocumentRepository)
|
||||
final documentRepositoryProvider =
|
||||
AutoDisposeNotifierProvider<DocumentRepository, void>.internal(
|
||||
DocumentRepository.new,
|
||||
name: r'documentRepositoryProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$documentRepositoryHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
DocumentRepository.new,
|
||||
name: r'documentRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$documentRepositoryHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$DocumentRepository = AutoDisposeNotifier<void>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
+9
-8
@@ -38,14 +38,15 @@ class SqliteVectorStore extends VectorStore {
|
||||
required List<double> embedding,
|
||||
VectorStoreSimilaritySearch config = const VectorStoreSimilaritySearch(),
|
||||
}) async {
|
||||
Iterable<VectorResult> results = await _dao
|
||||
.vectorSearch(
|
||||
config: config,
|
||||
searchVectors: embedding,
|
||||
contextId: contextId,
|
||||
mainDocumentId: mainDocumentId,
|
||||
)
|
||||
.get();
|
||||
Iterable<VectorResult> results =
|
||||
await _dao
|
||||
.vectorSearch(
|
||||
config: config,
|
||||
searchVectors: embedding,
|
||||
contextId: contextId,
|
||||
mainDocumentId: mainDocumentId,
|
||||
)
|
||||
.get();
|
||||
|
||||
if (config.scoreThreshold != null) {
|
||||
results = results.where(
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ class DocumentUuid {
|
||||
final Uint8List _baseBytes;
|
||||
|
||||
DocumentUuid([Uint8List? baseBytes])
|
||||
: _baseBytes = baseBytes ?? _rng.generate();
|
||||
: _baseBytes = baseBytes ?? _rng.generate();
|
||||
|
||||
factory DocumentUuid.fromUuid(String uuid) {
|
||||
return DocumentUuid(UuidParsing.parseAsByteList(uuid));
|
||||
|
||||
+19
-16
@@ -39,7 +39,7 @@ List<String> _headerValueList(dynamic value) {
|
||||
return switch (value) {
|
||||
String _ => [value],
|
||||
List<String> _ => value,
|
||||
_ => throw Exception('Unsupported type')
|
||||
_ => throw Exception('Unsupported type'),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -59,8 +59,9 @@ DocumentParts? splitMarkdownDocument(
|
||||
chunkOverlap: chunkOverlap,
|
||||
);
|
||||
|
||||
final headerChunks =
|
||||
markdownHeaderSplitter.splitText(originalDoc.pageContent);
|
||||
final headerChunks = markdownHeaderSplitter.splitText(
|
||||
originalDoc.pageContent,
|
||||
);
|
||||
final docChunks = markdownTextSplitter.splitDocuments(headerChunks);
|
||||
|
||||
if (docChunks.length == 1) {
|
||||
@@ -85,10 +86,11 @@ DocumentParts? splitMarkdownDocument(
|
||||
...a.metadata,
|
||||
...b.metadata,
|
||||
for (final header in intersectingHeaders)
|
||||
header: {
|
||||
..._headerValueList(a.metadata[header]),
|
||||
..._headerValueList(b.metadata[header]),
|
||||
}.toList(),
|
||||
header:
|
||||
{
|
||||
..._headerValueList(a.metadata[header]),
|
||||
..._headerValueList(b.metadata[header]),
|
||||
}.toList(),
|
||||
},
|
||||
);
|
||||
},
|
||||
@@ -99,14 +101,15 @@ DocumentParts? splitMarkdownDocument(
|
||||
|
||||
return (
|
||||
mainDocumentId: mainDocumentId,
|
||||
parts: mergedDocChunks
|
||||
.mapIndexed(
|
||||
(i, doc) => Document(
|
||||
id: documentIdFactory.getDocumentPartUuid(i),
|
||||
pageContent: doc.pageContent,
|
||||
metadata: mergeMaps(originalDoc.metadata, doc.metadata),
|
||||
),
|
||||
)
|
||||
.toList()
|
||||
parts:
|
||||
mergedDocChunks
|
||||
.mapIndexed(
|
||||
(i, doc) => Document(
|
||||
id: documentIdFactory.getDocumentPartUuid(i),
|
||||
pageContent: doc.pageContent,
|
||||
metadata: mergeMaps(originalDoc.metadata, doc.metadata),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
);
|
||||
}
|
||||
@@ -13,25 +13,11 @@ import 'package:lensai/presentation/icons/tor_icons.dart';
|
||||
enum _DialogMode { create, edit }
|
||||
|
||||
const _timeoutOptions = <DropdownMenuItem<Duration?>>[
|
||||
DropdownMenuItem(
|
||||
child: Text('Immediately'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: Duration(minutes: 1),
|
||||
child: Text('1 minute'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: Duration(minutes: 5),
|
||||
child: Text('5 minutes'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: Duration(minutes: 15),
|
||||
child: Text('15 minutes'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: Duration(hours: 1),
|
||||
child: Text('1 hour'),
|
||||
),
|
||||
DropdownMenuItem(child: Text('Immediately')),
|
||||
DropdownMenuItem(value: Duration(minutes: 1), child: Text('1 minute')),
|
||||
DropdownMenuItem(value: Duration(minutes: 5), child: Text('5 minutes')),
|
||||
DropdownMenuItem(value: Duration(minutes: 15), child: Text('15 minutes')),
|
||||
DropdownMenuItem(value: Duration(hours: 1), child: Text('1 hour')),
|
||||
];
|
||||
|
||||
class ContainerEditScreen extends HookConsumerWidget {
|
||||
@@ -63,22 +49,22 @@ class ContainerEditScreen extends HookConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final selectedColor = useState(initialContainer.color);
|
||||
final contextualIdentity =
|
||||
useState(initialContainer.metadata.contextualIdentity);
|
||||
final contextualIdentity = useState(
|
||||
initialContainer.metadata.contextualIdentity,
|
||||
);
|
||||
final authSettings = useState(initialContainer.metadata.authSettings);
|
||||
final useProxy = useState(initialContainer.metadata.useProxy);
|
||||
|
||||
final textController =
|
||||
useTextEditingController(text: initialContainer.name);
|
||||
final textController = useTextEditingController(
|
||||
text: initialContainer.name,
|
||||
);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
switch (_mode) {
|
||||
_DialogMode.create => 'New Container',
|
||||
_DialogMode.edit => 'Edit Container',
|
||||
},
|
||||
),
|
||||
title: Text(switch (_mode) {
|
||||
_DialogMode.create => 'New Container',
|
||||
_DialogMode.edit => 'Edit Container',
|
||||
}),
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
@@ -95,7 +81,9 @@ class ContainerEditScreen extends HookConsumerWidget {
|
||||
|
||||
//Check for permissions, when auth is set or getting set
|
||||
if (initialContainer
|
||||
.metadata.authSettings.authenticationRequired ||
|
||||
.metadata
|
||||
.authSettings
|
||||
.authenticationRequired ||
|
||||
container.metadata.authSettings.authenticationRequired) {
|
||||
final authResult = await ref
|
||||
.read(localAuthenticationServiceProvider.notifier)
|
||||
@@ -161,8 +149,9 @@ class ContainerEditScreen extends HookConsumerWidget {
|
||||
onPressed: () async {
|
||||
final color = await showDialog<Color?>(
|
||||
context: context,
|
||||
builder: (context) =>
|
||||
ColorPickerDialog(selectedColor.value),
|
||||
builder:
|
||||
(context) =>
|
||||
ColorPickerDialog(selectedColor.value),
|
||||
);
|
||||
|
||||
if (color != null) {
|
||||
@@ -175,19 +164,22 @@ class ContainerEditScreen extends HookConsumerWidget {
|
||||
title: const Text('Cookie Isolation'),
|
||||
secondary: const Icon(MdiIcons.cookieLock),
|
||||
contentPadding: EdgeInsets.zero,
|
||||
onChanged: (_mode == _DialogMode.create)
|
||||
? (value) {
|
||||
contextualIdentity.value = value
|
||||
? initialContainer
|
||||
.metadata.contextualIdentity ??
|
||||
uuid.v4()
|
||||
: null;
|
||||
onChanged:
|
||||
(_mode == _DialogMode.create)
|
||||
? (value) {
|
||||
contextualIdentity.value =
|
||||
value
|
||||
? initialContainer
|
||||
.metadata
|
||||
.contextualIdentity ??
|
||||
uuid.v4()
|
||||
: null;
|
||||
|
||||
if (!value && useProxy.value) {
|
||||
useProxy.value = false;
|
||||
if (!value && useProxy.value) {
|
||||
useProxy.value = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
: null,
|
||||
: null,
|
||||
),
|
||||
SwitchListTile.adaptive(
|
||||
value: useProxy.value,
|
||||
@@ -196,19 +188,20 @@ class ContainerEditScreen extends HookConsumerWidget {
|
||||
contentPadding: EdgeInsets.zero,
|
||||
onChanged: switch (_mode) {
|
||||
_DialogMode.create => (value) {
|
||||
if (value && contextualIdentity.value == null) {
|
||||
contextualIdentity.value = initialContainer
|
||||
.metadata.contextualIdentity ??
|
||||
uuid.v4();
|
||||
}
|
||||
if (value && contextualIdentity.value == null) {
|
||||
contextualIdentity.value =
|
||||
initialContainer.metadata.contextualIdentity ??
|
||||
uuid.v4();
|
||||
}
|
||||
|
||||
useProxy.value = value;
|
||||
},
|
||||
_DialogMode.edit => (contextualIdentity.value != null)
|
||||
? (value) {
|
||||
useProxy.value = value;
|
||||
},
|
||||
_DialogMode.edit =>
|
||||
(contextualIdentity.value != null)
|
||||
? (value) {
|
||||
useProxy.value = value;
|
||||
}
|
||||
: null,
|
||||
: null,
|
||||
},
|
||||
),
|
||||
SwitchListTile.adaptive(
|
||||
@@ -224,9 +217,7 @@ class ContainerEditScreen extends HookConsumerWidget {
|
||||
if (authSettings.value.authenticationRequired)
|
||||
CheckboxListTile.adaptive(
|
||||
value: authSettings.value.lockOnAppBackground,
|
||||
title: const Text(
|
||||
'Auto-lock on background',
|
||||
),
|
||||
title: const Text('Auto-lock on background'),
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
onChanged: (value) {
|
||||
authSettings.value = authSettings.value.copyWith
|
||||
@@ -236,23 +227,21 @@ class ContainerEditScreen extends HookConsumerWidget {
|
||||
if (authSettings.value.authenticationRequired)
|
||||
CheckboxListTile.adaptive(
|
||||
value: authSettings.value.lockTimeout != null,
|
||||
title: const Text(
|
||||
'Timeout',
|
||||
),
|
||||
title: const Text('Timeout'),
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
onChanged: (value) {
|
||||
final newValue =
|
||||
value! ? _timeoutOptions[1].value : null;
|
||||
|
||||
authSettings.value =
|
||||
authSettings.value.copyWith.lockTimeout(newValue);
|
||||
authSettings.value = authSettings.value.copyWith
|
||||
.lockTimeout(newValue);
|
||||
},
|
||||
secondary: DropdownButton(
|
||||
value: authSettings.value.lockTimeout,
|
||||
items: _timeoutOptions,
|
||||
onChanged: (value) {
|
||||
authSettings.value =
|
||||
authSettings.value.copyWith.lockTimeout(value);
|
||||
authSettings.value = authSettings.value.copyWith
|
||||
.lockTimeout(value);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
@@ -19,9 +19,7 @@ class ContainerListScreen extends HookConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Containers'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('Containers')),
|
||||
body: HookConsumer(
|
||||
builder: (context, ref, child) {
|
||||
final containersAsync = ref.watch(containersWithCountProvider);
|
||||
@@ -30,79 +28,90 @@ class ContainerListScreen extends HookConsumerWidget {
|
||||
return Skeletonizer(
|
||||
enabled: containersAsync.isLoading,
|
||||
child: containersAsync.when(
|
||||
data: (containers) => FadingScroll(
|
||||
fadingSize: 25,
|
||||
builder: (context, controller) {
|
||||
return ListView.builder(
|
||||
controller: controller,
|
||||
itemCount: containers.length,
|
||||
itemBuilder: (context, index) {
|
||||
final container = containers[index];
|
||||
return Slidable(
|
||||
key: ValueKey(container.id),
|
||||
endActionPane: ActionPane(
|
||||
motion: const ScrollMotion(),
|
||||
children: [
|
||||
SlidableAction(
|
||||
onPressed: (context) async {
|
||||
await ref
|
||||
.read(containerRepositoryProvider.notifier)
|
||||
.deleteContainer(container.id);
|
||||
},
|
||||
backgroundColor:
|
||||
Theme.of(context).colorScheme.errorContainer,
|
||||
foregroundColor: Theme.of(context)
|
||||
.colorScheme
|
||||
.onErrorContainer,
|
||||
icon: Icons.delete,
|
||||
label: 'Delete',
|
||||
data:
|
||||
(containers) => FadingScroll(
|
||||
fadingSize: 25,
|
||||
builder: (context, controller) {
|
||||
return ListView.builder(
|
||||
controller: controller,
|
||||
itemCount: containers.length,
|
||||
itemBuilder: (context, index) {
|
||||
final container = containers[index];
|
||||
return Slidable(
|
||||
key: ValueKey(container.id),
|
||||
endActionPane: ActionPane(
|
||||
motion: const ScrollMotion(),
|
||||
children: [
|
||||
SlidableAction(
|
||||
onPressed: (context) async {
|
||||
await ref
|
||||
.read(
|
||||
containerRepositoryProvider.notifier,
|
||||
)
|
||||
.deleteContainer(container.id);
|
||||
},
|
||||
backgroundColor:
|
||||
Theme.of(
|
||||
context,
|
||||
).colorScheme.errorContainer,
|
||||
foregroundColor:
|
||||
Theme.of(
|
||||
context,
|
||||
).colorScheme.onErrorContainer,
|
||||
icon: Icons.delete,
|
||||
label: 'Delete',
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
child: ContainerListTile(
|
||||
container,
|
||||
isSelected: container.id == selectedContainer,
|
||||
onTap: () async {
|
||||
if (container.id == selectedContainer) {
|
||||
ref
|
||||
.read(selectedContainerProvider.notifier)
|
||||
.clearContainer();
|
||||
} else {
|
||||
final result = await ref
|
||||
.read(selectedContainerProvider.notifier)
|
||||
.setContainerId(container.id);
|
||||
child: ContainerListTile(
|
||||
container,
|
||||
isSelected: container.id == selectedContainer,
|
||||
onTap: () async {
|
||||
if (container.id == selectedContainer) {
|
||||
ref
|
||||
.read(selectedContainerProvider.notifier)
|
||||
.clearContainer();
|
||||
} else {
|
||||
final result = await ref
|
||||
.read(selectedContainerProvider.notifier)
|
||||
.setContainerId(container.id);
|
||||
|
||||
if (context.mounted &&
|
||||
result ==
|
||||
SetContainerResult.successHasProxy) {
|
||||
await ref
|
||||
.read(startProxyControllerProvider.notifier)
|
||||
.maybeStartProxy(context);
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
if (context.mounted &&
|
||||
result ==
|
||||
SetContainerResult.successHasProxy) {
|
||||
await ref
|
||||
.read(
|
||||
startProxyControllerProvider.notifier,
|
||||
)
|
||||
.maybeStartProxy(context);
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
error: (error, stackTrace) => SizedBox.shrink(),
|
||||
loading: () => ListView.builder(
|
||||
itemCount: 3,
|
||||
itemBuilder: (context, index) => ContainerListTile(
|
||||
ContainerData(id: 'null', color: Colors.transparent),
|
||||
isSelected: false,
|
||||
),
|
||||
),
|
||||
loading:
|
||||
() => ListView.builder(
|
||||
itemCount: 3,
|
||||
itemBuilder:
|
||||
(context, index) => ContainerListTile(
|
||||
ContainerData(id: 'null', color: Colors.transparent),
|
||||
isSelected: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () async {
|
||||
final initialColor =
|
||||
await ref.read(unusedRandomContainerColorProvider.future);
|
||||
final initialColor = await ref.read(
|
||||
unusedRandomContainerColorProvider.future,
|
||||
);
|
||||
|
||||
if (context.mounted) {
|
||||
final result = await context.push<ContainerData?>(
|
||||
|
||||
+44
-37
@@ -40,15 +40,18 @@ class ContainerChips extends HookConsumerWidget {
|
||||
() => searchTextController?.text,
|
||||
);
|
||||
|
||||
final containersAsync =
|
||||
ref.watch(matchSortedContainersWithCountProvider(searchText));
|
||||
final containersAsync = ref.watch(
|
||||
matchSortedContainersWithCountProvider(searchText),
|
||||
);
|
||||
|
||||
final dragTargetTabId = useValueNotifier<String?>(null);
|
||||
|
||||
return containersAsync.when(
|
||||
data: (containers) {
|
||||
final availableContainers = containerFilter
|
||||
.mapNotNull((filter) => containers.where(filter).toList()) ??
|
||||
final availableContainers =
|
||||
containerFilter.mapNotNull(
|
||||
(filter) => containers.where(filter).toList(),
|
||||
) ??
|
||||
containers;
|
||||
|
||||
if (selectedContainer == null &&
|
||||
@@ -66,16 +69,17 @@ class ContainerChips extends HookConsumerWidget {
|
||||
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'),
|
||||
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,
|
||||
itemWrap: (child, container) {
|
||||
return HookBuilder(
|
||||
@@ -85,7 +89,9 @@ class ContainerChips extends HookConsumerWidget {
|
||||
|
||||
return DragTarget<TabDragData>(
|
||||
onMove: (details) {
|
||||
ref.read(willAcceptDropProvider.notifier).setData(
|
||||
ref
|
||||
.read(willAcceptDropProvider.notifier)
|
||||
.setData(
|
||||
ContainerDropData(details.data.tabId),
|
||||
);
|
||||
|
||||
@@ -103,12 +109,14 @@ class ContainerChips extends HookConsumerWidget {
|
||||
.read(tabDataRepositoryProvider.notifier)
|
||||
.containerTabId(details.data.tabId);
|
||||
|
||||
final containerData =
|
||||
await containerId.mapNotNull(
|
||||
(containerId) => ref
|
||||
.read(containerRepositoryProvider.notifier)
|
||||
.getContainerData(containerId),
|
||||
);
|
||||
final containerData = await containerId
|
||||
.mapNotNull(
|
||||
(containerId) => ref
|
||||
.read(
|
||||
containerRepositoryProvider.notifier,
|
||||
)
|
||||
.getContainerData(containerId),
|
||||
);
|
||||
|
||||
if (container.metadata.contextualIdentity ==
|
||||
containerData?.metadata.contextualIdentity) {
|
||||
@@ -139,24 +147,26 @@ class ContainerChips extends HookConsumerWidget {
|
||||
context.findRenderObject() as RenderBox?;
|
||||
final position =
|
||||
renderBox?.localToGlobal(Offset.zero) ??
|
||||
Offset.zero;
|
||||
Offset.zero;
|
||||
|
||||
return OverlayPortal(
|
||||
controller: overlayController,
|
||||
overlayChildBuilder: (context) => Positioned(
|
||||
top: position.dy,
|
||||
left: position.dx,
|
||||
child: IgnorePointer(
|
||||
child: Transform.scale(
|
||||
scale: 1.1,
|
||||
child: child,
|
||||
overlayChildBuilder:
|
||||
(context) => Positioned(
|
||||
top: position.dy,
|
||||
left: position.dx,
|
||||
child: IgnorePointer(
|
||||
child: Transform.scale(
|
||||
scale: 1.1,
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
child: HookBuilder(
|
||||
builder: (context) {
|
||||
final dragTabId =
|
||||
useValueListenable(dragTargetTabId);
|
||||
final dragTabId = useValueListenable(
|
||||
dragTargetTabId,
|
||||
);
|
||||
|
||||
return Opacity(
|
||||
opacity: (dragTabId == null) ? 1.0 : 0.0,
|
||||
@@ -201,10 +211,7 @@ class ContainerChips extends HookConsumerWidget {
|
||||
);
|
||||
},
|
||||
error: (error, stackTrace) => const SizedBox.shrink(),
|
||||
loading: () => const SizedBox(
|
||||
height: 48,
|
||||
width: double.infinity,
|
||||
),
|
||||
loading: () => const SizedBox(height: 48, width: double.infinity),
|
||||
);
|
||||
}
|
||||
}
|
||||
+1
-4
@@ -28,10 +28,7 @@ class ContainerListTile extends HookWidget {
|
||||
title: Text(container.name ?? 'New Container'),
|
||||
trailing: IconButton(
|
||||
onPressed: () async {
|
||||
await context.push(
|
||||
ContainerEditRoute().location,
|
||||
extra: container,
|
||||
);
|
||||
await context.push(ContainerEditRoute().location, extra: container);
|
||||
},
|
||||
icon: const Icon(Icons.chevron_right),
|
||||
),
|
||||
|
||||
+163
-137
@@ -47,49 +47,55 @@ class _MaterialPickerState extends State<MaterialPicker> {
|
||||
Widget build(BuildContext context) {
|
||||
final isPortrait =
|
||||
MediaQuery.of(context).orientation == Orientation.portrait ||
|
||||
widget.portraitOnly;
|
||||
widget.portraitOnly;
|
||||
|
||||
Widget colorList() {
|
||||
return Container(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: const BoxDecoration(),
|
||||
child: Container(
|
||||
margin: isPortrait
|
||||
? const EdgeInsets.only(right: 10)
|
||||
: const EdgeInsets.only(bottom: 10),
|
||||
margin:
|
||||
isPortrait
|
||||
? const EdgeInsets.only(right: 10)
|
||||
: const EdgeInsets.only(bottom: 10),
|
||||
width: isPortrait ? 60 : null,
|
||||
height: isPortrait ? null : 60,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).cardColor,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: (Theme.of(context).brightness == Brightness.light)
|
||||
? (Theme.of(context).brightness == Brightness.light)
|
||||
? Colors.grey[300]!
|
||||
: Colors.black38
|
||||
: Colors.black38,
|
||||
color:
|
||||
(Theme.of(context).brightness == Brightness.light)
|
||||
? (Theme.of(context).brightness == Brightness.light)
|
||||
? Colors.grey[300]!
|
||||
: Colors.black38
|
||||
: Colors.black38,
|
||||
blurRadius: 10,
|
||||
),
|
||||
],
|
||||
border: isPortrait
|
||||
? Border(
|
||||
right: BorderSide(
|
||||
color: (Theme.of(context).brightness == Brightness.light)
|
||||
? Colors.grey[300]!
|
||||
: Colors.black38,
|
||||
border:
|
||||
isPortrait
|
||||
? Border(
|
||||
right: BorderSide(
|
||||
color:
|
||||
(Theme.of(context).brightness == Brightness.light)
|
||||
? Colors.grey[300]!
|
||||
: Colors.black38,
|
||||
),
|
||||
)
|
||||
: Border(
|
||||
top: BorderSide(
|
||||
color:
|
||||
(Theme.of(context).brightness == Brightness.light)
|
||||
? Colors.grey[300]!
|
||||
: Colors.black38,
|
||||
),
|
||||
),
|
||||
)
|
||||
: Border(
|
||||
top: BorderSide(
|
||||
color: (Theme.of(context).brightness == Brightness.light)
|
||||
? Colors.grey[300]!
|
||||
: Colors.black38,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: ScrollConfiguration(
|
||||
behavior: ScrollConfiguration.of(context)
|
||||
.copyWith(dragDevices: PointerDeviceKind.values.toSet()),
|
||||
behavior: ScrollConfiguration.of(
|
||||
context,
|
||||
).copyWith(dragDevices: PointerDeviceKind.values.toSet()),
|
||||
child: FadingScroll(
|
||||
fadingSize: 25,
|
||||
builder: (context, controller) {
|
||||
@@ -112,9 +118,10 @@ class _MaterialPickerState extends State<MaterialPicker> {
|
||||
},
|
||||
child: Container(
|
||||
color: const Color(0x00000000),
|
||||
padding: isPortrait
|
||||
? const EdgeInsets.fromLTRB(0, 7, 0, 7)
|
||||
: const EdgeInsets.fromLTRB(7, 0, 7, 0),
|
||||
padding:
|
||||
isPortrait
|
||||
? const EdgeInsets.fromLTRB(0, 7, 0, 7)
|
||||
: const EdgeInsets.fromLTRB(7, 0, 7, 0),
|
||||
child: Align(
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
@@ -123,33 +130,38 @@ class _MaterialPickerState extends State<MaterialPicker> {
|
||||
decoration: BoxDecoration(
|
||||
color: colorType,
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: _currentColorType == colors
|
||||
? [
|
||||
if (colorType ==
|
||||
Theme.of(context).cardColor)
|
||||
BoxShadow(
|
||||
color:
|
||||
(Theme.of(context).brightness ==
|
||||
Brightness.light)
|
||||
? Colors.grey[300]!
|
||||
: Colors.black38,
|
||||
blurRadius: 10,
|
||||
)
|
||||
else
|
||||
BoxShadow(
|
||||
color: colorType,
|
||||
blurRadius: 10,
|
||||
),
|
||||
]
|
||||
: null,
|
||||
border: colorType == Theme.of(context).cardColor
|
||||
? Border.all(
|
||||
color: (Theme.of(context).brightness ==
|
||||
Brightness.light)
|
||||
? Colors.grey[300]!
|
||||
: Colors.black38,
|
||||
)
|
||||
: null,
|
||||
boxShadow:
|
||||
_currentColorType == colors
|
||||
? [
|
||||
if (colorType ==
|
||||
Theme.of(context).cardColor)
|
||||
BoxShadow(
|
||||
color:
|
||||
(Theme.of(
|
||||
context,
|
||||
).brightness ==
|
||||
Brightness.light)
|
||||
? Colors.grey[300]!
|
||||
: Colors.black38,
|
||||
blurRadius: 10,
|
||||
)
|
||||
else
|
||||
BoxShadow(
|
||||
color: colorType,
|
||||
blurRadius: 10,
|
||||
),
|
||||
]
|
||||
: null,
|
||||
border:
|
||||
colorType == Theme.of(context).cardColor
|
||||
? Border.all(
|
||||
color:
|
||||
(Theme.of(context).brightness ==
|
||||
Brightness.light)
|
||||
? Colors.grey[300]!
|
||||
: Colors.black38,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -171,8 +183,9 @@ class _MaterialPickerState extends State<MaterialPicker> {
|
||||
|
||||
Widget shadingList() {
|
||||
return ScrollConfiguration(
|
||||
behavior: ScrollConfiguration.of(context)
|
||||
.copyWith(dragDevices: PointerDeviceKind.values.toSet()),
|
||||
behavior: ScrollConfiguration.of(
|
||||
context,
|
||||
).copyWith(dragDevices: PointerDeviceKind.values.toSet()),
|
||||
child: FadingScroll(
|
||||
fadingSize: 25,
|
||||
builder: (context, controller) {
|
||||
@@ -184,8 +197,9 @@ class _MaterialPickerState extends State<MaterialPicker> {
|
||||
const Padding(padding: EdgeInsets.only(top: 15))
|
||||
else
|
||||
const Padding(padding: EdgeInsets.only(left: 15)),
|
||||
...shadingTypes(_currentColorType)
|
||||
.map((Map<Color, String> colors) {
|
||||
...shadingTypes(_currentColorType).map((
|
||||
Map<Color, String> colors,
|
||||
) {
|
||||
final Color color = colors.keys.first;
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
@@ -194,99 +208,111 @@ class _MaterialPickerState extends State<MaterialPicker> {
|
||||
},
|
||||
child: Container(
|
||||
color: const Color(0x00000000),
|
||||
margin: isPortrait
|
||||
? const EdgeInsets.only(right: 10)
|
||||
: const EdgeInsets.only(bottom: 10),
|
||||
padding: isPortrait
|
||||
? const EdgeInsets.fromLTRB(0, 7, 0, 7)
|
||||
: const EdgeInsets.fromLTRB(7, 0, 7, 0),
|
||||
margin:
|
||||
isPortrait
|
||||
? const EdgeInsets.only(right: 10)
|
||||
: const EdgeInsets.only(bottom: 10),
|
||||
padding:
|
||||
isPortrait
|
||||
? const EdgeInsets.fromLTRB(0, 7, 0, 7)
|
||||
: const EdgeInsets.fromLTRB(7, 0, 7, 0),
|
||||
child: Align(
|
||||
child: AnimatedContainer(
|
||||
curve: Curves.fastOutSlowIn,
|
||||
duration: const Duration(milliseconds: 500),
|
||||
width: isPortrait
|
||||
? (_currentShading == color ? 250 : 230)
|
||||
: (_currentShading == color ? 50 : 30),
|
||||
width:
|
||||
isPortrait
|
||||
? (_currentShading == color ? 250 : 230)
|
||||
: (_currentShading == color ? 50 : 30),
|
||||
height: isPortrait ? 50 : 220,
|
||||
decoration: BoxDecoration(
|
||||
color: color,
|
||||
boxShadow: _currentShading == color
|
||||
? [
|
||||
if ((color == Colors.white) ||
|
||||
(color == Colors.black))
|
||||
BoxShadow(
|
||||
color: (Theme.of(context).brightness ==
|
||||
Brightness.light)
|
||||
? Colors.grey[300]!
|
||||
: Colors.black38,
|
||||
blurRadius: 10,
|
||||
)
|
||||
else
|
||||
BoxShadow(
|
||||
color: color,
|
||||
blurRadius: 10,
|
||||
),
|
||||
]
|
||||
: null,
|
||||
border: (color == Colors.white) ||
|
||||
(color == Colors.black)
|
||||
? Border.all(
|
||||
color: (Theme.of(context).brightness ==
|
||||
Brightness.light)
|
||||
? Colors.grey[300]!
|
||||
: Colors.black38,
|
||||
)
|
||||
: null,
|
||||
boxShadow:
|
||||
_currentShading == color
|
||||
? [
|
||||
if ((color == Colors.white) ||
|
||||
(color == Colors.black))
|
||||
BoxShadow(
|
||||
color:
|
||||
(Theme.of(context).brightness ==
|
||||
Brightness.light)
|
||||
? Colors.grey[300]!
|
||||
: Colors.black38,
|
||||
blurRadius: 10,
|
||||
)
|
||||
else
|
||||
BoxShadow(color: color, blurRadius: 10),
|
||||
]
|
||||
: null,
|
||||
border:
|
||||
(color == Colors.white) ||
|
||||
(color == Colors.black)
|
||||
? Border.all(
|
||||
color:
|
||||
(Theme.of(context).brightness ==
|
||||
Brightness.light)
|
||||
? Colors.grey[300]!
|
||||
: Colors.black38,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
child: widget.enableLabel
|
||||
? isPortrait
|
||||
? Row(
|
||||
children: [
|
||||
Text(
|
||||
' ${colors.values.first}',
|
||||
style: TextStyle(
|
||||
color: useWhiteForeground(color)
|
||||
? Colors.white
|
||||
: Colors.black,
|
||||
child:
|
||||
widget.enableLabel
|
||||
? isPortrait
|
||||
? Row(
|
||||
children: [
|
||||
Text(
|
||||
' ${colors.values.first}',
|
||||
style: TextStyle(
|
||||
color:
|
||||
useWhiteForeground(color)
|
||||
? Colors.white
|
||||
: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
'#${color.toString().replaceFirst('Color(0xff', '').replaceFirst(')', '').toUpperCase()} ',
|
||||
style: TextStyle(
|
||||
color: useWhiteForeground(color)
|
||||
? Colors.white
|
||||
: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
'#${color.toString().replaceFirst('Color(0xff', '').replaceFirst(')', '').toUpperCase()} ',
|
||||
style: TextStyle(
|
||||
color:
|
||||
useWhiteForeground(color)
|
||||
? Colors.white
|
||||
: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: AnimatedOpacity(
|
||||
duration: const Duration(
|
||||
milliseconds: 300,
|
||||
),
|
||||
],
|
||||
)
|
||||
: AnimatedOpacity(
|
||||
duration:
|
||||
const Duration(milliseconds: 300),
|
||||
opacity: _currentShading == color ? 1 : 0,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(top: 16),
|
||||
alignment: Alignment.topCenter,
|
||||
child: Text(
|
||||
colors.values.first,
|
||||
style: TextStyle(
|
||||
color: useWhiteForeground(color)
|
||||
? Colors.white
|
||||
: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14,
|
||||
opacity:
|
||||
_currentShading == color ? 1 : 0,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 16,
|
||||
),
|
||||
alignment: Alignment.topCenter,
|
||||
child: Text(
|
||||
colors.values.first,
|
||||
style: TextStyle(
|
||||
color:
|
||||
useWhiteForeground(color)
|
||||
? Colors.white
|
||||
: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14,
|
||||
),
|
||||
softWrap: false,
|
||||
),
|
||||
softWrap: false,
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
)
|
||||
: const SizedBox(),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -17,11 +17,12 @@ bool useWhiteForeground(Color backgroundColor, {double bias = 0.0}) {
|
||||
// return 1.05 / (color.computeLuminance() + 0.05) > 4.5;
|
||||
|
||||
// New:
|
||||
final v = sqrt(
|
||||
pow(backgroundColor.r, 2) * 0.299 +
|
||||
pow(backgroundColor.g, 2) * 0.587 +
|
||||
pow(backgroundColor.b, 2) * 0.114,
|
||||
).round();
|
||||
final v =
|
||||
sqrt(
|
||||
pow(backgroundColor.r, 2) * 0.299 +
|
||||
pow(backgroundColor.g, 2) * 0.587 +
|
||||
pow(backgroundColor.b, 2) * 0.114,
|
||||
).round();
|
||||
return v < (130 + bias);
|
||||
}
|
||||
|
||||
@@ -54,9 +55,20 @@ List<Map<Color, String>> shadingTypes(List<Color> colors) {
|
||||
for (final Color colorType in colors) {
|
||||
if (colorType == Colors.grey) {
|
||||
result.addAll(
|
||||
[50, 100, 200, 300, 350, 400, 500, 600, 700, 800, 850, 900]
|
||||
.map((int shade) => {Colors.grey[shade]!: shade.toString()})
|
||||
.toList(),
|
||||
[
|
||||
50,
|
||||
100,
|
||||
200,
|
||||
300,
|
||||
350,
|
||||
400,
|
||||
500,
|
||||
600,
|
||||
700,
|
||||
800,
|
||||
850,
|
||||
900,
|
||||
].map((int shade) => {Colors.grey[shade]!: shade.toString()}).toList(),
|
||||
);
|
||||
} else if (colorType == Colors.black || colorType == Colors.white) {
|
||||
result.addAll([
|
||||
@@ -65,15 +77,27 @@ List<Map<Color, String>> shadingTypes(List<Color> colors) {
|
||||
]);
|
||||
} else if (colorType is MaterialAccentColor) {
|
||||
result.addAll(
|
||||
[100, 200, 400, 700]
|
||||
.map((int shade) => {colorType[shade]!: 'A$shade'})
|
||||
.toList(),
|
||||
[
|
||||
100,
|
||||
200,
|
||||
400,
|
||||
700,
|
||||
].map((int shade) => {colorType[shade]!: 'A$shade'}).toList(),
|
||||
);
|
||||
} else if (colorType is MaterialColor) {
|
||||
result.addAll(
|
||||
[50, 100, 200, 300, 400, 500, 600, 700, 800, 900]
|
||||
.map((int shade) => {colorType[shade]!: shade.toString()})
|
||||
.toList(),
|
||||
[
|
||||
50,
|
||||
100,
|
||||
200,
|
||||
300,
|
||||
400,
|
||||
500,
|
||||
600,
|
||||
700,
|
||||
800,
|
||||
900,
|
||||
].map((int shade) => {colorType[shade]!: shade.toString()}).toList(),
|
||||
);
|
||||
} else {
|
||||
result.add({const Color(0x00000000): ''});
|
||||
|
||||
Reference in new issue
Block a user