Last active
May 19, 2022 10:52
-
-
Save Zujaj/e8ebf83631963548e16b09350c9ad305 to your computer and use it in GitHub Desktop.
The SVGData ChangeNotifier class.
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'; | |
/// A [ChangeNotifier] that holds the svg text data. | |
class SVGData with ChangeNotifier { | |
/// Holds the `SVG` Formatted Code. | |
String code = ''; | |
SVGData(this.code); | |
void updateCode(String previousColor, String newColor) { | |
code = code.replaceAll(previousColor, newColor); | |
notifyListeners(); | |
} | |
@override | |
String toString() => 'SVGData(code:$code)'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment