chore: update svg when svg url changes (#2341)

This commit is contained in:
ggurdin 2025-04-03 12:06:09 -04:00 committed by GitHub
parent 3a06fddcc4
commit 0c988d55f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 1 deletions

View file

@ -43,7 +43,6 @@ import '../../widgets/matrix.dart';
import 'package:fluffychat/utils/tor_stub.dart'
if (dart.library.html) 'package:tor_detector_web/tor_detector_web.dart';
enum PopupMenuAction {
settings,
invite,

View file

@ -64,6 +64,19 @@ class _CustomizedSvgState extends State<CustomizedSvg> {
});
}
@override
void didUpdateWidget(covariant CustomizedSvg oldWidget) {
super.didUpdateWidget(oldWidget);
if (oldWidget.svgUrl != widget.svgUrl) {
setState(() {
_isLoading = true;
_hasError = false;
_showProgressIndicator = false;
});
_loadSvg();
}
}
Future<void> _loadSvg() async {
try {
final cached = _getSvgFromCache();