mirror of
https://github.com/foss42/apidash.git
synced 2025-06-18 12:28:35 +08:00
Update HTTPVerb
This commit is contained in:
@ -28,27 +28,14 @@ Color getResponseStatusCodeColor(int? statusCode,
|
||||
|
||||
Color getHTTPMethodColor(HTTPVerb method,
|
||||
{Brightness brightness = Brightness.light}) {
|
||||
Color col;
|
||||
switch (method) {
|
||||
case HTTPVerb.get:
|
||||
col = kColorHttpMethodGet;
|
||||
break;
|
||||
case HTTPVerb.head:
|
||||
col = kColorHttpMethodHead;
|
||||
break;
|
||||
case HTTPVerb.post:
|
||||
col = kColorHttpMethodPost;
|
||||
break;
|
||||
case HTTPVerb.put:
|
||||
col = kColorHttpMethodPut;
|
||||
break;
|
||||
case HTTPVerb.patch:
|
||||
col = kColorHttpMethodPatch;
|
||||
break;
|
||||
case HTTPVerb.delete:
|
||||
col = kColorHttpMethodDelete;
|
||||
break;
|
||||
}
|
||||
Color col = switch (method) {
|
||||
HTTPVerb.get => kColorHttpMethodGet,
|
||||
HTTPVerb.head => kColorHttpMethodHead,
|
||||
HTTPVerb.post => kColorHttpMethodPost,
|
||||
HTTPVerb.put => kColorHttpMethodPut,
|
||||
HTTPVerb.patch => kColorHttpMethodPatch,
|
||||
HTTPVerb.delete => kColorHttpMethodDelete,
|
||||
};
|
||||
if (brightness == Brightness.dark) {
|
||||
col = getDarkModeColor(col);
|
||||
}
|
||||
@ -73,12 +60,9 @@ double? getJsonPreviewerMaxRootNodeWidth(double w) {
|
||||
}
|
||||
|
||||
GlobalKey<ScaffoldState> getScaffoldKey(int railIdx) {
|
||||
switch (railIdx) {
|
||||
case 1:
|
||||
return kEnvScaffoldKey;
|
||||
case 2:
|
||||
return kHisScaffoldKey;
|
||||
default:
|
||||
return kHomeScaffoldKey;
|
||||
}
|
||||
return switch (railIdx) {
|
||||
1 => kEnvScaffoldKey,
|
||||
2 => kHisScaffoldKey,
|
||||
_ => kHomeScaffoldKey,
|
||||
};
|
||||
}
|
||||
|
@ -4,22 +4,18 @@ import 'package:flutter/material.dart';
|
||||
import 'package:apidash/utils/utils.dart';
|
||||
|
||||
class MethodBox extends StatelessWidget {
|
||||
const MethodBox({super.key, required this.method});
|
||||
const MethodBox({
|
||||
super.key,
|
||||
required this.method,
|
||||
});
|
||||
final HTTPVerb method;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
String text = method.name.toUpperCase();
|
||||
if (method == HTTPVerb.delete) {
|
||||
text = "DEL";
|
||||
}
|
||||
if (method == HTTPVerb.patch) {
|
||||
text = "PAT";
|
||||
}
|
||||
return SizedBox(
|
||||
width: 24,
|
||||
child: Text(
|
||||
text,
|
||||
method.abbr,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 8,
|
||||
|
@ -7,7 +7,17 @@ enum APIType {
|
||||
final String label;
|
||||
}
|
||||
|
||||
enum HTTPVerb { get, head, post, put, patch, delete }
|
||||
enum HTTPVerb {
|
||||
get("GET"),
|
||||
head("HEAD"),
|
||||
post("POST"),
|
||||
put("PUT"),
|
||||
patch("PAT"),
|
||||
delete("DEL");
|
||||
|
||||
const HTTPVerb(this.abbr);
|
||||
final String abbr;
|
||||
}
|
||||
|
||||
enum SupportedUriSchemes { https, http }
|
||||
|
||||
|
Reference in New Issue
Block a user