Skip to content

Commit

Permalink
Created DebugSVGPanel to test complex SVG images rendering [#4266].
Browse files Browse the repository at this point in the history
  • Loading branch information
mihail-varbanov committed Aug 5, 2024
1 parent 8be8d74 commit 12a2b22
Show file tree
Hide file tree
Showing 3 changed files with 728 additions and 0 deletions.
658 changes: 658 additions & 0 deletions images/building-example.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions lib/ui/debug/DebugHomePanel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import 'package:flutter/services.dart';
import 'package:illinois/service/AppReview.dart';
import 'package:illinois/service/Canvas.dart';
import 'package:illinois/service/CustomCourses.dart';
import 'package:illinois/ui/debug/DebugSVGPanel.dart';
import 'package:illinois/ui/debug/mobile_access/DebugMobileAccessHomePanel.dart';
import 'package:illinois/ui/debug/DebugRewardsPanel.dart';
import 'package:illinois/ui/debug/DebugStudentCoursesPanel.dart';
Expand Down Expand Up @@ -486,6 +487,16 @@ class _DebugHomePanelState extends State<DebugHomePanel> implements Notification
)
),
),
Padding(padding: EdgeInsets.symmetric(horizontal: 16, vertical: 5), child:
RoundedButton(
label: "SVG Test",
backgroundColor: Styles().colors.background,
fontSize: 16.0,
textColor: Styles().colors.fillColorPrimary,
borderColor: Styles().colors.fillColorPrimary,
onTap: _onTapSVGTest
)
),
Padding(padding: EdgeInsets.symmetric(horizontal: 16, vertical: 5), child:
RoundedButton(
label: "Test Crash",
Expand Down Expand Up @@ -955,6 +966,10 @@ class _DebugHomePanelState extends State<DebugHomePanel> implements Notification
}
}

void _onTapSVGTest() {
Navigator.push(context, CupertinoPageRoute(builder: (context) => DebugSVGPanel()));
}

void _onTapCrash(){
FirebaseCrashlytics.instance.crash();
}
Expand Down
55 changes: 55 additions & 0 deletions lib/ui/debug/DebugSVGPanel.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright 2020 Board of Trustees of the University of Illinois.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import 'package:flutter/material.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';

class DebugSVGPanel extends StatefulWidget{
_DebugSVGPanelState createState() => _DebugSVGPanelState();
}

class _DebugSVGPanelState extends State<DebugSVGPanel>{

@override
void initState() {
super.initState();
}

@override
void dispose() {
super.dispose();
}

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Styles().colors.surface,
appBar: HeaderBar(title: "SVG Test",),
body: PinchZoom(maxScale: 12, child: _svgPictureWidget),
);
}

Widget get _svgPictureWidget =>
SvgPicture.asset(
'images/building-example.svg',
semanticsLabel: 'Building Example'
);
}


0 comments on commit 12a2b22

Please sign in to comment.