diff --git a/packages/smooth_app/lib/cards/product_cards/product_image_carousel.dart b/packages/smooth_app/lib/cards/product_cards/product_image_carousel.dart index 6a3ba567719..29aae197c9e 100644 --- a/packages/smooth_app/lib/cards/product_cards/product_image_carousel.dart +++ b/packages/smooth_app/lib/cards/product_cards/product_image_carousel.dart @@ -11,13 +11,11 @@ class ProductImageCarousel extends StatelessWidget { this.product, { required this.height, this.controller, - this.onUpload, }); final Product product; final double height; final ScrollController? controller; - final Function(BuildContext)? onUpload; @override Widget build(BuildContext context) { 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 3bea629d45e..0e6c41d6111 100644 --- a/packages/smooth_app/lib/pages/product/new_product_page.dart +++ b/packages/smooth_app/lib/pages/product/new_product_page.dart @@ -157,19 +157,6 @@ class _ProductPageState extends State ); } - Future _refreshProduct(BuildContext context) async { - final bool success = await ProductRefresher().fetchAndRefresh( - barcode: barcode, - widget: this, - ); - if (context.mounted) { - if (success) { - // Reset the carousel to the beginning - _carouselController.jumpTo(0.0); - } - } - } - Future _updateLocalDatabaseWithProductHistory( final BuildContext context, ) async { @@ -209,7 +196,6 @@ class _ProductPageState extends State upToDateProduct, height: 200, controller: _carouselController, - onUpload: _refreshProduct, ), ), Padding( diff --git a/packages/smooth_app/lib/pages/product/product_question_card.dart b/packages/smooth_app/lib/pages/product/product_question_card.dart deleted file mode 100644 index 5c39b09c9ff..00000000000 --- a/packages/smooth_app/lib/pages/product/product_question_card.dart +++ /dev/null @@ -1,81 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:openfoodfacts/openfoodfacts.dart'; -import 'package:provider/provider.dart'; -import 'package:shimmer/shimmer.dart'; -import 'package:smooth_app/database/local_database.dart'; -import 'package:smooth_app/generic_lib/design_constants.dart'; -import 'package:smooth_app/pages/product/common/product_refresher.dart'; - -/// Display of a Robotoff question text. -class ProductQuestionCard extends StatelessWidget { - const ProductQuestionCard( - this.question, { - Key? key, - }) : super(key: key); - - final RobotoffQuestion question; - - static const Color robotoffBackground = Color(0xFFFFEFB7); - - @override - Widget build(BuildContext context) { - final Future productFuture = - ProductRefresher().silentFetchAndRefresh( - barcode: question.barcode!, - localDatabase: context.read(), - ); - - return FutureBuilder( - future: productFuture, - builder: (BuildContext context, AsyncSnapshot snapshot) { - if (!snapshot.hasData) { - return _buildQuestionShimmer(); - } - return _buildQuestionText(context, question); - }); - } - - Widget _buildQuestionText(BuildContext context, RobotoffQuestion question) { - final ThemeData theme = Theme.of(context); - final bool isDarkMode = theme.brightness == Brightness.dark; - return Padding( - padding: const EdgeInsetsDirectional.only(start: SMALL_SPACE), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsetsDirectional.only(bottom: VERY_SMALL_SPACE), - child: Text( - question.question!, - style: theme.textTheme.headlineMedium!.apply( - color: isDarkMode ? Colors.white : theme.cardTheme.color, - ), - ), - ), - Padding( - padding: const EdgeInsetsDirectional.only(bottom: VERY_SMALL_SPACE), - child: Text( - question.value!, - style: theme.textTheme.headlineMedium?.apply( - color: isDarkMode ? Colors.white : theme.cardTheme.color), - ), - ), - ], - ), - ); - } - - Widget _buildQuestionShimmer() => Shimmer.fromColors( - baseColor: robotoffBackground, - highlightColor: Colors.white, - child: Card( - clipBehavior: Clip.antiAlias, - shape: const RoundedRectangleBorder( - borderRadius: ROUNDED_BORDER_RADIUS, - ), - child: Container( - height: LARGE_SPACE * 4, - ), - ), - ); -}