1- import 'agent_character_artwork.dart' ;
21import 'package:flutter/foundation.dart' ;
32import 'package:flutter/material.dart' ;
43import 'package:flutter/services.dart' ;
54import 'package:flutter_hooks/flutter_hooks.dart' ;
65
76import '../../shared/agents/agent_avatar_catalog.dart' ;
7+ import '../../shared/animated_avatar.dart' ;
88import '../../shared/theme/theme.dart' ;
99import '../../shared/widgets/ios_glass_navigation_button.dart' ;
10-
11- import '../../shared/widgets/preset_agent_avatar .dart' ;
10+ import 'agent_avatar_category.dart' ;
11+ import 'agent_character_artwork .dart' ;
1212
1313/// Fixed category rail height used to anchor the editor tray.
1414const agentAvatarChoicesHeight = 92.0 ;
@@ -17,8 +17,7 @@ const agentAvatarChoicesHeight = 92.0;
1717class AgentAvatarChoices extends HookWidget {
1818 const AgentAvatarChoices ({
1919 super .key,
20- required this .mode,
21- required this .pack,
20+ required this .category,
2221 required this .examples,
2322 required this .emoji,
2423 required this .disabled,
@@ -27,8 +26,7 @@ class AgentAvatarChoices extends HookWidget {
2726 required this .onImage,
2827 });
2928
30- final int mode;
31- final AgentAvatarPack pack;
29+ final AgentAvatarCategory category;
3230 final Map <AgentAvatarPack , int > examples;
3331 final String emoji;
3432 final bool disabled;
@@ -42,7 +40,7 @@ class AgentAvatarChoices extends HookWidget {
4240 useEffect (() {
4341 WidgetsBinding .instance.addPostFrameCallback ((_) {
4442 if (! controller.hasClients) return ;
45- final position = mode == 0 ? pack.index : mode + 3 ;
43+ final position = category.position ;
4644 controller.jumpTo (
4745 (position * 84.0 - 84 ).clamp (
4846 0.0 ,
@@ -64,32 +62,30 @@ class AgentAvatarChoices extends HookWidget {
6462 for (final item in AgentAvatarPack .values)
6563 _Choice (
6664 label: item.label,
67- selected: mode == 0 && pack == item,
65+ selected: category. pack == item,
6866 onTap: disabled ? null : () => onPack (item),
6967 child: AgentCharacterAlignment (
7068 url: agentAvatarCatalog[examples[item]! ].url,
7169 scale: 0.85 ,
72- child: PresetAgentAvatar (
73- imageUrl: agentAvatarCatalog[examples[item]! ].url,
74- size: 60 ,
75- posterPlaceholder: characterPoster (
70+ child: Transform .scale (
71+ scale: animatedAvatarArtworkScale,
72+ child: characterPoster (
7673 agentAvatarCatalog[examples[item]! ].url,
7774 ),
78- fallback: const Icon (Icons .smart_toy_outlined),
7975 ),
8076 ),
8177 ),
8278 _Choice (
8379 label: 'Emoji' ,
84- selected: mode == 1 ,
80+ selected: category == AgentAvatarCategory .emoji ,
8581 onTap: disabled ? null : onEmoji,
8682 child: Center (
8783 child: Text (emoji, style: const TextStyle (fontSize: 32 )),
8884 ),
8985 ),
9086 _Choice (
9187 label: 'Image' ,
92- selected: mode == 2 ,
88+ selected: category == AgentAvatarCategory .image ,
9389 onTap: disabled ? null : onImage,
9490 child: const Icon (Icons .image_outlined, size: 28 ),
9591 ),
0 commit comments