info_label 2.0.1
info_label: ^2.0.1 copied to clipboard
info_label is a Flutter library that provides customizable components for displaying information.
info_label #
2.0.1 #
- Fix golden images in pub.dev — use absolute GitHub raw URLs.
2.0.0 #
Breaking Changes #
- Removed
activeOnHoverbool — replaced by composable flag. Hover is now enabled viaactiveOnHover: trueand usesValueNotifier+CustomPainter.repaintfor paint-only updates (no widget rebuild). - Removed
Widget? overlay— replaced by paintable overlay params (overlayColor,overlayText,overlayBorderColor, etc). Zero extra widgets. - Removed
InfoLabelTypeenum — features are now composable flags (activeOnHover,compactSize,overlayColor) that can be combined freely. _soliddistribution text color — now auto-selects black/white based on background luminance instead of always defaulting to null.
New Features #
- CustomPainter rendering — all labels use
CustomPainteras the base renderer. Background, border, and text (in compact mode) are painted directly on canvas for minimal RenderObject count._InfoLabelBasePainter— background + border for base/hover variants._CompactTextPainter— background + border + centered auto-scaled text for compact mode._OverlayPainter— positioned indicator painted asforegroundPainter.
- Compact mode (
compactSize) — fixed-size square label with auto-scaled centered text viaTextPainter. Replaces 6-widget tree with 1RenderCustomPaint. - Overlay indicator — 4 modes, all painted (zero widgets):
- Dot:
overlayColoronly. - Badge:
overlayColor+overlayText(auto-expands to pill for multi-char text like "99+"). - Text only:
overlayTextwithoutoverlayColor. - Bordered badge:
overlayColor+overlayText+overlayBorderColor.
- Dot:
- iOS smooth corners (
smoothCorners: true) — superellipse/squircle corners using cubic bezier curves. Matches iOS/Figma continuous corner radius style. - Composable features —
activeOnHover,compactSize, andoverlayColor/overlayTextcan be combined freely. Only the needed layers are instantiated. - Hover paint-only repaint —
ValueNotifier<Color?>passed toCustomPainter.repaint. Hover changes trigger onlypaint()— nobuild(), no layout, no widget tree diff. - Auto-contrast text —
_solid,_solidBackgroundTextContrastBorder,_solidBackgroundBorderContrastText, and_fullContrastdistribution modes auto-select black/white text based on background luminance whentextColoris not explicitly set.
Architecture #
part offile organization — each widget variant and painter is in its ownpartfile:_info_label_data.dart— shared data object._info_label_painters.dart— 3 CustomPainters + squircle path._base_info_label_widget.dart— base variant +_BaseContent._compact_info_label_widget.dart— compact variant._hover_info_label_widget.dart— hover wrapper._color_by_type_info_widget.dart— color lookup mixin.
_InfoLabelData— encapsulates 22+ shared params to avoid repetition across variants.- Switch on record pattern —
InfoLabel.build()usesswitch ((activeOnHover, compactSize != null))for zero-overhead routing.
Tests #
- 38 tests (up from 11) — 17 unit tests + 4 assertion tests + 17 golden test groups.
- Golden tests restructured — one file per concern:
golden_type_colors_test.dart— 13 TypeInfoLabel colors + globalColor override.golden_distribution_modes_test.dart— 6 modes × 3 contrast levels.golden_rounded_corners_test.dart— circular vs smooth (squircle) at 5 radii.golden_border_colors_test.dart— border color and visibility.golden_custom_colors_test.dart— text/bg/globalColor overrides.golden_layout_icons_test.dart— icons, alignment, padding, msg.golden_compact_test.dart— compact sizing and text scaling.golden_overlay_test.dart— dots, badges, text-only, bordered, positions.golden_hover_test.dart— normal vs hover state comparison.
- Standardized golden config — white background, 14px padding, Roboto font.
1.3.0 #
- Updated Dart SDK constraint to ^3.10.0.
- Fixed lint warning: added type annotation to
_onHoverActionparameter. - Fixed golden tests CI variant configuration.
1.2.4 #
- activeOnHover defaults to false.
1.2.3 #
- Improve validation, title, text, etc.
1.2.2 #
- Changelog format.
1.2.1 #
Added #
- Support for using either titleWidget or text in the InfoLabel's upper section
- New functionality that allows using message as title when no text is defined
Changed #
- Improved rendering logic to maintain consistent alignment
- Optimized handling of cases when only message is provided
Notes #
- Existing implementations using text and msg remain compatible
- This update enhances widget flexibility while maintaining backward compatibility
1.2.0 #
New Features #
- Message Support: Added
msgproperty to display additional descriptive text below the main label - Message Padding: Introduced
msgPaddingproperty for custom message spacing control - Adaptive Text: Added
isTextAdaptiveproperty for improved text responsiveness
Improvements #
- Layout Enhancement:
- Improved margin distribution for better visual consistency
- Enhanced spacing between label elements
- Optimized alignment of text and icons
- Test Coverage:
- Added comprehensive test cases for new features
- Expanded golden tests for layout variations
- Included responsive layout testing scenarios
Documentation #
- Updated README with new property examples
- Added usage examples for message functionality
- Included layout best practices
Internal Changes #
- Refactored padding logic for better maintainability
- Enhanced test infrastructure for golden tests
- Improved type safety for new properties
1.1.2 #
- Fix dev imports
1.1.1 #
- Update green color
1.1.0 #
- Remove global margin
- User margin for icons and content
1.0.8 #
- Improvement: Improve widgets use.
- Fix: Now is text centered correctly.
1.0.7 #
- Improvement: Update
TypeDistributionColor.
1.0.6 #
- Improvement: Solid background per default, etc.
1.0.5 #
1.0.2 #
Minor Changes #
- Improvement: LICENSE.
- Improvement: README.
- Improvement: InfoLabel widget validations.
1.0.0 #
Major Changes #
- Added: Introduced the
InfoLabelWidgetcomponent, allowing for customizable information labels in Flutter applications. - Added: Introduced the
TypeDistributionColorenum, defining different color distribution configurations for labels to optimize readability and visual appearance. - Added: Introduced the
TypeInfoLabelenum, representing different types of labels with associated colors and meanings for quick labeling of information.
Other Changes #
- Improvement: Enhanced documentation in classes and methods to improve understanding and usage of the library.
- Improvement: Optimized variable and method names to adhere to Dart naming conventions and improve code readability.
- Improvement: Effectively reused code to promote maintainability and scalability of the project.
- Fix: Addressed minor issues and improved code efficiency to ensure optimal performance.
Final Notes #
This marks the initial stable release of the info_label library! We hope you find the new components and improvements introduced in this version helpful. If you have any feedback, suggestions, or encounter any issues, please don't hesitate to let us know so we can continue improving the library in future releases.