Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Navigate to add basic details page if scanned product is unknown #1778

Merged
merged 2 commits into from
May 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 25 additions & 11 deletions packages/smooth_app/lib/cards/product_cards/product_title_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:smooth_app/data_models/continuous_scan_model.dart';
import 'package:smooth_app/generic_lib/design_constants.dart';
import 'package:smooth_app/helpers/extension_on_text_helper.dart';
import 'package:smooth_app/helpers/product_cards_helper.dart';
import 'package:smooth_app/pages/product/add_basic_details_page.dart';

class ProductTitleCard extends StatelessWidget {
const ProductTitleCard(
Expand Down Expand Up @@ -47,17 +48,30 @@ class ProductTitleCard extends StatelessWidget {
}
return Align(
alignment: Alignment.topLeft,
child: ListTile(
dense: dense,
contentPadding: EdgeInsets.zero,
title: Text(
getProductName(product, appLocalizations),
style: themeData.textTheme.headline4,
).selectable(isSelectable: isSelectable),
subtitle: Text(
subtitleText,
).selectable(isSelectable: isSelectable),
trailing: trailingWidget,
child: InkWell(
onTap: () async {
if (getProductName(product, appLocalizations) ==
appLocalizations.unknownProductName) {
await Navigator.push<bool>(
context,
MaterialPageRoute<bool>(
builder: (BuildContext context) => AddBasicDetailsPage(product),
),
);
}
},
child: ListTile(
dense: dense,
contentPadding: EdgeInsets.zero,
title: Text(
getProductName(product, appLocalizations),
style: themeData.textTheme.headline4,
).selectable(isSelectable: isSelectable),
subtitle: Text(
subtitleText,
).selectable(isSelectable: isSelectable),
trailing: trailingWidget,
),
),
);
}
Expand Down