import 'package:flutter/material.dart'; import '../l10n/app_localizations.dart'; import '../l10n/l10n.dart'; class EmojiPicker extends StatelessWidget { final Function(String) onEmojiSelected; const EmojiPicker({super.key, required this.onEmojiSelected}); static const List quickEmojis = ['๐Ÿ‘', 'โค๏ธ', '๐Ÿ˜‚', '๐ŸŽ‰', '๐Ÿ‘', '๐Ÿ”ฅ']; static const List smileys = [ '๐Ÿ˜€', '๐Ÿ˜ƒ', '๐Ÿ˜„', '๐Ÿ˜', '๐Ÿ˜…', '๐Ÿ˜‚', '๐Ÿคฃ', '๐Ÿ˜Š', '๐Ÿ˜‡', '๐Ÿ™‚', '๐Ÿ™ƒ', '๐Ÿ˜‰', '๐Ÿ˜Œ', '๐Ÿ˜', '๐Ÿฅฐ', '๐Ÿ˜˜', '๐Ÿ˜—', '๐Ÿ˜™', '๐Ÿ˜š', '๐Ÿ˜‹', '๐Ÿ˜›', '๐Ÿ˜', '๐Ÿ˜œ', '๐Ÿคช', '๐Ÿคจ', '๐Ÿง', '๐Ÿค“', '๐Ÿ˜Ž', '๐Ÿฅธ', '๐Ÿคฉ', '๐Ÿฅณ', '๐Ÿ˜', '๐Ÿ˜’', '๐Ÿ˜ž', '๐Ÿ˜”', '๐Ÿ˜Ÿ', '๐Ÿ˜•', '๐Ÿ™', '๐Ÿ˜ฃ', '๐Ÿ˜–', '๐Ÿ˜ซ', '๐Ÿ˜ฉ', '๐Ÿฅบ', '๐Ÿ˜ข', '๐Ÿ˜ญ', '๐Ÿ˜ค', '๐Ÿ˜ ', '๐Ÿ˜ก', '๐Ÿคฌ', '๐Ÿคฏ', '๐Ÿ˜ณ', '๐Ÿฅต', '๐Ÿฅถ', '๐Ÿ˜ฑ', '๐Ÿ˜จ', '๐Ÿ˜ฐ', '๐Ÿ˜ฅ', '๐Ÿ˜“', '๐Ÿค—', '๐Ÿค”', '๐Ÿคญ', '๐Ÿคซ', '๐Ÿคฅ', '๐Ÿ˜ถ', ]; static const List gestures = [ '๐Ÿ‘', '๐Ÿ‘Ž', '๐Ÿ‘Š', 'โœŠ', '๐Ÿค›', '๐Ÿคœ', '๐Ÿคž', 'โœŒ๏ธ', '๐ŸคŸ', '๐Ÿค˜', '๐Ÿ‘Œ', '๐ŸคŒ', '๐Ÿค', '๐Ÿ‘ˆ', '๐Ÿ‘‰', '๐Ÿ‘†', '๐Ÿ‘‡', 'โ˜๏ธ', '๐Ÿ‘‹', '๐Ÿคš', '๐Ÿ–๏ธ', 'โœ‹', '๐Ÿ––', '๐Ÿ‘', '๐Ÿ™Œ', '๐Ÿ‘', '๐Ÿคฒ', '๐Ÿค', '๐Ÿ™', 'โœ๏ธ', '๐Ÿ’…', '๐Ÿคณ', '๐Ÿ’ช', ]; static const List hearts = [ 'โค๏ธ', '๐Ÿงก', '๐Ÿ’›', '๐Ÿ’š', '๐Ÿ’™', '๐Ÿ’œ', '๐Ÿ–ค', '๐Ÿค', '๐ŸคŽ', '๐Ÿ’”', 'โค๏ธโ€๐Ÿ”ฅ', 'โค๏ธโ€๐Ÿฉน', '๐Ÿ’•', '๐Ÿ’ž', '๐Ÿ’“', '๐Ÿ’—', '๐Ÿ’–', '๐Ÿ’˜', '๐Ÿ’', '๐Ÿ’Ÿ', '๐Ÿ’Œ', '๐Ÿ’ข', '๐Ÿ’ฅ', '๐Ÿ’ซ', '๐Ÿ’ฆ', '๐Ÿ’จ', '๐Ÿ•ณ๏ธ', '๐Ÿ’ฌ', '๐Ÿ‘๏ธโ€๐Ÿ—จ๏ธ', '๐Ÿ—จ๏ธ', '๐Ÿ—ฏ๏ธ', '๐Ÿ’ญ', ]; static const List objects = [ '๐ŸŽ‰', '๐ŸŽŠ', '๐ŸŽˆ', '๐ŸŽ', '๐ŸŽ€', '๐Ÿช…', '๐Ÿช†', '๐Ÿ†', '๐Ÿฅ‡', '๐Ÿฅˆ', '๐Ÿฅ‰', 'โšฝ', 'โšพ', '๐ŸฅŽ', '๐Ÿ€', '๐Ÿ', '๐Ÿˆ', '๐Ÿ‰', '๐ŸŽพ', '๐Ÿฅ', '๐ŸŽณ', '๐Ÿ', '๐Ÿ‘', '๐Ÿ’', '๐Ÿฅ', '๐Ÿ“', '๐Ÿธ', '๐ŸฅŠ', '๐Ÿฅ‹', '๐Ÿฅ…', 'โ›ณ', '๐Ÿ”ฅ', 'โญ', '๐ŸŒŸ', 'โœจ', 'โšก', '๐Ÿ’ก', '๐Ÿ”ฆ', '๐Ÿฎ', '๐Ÿช”', '๐Ÿ“ฑ', '๐Ÿ’ป', 'โŒš', '๐Ÿ“ท', '๐Ÿ“บ', '๐Ÿ“ป', '๐ŸŽต', '๐ŸŽถ', '๐Ÿš€', ]; Map> _emojiCategories(AppLocalizations l10n) { return { l10n.emojiCategorySmileys: smileys, l10n.emojiCategoryGestures: gestures, l10n.emojiCategoryHearts: hearts, l10n.emojiCategoryObjects: objects, }; } @override Widget build(BuildContext context) { final l10n = context.l10n; final emojiCategories = _emojiCategories(l10n); return Container( height: MediaQuery.of(context).size.height * 0.5, decoration: BoxDecoration( color: Theme.of(context).colorScheme.surface, borderRadius: const BorderRadius.vertical(top: Radius.circular(20)), ), child: Column( children: [ Padding( padding: const EdgeInsets.all(16), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( l10n.chat_addReaction, style: const TextStyle( fontSize: 18, fontWeight: FontWeight.bold, ), ), IconButton( icon: const Icon(Icons.close), onPressed: () => Navigator.pop(context), ), ], ), ), Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), child: Wrap( spacing: 12, children: quickEmojis .map( (emoji) => InkWell( onTap: () { onEmojiSelected(emoji); Navigator.pop(context); }, child: Container( padding: const EdgeInsets.all(8), decoration: BoxDecoration( color: Theme.of( context, ).colorScheme.secondaryContainer, borderRadius: BorderRadius.circular(8), ), child: Text( emoji, style: const TextStyle(fontSize: 28), ), ), ), ) .toList(), ), ), const Divider(), Expanded( child: DefaultTabController( length: emojiCategories.length, child: Column( children: [ TabBar( isScrollable: true, tabs: emojiCategories.keys .map((cat) => Tab(text: cat)) .toList(), ), Expanded( child: TabBarView( children: emojiCategories.values .map( (emojis) => GridView.builder( padding: const EdgeInsets.all(8), gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 8, mainAxisSpacing: 8, crossAxisSpacing: 8, ), itemCount: emojis.length, itemBuilder: (context, index) => InkWell( onTap: () { onEmojiSelected(emojis[index]); Navigator.pop(context); }, child: Center( child: Text( emojis[index], style: const TextStyle(fontSize: 28), ), ), ), ), ) .toList(), ), ), ], ), ), ), ], ), ); } }