flutter_boring_avatars 2.1.0
flutter_boring_avatars: ^2.1.0 copied to clipboard
Boring avatars can generate unique avatars based on the username and color palette.
2.1.0 #
Special thanks to blopker for the performance improvements in this release!
Performance #
-
Marble painter: cached static paths and single-pass transforms — The two SVG-like
Pathobjects in the marble variant had constant geometry but were rebuilt from scratch on every paint call. They are now top-level constants, created once. Additionally, the per-element transform and resize transform (previously applied as two separatePath.transform()calls, producing 4Pathallocations per frame) are now combined into a singleMatrix4, halving path allocations. Benchmarked at ~2x faster paint calls. -
Widget data caching —
BoringAvatarandAnimatedBoringAvatarwereStatelessWidgets that calledBoringAvatarData.generate()on everybuild(), re-running the hash function and property calculations even when inputs hadn't changed. Both are nowStatefulWidgets that cache the generatedBoringAvatarDataand only regenerate when the resolvedname,type,palette, orshapeactually change. This eliminates redundant work during parent rebuilds (e.g. scrolling lists, unrelatedsetStatecalls). -
Animated paint hint — The
CustomPaintinsideAnimatedBoringCanvasnow setswillChange: true, telling the raster cache not to waste effort caching frames that are immediately invalidated during animation.
Fixes #
- Resolved all deprecated API warnings:
Matrix4.translate/scalemigrated totranslateByDouble/scaleByDouble,Color.withOpacitytowithValues,Color.red/green/blueto the new component accessors, andColor.valuetotoARGB32.
2.0.1 #
- Modify the image link in README to display correctly on pub.dev
2.0.0 #
- Completely refactored the code with a brand new API
- Avatars of different types now also support transition animations
- Supports using avatars in a Decoration manner
- Supports defining shapes and borders
- Supports exporting avatars as images
- Maintains the same generation algorithm as the original project
- Removed the dependency on
svg_path_parser, now relying only on the Flutter SDK - A beautiful Web Demo is available to experience the effect
1.1.0 #
Updated hash algorithm to match the changes made in version 1.6.0 of the original JavaScript project, ensuring consistent avatar generation. (#1) Special thanks to fieldOfView for discovering and fixing this issue!
1.0.2 #
Fix AvatarMarble blur effect fidelity
1.0.1 #
Fix the wrong link address in the readme file.
1.0.0 #
Initial release