Created
May 19, 2022 10:34
-
-
Save Zujaj/b7ed3443bcb92e0be8ed772a7e41d847 to your computer and use it in GitHub Desktop.
The SceneRenderer Widget.
This file contains 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/svg.dart'; | |
import 'package:provider/provider.dart'; | |
import 'package:svg_colorization/providers/svg_data.dart'; | |
/// An [SvgPicture] widget that renders the svg. | |
class SceneRenderer extends StatelessWidget { | |
const SceneRenderer({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
/// Holds the updated [SVData] object. | |
final svg = context.watch<SVGData>(); | |
return svg.code.isNotEmpty | |
? Center(child: SvgPicture.string(svg.code)) | |
: const Center(child: CircularProgressIndicator.adaptive()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment