Created
March 4, 2019 16:27
-
-
Save brianegan/d86ed20adf635e80a0e1f668cf55587e to your computer and use it in GitHub Desktop.
Simple SVG implementation + Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter_svg/flutter_svg.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'SVG + Test', | |
home: SvgTest(), | |
); | |
} | |
} | |
class SvgTest extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text("SVG + Test"), | |
), | |
body: Center( | |
child: SvgPicture.asset( | |
'assets/tiger.svg', | |
semanticsLabel: 'A red up arrow', | |
), | |
), | |
); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a basic Flutter widget test. | |
// | |
// To perform an interaction with a widget in your test, use the WidgetTester | |
// utility that Flutter provides. For example, you can send tap and scroll | |
// gestures. You can also use WidgetTester to find child widgets in the widget | |
// tree, read text, and verify that the values of widget properties are correct. | |
import 'package:asset_bundle_test/main.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter_test/flutter_test.dart'; | |
void main() { | |
testWidgets('throws an error with no mock', (WidgetTester tester) async { | |
await tester.pumpWidget(MaterialApp(home: SvgTest())); | |
expect(find.byType(SvgTest), findsOneWidget); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment