diff --git a/lib/providers/character.dart b/lib/providers/character.dart index c62f01d5..c1716993 100644 --- a/lib/providers/character.dart +++ b/lib/providers/character.dart @@ -298,6 +298,8 @@ class Character extends ChangeNotifier { return sha256.convert(bytes).toString(); } + Key get key => ValueKey(hash); + String get name => _name; String get description => _description; diff --git a/lib/providers/user.dart b/lib/providers/user.dart index fb0d7284..14262478 100644 --- a/lib/providers/user.dart +++ b/lib/providers/user.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:maid/static/utilities.dart'; class User extends ChangeNotifier { + Key _key = UniqueKey(); File? _profile; String _name = "User"; @@ -12,7 +13,8 @@ class User extends ChangeNotifier { } User.from(User user) { - _profile = profileFile; + _key = user.key; + _profile = user.profileFile; _name = user.name; } @@ -26,6 +28,8 @@ class User extends ChangeNotifier { File? get profileFile => _profile; String get name => _name; + + Key get key => _key; set profile(Future value) { value.then((File file) { @@ -67,4 +71,10 @@ class User extends ChangeNotifier { _name = "User"; notifyListeners(); } + + @override + void notifyListeners() { + _key = UniqueKey(); + super.notifyListeners(); + } } diff --git a/lib/ui/mobile/pages/character/character_customization_page.dart b/lib/ui/mobile/pages/character/character_customization_page.dart index 25e76ced..ecb600a0 100644 --- a/lib/ui/mobile/pages/character/character_customization_page.dart +++ b/lib/ui/mobile/pages/character/character_customization_page.dart @@ -118,6 +118,7 @@ class _CharacterCustomizationPageState extends State children: [ const SizedBox(height: 10.0), FutureAvatar( + key: character.key, image: character.profile, radius: 75, ), diff --git a/lib/ui/mobile/widgets/chat_widgets/chat_message.dart b/lib/ui/mobile/widgets/chat_widgets/chat_message.dart index f707760d..ff3a2f07 100644 --- a/lib/ui/mobile/widgets/chat_widgets/chat_message.dart +++ b/lib/ui/mobile/widgets/chat_widgets/chat_message.dart @@ -66,6 +66,7 @@ class _ChatMessageState extends State with SingleTickerProviderStat children: [ const SizedBox(width: 10.0), FutureAvatar( + key: node.role == ChatRole.user ? user.key : character.key, image: node.role == ChatRole.user ? user.profile : character.profile, radius: 16, ), @@ -187,7 +188,7 @@ class _ChatMessageState extends State with SingleTickerProviderStat IconButton( padding: const EdgeInsets.all(0), onPressed: () { - if (!context.watch().chat.tail.finalised) return; + if (!context.read().chat.tail.finalised) return; setState(() { editing = false; }); diff --git a/lib/ui/mobile/widgets/tiles/character_tile.dart b/lib/ui/mobile/widgets/tiles/character_tile.dart index 188b52a2..64c51db6 100644 --- a/lib/ui/mobile/widgets/tiles/character_tile.dart +++ b/lib/ui/mobile/widgets/tiles/character_tile.dart @@ -27,6 +27,7 @@ class CharacterTile extends StatelessWidget { const SizedBox(height: 10.0), ListTile( leading: FutureAvatar( + key: character.key, image: character.profile, radius: 25, ), diff --git a/lib/ui/mobile/widgets/tiles/user_tile.dart b/lib/ui/mobile/widgets/tiles/user_tile.dart index d7b368e1..16b4a424 100644 --- a/lib/ui/mobile/widgets/tiles/user_tile.dart +++ b/lib/ui/mobile/widgets/tiles/user_tile.dart @@ -28,6 +28,7 @@ class _UserTileState extends State { ), ), leading: FutureAvatar( + key: user.key, image: user.profile, radius: 20, ), @@ -156,7 +157,7 @@ class _UserTileState extends State { FilledButton( onPressed: () => Navigator.of(context).pop(), child: Text( - "Cancel", + "Close", style: Theme.of(context).textTheme.labelLarge, ), ), diff --git a/packages/maid_llm b/packages/maid_llm index dc7fa3dd..4519cc07 160000 --- a/packages/maid_llm +++ b/packages/maid_llm @@ -1 +1 @@ -Subproject commit dc7fa3dd80e5d08eab8b8b02c2eaed05fd9a80bb +Subproject commit 4519cc07c2e32c727c25ef39b565d562d235b3ce diff --git a/packages/maid_ui b/packages/maid_ui index f15e4f3c..9da77009 160000 --- a/packages/maid_ui +++ b/packages/maid_ui @@ -1 +1 @@ -Subproject commit f15e4f3c694cc5e5b36d8f4ca8cec34db8f5d50e +Subproject commit 9da77009cd5b6ae5ca8b004e1fe6630a765c7059