From bbc437081ff0f92c3477af29c59e0fb452a20d45 Mon Sep 17 00:00:00 2001 From: Edouard Marquez Date: Sat, 16 Apr 2022 13:34:15 +0200 Subject: [PATCH] UI changes --- packages/smooth_app/lib/l10n/app_en.arb | 1 + .../smooth_app/lib/pages/scan/scan_page.dart | 23 ++++++++++++++----- .../lib/widgets/smooth_product_carousel.dart | 3 ++- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/packages/smooth_app/lib/l10n/app_en.arb b/packages/smooth_app/lib/l10n/app_en.arb index 4baed82a6b0..aefa0a578c4 100644 --- a/packages/smooth_app/lib/l10n/app_en.arb +++ b/packages/smooth_app/lib/l10n/app_en.arb @@ -728,6 +728,7 @@ "@permission_photo_error": { "description": "When the camera/photo permission failed to be acquired (!= denied)" }, + "permission_photo_denied_title": "Allow camera use to scan barcodes", "permission_photo_denied_message": "For an enhanced experience, please allow {appName} to access your camera. You will be able to directly scan barcodes.", "@permission_photo_denied_message": { "description": "When the camera/photo permission is denied by user", diff --git a/packages/smooth_app/lib/pages/scan/scan_page.dart b/packages/smooth_app/lib/pages/scan/scan_page.dart index d258896219b..60b86c479d9 100644 --- a/packages/smooth_app/lib/pages/scan/scan_page.dart +++ b/packages/smooth_app/lib/pages/scan/scan_page.dart @@ -114,18 +114,29 @@ class _ScanPageTopWidget extends StatelessWidget { return Container( alignment: Alignment.topCenter, constraints: BoxConstraints.tightForFinite( + width: constraints.maxWidth * + SmoothProductCarousel.carouselViewPortFraction, height: math.min(constraints.maxHeight * 0.9, 200), ), + padding: SmoothProductCarousel.carouselItemInternalPadding, child: SmoothCard( - margin: SmoothProductCarousel.carouselItemHorizontalPadding - .add(SmoothProductCarousel.carouselItemInternalPadding), + padding: const EdgeInsetsDirectional.only( + top: 10.0, + start: 8.0, + end: 8.0, + bottom: 5.0, + ), child: Align( alignment: Alignment.topCenter, child: Column( children: [ - Icon( - Icons.warning_rounded, - size: constraints.maxHeight * 0.15, + Text( + localizations.permission_photo_denied_title, + style: const TextStyle( + fontSize: 18.0, + fontWeight: FontWeight.bold, + ), + textAlign: TextAlign.center, ), Expanded( child: SingleChildScrollView( @@ -141,7 +152,7 @@ class _ScanPageTopWidget extends StatelessWidget { textAlign: TextAlign.center, style: const TextStyle( height: 1.4, - fontSize: 16.0, + fontSize: 15.5, ), ), ), diff --git a/packages/smooth_app/lib/widgets/smooth_product_carousel.dart b/packages/smooth_app/lib/widgets/smooth_product_carousel.dart index 087f96fe7f3..d3dec41b7f4 100644 --- a/packages/smooth_app/lib/widgets/smooth_product_carousel.dart +++ b/packages/smooth_app/lib/widgets/smooth_product_carousel.dart @@ -27,6 +27,7 @@ class SmoothProductCarousel extends StatefulWidget { EdgeInsets.symmetric(horizontal: 20.0); static const EdgeInsets carouselItemInternalPadding = EdgeInsets.symmetric(horizontal: 2.0); + static const double carouselViewPortFraction = 0.91; @override State createState() => _SmoothProductCarouselState(); @@ -71,7 +72,7 @@ class _SmoothProductCarouselState extends State { carouselController: _controller, options: CarouselOptions( enlargeCenterPage: false, - viewportFraction: 0.91, + viewportFraction: SmoothProductCarousel.carouselViewPortFraction, height: widget.height, enableInfiniteScroll: false, onPageChanged: (int index, CarouselPageChangedReason reason) {