Skip to content

Commit

Permalink
fix: handle raw images returned in icons list
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewwahid committed Aug 4, 2023
1 parent d36be5d commit cd977c9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/screens/home/wallet_connect/components/wc_peer_icon.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';

Expand All @@ -12,8 +14,11 @@ class WCPeerIcon extends StatelessWidget {
|| icons!.isEmpty){
peerIcon = SvgPicture.asset("assets/images/walletconnect.svg");
}else{
RegExp rawData = RegExp("^data:image\/[a-z]+;base64,");
if (icons![0].endsWith(".svg")){
peerIcon = SvgPicture.network(icons![0]);
}else if (icons![0].startsWith(rawData)){
peerIcon = Image.memory(base64Decode(icons![0].replaceFirst(rawData, "")));
}else{
peerIcon = Image.network(icons![0]);
}
Expand Down

0 comments on commit cd977c9

Please sign in to comment.