From 4ae6ae7ad2213d96fc945f0bf11ab4d8e99eab46 Mon Sep 17 00:00:00 2001 From: Mihail Varbanov Date: Mon, 5 Aug 2024 15:04:49 +0300 Subject: [PATCH] Testing jovial_svg plugin [#4266]. --- lib/ui/debug/DebugSVGPanel.dart | 20 +++++++++++++++----- pubspec.lock | 16 ++++++++++++++++ pubspec.yaml | 1 + 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/lib/ui/debug/DebugSVGPanel.dart b/lib/ui/debug/DebugSVGPanel.dart index d93e6266e..08593895c 100644 --- a/lib/ui/debug/DebugSVGPanel.dart +++ b/lib/ui/debug/DebugSVGPanel.dart @@ -15,10 +15,12 @@ */ import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:pinch_zoom/pinch_zoom.dart'; import 'package:rokwire_plugin/service/styles.dart'; import 'package:illinois/ui/widgets/HeaderBar.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:jovial_svg/jovial_svg.dart'; class DebugSVGPanel extends StatefulWidget{ _DebugSVGPanelState createState() => _DebugSVGPanelState(); @@ -26,6 +28,8 @@ class DebugSVGPanel extends StatefulWidget{ class _DebugSVGPanelState extends State{ + static const String svgAssetName = 'images/building-example.svg'; + @override void initState() { super.initState(); @@ -41,15 +45,21 @@ class _DebugSVGPanelState extends State{ return Scaffold( backgroundColor: Styles().colors.surface, appBar: HeaderBar(title: "SVG Test",), - body: PinchZoom(maxScale: 12, child: _svgPictureWidget), + body: PinchZoom(maxScale: 12, child: + _scalableImageWidget + ), ); } + // ignore: unused_element Widget get _svgPictureWidget => - SvgPicture.asset( - 'images/building-example.svg', - semanticsLabel: 'Building Example' - ); + SvgPicture.asset(svgAssetName, semanticsLabel: 'Building Example'); + + // ignore: unused_element + Widget get _scalableImageWidget => ScalableImageWidget.fromSISource( + fit: BoxFit.contain, + si: ScalableImageSource.fromSvg(rootBundle, svgAssetName), + ); } diff --git a/pubspec.lock b/pubspec.lock index fbbe287d6..76b0ceb46 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -840,6 +840,22 @@ packages: url: "https://pub.dev" source: hosted version: "0.19.0" + jovial_misc: + dependency: transitive + description: + name: jovial_misc + sha256: f6e64f789ee311025bb367be9c9afe9759f76dd8209070b7f38e735b5f529eb1 + url: "https://pub.dev" + source: hosted + version: "0.8.5" + jovial_svg: + dependency: "direct main" + description: + name: jovial_svg + sha256: "893dab3d9bbb8dd03e8225d457004950b9cf828d0009fd14c185cedacb96839c" + url: "https://pub.dev" + source: hosted + version: "1.1.22" js: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 97726bb69..4b7962587 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -66,6 +66,7 @@ dependencies: fl_chart: ^0.68.0 record: ^4.4.4 flutter_svg: ^2.0.10+1 + jovial_svg: 1.1.22 font_awesome_flutter: '>= 4.7.0' # comment if published plugin is used rokwire_plugin: