Skip to content

Commit c1793c2

Browse files
animatorabhinavs1920
authored andcommitted
Fixes foss42#644
1 parent 9edfbf5 commit c1793c2

File tree

1 file changed

+61
-2
lines changed

1 file changed

+61
-2
lines changed

lib/widgets/previewer_json.dart

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,24 +179,83 @@ class _JsonPreviewerState extends State<JsonPreviewer> {
179179
Row(
180180
mainAxisAlignment: MainAxisAlignment.end,
181181
children: [
182+
Expanded(
183+
child: Container(
184+
decoration: BoxDecoration(
185+
color: Theme.of(context).colorScheme.surface,
186+
border: Border.all(
187+
color: Theme.of(context)
188+
.colorScheme
189+
.surfaceContainerHighest),
190+
borderRadius: kBorderRadius8,
191+
),
192+
child: Row(
193+
children: [
194+
const Padding(
195+
padding: kPh4,
196+
child: Icon(
197+
Icons.search,
198+
size: 16,
199+
),
200+
),
201+
Expanded(
202+
child: JsonSearchField(
203+
controller: searchController,
204+
onChanged: (term) => state.search(term),
205+
),
206+
),
207+
const SizedBox(
208+
width: 8,
209+
),
210+
if (state.searchResults.isNotEmpty)
211+
Text(_searchFocusText(),
212+
style:
213+
Theme.of(context).textTheme.bodySmall),
214+
if (state.searchResults.isNotEmpty)
215+
IconButton(
216+
visualDensity: VisualDensity.compact,
217+
onPressed: () {
218+
store.focusPreviousSearchResult();
219+
_scrollToSearchMatch();
220+
},
221+
icon: const Icon(Icons.arrow_drop_up),
222+
),
223+
if (state.searchResults.isNotEmpty)
224+
IconButton(
225+
visualDensity: VisualDensity.compact,
226+
onPressed: () {
227+
store.focusNextSearchResult();
228+
_scrollToSearchMatch();
229+
},
230+
icon: const Icon(Icons.arrow_drop_down),
231+
),
232+
],
233+
),
234+
),
235+
),
182236
ADTextButton(
183237
icon: Icons.unfold_more,
184-
showLabel: constraints.minWidth > kMinWindowSize.width,
238+
showLabel:
239+
(constraints.minWidth > kMinWindowSize.width) &&
240+
!kIsMobile,
185241
label: 'Expand All',
186242
labelTextStyle: kTextStyleButtonSmall,
187243
onPressed:
188244
state.areAllExpanded() ? null : state.expandAll,
189245
),
190246
ADTextButton(
191247
icon: Icons.unfold_less,
192-
showLabel: constraints.minWidth > kMinWindowSize.width,
248+
showLabel:
249+
(constraints.minWidth > kMinWindowSize.width) &&
250+
!kIsMobile,
193251
label: 'Collapse All',
194252
labelTextStyle: kTextStyleButtonSmall,
195253
onPressed:
196254
state.areAllCollapsed() ? null : state.collapseAll,
197255
),
198256
],
199257
),
258+
kVSpacer6,
200259
Expanded(
201260
child: JsonExplorer(
202261
nodes: state.displayNodes,

0 commit comments

Comments
 (0)