From 2d5c55506c970cfb495e391e6120bf5b281d1ec2 Mon Sep 17 00:00:00 2001 From: danemadsen Date: Mon, 5 Aug 2024 10:13:52 +1000 Subject: [PATCH] imageKey --- lib/classes/providers/character.dart | 8 ++++++++ lib/ui/shared/pages/character_customization_page.dart | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/classes/providers/character.dart b/lib/classes/providers/character.dart index 348a705d..56194d0b 100644 --- a/lib/classes/providers/character.dart +++ b/lib/classes/providers/character.dart @@ -309,6 +309,14 @@ class Character extends ChangeNotifier { Key get key => _key; + Key get imageKey { + final bytes = _profile!.readAsBytesSync(); + + final hash = sha256.convert(bytes).toString(); + + return ValueKey(hash); + } + String get name => _name; bool get useSystem => _useSystem; diff --git a/lib/ui/shared/pages/character_customization_page.dart b/lib/ui/shared/pages/character_customization_page.dart index 5acfe5a7..c8ba7b37 100644 --- a/lib/ui/shared/pages/character_customization_page.dart +++ b/lib/ui/shared/pages/character_customization_page.dart @@ -101,7 +101,7 @@ class _CharacterCustomizationPageState extends State Padding( padding: const EdgeInsets.all(20.0), child: FutureTileImage( - key: character.key, + key: character.imageKey, image: character.profile, borderRadius: BorderRadius.circular(10.0), )