scroll to setting search entry and threshold for search box

This commit is contained in:
Fabian Freund
2026-05-23 18:12:58 +02:00
parent 407daad06d
commit 696ea84412
4 changed files with 256 additions and 17 deletions
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2024-2026 Fabian Freund.
*
* This file is part of WebLibre
* (see https://weblibre.eu).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'pending_settings_highlight.g.dart';
/// Holds the [SettingsEntryDefinition.title] that a destination settings
/// screen should auto-scroll to and briefly pulse after navigation. Set by
/// the global settings search before pushing the destination route; consumed
/// (and cleared) by the matching entry once it has been highlighted.
@Riverpod(keepAlive: true)
class PendingSettingsHighlight extends _$PendingSettingsHighlight {
@override
String? build() => null;
// ignore: use_setters_to_change_properties
void set(String? title) {
state = title;
}
void clear() {
state = null;
}
}
@@ -0,0 +1,80 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'pending_settings_highlight.dart';
// **************************************************************************
// RiverpodGenerator
// **************************************************************************
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint, type=warning
/// Holds the [SettingsEntryDefinition.title] that a destination settings
/// screen should auto-scroll to and briefly pulse after navigation. Set by
/// the global settings search before pushing the destination route; consumed
/// (and cleared) by the matching entry once it has been highlighted.
@ProviderFor(PendingSettingsHighlight)
final pendingSettingsHighlightProvider = PendingSettingsHighlightProvider._();
/// Holds the [SettingsEntryDefinition.title] that a destination settings
/// screen should auto-scroll to and briefly pulse after navigation. Set by
/// the global settings search before pushing the destination route; consumed
/// (and cleared) by the matching entry once it has been highlighted.
final class PendingSettingsHighlightProvider
extends $NotifierProvider<PendingSettingsHighlight, String?> {
/// Holds the [SettingsEntryDefinition.title] that a destination settings
/// screen should auto-scroll to and briefly pulse after navigation. Set by
/// the global settings search before pushing the destination route; consumed
/// (and cleared) by the matching entry once it has been highlighted.
PendingSettingsHighlightProvider._()
: super(
from: null,
argument: null,
retry: null,
name: r'pendingSettingsHighlightProvider',
isAutoDispose: false,
dependencies: null,
$allTransitiveDependencies: null,
);
@override
String debugGetCreateSourceHash() => _$pendingSettingsHighlightHash();
@$internal
@override
PendingSettingsHighlight create() => PendingSettingsHighlight();
/// {@macro riverpod.override_with_value}
Override overrideWithValue(String? value) {
return $ProviderOverride(
origin: this,
providerOverride: $SyncValueProvider<String?>(value),
);
}
}
String _$pendingSettingsHighlightHash() =>
r'e64c23c22991e94ec6115ac27b5d7b9d33b801be';
/// Holds the [SettingsEntryDefinition.title] that a destination settings
/// screen should auto-scroll to and briefly pulse after navigation. Set by
/// the global settings search before pushing the destination route; consumed
/// (and cleared) by the matching entry once it has been highlighted.
abstract class _$PendingSettingsHighlight extends $Notifier<String?> {
String? build();
@$mustCallSuper
@override
void runBuild() {
final ref = this.ref as $Ref<String?, String?>;
final element =
ref.element
as $ClassProviderElement<
AnyNotifier<String?, String?>,
String?,
Object?,
Object?
>;
element.handleCreate(ref, build);
}
}