Revert f6da6e0, disable keepAlives for emote menu

This commit is contained in:
Tommy Chow 2022-01-25 19:19:21 -05:00
parent cac7e06791
commit a36bc29116
2 changed files with 26 additions and 24 deletions

View file

@ -45,6 +45,8 @@ class EmoteMenuSection extends StatelessWidget {
),
),
childCount: emotes.length,
addAutomaticKeepAlives: false,
addRepaintBoundaries: false,
),
),
);

View file

@ -39,33 +39,33 @@ class RecentEmotesPanel extends StatelessWidget {
crossAxisSpacing: 10.0,
),
delegate: SliverChildBuilderDelegate(
(context, index) => Observer(
builder: (context) {
final emote = assetsStore.recentEmotes[index];
final validEmotes = [...assetsStore.emoteToObject.values, ...assetsStore.userEmoteToObject.values];
final matchingEmotes = validEmotes.where((existingEmote) => existingEmote.name == emote.name);
(context, index) {
final emote = assetsStore.recentEmotes[index];
final validEmotes = [...assetsStore.emoteToObject.values, ...assetsStore.userEmoteToObject.values];
final matchingEmotes = validEmotes.where((existingEmote) => existingEmote.name == emote.name);
return GestureDetector(
onTap: matchingEmotes.isNotEmpty
? () {
textController.text += ' ' + emote.name;
assetsStore.recentEmotes.removeWhere((recentEmote) => recentEmote.name == matchingEmotes.first.name);
assetsStore.recentEmotes.insert(0, matchingEmotes.first);
}
: null,
child: Tooltip(
message: emote.name,
preferBelow: false,
child: CachedNetworkImage(
imageUrl: matchingEmotes.isNotEmpty ? matchingEmotes.first.url : emote.url,
color: matchingEmotes.isNotEmpty ? null : const Color.fromRGBO(255, 255, 255, 0.5),
colorBlendMode: matchingEmotes.isNotEmpty ? null : BlendMode.modulate,
),
return GestureDetector(
onTap: matchingEmotes.isNotEmpty
? () {
textController.text += ' ' + emote.name;
assetsStore.recentEmotes.removeWhere((recentEmote) => recentEmote.name == matchingEmotes.first.name);
assetsStore.recentEmotes.insert(0, matchingEmotes.first);
}
: null,
child: Tooltip(
message: emote.name,
preferBelow: false,
child: CachedNetworkImage(
imageUrl: matchingEmotes.isNotEmpty ? matchingEmotes.first.url : emote.url,
color: matchingEmotes.isNotEmpty ? null : const Color.fromRGBO(255, 255, 255, 0.5),
colorBlendMode: matchingEmotes.isNotEmpty ? null : BlendMode.modulate,
),
);
},
),
),
);
},
childCount: assetsStore.recentEmotes.length,
addAutomaticKeepAlives: false,
addRepaintBoundaries: false,
),
),
),