mirror of
https://github.com/foss42/apidash.git
synced 2025-10-19 20:54:32 +08:00
Update search field
This commit is contained in:
@ -7,6 +7,7 @@ import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
|||||||
import 'package:url_launcher/url_launcher_string.dart';
|
import 'package:url_launcher/url_launcher_string.dart';
|
||||||
import '../consts.dart';
|
import '../consts.dart';
|
||||||
import "snackbars.dart";
|
import "snackbars.dart";
|
||||||
|
import 'textfields.dart';
|
||||||
|
|
||||||
class JsonPreviewerColor {
|
class JsonPreviewerColor {
|
||||||
const JsonPreviewerColor._();
|
const JsonPreviewerColor._();
|
||||||
@ -214,23 +215,37 @@ class _JsonPreviewerState extends State<JsonPreviewer> {
|
|||||||
: dataExplorerThemeDark,
|
: dataExplorerThemeDark,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Row(
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).colorScheme.background,
|
||||||
|
border: Border.all(
|
||||||
|
color: Theme.of(context).colorScheme.surfaceVariant),
|
||||||
|
borderRadius: kBorderRadius8,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
|
const Padding(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 8.0),
|
||||||
|
child: Icon(
|
||||||
|
Icons.search,
|
||||||
|
size: 18,
|
||||||
|
),
|
||||||
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextField(
|
child: JsonSearchField(
|
||||||
controller: searchController,
|
controller: searchController,
|
||||||
onChanged: (term) => state.search(term),
|
onChanged: (term) => state.search(term),
|
||||||
decoration: const InputDecoration(
|
|
||||||
hintText: 'Search',
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 8,
|
width: 8,
|
||||||
),
|
),
|
||||||
if (state.searchResults.isNotEmpty) Text(_searchFocusText()),
|
if (state.searchResults.isNotEmpty)
|
||||||
|
Text(_searchFocusText(),
|
||||||
|
style: Theme.of(context).textTheme.bodySmall),
|
||||||
if (state.searchResults.isNotEmpty)
|
if (state.searchResults.isNotEmpty)
|
||||||
IconButton(
|
IconButton(
|
||||||
|
visualDensity: VisualDensity.compact,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
store.focusPreviousSearchResult();
|
store.focusPreviousSearchResult();
|
||||||
_scrollToSearchMatch();
|
_scrollToSearchMatch();
|
||||||
@ -239,6 +254,7 @@ class _JsonPreviewerState extends State<JsonPreviewer> {
|
|||||||
),
|
),
|
||||||
if (state.searchResults.isNotEmpty)
|
if (state.searchResults.isNotEmpty)
|
||||||
IconButton(
|
IconButton(
|
||||||
|
visualDensity: VisualDensity.compact,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
store.focusNextSearchResult();
|
store.focusNextSearchResult();
|
||||||
_scrollToSearchMatch();
|
_scrollToSearchMatch();
|
||||||
@ -247,8 +263,6 @@ class _JsonPreviewerState extends State<JsonPreviewer> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(
|
|
||||||
height: 16.0,
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -114,7 +114,7 @@ class JsonSearchField extends StatelessWidget {
|
|||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
isDense: true,
|
isDense: true,
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
hintText: 'Search',
|
hintText: 'Search..',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user