diff --git a/packages/smooth_app/lib/cards/data_cards/score_card.dart b/packages/smooth_app/lib/cards/data_cards/score_card.dart index a0bf5f25623..241cfc62b56 100644 --- a/packages/smooth_app/lib/cards/data_cards/score_card.dart +++ b/packages/smooth_app/lib/cards/data_cards/score_card.dart @@ -60,7 +60,7 @@ class ScoreCard extends StatelessWidget { Expanded( flex: 1, child: Padding( - padding: const EdgeInsets.only(right: 8.0), + padding: const EdgeInsetsDirectional.only(end: SMALL_SPACE), child: iconChip, ), ), diff --git a/packages/smooth_app/lib/cards/product_cards/product_title_card.dart b/packages/smooth_app/lib/cards/product_cards/product_title_card.dart index a27b8e30de4..ab45e639bed 100644 --- a/packages/smooth_app/lib/cards/product_cards/product_title_card.dart +++ b/packages/smooth_app/lib/cards/product_cards/product_title_card.dart @@ -47,7 +47,7 @@ class ProductTitleCard extends StatelessWidget { ).selectable(isSelectable: isSelectable); } return Align( - alignment: Alignment.topLeft, + alignment: AlignmentDirectional.topStart, child: InkWell( onTap: (getProductName(product, appLocalizations) == appLocalizations.unknownProductName) diff --git a/packages/smooth_app/lib/cards/product_cards/smooth_product_card_error.dart b/packages/smooth_app/lib/cards/product_cards/smooth_product_card_error.dart index 49603dd3623..16d06b876da 100644 --- a/packages/smooth_app/lib/cards/product_cards/smooth_product_card_error.dart +++ b/packages/smooth_app/lib/cards/product_cards/smooth_product_card_error.dart @@ -33,7 +33,7 @@ class SmoothProductCardError extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ Padding( - padding: const EdgeInsets.all(8.0), + padding: const EdgeInsets.all(SMALL_SPACE), child: SvgPicture.asset( 'assets/misc/error.svg', width: MINIMUM_TOUCH_SIZE * 2, @@ -47,7 +47,7 @@ class SmoothProductCardError extends StatelessWidget { ], ), const SizedBox( - height: 12.0, + height: MEDIUM_SPACE, ), ProductDialogHelper.getErrorMessage( _getErrorMessage( @@ -56,7 +56,7 @@ class SmoothProductCardError extends StatelessWidget { ), ), const SizedBox( - height: 12.0, + height: MEDIUM_SPACE, ), ElevatedButton( onPressed: () async { diff --git a/packages/smooth_app/lib/cards/product_cards/smooth_product_card_found.dart b/packages/smooth_app/lib/cards/product_cards/smooth_product_card_found.dart index 05b014f6c78..e5b909168a3 100644 --- a/packages/smooth_app/lib/cards/product_cards/smooth_product_card_found.dart +++ b/packages/smooth_app/lib/cards/product_cards/smooth_product_card_found.dart @@ -92,7 +92,9 @@ class SmoothProductCardFound extends StatelessWidget { width: screenSize.width * 0.20, height: screenSize.width * 0.20, ), - const Padding(padding: EdgeInsets.only(left: VERY_SMALL_SPACE)), + const Padding( + padding: + EdgeInsetsDirectional.only(start: VERY_SMALL_SPACE)), Expanded( child: SizedBox( height: screenSize.width * 0.2, @@ -118,8 +120,9 @@ class SmoothProductCardFound extends StatelessWidget { color: helper.getButtonColor(isDarkMode), ), const Padding( - padding: - EdgeInsets.only(left: VERY_SMALL_SPACE)), + padding: EdgeInsetsDirectional.only( + start: VERY_SMALL_SPACE), + ), Expanded( child: FittedBox( fit: BoxFit.scaleDown, @@ -127,8 +130,9 @@ class SmoothProductCardFound extends StatelessWidget { child: Text( helper.getSubtitle(appLocalizations), style: themeData.textTheme.bodyText2!.apply( - color: helper.getButtonForegroundColor( - isDarkMode)), + color: helper + .getButtonForegroundColor(isDarkMode), + ), ), ), ), @@ -138,7 +142,9 @@ class SmoothProductCardFound extends StatelessWidget { ), ), ), - const Padding(padding: EdgeInsets.only(left: VERY_SMALL_SPACE)), + const Padding( + padding: EdgeInsetsDirectional.only(start: VERY_SMALL_SPACE), + ), Padding( padding: const EdgeInsets.all(VERY_SMALL_SPACE), child: Column( diff --git a/packages/smooth_app/lib/cards/product_cards/smooth_product_card_not_found.dart b/packages/smooth_app/lib/cards/product_cards/smooth_product_card_not_found.dart index c2d216d935f..41e1e2bb22c 100644 --- a/packages/smooth_app/lib/cards/product_cards/smooth_product_card_not_found.dart +++ b/packages/smooth_app/lib/cards/product_cards/smooth_product_card_not_found.dart @@ -53,7 +53,7 @@ class SmoothProductCardNotFound extends StatelessWidget { style: Theme.of(context).textTheme.bodyText2, ), Padding( - padding: const EdgeInsets.only(top: LARGE_SPACE), + padding: const EdgeInsetsDirectional.only(top: LARGE_SPACE), child: SmoothLargeButtonWithIcon( text: appLocalizations.add_product_information_button_label, icon: Icons.add, diff --git a/packages/smooth_app/lib/generic_lib/dialogs/smooth_alert_dialog.dart b/packages/smooth_app/lib/generic_lib/dialogs/smooth_alert_dialog.dart index 88a904e8989..2c16c41b9ae 100644 --- a/packages/smooth_app/lib/generic_lib/dialogs/smooth_alert_dialog.dart +++ b/packages/smooth_app/lib/generic_lib/dialogs/smooth_alert_dialog.dart @@ -30,8 +30,12 @@ class SmoothAlertDialog extends StatelessWidget { final SmoothActionButton? positiveAction; final SmoothActionButton? negativeAction; - static const EdgeInsets _contentPadding = - EdgeInsets.fromLTRB(24.0, 20.0, 24.0, 24.0); + static const EdgeInsets _contentPadding = EdgeInsets.only( + left: 24.0, + top: VERY_LARGE_SPACE, + right: 24.0, + bottom: 24.0, + ); @override Widget build(BuildContext context) { @@ -57,7 +61,7 @@ class SmoothAlertDialog extends StatelessWidget { return Padding( padding: EdgeInsetsDirectional.only( top: _contentPadding.bottom, - start: 8.0, + start: SMALL_SPACE, ), child: SmoothActionButtonsBar( positiveAction: positiveAction, @@ -262,7 +266,9 @@ class _SmoothActionFlatButton extends StatelessWidget { ), ), child: SizedBox( - height: buttonData.lines != null ? 20.0 * buttonData.lines! : null, + height: buttonData.lines != null + ? VERY_LARGE_SPACE * buttonData.lines! + : null, child: FittedBox( child: Text( buttonData.text.toUpperCase(), diff --git a/packages/smooth_app/lib/generic_lib/dialogs/smooth_category_picker.dart b/packages/smooth_app/lib/generic_lib/dialogs/smooth_category_picker.dart index feae28c5857..c47021ec9d4 100644 --- a/packages/smooth_app/lib/generic_lib/dialogs/smooth_category_picker.dart +++ b/packages/smooth_app/lib/generic_lib/dialogs/smooth_category_picker.dart @@ -7,6 +7,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:openfoodfacts/openfoodfacts.dart'; import 'package:openfoodfacts/utils/LanguageHelper.dart'; +import 'package:smooth_app/generic_lib/design_constants.dart'; import 'package:smooth_app/generic_lib/duration_constants.dart'; import 'package:smooth_app/widgets/smooth_scaffold.dart'; @@ -142,7 +143,7 @@ class _SmoothCategoryPickerState> crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( - padding: const EdgeInsets.all(8.0), + padding: const EdgeInsets.all(SMALL_SPACE), child: SmoothCategoryDisplay( categories: widget.currentCategories, onDeleted: (T item) { @@ -155,7 +156,8 @@ class _SmoothCategoryPickerState> Row( children: [ IconButton( - padding: const EdgeInsets.symmetric(horizontal: 16.0), + padding: + const EdgeInsets.symmetric(horizontal: LARGE_SPACE), icon: const Icon(Icons.chevron_left), onPressed: category.value != widget.currentPath.first ? () { @@ -424,7 +426,7 @@ class _CategoryItem> extends StatelessWidget { @override Widget build(BuildContext context) { return Padding( - padding: const EdgeInsetsDirectional.only(start: 8.0), + padding: const EdgeInsetsDirectional.only(start: SMALL_SPACE), child: FutureBuilder( future: category.hasChildren, builder: (BuildContext context, AsyncSnapshot snapshot) { @@ -562,8 +564,8 @@ class _SmoothCategoryDisplayState combinedCategories.sort(); return Wrap( alignment: WrapAlignment.start, - spacing: 8.0, - runSpacing: 4.0, + spacing: SMALL_SPACE, + runSpacing: VERY_SMALL_SPACE, children: [ for (final T category in combinedCategories) AnimatedInputChip( diff --git a/packages/smooth_app/lib/generic_lib/widgets/smooth_card.dart b/packages/smooth_app/lib/generic_lib/widgets/smooth_card.dart index 4f7d3b0290f..d7928bbdf67 100644 --- a/packages/smooth_app/lib/generic_lib/widgets/smooth_card.dart +++ b/packages/smooth_app/lib/generic_lib/widgets/smooth_card.dart @@ -35,9 +35,9 @@ class SmoothCard extends StatelessWidget { const SmoothCard.flat({ required this.child, this.color, - this.margin = const EdgeInsets.only( - right: SMALL_SPACE, - left: SMALL_SPACE, + this.margin = const EdgeInsetsDirectional.only( + start: SMALL_SPACE, + end: SMALL_SPACE, top: VERY_SMALL_SPACE, bottom: VERY_SMALL_SPACE, ), diff --git a/packages/smooth_app/lib/helpers/attributes_card_helper.dart b/packages/smooth_app/lib/helpers/attributes_card_helper.dart index c84a3f9b461..ace2a1fa65e 100644 --- a/packages/smooth_app/lib/helpers/attributes_card_helper.dart +++ b/packages/smooth_app/lib/helpers/attributes_card_helper.dart @@ -14,7 +14,7 @@ enum AttributeEvaluation { } Widget getAttributeDisplayIcon(final Attribute attribute) => Padding( - padding: const EdgeInsets.only(right: VERY_SMALL_SPACE), + padding: const EdgeInsetsDirectional.only(end: VERY_SMALL_SPACE), child: _attributeMatchComparison( attribute, const Icon(CupertinoIcons.question, color: RED_COLOR), diff --git a/packages/smooth_app/lib/helpers/product_cards_helper.dart b/packages/smooth_app/lib/helpers/product_cards_helper.dart index ddd5f33dbe8..ad244d713d5 100644 --- a/packages/smooth_app/lib/helpers/product_cards_helper.dart +++ b/packages/smooth_app/lib/helpers/product_cards_helper.dart @@ -10,8 +10,10 @@ String getProductName(Product product, AppLocalizations appLocalizations) => product.productName ?? appLocalizations.unknownProductName; /// Padding to be used while building the SmoothCard on any Product card. -const EdgeInsets SMOOTH_CARD_PADDING = - EdgeInsets.symmetric(horizontal: 12.0, vertical: 4.0); +const EdgeInsets SMOOTH_CARD_PADDING = EdgeInsets.symmetric( + horizontal: MEDIUM_SPACE, + vertical: VERY_SMALL_SPACE, +); /// A SmoothCard on Product cards using default margin and padding. Widget buildProductSmoothCard({ diff --git a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_expanded_card.dart b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_expanded_card.dart index a4e778cdba5..02cf616f273 100644 --- a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_expanded_card.dart +++ b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_expanded_card.dart @@ -26,7 +26,7 @@ class KnowledgePanelExpandedCard extends StatelessWidget { in panel.elements ?? []) { elementWidgets.add( Padding( - padding: const EdgeInsets.only(top: VERY_SMALL_SPACE), + padding: const EdgeInsetsDirectional.only(top: VERY_SMALL_SPACE), child: KnowledgePanelElementCard( knowledgePanelElement: element, allPanels: allPanels, diff --git a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_group_card.dart b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_group_card.dart index a4e13626f62..9e75ee8a687 100644 --- a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_group_card.dart +++ b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_group_card.dart @@ -28,7 +28,7 @@ class KnowledgePanelGroupCard extends StatelessWidget { children: [ if (groupElement.title.isNotEmpty) Padding( - padding: const EdgeInsets.only(top: LARGE_SPACE), + padding: const EdgeInsetsDirectional.only(top: LARGE_SPACE), child: Text( groupElement.title, style: themeData.textTheme.subtitle2!.apply(color: Colors.grey), diff --git a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_product_cards.dart b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_product_cards.dart index 2a86cf68cf6..4510ecb33ad 100644 --- a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_product_cards.dart +++ b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_product_cards.dart @@ -13,7 +13,7 @@ class KnowledgePanelProductCards extends StatelessWidget { for (final Widget widget in knowledgePanelWidgets) { widgetsWrappedInSmoothCards.add( Padding( - padding: const EdgeInsets.only(top: VERY_LARGE_SPACE), + padding: const EdgeInsetsDirectional.only(top: VERY_LARGE_SPACE), child: buildProductSmoothCard( body: widget, padding: SMOOTH_CARD_PADDING, @@ -23,7 +23,7 @@ class KnowledgePanelProductCards extends StatelessWidget { } return Center( child: Padding( - padding: const EdgeInsets.only(bottom: SMALL_SPACE), + padding: const EdgeInsetsDirectional.only(bottom: SMALL_SPACE), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, diff --git a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_table_card.dart b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_table_card.dart index 9c55aeb8691..298e876d419 100644 --- a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_table_card.dart +++ b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_table_card.dart @@ -50,6 +50,7 @@ class TableCell { final String text; final Color? color; final bool isHeader; + // [columnGroup] is set only for cells that have [isHeader = true]. This is used // to show a dropdown of other column headers in the group for this column. final ColumnGroup? columnGroup; @@ -265,7 +266,8 @@ class _TableCellWidgetState extends State { @override Widget build(BuildContext context) { - EdgeInsets padding = const EdgeInsets.only(bottom: VERY_SMALL_SPACE); + EdgeInsetsGeometry padding = + const EdgeInsetsDirectional.only(bottom: VERY_SMALL_SPACE); // header cells get a bigger vertical padding. if (widget.cell.isHeader) { padding = const EdgeInsets.symmetric(vertical: SMALL_SPACE); @@ -283,8 +285,11 @@ class _TableCellWidgetState extends State { return _buildDropDownColumnHeader(padding, style); } - Widget _buildHtmlCell(EdgeInsets padding, TextStyle style, - {required bool isSelectable}) { + Widget _buildHtmlCell( + EdgeInsetsGeometry padding, + TextStyle style, { + required bool isSelectable, + }) { String cellText = widget.cell.text; if (!_isExpanded) { const String htmlStyle = ''' @@ -312,7 +317,10 @@ class _TableCellWidgetState extends State { ); } - Widget _buildDropDownColumnHeader(EdgeInsets padding, TextStyle style) { + Widget _buildDropDownColumnHeader( + EdgeInsetsGeometry padding, + TextStyle style, + ) { // Now we finally render [ColumnGroup]s as drop down menus. return Padding( padding: padding, diff --git a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_title_card.dart b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_title_card.dart index bb24297c870..94a606aec54 100644 --- a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_title_card.dart +++ b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_title_card.dart @@ -42,13 +42,15 @@ class KnowledgePanelTitleCard extends StatelessWidget { ), ), ), - const Padding(padding: EdgeInsets.only(left: SMALL_SPACE)), + const Padding( + padding: EdgeInsetsDirectional.only(start: SMALL_SPACE), + ), ]; } else { iconWidget = []; } return Padding( - padding: const EdgeInsets.only( + padding: const EdgeInsetsDirectional.only( top: VERY_SMALL_SPACE, bottom: VERY_SMALL_SPACE, ), diff --git a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_world_map_card.dart b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_world_map_card.dart index 431d304cd3d..129f3eb3605 100644 --- a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_world_map_card.dart +++ b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_world_map_card.dart @@ -17,7 +17,7 @@ class KnowledgePanelWorldMapCard extends StatelessWidget { // TODO(monsieurtanuki): Zoom the map to show all [mapElement.pointers] // TODO(monsieurtanuki): Add a OSM copyright. return Padding( - padding: const EdgeInsets.only(bottom: MEDIUM_SPACE), + padding: const EdgeInsetsDirectional.only(bottom: MEDIUM_SPACE), child: SizedBox( height: 200, child: FlutterMap( diff --git a/packages/smooth_app/lib/pages/onboarding/common/tooltip_shape_border.dart b/packages/smooth_app/lib/pages/onboarding/common/tooltip_shape_border.dart index ba8875544f5..100e689d9c3 100644 --- a/packages/smooth_app/lib/pages/onboarding/common/tooltip_shape_border.dart +++ b/packages/smooth_app/lib/pages/onboarding/common/tooltip_shape_border.dart @@ -1,10 +1,11 @@ -import 'package:flutter/cupertino.dart'; +import 'package:flutter/widgets.dart'; +import 'package:smooth_app/generic_lib/design_constants.dart'; class TooltipShapeBorder extends ShapeBorder { const TooltipShapeBorder({ this.radius = 10.0, - this.arrowWidth = 20.0, - this.arrowHeight = 20.0, + this.arrowWidth = VERY_LARGE_SPACE, + this.arrowHeight = VERY_LARGE_SPACE, this.arrowArc = 0.0, }) : assert(arrowArc <= 1.0 && arrowArc >= 0.0); final double arrowWidth; @@ -13,7 +14,9 @@ class TooltipShapeBorder extends ShapeBorder { final double radius; @override - EdgeInsetsGeometry get dimensions => EdgeInsets.only(top: arrowHeight); + EdgeInsetsGeometry get dimensions => EdgeInsetsDirectional.only( + top: arrowHeight, + ); @override Path getOuterPath(Rect rect, {TextDirection? textDirection}) { diff --git a/packages/smooth_app/lib/pages/onboarding/consent_analytics_page.dart b/packages/smooth_app/lib/pages/onboarding/consent_analytics_page.dart index 428266ddcf0..1707717fcc3 100644 --- a/packages/smooth_app/lib/pages/onboarding/consent_analytics_page.dart +++ b/packages/smooth_app/lib/pages/onboarding/consent_analytics_page.dart @@ -39,7 +39,7 @@ class ConsentAnalytics extends StatelessWidget { width: screenSize.width * .50, ), Padding( - padding: const EdgeInsets.only(top: SMALL_SPACE), + padding: const EdgeInsetsDirectional.only(top: SMALL_SPACE), child: AutoSizeText( appLocalizations.consent_analytics_title, maxLines: 2, @@ -51,7 +51,7 @@ class ConsentAnalytics extends StatelessWidget { ), ), Padding( - padding: const EdgeInsets.only(top: SMALL_SPACE), + padding: const EdgeInsetsDirectional.only(top: SMALL_SPACE), child: AutoSizeText( appLocalizations.consent_analytics_body1, maxLines: 3, @@ -59,7 +59,7 @@ class ConsentAnalytics extends StatelessWidget { ), ), Padding( - padding: const EdgeInsets.only(top: SMALL_SPACE), + padding: const EdgeInsetsDirectional.only(top: SMALL_SPACE), child: AutoSizeText( appLocalizations.consent_analytics_body2, maxLines: 3, diff --git a/packages/smooth_app/lib/pages/onboarding/knowledge_panel_page_template.dart b/packages/smooth_app/lib/pages/onboarding/knowledge_panel_page_template.dart index fe1720d463c..6e7472b9c4e 100644 --- a/packages/smooth_app/lib/pages/onboarding/knowledge_panel_page_template.dart +++ b/packages/smooth_app/lib/pages/onboarding/knowledge_panel_page_template.dart @@ -136,7 +136,12 @@ class _KnowledgePanelPageTemplateState color: Theme.of(context).hintColor.withOpacity(0.9), shape: const TooltipShapeBorder(arrowArc: 0.5), child: Container( - margin: const EdgeInsets.fromLTRB(20, 10, 20, 10), + margin: const EdgeInsetsDirectional.only( + start: VERY_LARGE_SPACE, + top: 10, + end: VERY_LARGE_SPACE, + bottom: 10, + ), child: Text( appLocalizations.hint_knowledge_panel_message, style: TextStyle(color: Theme.of(context).cardColor), diff --git a/packages/smooth_app/lib/pages/onboarding/onboarding_bottom_bar.dart b/packages/smooth_app/lib/pages/onboarding/onboarding_bottom_bar.dart index 0c6204779c5..43ba06240fa 100644 --- a/packages/smooth_app/lib/pages/onboarding/onboarding_bottom_bar.dart +++ b/packages/smooth_app/lib/pages/onboarding/onboarding_bottom_bar.dart @@ -107,7 +107,7 @@ class OnboardingBottomIcon extends StatelessWidget { Widget build(BuildContext context) => ElevatedButton( style: ElevatedButton.styleFrom( shape: const CircleBorder(), - padding: const EdgeInsets.all(12), + padding: const EdgeInsets.all(MEDIUM_SPACE), primary: backgroundColor, onPrimary: foregroundColor, ), diff --git a/packages/smooth_app/lib/pages/onboarding/preferences_page.dart b/packages/smooth_app/lib/pages/onboarding/preferences_page.dart index 61e2c70637a..7c3f503a75a 100644 --- a/packages/smooth_app/lib/pages/onboarding/preferences_page.dart +++ b/packages/smooth_app/lib/pages/onboarding/preferences_page.dart @@ -84,10 +84,10 @@ class _HelperState extends State<_Helper> { height: MediaQuery.of(context).size.height * .25, ), Padding( - padding: const EdgeInsets.only( - right: LARGE_SPACE, - left: LARGE_SPACE, + padding: const EdgeInsetsDirectional.only( bottom: LARGE_SPACE, + start: LARGE_SPACE, + end: LARGE_SPACE, ), child: Text( appLocalizations.productDataUtility, @@ -96,10 +96,10 @@ class _HelperState extends State<_Helper> { ), Container( height: _isProductExpanded ? null : 180, - padding: const EdgeInsets.only( + padding: const EdgeInsetsDirectional.only( bottom: LARGE_SPACE, - right: LARGE_SPACE, - left: LARGE_SPACE, + start: LARGE_SPACE, + end: LARGE_SPACE, ), child: GestureDetector( onTap: () => _expandProductCard(), @@ -133,7 +133,7 @@ class _HelperState extends State<_Helper> { Flexible( flex: 1, child: ListView.builder( - padding: const EdgeInsets.only(top: LARGE_SPACE), + padding: const EdgeInsetsDirectional.only(top: LARGE_SPACE), itemCount: pageData.length, itemBuilder: (BuildContext context, int position) => pageData[position], diff --git a/packages/smooth_app/lib/pages/onboarding/scan_example.dart b/packages/smooth_app/lib/pages/onboarding/scan_example.dart index b0de17d14f1..fe759c8aed6 100644 --- a/packages/smooth_app/lib/pages/onboarding/scan_example.dart +++ b/packages/smooth_app/lib/pages/onboarding/scan_example.dart @@ -34,7 +34,7 @@ class ScanExample extends StatelessWidget { height: screenSize.height * .50, ), Padding( - padding: const EdgeInsets.only(top: SMALL_SPACE), + padding: const EdgeInsetsDirectional.only(top: SMALL_SPACE), child: SizedBox( height: screenSize.height * .15, child: AutoSizeText( diff --git a/packages/smooth_app/lib/pages/onboarding/welcome_page.dart b/packages/smooth_app/lib/pages/onboarding/welcome_page.dart index e12c333b480..d70f8af2608 100644 --- a/packages/smooth_app/lib/pages/onboarding/welcome_page.dart +++ b/packages/smooth_app/lib/pages/onboarding/welcome_page.dart @@ -43,7 +43,7 @@ class WelcomePage extends StatelessWidget { height: screenSize.height * .20, ), Padding( - padding: const EdgeInsets.only(top: SMALL_SPACE), + padding: const EdgeInsetsDirectional.only(top: SMALL_SPACE), child: SizedBox( height: screenSize.height * .15, child: AutoSizeText( diff --git a/packages/smooth_app/lib/pages/personalized_ranking_page.dart b/packages/smooth_app/lib/pages/personalized_ranking_page.dart index f2eca7b4b53..28ce219b588 100644 --- a/packages/smooth_app/lib/pages/personalized_ranking_page.dart +++ b/packages/smooth_app/lib/pages/personalized_ranking_page.dart @@ -129,7 +129,7 @@ class _PersonalizedRankingPageState extends State alignment: Alignment.centerRight, margin: const EdgeInsets.symmetric(vertical: 14), color: RED_COLOR, - padding: const EdgeInsets.only(right: 30), + padding: const EdgeInsetsDirectional.only(end: 30), child: const Icon( Icons.delete, color: Colors.white, @@ -153,7 +153,10 @@ class _PersonalizedRankingPageState extends State ); }, child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0), + padding: const EdgeInsets.symmetric( + horizontal: MEDIUM_SPACE, + vertical: SMALL_SPACE, + ), child: SmoothProductCardFound( heroTag: matchedProduct.product.barcode!, product: matchedProduct.product, @@ -168,6 +171,7 @@ class _PersonalizedRankingPageState extends State /// Virtual item in the list: either a product or a status header class _VirtualItem { const _VirtualItem.product(this.product) : status = null; + const _VirtualItem.status(this.status) : product = null; final MatchedProductV2? product; final MatchedProductStatusV2? status; diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_contribute.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_contribute.dart index f221f4f36c7..feddf3be0ae 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_contribute.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_contribute.dart @@ -7,6 +7,7 @@ import 'package:provider/provider.dart'; import 'package:share_plus/share_plus.dart'; import 'package:smooth_app/data_models/github_contributors_model.dart'; import 'package:smooth_app/data_models/user_preferences.dart'; +import 'package:smooth_app/generic_lib/design_constants.dart'; import 'package:smooth_app/generic_lib/dialogs/smooth_alert_dialog.dart'; import 'package:smooth_app/helpers/launch_url_helper.dart'; import 'package:smooth_app/pages/preferences/abstract_user_preferences.dart'; @@ -130,7 +131,7 @@ class UserPreferencesContribute extends AbstractUserPreferences { body: Column( children: [ Text(appLocalizations.contribute_develop_text), - const SizedBox(height: 20), + const SizedBox(height: VERY_LARGE_SPACE), Text(appLocalizations.contribute_develop_text_2), const SizedBox(height: 10), Row( diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_page.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_page.dart index a84dfffbce4..dbff172c7ab 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_page.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_page.dart @@ -100,7 +100,9 @@ class _UserPreferencesPageState extends State headerColor = abstractUserPreferences.getHeaderColor(); } - const EdgeInsets padding = EdgeInsets.only(top: MEDIUM_SPACE); + const EdgeInsetsGeometry padding = EdgeInsetsDirectional.only( + top: MEDIUM_SPACE, + ); final ListView list; if (addDividers) { list = ListView.separated( @@ -153,8 +155,9 @@ class _UserPreferencesPageState extends State style: TextStyle(color: foregroundColor), ), background: Padding( - padding: - const EdgeInsets.only(bottom: titleHeightInExpandedMode), + padding: const EdgeInsetsDirectional.only( + bottom: titleHeightInExpandedMode, + ), child: SvgPicture.asset( headerAsset, height: backgroundHeight, diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_widgets.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_widgets.dart index 3d8c18ef2d2..94f04d4548c 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_widgets.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_widgets.dart @@ -77,14 +77,14 @@ class UserPreferencesSwitchItem extends StatelessWidget { Widget build(BuildContext context) { return SwitchListTile.adaptive( title: Padding( - padding: const EdgeInsets.only( + padding: const EdgeInsetsDirectional.only( top: SMALL_SPACE, bottom: SMALL_SPACE, ), child: Text(title, style: Theme.of(context).textTheme.headline4), ), subtitle: Padding( - padding: const EdgeInsets.only( + padding: const EdgeInsetsDirectional.only( bottom: SMALL_SPACE, ), child: Text( @@ -137,14 +137,14 @@ class UserPreferencesMultipleChoicesItem extends StatelessWidget { Widget build(BuildContext context) { return ListTile( title: Padding( - padding: const EdgeInsets.only( + padding: const EdgeInsetsDirectional.only( top: SMALL_SPACE, bottom: SMALL_SPACE, ), child: Text(title, style: Theme.of(context).textTheme.headline4), ), subtitle: Padding( - padding: const EdgeInsets.only( + padding: const EdgeInsetsDirectional.only( bottom: SMALL_SPACE, ), child: Text( @@ -184,7 +184,7 @@ class UserPreferencesMultipleChoicesItem extends StatelessWidget { ? Text(descriptions!.elementAt(position)) : null, contentPadding: const EdgeInsets.symmetric( - horizontal: 16.0, + horizontal: LARGE_SPACE, vertical: 5.0, ), onTap: () { @@ -224,12 +224,12 @@ class UserPreferencesTitle extends StatelessWidget { return SizedBox( width: double.infinity, child: Padding( - padding: const EdgeInsets.only( + padding: const EdgeInsetsDirectional.only( top: SMALL_SPACE, bottom: MEDIUM_SPACE, // Horizontal = same as ListTile - left: 16.0, - right: 16.0, + start: LARGE_SPACE, + end: LARGE_SPACE, ), child: Text( label, diff --git a/packages/smooth_app/lib/pages/product/add_basic_details_page.dart b/packages/smooth_app/lib/pages/product/add_basic_details_page.dart index 47d1a2a10bd..1aa6bda75b7 100644 --- a/packages/smooth_app/lib/pages/product/add_basic_details_page.dart +++ b/packages/smooth_app/lib/pages/product/add_basic_details_page.dart @@ -55,7 +55,7 @@ class _AddBasicDetailsPageState extends State { child: ListView( children: [ Align( - alignment: Alignment.topLeft, + alignment: AlignmentDirectional.topStart, child: ProductImageCarousel( _product, height: size.height * 0.20, diff --git a/packages/smooth_app/lib/pages/product/add_new_product_page.dart b/packages/smooth_app/lib/pages/product/add_new_product_page.dart index af458878711..7a0e7f115a2 100644 --- a/packages/smooth_app/lib/pages/product/add_new_product_page.dart +++ b/packages/smooth_app/lib/pages/product/add_new_product_page.dart @@ -14,7 +14,9 @@ import 'package:smooth_app/pages/product/nutrition_page_loaded.dart'; import 'package:smooth_app/pages/product/ordered_nutrients_cache.dart'; import 'package:smooth_app/widgets/smooth_scaffold.dart'; -const EdgeInsets _ROW_PADDING_TOP = EdgeInsets.only(top: VERY_LARGE_SPACE); +const EdgeInsetsGeometry _ROW_PADDING_TOP = EdgeInsetsDirectional.only( + top: VERY_LARGE_SPACE, +); // Buttons to add images will appear in this order. const List _SORTED_IMAGE_FIELD_LIST = [ @@ -51,10 +53,10 @@ class _AddNewProductPageState extends State { title: Text(appLocalizations.new_product), automaticallyImplyLeading: !_isProductLoaded), body: Padding( - padding: const EdgeInsets.only( + padding: const EdgeInsetsDirectional.only( top: VERY_LARGE_SPACE, - left: VERY_LARGE_SPACE, - right: VERY_LARGE_SPACE, + start: VERY_LARGE_SPACE, + end: VERY_LARGE_SPACE, ), child: Stack( children: [ diff --git a/packages/smooth_app/lib/pages/product/autocomplete.dart b/packages/smooth_app/lib/pages/product/autocomplete.dart index 35640fcc5de..850286db9e5 100644 --- a/packages/smooth_app/lib/pages/product/autocomplete.dart +++ b/packages/smooth_app/lib/pages/product/autocomplete.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; +import 'package:smooth_app/generic_lib/design_constants.dart'; /// The default Material-style Autocomplete options. /// @@ -25,7 +26,7 @@ class AutocompleteOptions extends StatelessWidget { @override Widget build(BuildContext context) { return Align( - alignment: Alignment.topLeft, + alignment: AlignmentDirectional.topStart, child: Material( elevation: 4.0, child: ConstrainedBox( @@ -51,7 +52,7 @@ class AutocompleteOptions extends StatelessWidget { } return Container( color: highlight ? Theme.of(context).focusColor : null, - padding: const EdgeInsets.all(16.0), + padding: const EdgeInsets.all(LARGE_SPACE), child: Text(displayStringForOption(option)), ); }), diff --git a/packages/smooth_app/lib/pages/product/common/product_list_page.dart b/packages/smooth_app/lib/pages/product/common/product_list_page.dart index 35ba6a9907c..1403e1f9644 100644 --- a/packages/smooth_app/lib/pages/product/common/product_list_page.dart +++ b/packages/smooth_app/lib/pages/product/common/product_list_page.dart @@ -262,8 +262,8 @@ class _ProductListPageState extends State onTap: _selectionMode ? onTap : null, child: Container( padding: EdgeInsets.symmetric( - horizontal: _selectionMode ? 0 : 12.0, - vertical: 8.0, + horizontal: _selectionMode ? 0 : MEDIUM_SPACE, + vertical: SMALL_SPACE, ), child: Row( children: [ @@ -291,7 +291,7 @@ class _ProductListPageState extends State alignment: Alignment.centerRight, margin: const EdgeInsets.symmetric(vertical: 14), color: RED_COLOR, - padding: const EdgeInsets.only(right: 30), + padding: const EdgeInsetsDirectional.only(end: 30), child: const Icon( Icons.delete, color: Colors.white, diff --git a/packages/smooth_app/lib/pages/product/common/product_query_page.dart b/packages/smooth_app/lib/pages/product/common/product_query_page.dart index 1be2116a783..35221675a2c 100644 --- a/packages/smooth_app/lib/pages/product/common/product_query_page.dart +++ b/packages/smooth_app/lib/pages/product/common/product_query_page.dart @@ -12,6 +12,7 @@ import 'package:smooth_app/cards/product_cards/smooth_product_card_found.dart'; import 'package:smooth_app/data_models/product_list_supplier.dart'; import 'package:smooth_app/data_models/product_query_model.dart'; import 'package:smooth_app/generic_lib/animations/smooth_reveal_animation.dart'; +import 'package:smooth_app/generic_lib/design_constants.dart'; import 'package:smooth_app/generic_lib/duration_constants.dart'; import 'package:smooth_app/generic_lib/loading_dialog.dart'; import 'package:smooth_app/generic_lib/widgets/smooth_error_card.dart'; @@ -190,7 +191,9 @@ class _ProductQueryPageState extends State animationCurve: Curves.easeInOutBack, startOffset: const Offset(0.0, 1.0), child: Padding( - padding: const EdgeInsets.only(left: 8.0), + padding: const EdgeInsetsDirectional.only( + start: SMALL_SPACE, + ), child: FloatingActionButton( backgroundColor: themeData.colorScheme.secondary, onPressed: () { @@ -302,8 +305,11 @@ class _ProductQueryPageState extends State ); } return Padding( - padding: const EdgeInsets.only( - bottom: 90.0, left: 20, right: 20), + padding: const EdgeInsetsDirectional.only( + bottom: 90.0, + start: VERY_LARGE_SPACE, + end: VERY_LARGE_SPACE, + ), child: child, ); } @@ -311,8 +317,8 @@ class _ProductQueryPageState extends State _model.displayProducts![index]; return Padding( padding: const EdgeInsets.symmetric( - horizontal: 12.0, - vertical: 8.0, + horizontal: MEDIUM_SPACE, + vertical: SMALL_SPACE, ), child: SmoothProductCardFound( heroTag: product.barcode!, @@ -333,12 +339,17 @@ class _ProductQueryPageState extends State ); Widget _getHero(final Size screenSize, final ThemeData themeData) => Hero( - tag: widget.heroTag, - child: Container( - width: screenSize.width, - height: double.infinity, - padding: const EdgeInsets.only(left: 10.0, right: 10.0, top: 96.0), - )); + tag: widget.heroTag, + child: Container( + width: screenSize.width, + height: double.infinity, + padding: const EdgeInsetsDirectional.only( + start: 10.0, + end: 10.0, + top: 96.0, + ), + ), + ); Widget _getErrorWidget( final Size screenSize, @@ -349,7 +360,7 @@ class _ProductQueryPageState extends State screenSize, themeData, Padding( - padding: const EdgeInsets.all(8.0), + padding: const EdgeInsets.all(SMALL_SPACE), child: SmoothErrorCard( errorMessage: errorMessage, tryAgainFunction: retryConnection, diff --git a/packages/smooth_app/lib/pages/product/confirm_and_upload_picture.dart b/packages/smooth_app/lib/pages/product/confirm_and_upload_picture.dart index 554256849fe..09f535bed56 100644 --- a/packages/smooth_app/lib/pages/product/confirm_and_upload_picture.dart +++ b/packages/smooth_app/lib/pages/product/confirm_and_upload_picture.dart @@ -61,7 +61,7 @@ class _ConfirmAndUploadPictureState extends State { child: Align( alignment: Alignment.bottomCenter, child: Padding( - padding: const EdgeInsets.only(bottom: MEDIUM_SPACE), + padding: const EdgeInsetsDirectional.only(bottom: MEDIUM_SPACE), child: Wrap( spacing: MEDIUM_SPACE, alignment: WrapAlignment.center, diff --git a/packages/smooth_app/lib/pages/product/edit_ingredients_page.dart b/packages/smooth_app/lib/pages/product/edit_ingredients_page.dart index 0a86c818607..05ea0b4e565 100644 --- a/packages/smooth_app/lib/pages/product/edit_ingredients_page.dart +++ b/packages/smooth_app/lib/pages/product/edit_ingredients_page.dart @@ -221,10 +221,18 @@ class _EditOcrPageState extends State { Widget _buildZoomableImage(ImageProvider imageSource) { return InteractiveViewer( - boundaryMargin: const EdgeInsets.fromLTRB(20, 10, 20, 200), + boundaryMargin: const EdgeInsets.only( + left: VERY_LARGE_SPACE, + top: 10, + right: VERY_LARGE_SPACE, + bottom: 200, + ), minScale: 0.1, maxScale: 5, - child: Image(fit: BoxFit.contain, image: imageSource), + child: Image( + fit: BoxFit.contain, + image: imageSource, + ), ); } } @@ -252,7 +260,7 @@ class _OcrWidget extends StatelessWidget { Widget build(BuildContext context) { final AppLocalizations appLocalizations = AppLocalizations.of(context); return Align( - alignment: Alignment.bottomLeft, + alignment: AlignmentDirectional.bottomStart, child: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ @@ -261,10 +269,10 @@ class _OcrWidget extends StatelessWidget { child: Align( alignment: Alignment.bottomRight, child: Padding( - padding: const EdgeInsets.only( + padding: const EdgeInsetsDirectional.only( bottom: LARGE_SPACE, - right: LARGE_SPACE, - left: LARGE_SPACE, + start: LARGE_SPACE, + end: LARGE_SPACE, ), child: SmoothActionButtonsBar( positiveAction: SmoothActionButton( 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 2fb1df84254..fc56563e6b7 100644 --- a/packages/smooth_app/lib/pages/product/new_product_page.dart +++ b/packages/smooth_app/lib/pages/product/new_product_page.dart @@ -206,7 +206,7 @@ class _ProductPageState extends State with TraceableClientMixin { children: [ Align( heightFactor: 0.7, - alignment: Alignment.topLeft, + alignment: AlignmentDirectional.topStart, child: ProductImageCarousel( _product, height: 200, diff --git a/packages/smooth_app/lib/pages/product/nutrition_page_loaded.dart b/packages/smooth_app/lib/pages/product/nutrition_page_loaded.dart index e664afbdd34..2181f3c1c2a 100644 --- a/packages/smooth_app/lib/pages/product/nutrition_page_loaded.dart +++ b/packages/smooth_app/lib/pages/product/nutrition_page_loaded.dart @@ -239,7 +239,7 @@ class _NutritionPageLoadedState extends State { controller.text = _nutritionContainer.servingSize ?? ''; _controllers[NutritionContainer.fakeNutrientIdServingSize] = controller; return Padding( - padding: const EdgeInsets.only(bottom: VERY_LARGE_SPACE), + padding: const EdgeInsetsDirectional.only(bottom: VERY_LARGE_SPACE), child: TextFormField( controller: controller, decoration: InputDecoration( diff --git a/packages/smooth_app/lib/pages/product/summary_card.dart b/packages/smooth_app/lib/pages/product/summary_card.dart index 1239dfdf378..9197703564e 100644 --- a/packages/smooth_app/lib/pages/product/summary_card.dart +++ b/packages/smooth_app/lib/pages/product/summary_card.dart @@ -251,8 +251,8 @@ class _SummaryCardState extends State { } } final Widget attributesContainer = Container( - alignment: Alignment.topLeft, - margin: const EdgeInsets.only(bottom: 16), + alignment: AlignmentDirectional.topStart, + margin: const EdgeInsetsDirectional.only(bottom: LARGE_SPACE), child: Column(children: displayedGroups), ); // cf. https://github.com/openfoodfacts/smooth-app/issues/2147 @@ -500,7 +500,8 @@ class _SummaryCardState extends State { if (groupName != null) { return Container( alignment: Alignment.topLeft, - padding: const EdgeInsets.only(top: SMALL_SPACE, bottom: LARGE_SPACE), + padding: const EdgeInsetsDirectional.only( + top: SMALL_SPACE, bottom: LARGE_SPACE), child: Text( groupName, style: @@ -654,7 +655,8 @@ class _SummaryCardState extends State { ), ), Container( - padding: const EdgeInsets.only(top: SMALL_SPACE), + padding: + const EdgeInsetsDirectional.only(top: SMALL_SPACE), child: Text( appLocalizations.contribute_to_get_rewards, style: Theme.of(context) diff --git a/packages/smooth_app/lib/pages/question_page.dart b/packages/smooth_app/lib/pages/question_page.dart index 3a888e3bf8f..f6a0711a923 100644 --- a/packages/smooth_app/lib/pages/question_page.dart +++ b/packages/smooth_app/lib/pages/question_page.dart @@ -85,7 +85,7 @@ class _QuestionPageState extends State child: SlideTransition( position: inAnimation, child: Padding( - padding: const EdgeInsets.all(8.0), + padding: const EdgeInsets.all(SMALL_SPACE), child: child, ), ), @@ -96,7 +96,7 @@ class _QuestionPageState extends State child: SlideTransition( position: outAnimation, child: Padding( - padding: const EdgeInsets.all(8.0), + padding: const EdgeInsets.all(SMALL_SPACE), child: child, ), ), @@ -188,7 +188,7 @@ class _QuestionPageState extends State children: [ Container( alignment: Alignment.center, - padding: const EdgeInsets.only(bottom: SMALL_SPACE), + padding: const EdgeInsetsDirectional.only(bottom: SMALL_SPACE), child: Text( question.question!, style: Theme.of(context) @@ -276,7 +276,7 @@ class _QuestionPageState extends State required Color backgroundColor, required Color contentColor, required int currentQuestionIndex, - EdgeInsets padding = const EdgeInsets.all(4), + EdgeInsets padding = const EdgeInsets.all(VERY_SMALL_SPACE), }) { final AppLocalizations appLocalizations = AppLocalizations.of(context); String buttonText; diff --git a/packages/smooth_app/lib/pages/scan/scan_flash_toggle.dart b/packages/smooth_app/lib/pages/scan/scan_flash_toggle.dart index ea855a05576..03b55fa32b6 100644 --- a/packages/smooth_app/lib/pages/scan/scan_flash_toggle.dart +++ b/packages/smooth_app/lib/pages/scan/scan_flash_toggle.dart @@ -29,11 +29,11 @@ class ScannerFlashToggleWidget extends StatelessWidget { child: Padding( padding: const EdgeInsets.symmetric( horizontal: 6.0, - vertical: 8.0, + vertical: SMALL_SPACE, ), child: Icon( value ? Icons.flash_on : Icons.flash_off, - size: 20.0, + size: VERY_LARGE_SPACE, color: Colors.white, ), ), diff --git a/packages/smooth_app/lib/pages/scan/scan_page.dart b/packages/smooth_app/lib/pages/scan/scan_page.dart index 6380106a6b1..034cb7b3466 100644 --- a/packages/smooth_app/lib/pages/scan/scan_page.dart +++ b/packages/smooth_app/lib/pages/scan/scan_page.dart @@ -188,8 +188,8 @@ class _ScanPageTopWidget extends StatelessWidget { child: SmoothCard( padding: const EdgeInsetsDirectional.only( top: 10.0, - start: 8.0, - end: 8.0, + start: SMALL_SPACE, + end: SMALL_SPACE, bottom: 5.0, ), child: Align( diff --git a/packages/smooth_app/lib/pages/scan/scanner_overlay.dart b/packages/smooth_app/lib/pages/scan/scanner_overlay.dart index cce1a2058b2..2cc7618ed37 100644 --- a/packages/smooth_app/lib/pages/scan/scanner_overlay.dart +++ b/packages/smooth_app/lib/pages/scan/scanner_overlay.dart @@ -119,7 +119,7 @@ class ScannerOverlay extends StatelessWidget { startOffset: Offset(0.0, -0.1), animationCurve: Curves.easeInOutBack, child: Padding( - padding: EdgeInsets.only( + padding: EdgeInsetsDirectional.only( bottom: carouselBottomPadding, ), child: SmoothProductCarousel( diff --git a/packages/smooth_app/lib/pages/scan/search_history_view.dart b/packages/smooth_app/lib/pages/scan/search_history_view.dart index 4db4cc9ea42..34c234c6fa0 100644 --- a/packages/smooth_app/lib/pages/scan/search_history_view.dart +++ b/packages/smooth_app/lib/pages/scan/search_history_view.dart @@ -51,7 +51,7 @@ class _SearchHistoryViewState extends State { background: Container(color: RED_COLOR), child: ListTile( leading: const Padding( - padding: EdgeInsets.only(top: 4.0), + padding: EdgeInsetsDirectional.only(top: VERY_SMALL_SPACE), child: Icon(Icons.search, size: 18.0), ), trailing: InkWell( @@ -70,7 +70,7 @@ class _SearchHistoryViewState extends State { Focus.maybeOf(context)?.requestFocus(); }, child: const Padding( - padding: EdgeInsets.all(8.0), + padding: EdgeInsets.all(SMALL_SPACE), child: Icon(Icons.edit, size: 18.0), ), ), diff --git a/packages/smooth_app/lib/pages/scan/search_page.dart b/packages/smooth_app/lib/pages/scan/search_page.dart index 4ca6550dd9e..bafe0b12a37 100644 --- a/packages/smooth_app/lib/pages/scan/search_page.dart +++ b/packages/smooth_app/lib/pages/scan/search_page.dart @@ -211,7 +211,7 @@ class _SearchFieldState extends State { Widget _buildClearButton() { return Padding( - padding: const EdgeInsets.only(right: 12.0), + padding: const EdgeInsetsDirectional.only(end: MEDIUM_SPACE), child: IconButton( onPressed: _handleClear, icon: AnimatedCrossFade( diff --git a/packages/smooth_app/lib/pages/user_management/login_page.dart b/packages/smooth_app/lib/pages/user_management/login_page.dart index 53ab1da149e..e5ffa7c2c75 100644 --- a/packages/smooth_app/lib/pages/user_management/login_page.dart +++ b/packages/smooth_app/lib/pages/user_management/login_page.dart @@ -122,7 +122,7 @@ class _LoginPageState extends State with TraceableClientMixin { appLocalizations.sign_in_text, textAlign: TextAlign.center, style: theme.textTheme.headline1?.copyWith( - fontSize: 20.0, + fontSize: VERY_LARGE_SPACE, fontWeight: FontWeight.w700, ), ), @@ -234,7 +234,7 @@ class _LoginPageState extends State with TraceableClientMixin { padding: MaterialStateProperty.all( const EdgeInsets.symmetric( vertical: 10.0, - horizontal: 20.0, + horizontal: VERY_LARGE_SPACE, ), ), shape: @@ -301,11 +301,12 @@ class _LoginPageState extends State with TraceableClientMixin { ), ), child: Padding( - padding: const EdgeInsets.only(bottom: 2.0), + padding: + const EdgeInsetsDirectional.only(bottom: 2.0), child: Text( appLocalizations.create_account, style: theme.textTheme.bodyText2?.copyWith( - fontSize: 20.0, + fontSize: VERY_LARGE_SPACE, fontWeight: FontWeight.w500, color: theme.colorScheme.primary, ), diff --git a/packages/smooth_app/lib/themes/smooth_theme.dart b/packages/smooth_app/lib/themes/smooth_theme.dart index c231a6dbfd7..c8a480b4023 100644 --- a/packages/smooth_app/lib/themes/smooth_theme.dart +++ b/packages/smooth_app/lib/themes/smooth_theme.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:smooth_app/generic_lib/design_constants.dart'; import 'package:smooth_app/themes/color_schemes.dart'; import 'package:smooth_app/themes/theme_provider.dart'; @@ -85,7 +86,7 @@ class SmoothTheme { fontWeight: FontWeight.bold, ), headline4: TextStyle( - fontSize: 16.0, + fontSize: LARGE_SPACE, fontWeight: FontWeight.bold, color: Colors.black, ), diff --git a/packages/smooth_app/lib/views/bottom_sheet_views/group_query_filter_view.dart b/packages/smooth_app/lib/views/bottom_sheet_views/group_query_filter_view.dart index cae39ff0420..b3a4dd23ff5 100644 --- a/packages/smooth_app/lib/views/bottom_sheet_views/group_query_filter_view.dart +++ b/packages/smooth_app/lib/views/bottom_sheet_views/group_query_filter_view.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:provider/provider.dart'; import 'package:smooth_app/generic_lib/buttons/smooth_main_button.dart'; +import 'package:smooth_app/generic_lib/design_constants.dart'; class GroupQueryFilterView extends StatelessWidget { const GroupQueryFilterView({ @@ -34,10 +35,10 @@ class GroupQueryFilterView extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( - margin: EdgeInsets.only( - left: - MediaQuery.of(context).size.width * 0.05 + 6.0, - top: 24.0), + margin: EdgeInsetsDirectional.only( + start: MediaQuery.of(context).size.width * 0.05 + 6.0, + top: 24.0, + ), child: Row( mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -48,13 +49,15 @@ class GroupQueryFilterView extends StatelessWidget { ), ), Container( - padding: const EdgeInsets.only(left: 10.0), - margin: const EdgeInsets.only(top: 6.0), + padding: const EdgeInsetsDirectional.only(start: 10.0), + margin: const EdgeInsetsDirectional.only(top: 6.0), width: MediaQuery.of(context).size.width * 0.9, decoration: const BoxDecoration( - color: Colors.black12, - borderRadius: - BorderRadius.all(Radius.circular(12.0))), + color: Colors.black12, + borderRadius: BorderRadius.all( + Radius.circular(MEDIUM_SPACE), + ), + ), child: DropdownButton( items: selectedCategoryModel.categoriesList.map( (String key) { @@ -68,7 +71,7 @@ class GroupQueryFilterView extends StatelessWidget { style: Theme.of(context) .textTheme .bodyText2! - .copyWith(fontSize: 12.0)), + .copyWith(fontSize: MEDIUM_SPACE)), ), ); }, @@ -88,7 +91,7 @@ class GroupQueryFilterView extends StatelessWidget { /*Container( margin: EdgeInsets.only( left: MediaQuery.of(context).size.width * 0.05 + 6.0, - top: 12.0), + top: MEDIUM_SPACE), child: Row( mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -105,7 +108,7 @@ class GroupQueryFilterView extends StatelessWidget { decoration: const BoxDecoration( color: Colors.black12, borderRadius: - BorderRadius.all(Radius.circular(12.0))), + BorderRadius.all(Radius.circular(MEDIUM_SPACE))), child: DropdownButton( items: selectedCategoryModel.categoriesList .map((String key) { @@ -119,7 +122,7 @@ class GroupQueryFilterView extends StatelessWidget { .bodyText2 !.copyWith( color: Colors.black, - fontSize: 12.0)), + fontSize: MEDIUM_SPACE)), ), ); }).toList(), @@ -147,7 +150,8 @@ class GroupQueryFilterView extends StatelessWidget { child: Container( color: Colors.black12, padding: const EdgeInsets.symmetric( - horizontal: 12.0, vertical: 20.0), + horizontal: MEDIUM_SPACE, + vertical: VERY_LARGE_SPACE), child: SmoothMainButton( text: AppLocalizations.of(context).applyButtonText, diff --git a/packages/smooth_app/lib/widgets/smooth_product_carousel.dart b/packages/smooth_app/lib/widgets/smooth_product_carousel.dart index 10a703db08d..552a60b292e 100644 --- a/packages/smooth_app/lib/widgets/smooth_product_carousel.dart +++ b/packages/smooth_app/lib/widgets/smooth_product_carousel.dart @@ -31,10 +31,10 @@ class SmoothProductCarousel extends StatefulWidget { static const EdgeInsetsGeometry carouselItemHorizontalPadding = EdgeInsetsDirectional.only( - top: 16.0, - start: 20.0, - end: 20.0, - bottom: 20.0, + top: LARGE_SPACE, + start: VERY_LARGE_SPACE, + end: VERY_LARGE_SPACE, + bottom: VERY_LARGE_SPACE, ); static const EdgeInsetsGeometry carouselItemInternalPadding = EdgeInsets.symmetric(horizontal: 2.0); @@ -268,7 +268,7 @@ class _SearchCardTagLine extends StatelessWidget { padding: const EdgeInsets.symmetric(vertical: VERY_SMALL_SPACE), child: DefaultTextStyle.merge( style: const TextStyle( - fontSize: 16.0, + fontSize: LARGE_SPACE, height: 1.22, ), textAlign: TextAlign.center,