Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/src/widget/svg_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:http/http.dart' as http;
import 'package:logging/logging.dart';
import 'package:vector_graphics_compiler/vector_graphics_compiler.dart';
import 'package:xml/xml.dart';

final nftRenderingLog = Logger('NFT rendering');

class SvgImage extends StatefulWidget {
final String url;
final String userAgent;
Expand Down Expand Up @@ -44,8 +47,11 @@ class _SvgImageState extends State<SvgImage> {
final Completer<String> _svgString = Completer();
bool _webviewLoadFailed = false;

get log => null;

@override
void initState() {
super.initState();
Future(() async {
String? svg;
try {
Expand All @@ -65,14 +71,14 @@ class _SvgImageState extends State<SvgImage> {
parse(svg);
_svgString.complete(svg);
} catch (e) {
nftRenderingLog.info("rendering svg ${e.toString()}");
if (svg != null) {
_svgString.completeError(SvgNotSupported(svg));
} else {
_svgString.completeError(e);
}
}
});
super.initState();
}

@override
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dependencies:
easy_debounce: ^2.0.2+1
syncfusion_flutter_pdfviewer: ^22.2.5
xml: ^6.1.0
logging: ^1.2.0
flutter_inline_webview_macos:
git:
url: https://github.com/autonomy-system/flutter_inline_webview_macos
Expand Down