Skip to content

Commit 9edfbf5

Browse files
animatorabhinavs1920
authored andcommitted
Refactor JSON Previewer buttons
1 parent 6b4e27e commit 9edfbf5

File tree

1 file changed

+4
-71
lines changed

1 file changed

+4
-71
lines changed

lib/widgets/previewer_json.dart

Lines changed: 4 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -177,93 +177,26 @@ class _JsonPreviewerState extends State<JsonPreviewer> {
177177
crossAxisAlignment: CrossAxisAlignment.start,
178178
children: [
179179
Row(
180-
mainAxisAlignment: MainAxisAlignment.end,
181-
children: constraints.minWidth > kMinWindowSize.width
182-
? [
183-
TextButton(
184-
onPressed: state.areAllExpanded()
185-
? null
186-
: state.expandAll,
187-
child: const Text(
188-
'Expand All',
189-
style: kTextStyleButtonSmall,
190-
),
191-
),
192-
TextButton(
193-
onPressed: state.areAllCollapsed()
194-
? null
195-
: state.collapseAll,
196-
child: const Text(
197-
'Collapse All',
198-
style: kTextStyleButtonSmall,
199-
),
200-
),
201-
]
202-
: [
203-
IconButton(
204-
tooltip: "Expand All",
205-
color: Theme.of(context).colorScheme.primary,
206-
visualDensity: VisualDensity.compact,
207-
onPressed: state.areAllExpanded()
208-
? null
209-
: state.expandAll,
210-
icon: const Icon(
211-
Icons.unfold_more,
212-
size: 16,
213-
),
214-
),
215-
const SizedBox(
216-
width: 8,
217-
),
218-
if (state.searchResults.isNotEmpty)
219-
Text(_searchFocusText(),
220-
style:
221-
Theme.of(context).textTheme.bodySmall),
222-
if (state.searchResults.isNotEmpty)
223-
IconButton(
224-
visualDensity: VisualDensity.compact,
225-
onPressed: () {
226-
store.focusPreviousSearchResult();
227-
_scrollToSearchMatch();
228-
},
229-
icon: const Icon(Icons.arrow_drop_up),
230-
),
231-
if (state.searchResults.isNotEmpty)
232-
IconButton(
233-
visualDensity: VisualDensity.compact,
234-
onPressed: () {
235-
store.focusNextSearchResult();
236-
_scrollToSearchMatch();
237-
},
238-
icon: const Icon(Icons.arrow_drop_down),
239-
),
240-
],
241-
),
242-
),
243-
),
180+
mainAxisAlignment: MainAxisAlignment.end,
181+
children: [
244182
ADTextButton(
245183
icon: Icons.unfold_more,
246-
showLabel:
247-
(constraints.minWidth > kMinWindowSize.width) &&
248-
!kIsMobile,
184+
showLabel: constraints.minWidth > kMinWindowSize.width,
249185
label: 'Expand All',
250186
labelTextStyle: kTextStyleButtonSmall,
251187
onPressed:
252188
state.areAllExpanded() ? null : state.expandAll,
253189
),
254190
ADTextButton(
255191
icon: Icons.unfold_less,
256-
showLabel:
257-
(constraints.minWidth > kMinWindowSize.width) &&
258-
!kIsMobile,
192+
showLabel: constraints.minWidth > kMinWindowSize.width,
259193
label: 'Collapse All',
260194
labelTextStyle: kTextStyleButtonSmall,
261195
onPressed:
262196
state.areAllCollapsed() ? null : state.collapseAll,
263197
),
264198
],
265199
),
266-
kVSpacer6,
267200
Expanded(
268201
child: JsonExplorer(
269202
nodes: state.displayNodes,

0 commit comments

Comments
 (0)