From c8708992928d87933f7e6949b6863b632b4452c0 Mon Sep 17 00:00:00 2001 From: Edouard Marquez Date: Thu, 4 Jan 2024 16:05:33 +0100 Subject: [PATCH] Dart format --- .../pages/product/add_basic_details_page.dart | 166 +++++++++--------- .../lib/pages/product/portion_calculator.dart | 4 +- .../lib/widgets/will_pop_scope.dart | 2 +- 3 files changed, 87 insertions(+), 85 deletions(-) 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 d1f04cf98d7..e017feeb115 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 @@ -93,99 +93,99 @@ class _AddBasicDetailsPageState extends State { child: SmoothScaffold( fixKeyboard: true, appBar: SmoothAppBar( - centerTitle: false, - title: Text(appLocalizations.basic_details), - subTitle: buildProductTitle(widget.product, appLocalizations), - ), - body: Form( - key: _formKey, - child: Scrollbar( - child: ListView( - children: [ - Align( - alignment: AlignmentDirectional.topStart, - child: ProductImageCarousel( - _product, - height: size.height * 0.20, - ), + centerTitle: false, + title: Text(appLocalizations.basic_details), + subTitle: buildProductTitle(widget.product, appLocalizations), + ), + body: Form( + key: _formKey, + child: Scrollbar( + child: ListView( + children: [ + Align( + alignment: AlignmentDirectional.topStart, + child: ProductImageCarousel( + _product, + height: size.height * 0.20, ), - SizedBox(height: _heightSpace), - Padding( - padding: EdgeInsets.symmetric( - horizontal: size.width * 0.05, - ), - child: Column( - children: [ - Text( - appLocalizations.barcode_barcode(_product.barcode!), - style: - Theme.of(context).textTheme.bodyMedium?.copyWith( - fontWeight: FontWeight.bold, - ), - ), - SizedBox(height: _heightSpace), - if (_multilingualHelper.isMonolingual()) - SmoothTextFormField( - controller: _productNameController, - type: TextFieldTypes.PLAIN_TEXT, - hintText: appLocalizations.product_name, - ) - else - Card( - child: Column( - children: [ - _multilingualHelper - .getLanguageSelector(setState), - Padding( - padding: const EdgeInsets.all(8.0), - child: SmoothTextFormField( - controller: _productNameController, - type: TextFieldTypes.PLAIN_TEXT, - hintText: appLocalizations.product_name, - ), + ), + SizedBox(height: _heightSpace), + Padding( + padding: EdgeInsets.symmetric( + horizontal: size.width * 0.05, + ), + child: Column( + children: [ + Text( + appLocalizations.barcode_barcode(_product.barcode!), + style: + Theme.of(context).textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.bold, ), - ], - ), - ), - SizedBox(height: _heightSpace), - LayoutBuilder( - builder: ( - final BuildContext context, - final BoxConstraints constraints, - ) => - SmoothAutocompleteTextField( - focusNode: _focusNode, - controller: _brandNameController, - autocompleteKey: _autocompleteKey, - hintText: appLocalizations.brand_name, - constraints: constraints, - manager: AgnosticSuggestionManager.brand(), - ), - ), - SizedBox(height: _heightSpace), + ), + SizedBox(height: _heightSpace), + if (_multilingualHelper.isMonolingual()) SmoothTextFormField( - controller: _weightController, + controller: _productNameController, type: TextFieldTypes.PLAIN_TEXT, - hintText: appLocalizations.quantity, + hintText: appLocalizations.product_name, + ) + else + Card( + child: Column( + children: [ + _multilingualHelper + .getLanguageSelector(setState), + Padding( + padding: const EdgeInsets.all(8.0), + child: SmoothTextFormField( + controller: _productNameController, + type: TextFieldTypes.PLAIN_TEXT, + hintText: appLocalizations.product_name, + ), + ), + ], + ), ), - // in order to be able to scroll suggestions - SizedBox(height: MediaQuery.sizeOf(context).height), - ], - ), + SizedBox(height: _heightSpace), + LayoutBuilder( + builder: ( + final BuildContext context, + final BoxConstraints constraints, + ) => + SmoothAutocompleteTextField( + focusNode: _focusNode, + controller: _brandNameController, + autocompleteKey: _autocompleteKey, + hintText: appLocalizations.brand_name, + constraints: constraints, + manager: AgnosticSuggestionManager.brand(), + ), + ), + SizedBox(height: _heightSpace), + SmoothTextFormField( + controller: _weightController, + type: TextFieldTypes.PLAIN_TEXT, + hintText: appLocalizations.quantity, + ), + // in order to be able to scroll suggestions + SizedBox(height: MediaQuery.sizeOf(context).height), + ], ), - ], - ), + ), + ], ), ), - bottomNavigationBar: ProductBottomButtonsBar( - onSave: () async => _exitPage( - await _mayExitPage(saving: true), - ), - onCancel: () async => _exitPage( - await _mayExitPage(saving: false), - ), + ), + bottomNavigationBar: ProductBottomButtonsBar( + onSave: () async => _exitPage( + await _mayExitPage(saving: true), + ), + onCancel: () async => _exitPage( + await _mayExitPage(saving: false), ), ), + ), ), ); } diff --git a/packages/smooth_app/lib/pages/product/portion_calculator.dart b/packages/smooth_app/lib/pages/product/portion_calculator.dart index 0b44db940f7..34eb43dc486 100644 --- a/packages/smooth_app/lib/pages/product/portion_calculator.dart +++ b/packages/smooth_app/lib/pages/product/portion_calculator.dart @@ -56,7 +56,9 @@ class _PortionCalculatorState extends State { ), const SizedBox(height: MEDIUM_SPACE), Container( - height: MediaQuery.textScalerOf(context).scale(SMALL_SPACE * 2 + 15.0) * 1.2, + height: + MediaQuery.textScalerOf(context).scale(SMALL_SPACE * 2 + 15.0) * + 1.2, padding: const EdgeInsets.symmetric(horizontal: MEDIUM_SPACE), child: Row( mainAxisAlignment: MainAxisAlignment.center, diff --git a/packages/smooth_app/lib/widgets/will_pop_scope.dart b/packages/smooth_app/lib/widgets/will_pop_scope.dart index be96d655074..034dd000000 100644 --- a/packages/smooth_app/lib/widgets/will_pop_scope.dart +++ b/packages/smooth_app/lib/widgets/will_pop_scope.dart @@ -33,4 +33,4 @@ class WillPopScope2 extends StatelessWidget { child: child, ); } -} \ No newline at end of file +}