mirror of
https://github.com/foss42/apidash.git
synced 2025-07-03 06:27:26 +08:00
feat: update scripts code pane to use ad dropdown button
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import 'package:apidash/widgets/scripts_editor_pane.dart';
|
||||
import 'package:apidash_design_system/apidash_design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_code_editor/flutter_code_editor.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
@ -40,7 +41,7 @@ class _ScriptsCodePaneState extends ConsumerState<ScriptsCodePane> {
|
||||
);
|
||||
});
|
||||
|
||||
final tabs = ["Pre Request", "Post Response"];
|
||||
final tabs = [(0, "Pre Request"), (1, "Post Response")];
|
||||
final content = [
|
||||
ScriptsEditorPane(
|
||||
controller: preReqCodeController,
|
||||
@ -56,28 +57,9 @@ class _ScriptsCodePaneState extends ConsumerState<ScriptsCodePane> {
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: DropdownButton<int>(
|
||||
focusColor: Theme.of(context).colorScheme.surface,
|
||||
icon: Icon(
|
||||
Icons.arrow_drop_down_rounded,
|
||||
size: 22,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(9),
|
||||
elevation: 4,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
fontSize: 12,
|
||||
),
|
||||
underline: Container(
|
||||
height: 0,
|
||||
),
|
||||
child: ADDropdownButton<int>(
|
||||
value: _selectedTabIndex,
|
||||
items: tabs.asMap().entries.map((entry) {
|
||||
return DropdownMenuItem<int>(
|
||||
value: entry.key,
|
||||
child: Text(entry.value),
|
||||
);
|
||||
}).toList(),
|
||||
values: tabs,
|
||||
onChanged: (int? newValue) {
|
||||
if (newValue != null) {
|
||||
setState(() {
|
||||
|
@ -153,8 +153,6 @@ Future<
|
||||
try {
|
||||
resultingRequest = HttpRequestModel.fromJson(
|
||||
Map<String, Object?>.from(resultMap['request']));
|
||||
log(resultingRequest.toString());
|
||||
log("Resmap req/; ${resultMap['request'].toString()}");
|
||||
} catch (e) {
|
||||
print("Error deserializing modified request from script: $e");
|
||||
//TODO: Handle error - maybe keep original request?
|
||||
|
18
pubspec.lock
18
pubspec.lock
@ -333,7 +333,7 @@ packages:
|
||||
path: "packages/curl_parser"
|
||||
relative: true
|
||||
source: path
|
||||
version: "0.1.2"
|
||||
version: "0.1.3"
|
||||
dart_style:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -552,6 +552,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.0"
|
||||
flutter_highlighter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_highlighter
|
||||
sha256: "93173afd47a9ada53f3176371755e7ea4a1065362763976d06d6adfb4d946e10"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.1.1"
|
||||
flutter_hooks:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -703,6 +711,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.0"
|
||||
highlighter:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: highlighter
|
||||
sha256: "92180c72b9da8758e1acf39a45aa305a97dcfe2fdc8f3d1d2947c23f2772bfbc"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.1.1"
|
||||
hive:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
Reference in New Issue
Block a user