diff --git a/CHANGELOG.md b/CHANGELOG.md index 19c17d6..49b2d5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ -## 1.0.10 +## 1.2.0 + +- feature: Added custom indicator painter support + +## 1.1.0 - feature: Added arrow gap support according to the arrow direction - doc: Updated example project diff --git a/lib/src/overlays/overlay_entry_layout.dart b/lib/src/overlays/overlay_entry_layout.dart index 1979e99..dd2e531 100644 --- a/lib/src/overlays/overlay_entry_layout.dart +++ b/lib/src/overlays/overlay_entry_layout.dart @@ -78,10 +78,11 @@ class _OverlayInfoPopupState extends State { top: _getIndicatorTopPosition, child: CustomPaint( size: widget.arrowTheme.arrowSize, - painter: ArrowIndicatorPainter( - arrowDirection: widget.arrowTheme.arrowDirection, - arrowColor: widget.arrowTheme.color, - ), + painter: widget.arrowTheme.arrowPainter ?? + ArrowIndicatorPainter( + arrowDirection: widget.arrowTheme.arrowDirection, + arrowColor: widget.arrowTheme.color, + ), ), ), Positioned( diff --git a/lib/src/themes/info_popup_arrow_theme.dart b/lib/src/themes/info_popup_arrow_theme.dart index d1bac0a..f6ddfb3 100644 --- a/lib/src/themes/info_popup_arrow_theme.dart +++ b/lib/src/themes/info_popup_arrow_theme.dart @@ -1,4 +1,4 @@ -import 'package:flutter/material.dart' show Color, Colors, Size; +import 'package:flutter/material.dart' show Color, Colors, CustomPainter, Size; import 'package:info_popup/src/constants/popup_constants.dart'; import 'package:info_popup/src/enums/arrow_direction.dart'; @@ -8,11 +8,13 @@ class InfoPopupArrowTheme { /// [arrowDirection] is used to customize the direction of the arrow. /// [arrowSize] is used to customize the size of the arrow. /// [arrowGap] is used to customize the gap between the arrow and the content. + /// [arrowPainter] is used to customize the painter of the arrow. const InfoPopupArrowTheme({ this.arrowSize = PopupConstants.defaultArrowSize, this.arrowDirection = ArrowDirection.up, this.color = Colors.black, this.arrowGap = 0, + this.arrowPainter, }); /// The size [arrowSize] of the arrow indicator. @@ -27,18 +29,23 @@ class InfoPopupArrowTheme { /// The [arrowGap] add a gap between the arrow and the content. final double arrowGap; + /// The [arrowPainter] is used to draw the arrow indicator. + final CustomPainter? arrowPainter; + /// [copyWith] is used to copy the [InfoPopupArrowTheme] with new values. InfoPopupArrowTheme copyWith({ Size? arrowSize, ArrowDirection? arrowDirection, Color? color, double? arrowGap, + CustomPainter? arrowPainter, }) { return InfoPopupArrowTheme( arrowSize: arrowSize ?? this.arrowSize, arrowDirection: arrowDirection ?? this.arrowDirection, color: color ?? this.color, arrowGap: arrowGap ?? this.arrowGap, + arrowPainter: arrowPainter ?? this.arrowPainter, ); } } diff --git a/pubspec.yaml b/pubspec.yaml index 45533c4..5f65fe7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: info_popup description: The simple way to show the user some information on your selected widget. -version: 1.1.0 +version: 1.2.0 repository: https://github.com/salihcanbinboga/info_popup environment: