@@ -25,75 +25,89 @@ Future<void> _performSearch(String query) async {
2525
2626 if ((searchResponse.nbHits ?? 0 ) > 0 ) {
2727 final AlfredItems items = AlfredItems (
28- await Future .wait (searchResponse.hits
29- .map ((Hit hit) => SearchResult .fromJson (
30- < String , dynamic > {...hit, 'objectID' : hit.objectID}))
31- .map ((SearchResult result) async {
32- final File ? image = await EmojiDownloader (
33- emoji: result.emoji,
34- ).downloadImage ();
28+ await Future .wait (
29+ searchResponse.hits
30+ .map (
31+ (Hit hit) => SearchResult .fromJson (< String , dynamic > {
32+ ...hit,
33+ 'objectID' : hit.objectID,
34+ }),
35+ )
36+ .map ((SearchResult result) async {
37+ final File ? image = await EmojiDownloader (
38+ emoji: result.emoji,
39+ ).downloadImage ();
3540
36- return AlfredItem (
37- uid: result.objectID,
38- title: result.code,
39- subtitle: result.description,
40- arg: result.code,
41- match: '${result .name } ${result .description }' ,
42- text: AlfredItemText (
43- copy: result.code,
44- largeType: result.code,
45- ),
46- icon: AlfredItemIcon (
47- path: image != null ? image.absolute.path : 'question.png' ,
48- ),
49- mods: {
50- {AlfredItemModKey .alt}: AlfredItemMod (
51- subtitle: 'Copy "${result .emoji }" to clipboard' ,
52- arg: result.emoji,
53- icon: AlfredItemIcon (
54- path: image? .absolute.path ?? 'question.png' ),
55- ),
56- {AlfredItemModKey .shift}: AlfredItemMod (
57- subtitle:
58- 'Copy Python source of "${result .emoji }" to clipboard' ,
59- arg: 'u"\\ U000'
60- '${result .emoji .runes .first .toRadixString (16 ).toUpperCase ()}'
61- '${result .emoji .runes .toList ().sublist (1 ).map (
62- (int i ) => '\\ u${i .toRadixString (16 ).toUpperCase ()}' ,
63- ).join ()}"' ,
64- icon: AlfredItemIcon (
65- path: image? .absolute.path ?? 'question.png' ),
66- ),
67- {AlfredItemModKey .ctrl}: AlfredItemMod (
68- subtitle: 'Copy HTML Entity of "${result .emoji }" to clipboard' ,
69- arg: result.emoji.runes
70- .map ((int i) => '&#x${i .toRadixString (16 )};' )
71- .join (),
72- icon: AlfredItemIcon (
73- path: image? .absolute.path ?? 'question.png' ),
74- ),
75- {AlfredItemModKey .ctrl, AlfredItemModKey .shift}: AlfredItemMod (
76- subtitle:
77- 'Copy formal Unicode notation of "${result .emoji }" to clipboard' ,
78- arg: result.emoji.runes
79- .map ((int i) => 'U+${i .toRadixString (16 ).toUpperCase ()}' )
80- .join (', ' ),
81- icon: AlfredItemIcon (
82- path: image? .absolute.path ?? 'question.png' ),
83- ),
84- },
85- valid: true ,
86- );
87- }).toList ()),
41+ return AlfredItem (
42+ uid: result.objectID,
43+ title: result.code,
44+ subtitle: result.description,
45+ arg: result.code,
46+ match: '${result .name } ${result .description }' ,
47+ text: AlfredItemText (
48+ copy: result.code,
49+ largeType: result.code,
50+ ),
51+ icon: AlfredItemIcon (
52+ path: image != null ? image.absolute.path : 'question.png' ,
53+ ),
54+ mods: {
55+ {AlfredItemModKey .alt}: AlfredItemMod (
56+ subtitle: 'Copy "${result .emoji }" to clipboard' ,
57+ arg: result.emoji,
58+ icon: AlfredItemIcon (
59+ path: image? .absolute.path ?? 'question.png' ,
60+ ),
61+ ),
62+ {AlfredItemModKey .shift}: AlfredItemMod (
63+ subtitle:
64+ 'Copy Python source of "${result .emoji }" to clipboard' ,
65+ arg:
66+ 'u"\\ U000'
67+ '${result .emoji .runes .first .toRadixString (16 ).toUpperCase ()}'
68+ '${result .emoji .runes .toList ().sublist (1 ).map ((int i ) => '\\ u${i .toRadixString (16 ).toUpperCase ()}' ).join ()}"' ,
69+ icon: AlfredItemIcon (
70+ path: image? .absolute.path ?? 'question.png' ,
71+ ),
72+ ),
73+ {AlfredItemModKey .ctrl}: AlfredItemMod (
74+ subtitle:
75+ 'Copy HTML Entity of "${result .emoji }" to clipboard' ,
76+ arg: result.emoji.runes
77+ .map ((int i) => '&#x${i .toRadixString (16 )};' )
78+ .join (),
79+ icon: AlfredItemIcon (
80+ path: image? .absolute.path ?? 'question.png' ,
81+ ),
82+ ),
83+ {
84+ AlfredItemModKey .ctrl,
85+ AlfredItemModKey .shift,
86+ }: AlfredItemMod (
87+ subtitle:
88+ 'Copy formal Unicode notation of "${result .emoji }" to clipboard' ,
89+ arg: result.emoji.runes
90+ .map (
91+ (int i) => 'U+${i .toRadixString (16 ).toUpperCase ()}' ,
92+ )
93+ .join (', ' ),
94+ icon: AlfredItemIcon (
95+ path: image? .absolute.path ?? 'question.png' ,
96+ ),
97+ ),
98+ },
99+ valid: true ,
100+ );
101+ })
102+ .toList (),
103+ ),
88104 );
89105 _workflow.addItems (items.items);
90106 } else {
91107 _workflow.addItem (
92108 AlfredItem (
93109 title: 'No matching gitmoji found' ,
94- icon: AlfredItemIcon (
95- path: 'question.png' ,
96- ),
110+ icon: AlfredItemIcon (path: 'question.png' ),
97111 valid: false ,
98112 ),
99113 );
0 commit comments