Skip to content

Commit

Permalink
fix: Add the brand name in the AppBar and sub screens (#4578)
Browse files Browse the repository at this point in the history
* fix: Add the brand name in the AppBar

* Sub=page fix
  • Loading branch information
saiprasad-patil authored Aug 25, 2023
1 parent 5cc7fa4 commit dadef33
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ class _AddBasicDetailsPageState extends State<AddBasicDetailsPage> {
centerTitle: false,
title: Text(appLocalizations.basic_details),
subTitle: widget.product.productName != null
? Text(widget.product.productName!,
overflow: TextOverflow.ellipsis, maxLines: 1)
? Text(
'${widget.product.productName!.trim()}, ${widget.product.brands!.trim()}',
overflow: TextOverflow.ellipsis,
maxLines: 1)
: null,
),
body: Form(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ class _AddOtherDetailsPageState extends State<AddOtherDetailsPage> {
title:
Text(appLocalizations.edit_product_form_item_other_details_title),
subTitle: widget.product.productName != null
? Text(widget.product.productName!,
overflow: TextOverflow.ellipsis, maxLines: 1)
? Text(
'${widget.product.productName!.trim()}, ${widget.product.brands!.trim()}',
overflow: TextOverflow.ellipsis,
maxLines: 1)
: null,
ignoreSemanticsForSubtitle: true,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class _EditNewPackagingsState extends State<EditNewPackagings>
title: Text(appLocalizations.edit_packagings_title),
subTitle: upToDateProduct.productName != null
? Text(
upToDateProduct.productName!,
'${upToDateProduct.productName!.trim()}, ${upToDateProduct.brands!.trim()}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
)
Expand Down
2 changes: 1 addition & 1 deletion packages/smooth_app/lib/pages/product/edit_ocr_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class _EditOcrPageState extends State<EditOcrPage> with UpToDateMixin {
),
subTitle: upToDateProduct.productName != null
? Text(
upToDateProduct.productName!,
'${upToDateProduct.productName!.trim()}, ${upToDateProduct.brands!.trim()}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: appbarTextStyle,
Expand Down
4 changes: 3 additions & 1 deletion packages/smooth_app/lib/pages/product/edit_product_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class _EditProductPageState extends State<EditProductPage> with UpToDateMixin {
upToDateProduct,
appLocalizations,
);
final String productBrand =
getProductBrands(upToDateProduct, appLocalizations);

return SmoothScaffold(
appBar: SmoothAppBar(
Expand All @@ -72,7 +74,7 @@ class _EditProductPageState extends State<EditProductPage> with UpToDateMixin {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
AutoSizeText(
productName,
'${productName.trim()}, ${productBrand.trim()}',
minFontSize:
theme.textTheme.titleLarge?.fontSize?.clamp(13.0, 17.0) ??
13.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class _NutritionPageLoadedState extends State<NutritionPageLoaded>
),
subTitle: upToDateProduct.productName != null
? Text(
upToDateProduct.productName!,
'${upToDateProduct.productName!.trim()}, ${upToDateProduct.brands!.trim()}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class _ProductImageGalleryViewState extends State<ProductImageGalleryView>
subTitle: upToDateProduct.productName == null
? null
: Text(
upToDateProduct.productName!,
'${upToDateProduct.productName!.trim()}, ${upToDateProduct.brands!.trim()}',
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
Expand Down
6 changes: 5 additions & 1 deletion packages/smooth_app/lib/pages/product/simple_input_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ class _SimpleInputPageState extends State<SimpleInputPage> {
),
);
}
final String productName = getProductName(
widget.product,
appLocalizations,
);

return WillPopScope(
onWillPop: () async => _mayExitPage(saving: false),
Expand All @@ -94,7 +98,7 @@ class _SimpleInputPageState extends State<SimpleInputPage> {
appBar: SmoothAppBar(
centerTitle: false,
title: Text(
getProductName(widget.product, appLocalizations),
'${productName.trim()}, ${widget.product.brands!.trim()}',
maxLines: widget.product.barcode?.isNotEmpty == true ? 1 : 2,
overflow: TextOverflow.ellipsis,
),
Expand Down

0 comments on commit dadef33

Please sign in to comment.