mirror of
https://github.com/foss42/apidash.git
synced 2025-06-05 19:14:25 +08:00
Update main package
This commit is contained in:
252
lib/consts.dart
252
lib/consts.dart
@ -1,8 +1,9 @@
|
||||
import 'dart:io';
|
||||
import 'dart:convert';
|
||||
import 'package:apidash_design_system/apidash_design_system.dart';
|
||||
export 'package:apidash_design_system/apidash_design_system.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
const kDiscordUrl = "https://bit.ly/heyfoss";
|
||||
const kGitUrl = "https://github.com/foss42/apidash";
|
||||
@ -25,15 +26,6 @@ final kIsIOS = !kIsWeb && Platform.isIOS;
|
||||
final kIsAndroid = !kIsWeb && Platform.isAndroid;
|
||||
final kIsMobile = !kIsWeb && (Platform.isIOS || Platform.isAndroid);
|
||||
|
||||
final kColorTransparentState =
|
||||
WidgetStateProperty.all<Color>(Colors.transparent);
|
||||
const kColorTransparent = Colors.transparent;
|
||||
const kColorWhite = Colors.white;
|
||||
const kColorBlack = Colors.black;
|
||||
const kColorRed = Colors.red;
|
||||
final kColorLightDanger = Colors.red.withOpacity(0.9);
|
||||
const kColorDarkDanger = Color(0xffcf6679);
|
||||
|
||||
const kWindowTitle = "API Dash";
|
||||
const kMinWindowSize = Size(320, 640);
|
||||
const kMinInitialWindowWidth = 1200.0;
|
||||
@ -44,149 +36,10 @@ const kMediumWindowWidth = 840.0;
|
||||
const kExpandedWindowWidth = 1200.0;
|
||||
const kLargeWindowWidth = 1600.0;
|
||||
|
||||
const kColorSchemeSeed = Colors.blue;
|
||||
final kFontFamily = GoogleFonts.openSans().fontFamily;
|
||||
final kFontFamilyFallback =
|
||||
kIsApple ? null : <String>[GoogleFonts.notoColorEmoji().fontFamily!];
|
||||
|
||||
final kLightMaterialAppTheme = ThemeData(
|
||||
fontFamily: kFontFamily,
|
||||
fontFamilyFallback: kFontFamilyFallback,
|
||||
colorSchemeSeed: kColorSchemeSeed,
|
||||
useMaterial3: true,
|
||||
brightness: Brightness.light,
|
||||
visualDensity: VisualDensity.adaptivePlatformDensity,
|
||||
);
|
||||
final kDarkMaterialAppTheme = ThemeData(
|
||||
fontFamily: kFontFamily,
|
||||
fontFamilyFallback: kFontFamilyFallback,
|
||||
colorSchemeSeed: kColorSchemeSeed,
|
||||
useMaterial3: true,
|
||||
brightness: Brightness.dark,
|
||||
visualDensity: VisualDensity.adaptivePlatformDensity,
|
||||
);
|
||||
|
||||
final kCodeStyle = TextStyle(
|
||||
fontFamily: GoogleFonts.sourceCodePro().fontFamily,
|
||||
fontFamilyFallback: kFontFamilyFallback,
|
||||
);
|
||||
|
||||
final kHomeScaffoldKey = GlobalKey<ScaffoldState>();
|
||||
final kEnvScaffoldKey = GlobalKey<ScaffoldState>();
|
||||
final kHisScaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
const kHintOpacity = 0.6;
|
||||
const kForegroundOpacity = 0.05;
|
||||
const kOverlayBackgroundOpacity = 0.5;
|
||||
|
||||
const kTextStyleButton = TextStyle(fontWeight: FontWeight.bold);
|
||||
const kTextStyleTab = TextStyle(fontSize: 14);
|
||||
const kTextStyleButtonSmall = TextStyle(fontSize: 12);
|
||||
const kFormDataButtonLabelTextStyle = TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
);
|
||||
const kTextStylePopupMenuItem = TextStyle(fontSize: 14);
|
||||
|
||||
final kButtonSidebarStyle = ElevatedButton.styleFrom(padding: kPh12);
|
||||
|
||||
const kBorderRadius4 = BorderRadius.all(Radius.circular(4));
|
||||
const kBorderRadius6 = BorderRadius.all(Radius.circular(6));
|
||||
const kBorderRadius8 = BorderRadius.all(Radius.circular(8));
|
||||
final kBorderRadius10 = BorderRadius.circular(10);
|
||||
const kBorderRadius12 = BorderRadius.all(Radius.circular(12));
|
||||
const kBorderRadius20 = BorderRadius.all(Radius.circular(20));
|
||||
|
||||
const kP1 = EdgeInsets.all(1);
|
||||
const kP4 = EdgeInsets.all(4);
|
||||
const kP5 = EdgeInsets.all(5);
|
||||
const kP6 = EdgeInsets.all(6);
|
||||
const kP8 = EdgeInsets.all(8);
|
||||
const kPs8 = EdgeInsets.only(left: 8);
|
||||
const kPs2 = EdgeInsets.only(left: 2);
|
||||
const kPe4 = EdgeInsets.only(right: 4);
|
||||
const kPe8 = EdgeInsets.only(right: 8);
|
||||
const kPh20v5 = EdgeInsets.symmetric(horizontal: 20, vertical: 5);
|
||||
const kPh20v10 = EdgeInsets.symmetric(horizontal: 20, vertical: 10);
|
||||
const kP10 = EdgeInsets.all(10);
|
||||
const kPv2 = EdgeInsets.symmetric(vertical: 2);
|
||||
const kPv6 = EdgeInsets.symmetric(vertical: 6);
|
||||
const kPv8 = EdgeInsets.symmetric(vertical: 8);
|
||||
const kPv10 = EdgeInsets.symmetric(vertical: 10);
|
||||
const kPv20 = EdgeInsets.symmetric(vertical: 20);
|
||||
const kPh2 = EdgeInsets.symmetric(horizontal: 2);
|
||||
const kPt28o8 = EdgeInsets.only(top: 28, left: 8.0, right: 8.0, bottom: 8.0);
|
||||
const kPt5o10 =
|
||||
EdgeInsets.only(left: 10.0, right: 10.0, top: 5.0, bottom: 10.0);
|
||||
const kPh4 = EdgeInsets.symmetric(horizontal: 4);
|
||||
const kPh8 = EdgeInsets.symmetric(horizontal: 8);
|
||||
const kPh12 = EdgeInsets.symmetric(horizontal: 12);
|
||||
const kPh20 = EdgeInsets.symmetric(horizontal: 20);
|
||||
const kPh24 = EdgeInsets.symmetric(horizontal: 24);
|
||||
const kPh20t40 = EdgeInsets.only(
|
||||
left: 20,
|
||||
right: 20,
|
||||
top: 40,
|
||||
);
|
||||
const kPs0o6 = EdgeInsets.only(
|
||||
left: 0,
|
||||
top: 6,
|
||||
right: 6,
|
||||
bottom: 6,
|
||||
);
|
||||
const kPh60 = EdgeInsets.symmetric(horizontal: 60);
|
||||
const kPh60v60 = EdgeInsets.symmetric(vertical: 60, horizontal: 60);
|
||||
const kP24CollectionPane = EdgeInsets.only(
|
||||
top: 24,
|
||||
left: 4.0,
|
||||
//right: 4.0,
|
||||
// bottom: 8.0,
|
||||
);
|
||||
const kP8CollectionPane = EdgeInsets.only(
|
||||
top: 8.0,
|
||||
left: 4.0,
|
||||
//right: 4.0,
|
||||
// bottom: 8.0,
|
||||
);
|
||||
const kPt8 = EdgeInsets.only(
|
||||
top: 8,
|
||||
);
|
||||
const kPt20 = EdgeInsets.only(
|
||||
top: 20,
|
||||
);
|
||||
const kPt24 = EdgeInsets.only(
|
||||
top: 24,
|
||||
);
|
||||
const kPt28 = EdgeInsets.only(
|
||||
top: 28,
|
||||
);
|
||||
const kPt32 = EdgeInsets.only(
|
||||
top: 32,
|
||||
);
|
||||
const kPb10 = EdgeInsets.only(
|
||||
bottom: 10,
|
||||
);
|
||||
const kPb15 = EdgeInsets.only(
|
||||
bottom: 15,
|
||||
);
|
||||
const kPb70 = EdgeInsets.only(
|
||||
bottom: 70,
|
||||
);
|
||||
const kSizedBoxEmpty = SizedBox();
|
||||
const kHSpacer2 = SizedBox(width: 2);
|
||||
const kHSpacer4 = SizedBox(width: 4);
|
||||
const kHSpacer5 = SizedBox(width: 5);
|
||||
const kHSpacer10 = SizedBox(width: 10);
|
||||
const kHSpacer12 = SizedBox(width: 12);
|
||||
const kHSpacer20 = SizedBox(width: 20);
|
||||
const kHSpacer40 = SizedBox(width: 40);
|
||||
const kVSpacer5 = SizedBox(height: 5);
|
||||
const kVSpacer8 = SizedBox(height: 8);
|
||||
const kVSpacer10 = SizedBox(height: 10);
|
||||
const kVSpacer16 = SizedBox(height: 16);
|
||||
const kVSpacer20 = SizedBox(height: 20);
|
||||
const kVSpacer40 = SizedBox(height: 40);
|
||||
|
||||
const kTabAnimationDuration = Duration(milliseconds: 200);
|
||||
const kTabHeight = 40.0;
|
||||
const kHeaderHeight = 32.0;
|
||||
@ -222,107 +75,6 @@ final kIconRemoveLight = Icon(
|
||||
const kCodePreviewLinesLimit = 500;
|
||||
const kCodeCharsPerLineLimit = 200;
|
||||
|
||||
const kLightCodeTheme = {
|
||||
'root':
|
||||
TextStyle(backgroundColor: Color(0xffffffff), color: Color(0xff000000)),
|
||||
'addition': TextStyle(backgroundColor: Color(0xffbaeeba)),
|
||||
'attr': TextStyle(color: Color(0xff836C28)),
|
||||
'attribute': TextStyle(color: Color(0xffaa0d91)),
|
||||
'built_in': TextStyle(color: Color(0xff5c2699)),
|
||||
'builtin-name': TextStyle(color: Color(0xff5c2699)),
|
||||
'bullet': TextStyle(color: Color(0xff1c00cf)),
|
||||
'code': TextStyle(color: Color(0xffc41a16)),
|
||||
'comment': TextStyle(color: Color(0xff007400), fontStyle: FontStyle.italic),
|
||||
'deletion': TextStyle(backgroundColor: Color(0xffffc8bd)),
|
||||
'doctag': TextStyle(fontWeight: FontWeight.bold),
|
||||
'emphasis': TextStyle(fontStyle: FontStyle.italic),
|
||||
'formula': TextStyle(
|
||||
backgroundColor: Color(0xffeeeeee), fontStyle: FontStyle.italic),
|
||||
'keyword': TextStyle(color: Color(0xffaa0d91)),
|
||||
'link': TextStyle(color: Color(0xff0E0EFF)),
|
||||
'literal': TextStyle(color: Color(0xffaa0d91)),
|
||||
'meta': TextStyle(color: Color(0xff643820)),
|
||||
'meta-string': TextStyle(color: Color(0xffc41a16)),
|
||||
'name': TextStyle(color: Color(0xffaa0d91)),
|
||||
'number': TextStyle(color: Color(0xff1c00cf)),
|
||||
'params': TextStyle(color: Color(0xff5c2699)),
|
||||
'quote': TextStyle(color: Color(0xff007400)),
|
||||
'regexp': TextStyle(color: Color(0xff0E0EFF)),
|
||||
'section': TextStyle(color: Color(0xff643820)),
|
||||
'selector-class': TextStyle(color: Color(0xff9b703f)),
|
||||
'selector-id': TextStyle(color: Color(0xff9b703f)),
|
||||
'selector-tag': TextStyle(color: Color(0xffaa0d91)),
|
||||
'string': TextStyle(color: Color(0xffc41a16)),
|
||||
'strong': TextStyle(fontWeight: FontWeight.bold),
|
||||
'subst': TextStyle(color: Color(0xff000000)),
|
||||
'symbol': TextStyle(color: Color(0xff1c00cf)),
|
||||
'tag': TextStyle(color: Color(0xffaa0d91)),
|
||||
'template-variable': TextStyle(color: Color(0xff3F6E74)),
|
||||
'title': TextStyle(color: Color(0xff1c00cf)),
|
||||
'type': TextStyle(color: Color(0xff5c2699)),
|
||||
'variable': TextStyle(color: Color(0xff3F6E74)),
|
||||
};
|
||||
|
||||
const kDarkCodeTheme = {
|
||||
'root':
|
||||
TextStyle(backgroundColor: Color(0xff011627), color: Color(0xffd6deeb)),
|
||||
'addition': TextStyle(color: Color(0xffaddb67)),
|
||||
'attr': TextStyle(color: Color(0xff7fdbca)),
|
||||
'attribute': TextStyle(color: Color(0xff80cbc4)),
|
||||
'built_in': TextStyle(color: Color(0xffaddb67)),
|
||||
'builtin-name': TextStyle(color: Color(0xff7fdbca)),
|
||||
'bullet': TextStyle(color: Color(0xffd9f5dd)),
|
||||
'class': TextStyle(color: Color(0xffffcb8b)),
|
||||
'code': TextStyle(color: Color(0xff80CBC4)),
|
||||
'comment': TextStyle(color: Color(0xff637777), fontStyle: FontStyle.italic),
|
||||
'deletion': TextStyle(color: Color(0xffef5350)),
|
||||
'doctag': TextStyle(color: Color(0xff7fdbca)),
|
||||
'emphasis': TextStyle(color: Color(0xffc792ea)),
|
||||
'formula': TextStyle(color: Color(0xffc792ea), fontStyle: FontStyle.italic),
|
||||
'function': TextStyle(color: Color(0xff82AAFF)),
|
||||
'keyword': TextStyle(color: Color(0xffc792ea)),
|
||||
'link': TextStyle(color: Color(0xffff869a)),
|
||||
'literal': TextStyle(color: Color(0xffff5874)),
|
||||
'meta': TextStyle(color: Color(0xff82aaff)),
|
||||
'meta-keyword': TextStyle(color: Color(0xff82aaff)),
|
||||
'meta-string': TextStyle(color: Color(0xffecc48d)),
|
||||
'name': TextStyle(color: Color(0xff7fdbca)),
|
||||
'number': TextStyle(color: Color(0xffF78C6C)),
|
||||
'params': TextStyle(color: Color(0xff7fdbca)),
|
||||
'quote': TextStyle(color: Color(0xff697098)),
|
||||
'regexp': TextStyle(color: Color(0xff5ca7e4)),
|
||||
'section': TextStyle(color: Color(0xff82b1ff)),
|
||||
'selector-attr': TextStyle(color: Color(0xffc792ea)),
|
||||
'selector-class': TextStyle(color: Color(0xffaddb67)),
|
||||
'selector-id': TextStyle(color: Color(0xfffad430)),
|
||||
'selector-pseudo': TextStyle(color: Color(0xffc792ea)),
|
||||
'selector-tag': TextStyle(color: Color(0xffff6363)),
|
||||
'string': TextStyle(color: Color(0xffecc48d)),
|
||||
'strong': TextStyle(color: Color(0xffaddb67), fontWeight: FontWeight.bold),
|
||||
'subst': TextStyle(color: Color(0xffd3423e)),
|
||||
'symbol': TextStyle(color: Color(0xff82aaff)),
|
||||
'tag': TextStyle(color: Color(0xff7fdbca)),
|
||||
'template-tag': TextStyle(color: Color(0xffc792ea)),
|
||||
'template-variable': TextStyle(color: Color(0xffaddb67)),
|
||||
'title': TextStyle(color: Color(0xffDCDCAA)),
|
||||
'type': TextStyle(color: Color(0xff82aaff)),
|
||||
'variable': TextStyle(color: Color(0xffaddb67)),
|
||||
};
|
||||
|
||||
final kColorStatusCodeDefault = Colors.grey.shade700;
|
||||
final kColorStatusCode200 = Colors.green.shade800;
|
||||
final kColorStatusCode300 = Colors.blue.shade800;
|
||||
final kColorStatusCode400 = Colors.red.shade800;
|
||||
final kColorStatusCode500 = Colors.amber.shade900;
|
||||
const kOpacityDarkModeBlend = 0.4;
|
||||
|
||||
final kColorHttpMethodGet = Colors.green.shade800;
|
||||
final kColorHttpMethodHead = kColorHttpMethodGet;
|
||||
final kColorHttpMethodPost = Colors.blue.shade800;
|
||||
final kColorHttpMethodPut = Colors.amber.shade900;
|
||||
final kColorHttpMethodPatch = kColorHttpMethodPut;
|
||||
final kColorHttpMethodDelete = Colors.red.shade800;
|
||||
|
||||
enum HistoryRetentionPeriod {
|
||||
oneWeek("1 Week", Icons.calendar_view_week_rounded),
|
||||
oneMonth("1 Month", Icons.calendar_view_month_rounded),
|
||||
|
11
pubspec.lock
11
pubspec.lock
@ -30,6 +30,13 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.3"
|
||||
apidash_design_system:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "packages/apidash_design_system"
|
||||
relative: true
|
||||
source: path
|
||||
version: "0.0.1"
|
||||
archive:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -625,7 +632,7 @@ packages:
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
google_fonts:
|
||||
dependency: "direct main"
|
||||
dependency: transitive
|
||||
description:
|
||||
name: google_fonts
|
||||
sha256: b1ac0fe2832c9cc95e5e88b57d627c5e68c223b9657f4b96e1487aa9098c7b82
|
||||
@ -1750,5 +1757,5 @@ packages:
|
||||
source: hosted
|
||||
version: "3.1.2"
|
||||
sdks:
|
||||
dart: ">=3.5.0-259.0.dev <3.999.0"
|
||||
dart: ">=3.5.3 <3.999.0"
|
||||
flutter: ">=3.24.2"
|
||||
|
@ -10,6 +10,8 @@ environment:
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
apidash_design_system:
|
||||
path: packages/apidash_design_system
|
||||
code_builder: ^4.10.0
|
||||
collection: ^1.18.0
|
||||
csv: ^6.0.0
|
||||
@ -31,7 +33,6 @@ dependencies:
|
||||
flutter_typeahead: ^5.2.0
|
||||
freezed_annotation: ^2.4.1
|
||||
fvp: ^0.26.1
|
||||
google_fonts: ^6.2.1
|
||||
highlighter: ^0.1.1
|
||||
hive_flutter: ^1.1.0
|
||||
hooks_riverpod: ^2.5.2
|
||||
@ -98,6 +99,4 @@ dev_dependencies:
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
assets:
|
||||
- google_fonts/
|
||||
- assets/
|
||||
- assets/intro/
|
||||
|
Reference in New Issue
Block a user