mirror of
https://github.com/foss42/apidash.git
synced 2025-07-02 05:57:55 +08:00
Merge pull request #98 from mmjsmohit/add-feature-svgpreview
Add SVG Rendering
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -50,6 +50,7 @@ macos/
|
|||||||
windows/
|
windows/
|
||||||
web/
|
web/
|
||||||
ios/
|
ios/
|
||||||
|
android/
|
||||||
.vscode/*
|
.vscode/*
|
||||||
icons/
|
icons/
|
||||||
coverage/*
|
coverage/*
|
||||||
|
@ -342,7 +342,7 @@ const Map<String, Map<String, List<ResponseBodyView>>>
|
|||||||
},
|
},
|
||||||
kTypeImage: {
|
kTypeImage: {
|
||||||
kSubTypeDefaultViewOptions: kPreviewBodyViewOptions,
|
kSubTypeDefaultViewOptions: kPreviewBodyViewOptions,
|
||||||
kSubTypeSvg: kCodeRawBodyViewOptions,
|
kSubTypeSvg: kPreviewCodeRawBodyViewOptions,
|
||||||
},
|
},
|
||||||
kTypeAudio: {
|
kTypeAudio: {
|
||||||
kSubTypeDefaultViewOptions: kPreviewBodyViewOptions,
|
kSubTypeDefaultViewOptions: kPreviewBodyViewOptions,
|
||||||
@ -459,6 +459,9 @@ const kUnexpectedRaiseIssue =
|
|||||||
const kImageError =
|
const kImageError =
|
||||||
"There seems to be an issue rendering this image. Please raise an issue in API Dash GitHub repo so that we can resolve it.";
|
"There seems to be an issue rendering this image. Please raise an issue in API Dash GitHub repo so that we can resolve it.";
|
||||||
|
|
||||||
|
const kSvgError =
|
||||||
|
"There seems to be an issue rendering this SVG image. Please raise an issue in API Dash GitHub repo so that we can resolve it.";
|
||||||
|
|
||||||
const kPdfError =
|
const kPdfError =
|
||||||
"There seems to be an issue rendering this pdf. Please raise an issue in API Dash GitHub repo so that we can resolve it.";
|
"There seems to be an issue rendering this pdf. Please raise an issue in API Dash GitHub repo so that we can resolve it.";
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'error_message.dart';
|
import 'error_message.dart';
|
||||||
import 'package:apidash/consts.dart';
|
import 'package:apidash/consts.dart';
|
||||||
import 'package:printing/printing.dart';
|
import 'package:printing/printing.dart';
|
||||||
@ -40,6 +41,12 @@ class _PreviewerState extends State<Previewer> {
|
|||||||
// pass
|
// pass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (widget.type == kTypeImage && widget.subtype == kSubTypeSvg) {
|
||||||
|
final String rawSvg = widget.body;
|
||||||
|
return SvgPicture.string(
|
||||||
|
rawSvg,
|
||||||
|
);
|
||||||
|
}
|
||||||
if (widget.type == kTypeImage) {
|
if (widget.type == kTypeImage) {
|
||||||
return Image.memory(
|
return Image.memory(
|
||||||
widget.bytes,
|
widget.bytes,
|
||||||
|
32
pubspec.lock
32
pubspec.lock
@ -358,6 +358,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.4.4"
|
version: "2.4.4"
|
||||||
|
flutter_svg:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: flutter_svg
|
||||||
|
sha256: d39e7f95621fc84376bc0f7d504f05c3a41488c562f4a8ad410569127507402c
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.9"
|
||||||
flutter_test:
|
flutter_test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description: flutter
|
description: flutter
|
||||||
@ -1150,6 +1158,30 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.1.0"
|
version: "4.1.0"
|
||||||
|
vector_graphics:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: vector_graphics
|
||||||
|
sha256: "0f0c746dd2d6254a0057218ff980fc7f5670fd0fcf5e4db38a490d31eed4ad43"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.1.9+1"
|
||||||
|
vector_graphics_codec:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: vector_graphics_codec
|
||||||
|
sha256: "0edf6d630d1bfd5589114138ed8fada3234deacc37966bec033d3047c29248b7"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.1.9+1"
|
||||||
|
vector_graphics_compiler:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: vector_graphics_compiler
|
||||||
|
sha256: d24333727332d9bd20990f1483af4e09abdb9b1fc7c3db940b56ab5c42790c26
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.1.9+1"
|
||||||
vector_math:
|
vector_math:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -48,6 +48,7 @@ dependencies:
|
|||||||
url: https://github.com/foss42/json_data_explorer.git
|
url: https://github.com/foss42/json_data_explorer.git
|
||||||
version: ^0.1.1
|
version: ^0.1.1
|
||||||
scrollable_positioned_list: ^0.2.3
|
scrollable_positioned_list: ^0.2.3
|
||||||
|
flutter_svg: ^2.0.9
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
Reference in New Issue
Block a user