Closed agufagit closed 8 months ago
Seen that around a few times, can you check if your widgets used in config are 'const'?
Seen that around a few times, can you check if your widgets used in config are 'const'?
Here is my code
EmojiPicker(
textEditingController: textController,
onBackspacePressed: () {},
config: Config(
columns: 7,
emojiSizeMax: 32 * (Platform.isIOS ? 1.30 : 1.0), // Issue: https://github.com/flutter/flutter/issues/28894
verticalSpacing: 0,
horizontalSpacing: 0,
gridPadding: EdgeInsets.zero,
initCategory: Category.RECENT,
bgColor: colorScheme.background,
indicatorColor: Colors.blue,
iconColor: Colors.grey,
iconColorSelected: Colors.blue,
backspaceColor: Colors.blue,
skinToneDialogBgColor: Colors.white,
skinToneIndicatorColor: Colors.grey,
enableSkinTones: true,
recentTabBehavior: RecentTabBehavior.RECENT,
recentsLimit: 28,
noRecents: Text(
t.noRecents,
style: textTheme.titleLarge?.copyWith(color: colorScheme.onBackground),
textAlign: TextAlign.center,
), // Needs to be const Widget
loadingIndicator: const SizedBox.shrink(), // Needs to be const Widget
tabIndicatorAnimDuration: kTabScrollDuration,
categoryIcons: const CategoryIcons(),
buttonMode: ButtonMode.MATERIAL,
),
)
noRecents: Text(
t.noRecents,
style: textTheme.titleLarge?.copyWith(color: colorScheme.onBackground),
textAlign: TextAlign.center,
), // Needs to be const Widget
As it is already written here, it needs to be const. If you use localization here then you need to wrap it into a Stateless Widget.
e.g.
class NoRecents extends StatelessWidget {
@override
void build() {
return Text(
t.noRecents,
style: textTheme.titleLarge?.copyWith(color: colorScheme.onBackground),
textAlign: TextAlign.center,
);
}
}
and
noRecents: const NoRecents()
When switching between keyboard and emoji picker panel multiple times, following flutter error is shown