diff --git a/example/lib/page/style/classical_page.dart b/example/lib/page/style/classical_page.dart index cdc3c335..6fbf4644 100644 --- a/example/lib/page/style/classical_page.dart +++ b/example/lib/page/style/classical_page.dart @@ -53,6 +53,7 @@ class _ClassicPageState extends State { body: EasyRefresh( controller: _controller, header: ClassicHeader( + iconTheme: IconThemeData(color: Colors.green), clamping: _headerProperties.clamping, backgroundColor: _headerProperties.background ? Theme.of(context).colorScheme.surfaceVariant @@ -71,6 +72,7 @@ class _ClassicPageState extends State { messageText: 'Last updated at %T'.tr, ), footer: ClassicFooter( + iconTheme: IconThemeData(color: Colors.green), clamping: _footerProperties.clamping, backgroundColor: _footerProperties.background ? Theme.of(context).colorScheme.surfaceVariant diff --git a/lib/src/styles/classic/classic_indicator.dart b/lib/src/styles/classic/classic_indicator.dart index a85a6ec4..d7e82769 100644 --- a/lib/src/styles/classic/classic_indicator.dart +++ b/lib/src/styles/classic/classic_indicator.dart @@ -98,6 +98,9 @@ class _ClassicIndicator extends StatefulWidget { /// Link [Stack.clipBehavior]. final Clip clipBehavior; + /// Icon style. + final IconThemeData? iconTheme; + const _ClassicIndicator({ Key? key, required this.state, @@ -126,6 +129,7 @@ class _ClassicIndicator extends StatefulWidget { this.messageStyle, this.messageBuilder, this.clipBehavior = Clip.hardEdge, + this.iconTheme }) : assert( mainAxisAlignment == MainAxisAlignment.start || mainAxisAlignment == MainAxisAlignment.center || @@ -246,6 +250,7 @@ class _ClassicIndicatorState extends State<_ClassicIndicator> /// Build icon. Widget _buildIcon() { Widget icon; + final iconTheme = widget.iconTheme ?? Theme.of(context).iconTheme; if (_result == IndicatorResult.noMore) { icon = SizedBox( key: const ValueKey(IndicatorResult.noMore), @@ -262,7 +267,7 @@ class _ClassicIndicatorState extends State<_ClassicIndicator> height: 20, child: CircularProgressIndicator( strokeWidth: 2, - color: Theme.of(context).iconTheme.color, + color: iconTheme.color, ), ); } else if (_mode == IndicatorMode.processed || @@ -304,6 +309,8 @@ class _ClassicIndicatorState extends State<_ClassicIndicator> ), ); } + + return AnimatedSwitcher( key: _iconAnimatedSwitcherKey, duration: const Duration(milliseconds: 300), @@ -317,7 +324,7 @@ class _ClassicIndicatorState extends State<_ClassicIndicator> opacity: animation, ); }, - child: icon, + child: IconTheme.merge(data: iconTheme, child: icon), ); } diff --git a/lib/src/styles/classic/footer/classic_footer.dart b/lib/src/styles/classic/footer/classic_footer.dart index 60c44988..308c47ef 100644 --- a/lib/src/styles/classic/footer/classic_footer.dart +++ b/lib/src/styles/classic/footer/classic_footer.dart @@ -80,6 +80,10 @@ class ClassicFooter extends Footer { /// Link [Stack.clipBehavior]. final Clip clipBehavior; + /// Icon style. + final IconThemeData? iconTheme; + + const ClassicFooter({ this.key, double triggerOffset = 70, @@ -119,6 +123,7 @@ class ClassicFooter extends Footer { this.messageStyle, this.messageBuilder, this.clipBehavior = Clip.hardEdge, + this.iconTheme }) : super( triggerOffset: triggerOffset, clamping: clamping, @@ -165,6 +170,7 @@ class ClassicFooter extends Footer { messageStyle: messageStyle, messageBuilder: messageBuilder, clipBehavior: clipBehavior, + iconTheme: iconTheme ); } } diff --git a/lib/src/styles/classic/header/classic_header.dart b/lib/src/styles/classic/header/classic_header.dart index 43570b95..055172f0 100644 --- a/lib/src/styles/classic/header/classic_header.dart +++ b/lib/src/styles/classic/header/classic_header.dart @@ -80,6 +80,9 @@ class ClassicHeader extends Header { /// Link [Stack.clipBehavior]. final Clip clipBehavior; + /// Icon style. + final IconThemeData? iconTheme; + const ClassicHeader({ this.key, double triggerOffset = 70, @@ -119,6 +122,7 @@ class ClassicHeader extends Header { this.messageStyle, this.messageBuilder, this.clipBehavior = Clip.hardEdge, + this.iconTheme }) : super( triggerOffset: triggerOffset, clamping: clamping, @@ -165,6 +169,7 @@ class ClassicHeader extends Header { messageStyle: messageStyle, messageBuilder: messageBuilder, clipBehavior: clipBehavior, + iconTheme: iconTheme ); } }