You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Introduces AnimatedIconGenerator for pixel-perfect animated menu icons using Flutter's Canvas API. Updates README and UI to document and demonstrate new animated icon features, including spinner, pulse, blink, progress, wave, and rotating square animations, with high DPI support and real-time updates.
1. Click **Set Icon from Asset** - first menu item displays icon from asset file
203
+
1. Click **Set Asset Icon** - first menu item displays icon from asset file
193
204
2. Right-click the context menu region to verify icon appears
194
-
3. Click **Set Icon from Widget** - first menu item displays a star icon (converted from Material Icons)
205
+
3. Click **Set Widget Icon** - first menu item displays a star icon (converted from Material Icons)
195
206
4. Right-click to verify the widget-based icon appears
196
-
5. Click **Remove Icon from First Item** - icon should disappear
207
+
5. Click **Remove Icon** - icon should disappear
197
208
6. Right-click again to verify icon is removed
198
209
199
-
**Note:** The "Set Icon from Widget" feature demonstrates converting Flutter's Material Icons to native menu icons using base64 encoding.
210
+
**Note:** The "Set Widget Icon" feature demonstrates converting Flutter's Material Icons to native menu icons using base64 encoding.
200
211
201
-
### Menu Item Removal Testing
202
-
1. Click **Remove First Menu Item** - first item should be removed, count decreases
203
-
2. Click **Remove Item at Position 2** - item at position 2 removed
204
-
3. Click **Remove Last Menu Item** - last item removed
205
-
4. Verify item count updates correctly after each removal
206
-
5. Right-click to verify items are actually removed from menu
212
+
### Animated Icons Testing
213
+
1. Click **Spinner** - first menu item displays a rotating spinner animation
214
+
2. Right-click to see the animation in action
215
+
3. Click **Pulse** - switches to pulsing circle animation
216
+
4. Click **Blink** - switches to blinking dot animation
217
+
5. Click **Progress** - switches to filling progress bar animation
218
+
6. Click **Wave** - switches to moving wave pattern animation
219
+
7. Click **Rotate** - switches to rotating square animation
220
+
8. Click **Stop** - stops any running animation
221
+
9. Right-click to verify the icon updates in real-time
222
+
223
+
**Note:** The animated icons are generated pixel-by-pixel using Flutter's Canvas API and converted to native images. Each animation type provides different visual feedback suitable for loading states, notifications, or progress indicators.
207
224
208
225
### Positioning Testing
209
-
1. Click **Absolute (100,100)** - menu appears at top-left
210
-
2. Click **Absolute (300,200)** - menu appears at center-left
211
-
3. Click **Cursor Position** - menu appears at mouse location
226
+
1. Click **Pos (100,100)** - menu appears at top-left coordinates
227
+
2. Click **Pos (300,200)** - menu appears at center-left coordinates
228
+
3. Click **At Cursor** - menu appears at mouse location
212
229
213
230
### Placement Testing
214
231
1. Click each placement button (topStart, bottomEnd, etc.)
@@ -217,8 +234,8 @@ flutter run -d linux
217
234
218
235
### Edge Cases Testing
219
236
1. Click **Add 10 Items** - verify menu handles many items
This allows you to use any Flutter Icon (Material Icons, Cupertino Icons, custom icon fonts) as native menu icons.
298
315
316
+
### Using Animated Icons
317
+
318
+
Create pixel-perfect animated icons using the `AnimatedIconGenerator` class:
319
+
320
+
```dart
321
+
import 'animated_icon_generator.dart';
322
+
323
+
// Create an animated icon generator with high DPI support
324
+
final generator = AnimatedIconGenerator(
325
+
size: 32, // Higher resolution for better quality
326
+
foregroundColor: Colors.blue,
327
+
);
328
+
329
+
// Create a menu item
330
+
final menuItem = MenuItem('Loading...');
331
+
332
+
// Start a spinner animation
333
+
generator.startSpinner(
334
+
onFrame: (image) async {
335
+
menuItem.icon = image;
336
+
},
337
+
);
338
+
339
+
// Switch to pulse animation
340
+
generator.startPulse(
341
+
onFrame: (image) async {
342
+
menuItem.icon = image;
343
+
},
344
+
);
345
+
346
+
// Stop animation when done
347
+
generator.stop();
348
+
```
349
+
350
+
Available animation types:
351
+
-`startSpinner()` - Rotating circular loader
352
+
-`startPulse()` - Expanding/contracting circle
353
+
-`startBlink()` - On/off blinking dot
354
+
-`startProgress()` - Filling progress bar
355
+
-`startWave()` - Moving wave pattern
356
+
-`startRotatingSquare()` - Rotating square icon
357
+
358
+
The animations are generated using Flutter's Canvas API and converted to native images, providing smooth pixel-perfect animations suitable for menu icons.
359
+
360
+
**High DPI Support:** The `AnimatedIconGenerator` automatically scales icons for high DPI displays (Retina, HiDPI). Default size is 32x32 logical pixels, which produces crisp icons on all displays including Retina displays (64x64 or 96x96 physical pixels).
361
+
299
362
## Platform-Specific Notes
300
363
301
364
### macOS
@@ -343,24 +406,33 @@ main.dart
343
406
├── _iconToImage() - Converts Flutter Icon widget to base64 image
344
407
├── _setupContextMenu() - Creates main context menu
345
408
├── _setupPositioningMenu() - Creates positioning test menu
346
-
├── _setupPlacementMenu() - Creates placement test menu
347
409
├── _addToHistory() - Logs events to history
410
+
├── Item Management Methods
411
+
│ ├── _addNewMenuItem() - Adds item to end
412
+
│ ├── _insertMenuItemAtPosition() - Inserts item at specific position
413
+
│ ├── _insertSeparatorAtPosition() - Inserts separator at position
414
+
│ ├── _removeFirstMenuItem() - Removes first item
415
+
│ ├── _removeMenuItemAtPosition() - Removes item at position
416
+
│ └── _removeLastMenuItem() - Removes last item
417
+
├── Item Properties Methods
418
+
│ ├── _changeDynamicLabel() - Changes menu item label
419
+
│ ├── _setCheckboxMixed() - Sets checkbox to mixed state
0 commit comments