From 47655b1054aaf59c3223e0267099b7ed9506a41e Mon Sep 17 00:00:00 2001 From: pc Date: Sun, 8 Oct 2023 17:13:00 +0100 Subject: [PATCH] fix: fix example --- example/lib/image.dart | 12 +++++------- example/pubspec.lock | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/example/lib/image.dart b/example/lib/image.dart index 8665b99..32da882 100644 --- a/example/lib/image.dart +++ b/example/lib/image.dart @@ -39,11 +39,11 @@ class _ImageWidgetState extends State { ), ), child: ReactionButton( - onReactionChanged: (Reaction? value) { + onReactionChanged: (Reaction? reaction) { setState(() { - _selectedReaction = value; + _selectedReaction = reaction; }); - debugPrint('Selected value: $value'); + debugPrint('Selected value: ${reaction?.value}'); }, itemSize: const Size.square(40), reactions: widget.reactions, @@ -72,10 +72,8 @@ class _ImageWidgetState extends State { ], ), child: _selectedReaction != null - ? widget.reactions - .firstWhere((value) => value.value == _selectedReaction) - .previewIcon - : const SizedBox(), + ? _selectedReaction!.previewIcon + : null, ), ), ], diff --git a/example/pubspec.lock b/example/pubspec.lock index 80269c7..132d1a6 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -76,7 +76,7 @@ packages: path: ".." relative: true source: path - version: "2.0.1+1" + version: "2.0.2" flutter_test: dependency: "direct dev" description: flutter