mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 10:49:49 +08:00
feat: add indicator for request scripts
Shows an indicator on the 'Scripts' tab when pre-request or post-request scripts exist for the selected request. Updates the selected tab text color in the scripts pane for better visibility.
This commit is contained in:
@@ -28,6 +28,12 @@ class EditRestRequestPane extends ConsumerWidget {
|
|||||||
.select((value) => value?.httpRequestModel?.hasBody)) ??
|
.select((value) => value?.httpRequestModel?.hasBody)) ??
|
||||||
false;
|
false;
|
||||||
|
|
||||||
|
final scriptsLength = ref.watch(selectedRequestModelProvider
|
||||||
|
.select((value) => value?.preRequestScript.length)) ??
|
||||||
|
ref.watch(selectedRequestModelProvider
|
||||||
|
.select((value) => value?.postRequestScript.length)) ??
|
||||||
|
0;
|
||||||
|
|
||||||
return RequestPane(
|
return RequestPane(
|
||||||
selectedId: selectedId,
|
selectedId: selectedId,
|
||||||
codePaneVisible: codePaneVisible,
|
codePaneVisible: codePaneVisible,
|
||||||
@@ -45,7 +51,7 @@ class EditRestRequestPane extends ConsumerWidget {
|
|||||||
paramLength > 0,
|
paramLength > 0,
|
||||||
headerLength > 0,
|
headerLength > 0,
|
||||||
hasBody,
|
hasBody,
|
||||||
false, // TODO: Add indicator condition once it is added to [selectedRequestModelProvider]
|
scriptsLength > 0,
|
||||||
],
|
],
|
||||||
tabLabels: const [
|
tabLabels: const [
|
||||||
kLabelURLParams,
|
kLabelURLParams,
|
||||||
|
|||||||
@@ -73,6 +73,11 @@ class _ScriptsCodePaneState extends ConsumerState<ScriptsCodePane> {
|
|||||||
tabs[i],
|
tabs[i],
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
|
color: _selectedTabIndex == i
|
||||||
|
? Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.onSecondaryFixedVariant
|
||||||
|
: Theme.of(context).colorScheme.onSurface,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
selected: _selectedTabIndex == i,
|
selected: _selectedTabIndex == i,
|
||||||
|
|||||||
Reference in New Issue
Block a user