Files
apidash/lib/consts.dart
2023-03-13 20:15:30 +05:30

138 lines
3.6 KiB
Dart

import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:davi/davi.dart';
final kColorTransparent = MaterialStateProperty.all<Color>(Colors.transparent);
const kColorBg = Colors.white;
final kCodeStyle = GoogleFonts.sourceCodePro();
const kHintOpacity = 0.6;
const kTextStyleButton = TextStyle(fontWeight: FontWeight.bold);
const kBorderRadius8 = BorderRadius.all(Radius.circular(8));
final kBorderRadius10 = BorderRadius.circular(10);
const kBorderRadius12 = BorderRadius.all(Radius.circular(12));
const kTableContainerDecoration = BoxDecoration(
color: kColorBg,
borderRadius: kBorderRadius12,
);
const kP1 = EdgeInsets.all(1);
const kP5 = EdgeInsets.all(5);
const kP8 = EdgeInsets.all(8);
const kPs8 = EdgeInsets.only(left: 8);
const kPh20v5 = EdgeInsets.symmetric(horizontal: 20, vertical: 5);
const kPh20v10 = EdgeInsets.symmetric(horizontal: 20, vertical: 10);
const kP10 = EdgeInsets.all(10);
const kHSpacer5 = SizedBox(width: 5);
const kHSpacer10 = SizedBox(width: 10);
const kHSpacer20 = SizedBox(width: 20);
const kVSpacer5 = SizedBox(height: 5);
const kVSpacer8 = SizedBox(height: 8);
const kVSpacer10 = SizedBox(height: 10);
const kTabAnimationDuration = Duration(milliseconds: 200);
const kTabHeight = 45.0;
const kHeaderHeight = 32.0;
const kRandMax = 100000;
const kTableThemeData = DaviThemeData(
columnDividerThickness: 1,
columnDividerColor: Colors.transparent,
row: RowThemeData(
dividerColor: Colors.transparent,
),
decoration: BoxDecoration(
border: Border(),
),
header: HeaderThemeData(
visible: false,
),
);
enum HTTPVerb { get, head, post, put, patch, delete }
enum ContentType { json, text }
const kDefaultHttpMethod = HTTPVerb.get;
const kDefaultContentType = ContentType.json;
const JsonEncoder encoder = JsonEncoder.withIndent(' ');
const kJsonMimeType = 'application/json';
const sendingIndicator = AssetImage("assets/sending.gif");
const kResponseCodeReasons = {
// 100s
100: 'Continue',
101: 'Switching Protocols',
// 200s
200: 'OK',
201: 'Created',
202: 'Accepted',
203: 'Non-Authoritative Information',
204: 'No Content',
205: 'Reset Content',
206: 'Partial Content',
207: 'Multi-Status',
208: 'Already Reported',
226: 'IM Used',
// 300s
300: 'Multiple Choices',
301: 'Moved Permanently',
302: 'Found',
303: 'See Other',
304: 'Not Modified',
305: 'Use Proxy',
306: 'Switch Proxy',
307: 'Temporary Redirect',
308: 'Permanent Redirect',
// 400s
400: 'Bad Request',
401: 'Unauthorized',
402: 'Payment Required',
403: 'Forbidden',
404: 'Not Found',
405: 'Method Not Allowed',
406: 'Not Acceptable',
407: 'Proxy Authentication Required',
408: 'Request Timeout',
409: 'Conflict',
410: 'Gone',
411: 'Length Required',
412: 'Precondition Failed',
413: 'Payload Too Large',
414: 'URI Too Long',
415: 'Unsupported Media Type',
416: 'Range Not Satisfiable',
417: 'Expectation Failed',
418: "I'm a Teapot",
421: 'Misdirected Request',
422: 'Unprocessable Entity',
423: 'Locked',
424: 'Failed Dependency',
425: 'Too Early',
426: 'Upgrade Required',
428: 'Precondition Required',
429: 'Too Many Requests',
431: 'Request Header Fields Too Large',
451: 'Unavailable For Legal Reasons',
// 500s
500: 'Internal Server Error',
501: 'Not Implemented',
502: 'Bad Gateway',
503: 'Service Unavailable',
504: 'Gateway Timeout',
505: 'HTTP Version Not Supported',
506: 'Variant Also Negotiates',
507: 'Insufficient Storage',
508: 'Loop Detected',
510: 'Not Extended',
511: 'Network Authentication Required',
};