From e15720dfc2f99701a153590367f41360cc4f2979 Mon Sep 17 00:00:00 2001 From: Aman Singh <68653906+Gagarod@users.noreply.github.com> Date: Sat, 26 Mar 2022 19:02:58 +0530 Subject: [PATCH] Added hero animation to the product summary card (#1334) * Added hero animation to the product summary card * formatted the code --- .../lib/pages/product/new_product_page.dart | 15 +++++++++------ .../lib/pages/scan/scan_product_card.dart | 5 ++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/smooth_app/lib/pages/product/new_product_page.dart b/packages/smooth_app/lib/pages/product/new_product_page.dart index b652f0d06dd..6053851125b 100644 --- a/packages/smooth_app/lib/pages/product/new_product_page.dart +++ b/packages/smooth_app/lib/pages/product/new_product_page.dart @@ -197,12 +197,15 @@ class _ProductPageState extends State { padding: const EdgeInsets.symmetric( horizontal: SMALL_SPACE, ), - child: SummaryCard( - _product, - _productPreferences, - isFullVersion: true, - showUnansweredQuestions: true, - refreshProductCallback: _refreshProduct, + child: Hero( + tag: _product.barcode ?? '', + child: SummaryCard( + _product, + _productPreferences, + isFullVersion: true, + showUnansweredQuestions: true, + refreshProductCallback: _refreshProduct, + ), ), ), _buildKnowledgePanelCards(), diff --git a/packages/smooth_app/lib/pages/scan/scan_product_card.dart b/packages/smooth_app/lib/pages/scan/scan_product_card.dart index b3f8cad929c..6d0ff8d5b5f 100644 --- a/packages/smooth_app/lib/pages/scan/scan_product_card.dart +++ b/packages/smooth_app/lib/pages/scan/scan_product_card.dart @@ -24,7 +24,10 @@ class ScanProductCard extends StatelessWidget { _openProductPage(context); } }, - child: SummaryCard(product, productPreferences), + child: Hero( + tag: product.barcode ?? '', + child: SummaryCard(product, productPreferences), + ), ); }