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

feat: Reworked UI for ingredients/packaging input #6156

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
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
Binary file modified packages/smooth_app/assets/fonts/SmoothIcons.ttf
Binary file not shown.
42 changes: 42 additions & 0 deletions packages/smooth_app/assets/fonts/icons/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1761,6 +1761,48 @@
"search": [
"gallery"
]
},
{
"uid": "e660fb4e7284d1796f4951980902e4e1",
"css": "ocr",
"code": 59498,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M152.8 0C68.9 0 0 68.9 0 152.8L0 236.1C-0.2 251.1 7.7 265.1 20.7 272.7 33.6 280.3 49.7 280.3 62.7 272.7 75.7 265.1 83.6 251.1 83.3 236.1L83.3 152.8C83.3 113.9 113.9 83.3 152.8 83.3L236.1 83.3C251.1 83.6 265.1 75.7 272.7 62.7 280.3 49.7 280.3 33.6 272.7 20.7 265.1 7.7 251.1-0.2 236.1 0L152.8 0ZM763.9 0C748.9-0.2 734.9 7.7 727.3 20.7 719.7 33.6 719.7 49.7 727.3 62.7 734.9 75.7 748.9 83.6 763.9 83.3L847.2 83.3C886.1 83.3 916.7 113.9 916.7 152.8L916.7 236.1C916.5 251.1 924.4 265.1 937.3 272.7 950.3 280.3 966.4 280.3 979.4 272.7 992.3 265.1 1000.2 251.1 1000 236.1L1000 152.8C1000 68.9 931.1 0 847.2 0L763.9 0ZM498.2 194.5C480.8 195.2 465.7 206.7 460.3 223.3L345.5 578.2C343.5 582.1 342.2 586.4 341.5 590.8L307.6 695.5C300.5 717.4 312.5 740.9 334.4 748 356.3 755.1 379.8 743.1 386.9 721.1L413.5 638.9 586.5 638.9 613.1 721.1C617.7 735.3 629.5 746 644 749.1 658.6 752.2 673.7 747.3 683.7 736.3 693.7 725.2 697 709.7 692.4 695.5L658.1 589.1C657.4 585.9 656.4 582.7 655 579.7L539.7 223.3C533.9 205.5 516.9 193.7 498.2 194.5ZM500 371.5L559.6 555.6 440.4 555.6 500 371.5ZM41 721.6C18 722-0.3 740.9 0 763.9L0 847.2C0 931.1 68.9 1000 152.8 1000L236.1 1000C251.1 1000.2 265.1 992.3 272.7 979.4 280.3 966.4 280.3 950.3 272.7 937.3 265.1 924.4 251.1 916.5 236.1 916.7L152.8 916.7C113.9 916.7 83.3 886.1 83.3 847.2L83.3 763.9C83.5 752.6 79.1 741.8 71.1 733.8 63.1 725.9 52.3 721.5 41 721.6ZM957.7 721.6C934.7 722 916.3 740.9 916.7 763.9L916.7 847.2C916.7 886.1 886.1 916.7 847.2 916.7L763.9 916.7C748.9 916.5 734.9 924.4 727.3 937.3 719.7 950.3 719.7 966.4 727.3 979.4 734.9 992.3 748.9 1000.2 763.9 1000L847.2 1000C931.1 1000 1000 931.1 1000 847.2L1000 763.9C1000.2 752.6 995.8 741.8 987.8 733.8 979.8 725.9 969 721.5 957.7 721.6Z",
"width": 1000
},
"search": [
"ocr"
]
},
{
"uid": "d09a76b7830a5bd5868aa1261b169b00",
"css": "milk_filled_unhappy",
"code": 59518,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M691.5 0C711.7 0 728 16.4 728 36.6L728 76.7 835.8 292.3 840.1 301.8C846.6 317.8 850 334.9 850 352.3L850 914.6C850 961.3 811.3 1000 764.6 1000L203.7 1000C156.9 1000 118.3 961.3 118.3 914.6L118.3 352.3C118.3 331.5 123.1 310.9 132.4 292.3L240.2 76.7 240.2 36.6C240.2 16.4 256.6 0 276.8 0ZM691.5 167.2L612.5 325C608.3 333.4 606.1 342.8 606.1 352.3L606.1 926.8 764.6 926.8C771.8 926.8 776.8 921.8 776.8 914.6L776.8 352.3C776.8 342.8 774.6 333.5 770.4 325L691.5 167.2ZM247.9 681.1C236.6 691 232.5 706.9 237.6 721 242.7 735.2 256 744.8 271.1 745.2 281 745.4 290.5 741.7 297.6 734.8 335 700.1 385.2 700.1 422.7 734.8 429.6 741.3 438.8 744.9 448.3 744.9 463.4 744.7 476.8 735.3 482.2 721.2 487.5 707.1 483.6 691.2 472.4 681.1 408.9 622.2 311.4 622.2 247.9 681.1ZM276.8 512.2C256.6 512.2 240.2 528.6 240.2 548.8 240.2 569 256.6 585.4 276.8 585.4 297 585.4 313.4 569 313.4 548.8 313.4 528.6 297 512.2 276.8 512.2ZM447.6 512.2C427.3 512.2 411 528.6 411 548.8 411 569 427.3 585.4 447.6 585.4 467.8 585.4 484.1 569 484.1 548.8 484.1 528.6 467.8 512.2 447.6 512.2ZM632.2 122L299.4 122 214 292.7 546.9 292.7 632.2 122Z",
"width": 1000
},
"search": [
"milk_filled_unhappy"
]
},
{
"uid": "9e689efdfa6cb85c20cd014ef79d5b26",
"css": "move",
"code": 59519,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M499.9 0L352.9 145.4C340.9 156.9 335.9 173.9 340.1 190.1 344.2 206.1 356.6 218.8 372.7 223.1 388.7 227.4 405.9 222.6 417.4 210.7L454 174.5 454 338.7C453.7 355.3 462.4 370.6 476.8 379 491 387.4 508.8 387.4 523 379 537.4 370.6 546.1 355.3 545.8 338.7L545.8 174.5 582.4 210.7C594 222.6 611.1 227.4 627.1 223.1 643.2 218.8 655.6 206.1 659.8 190.1 663.9 173.9 658.9 156.9 646.9 145.4L499.9 0ZM821.6 338.9C802.9 338.8 786.1 350 779 367.3 771.8 384.5 775.9 404.4 789.2 417.5L825.4 454.1 661.2 454.1C644.6 453.8 629.3 462.5 620.9 476.9 612.5 491.1 612.5 508.9 620.9 523.1 629.3 537.5 644.6 546.2 661.2 545.9L825.4 545.9 789.2 582.5C777.3 594 772.5 611.2 776.8 627.2 781.1 643.3 793.8 655.7 809.8 659.9 826 664 843 659 854.5 647L999.9 500 854.5 353C845.9 344 834 339 821.6 338.9ZM176.8 339C164.9 339.3 153.6 344.4 145.2 353L0 500 145.2 647C163.1 665.1 192.2 665.2 210.2 647.4 228.3 629.5 228.4 600.5 210.6 582.5L174.4 545.9 338.5 545.9C355.1 546.2 370.5 537.5 378.9 523.1 387.2 508.9 387.2 491.1 378.9 476.9 370.5 462.5 355.1 453.8 338.5 454.1L174.4 454.1 210.6 417.5C224 404.2 228 384.1 220.5 366.7 213.1 349.3 195.7 338.3 176.8 339ZM499.2 614.8C473.9 615.2 453.6 636 454 661.4L454 825.5 417.4 789.4C408.7 780.5 396.8 775.6 384.4 775.6 365.7 775.8 349 787.2 342 804.6 335.1 821.9 339.4 841.7 352.9 854.7L463.5 964C466 967.3 469 970.2 472.3 972.7L499.9 1000 527.4 972.7C530.8 970.2 533.9 967.2 536.5 963.8L646.9 854.7C660.7 841.6 665 821.4 657.8 803.9 650.6 786.4 633.4 775.1 614.4 775.5 602.4 775.7 590.8 780.7 582.4 789.4L545.8 825.5 545.8 661.4C546 648.9 541.1 637 532.4 628.2 523.6 619.4 511.6 614.6 499.2 614.8Z",
"width": 1000
},
"search": [
"move"
]
}
]
}
Binary file modified packages/smooth_app/assets/fonts/icons/icons.sketch
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions packages/smooth_app/assets/fonts/icons/move.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions packages/smooth_app/assets/fonts/icons/ocr.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:provider/provider.dart';
import 'package:smooth_app/cards/product_cards/smooth_product_base_card.dart';
import 'package:smooth_app/cards/product_cards/smooth_product_image.dart';
import 'package:smooth_app/generic_lib/design_constants.dart';
import 'package:smooth_app/generic_lib/widgets/picture_not_found.dart';
import 'package:smooth_app/helpers/product_cards_helper.dart';
import 'package:smooth_app/pages/product/gallery_view/product_image_gallery_view.dart';

Expand Down Expand Up @@ -83,6 +84,7 @@ class ProductTitleCard extends StatelessWidget {
imageNotFoundBorder: 1.0,
heroTag: heroTag,
borderRadius: BorderRadius.circular(14.0),
noImageBuilder: (_) => const PictureNotFound(),
onTap: !dense
? () async => Navigator.push<void>(
context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class ProductPicture extends StatefulWidget {
double imageFoundBorder = 0.0,
double imageNotFoundBorder = 0.0,
TextStyle? errorTextStyle,
WidgetBuilder? noImageBuilder,
}) : this._(
transientFile: null,
product: product,
Expand All @@ -49,6 +50,7 @@ class ProductPicture extends StatefulWidget {
errorTextStyle: errorTextStyle,
showObsoleteIcon: showObsoleteIcon,
showOwnerIcon: showOwnerIcon,
noImageBuilder: noImageBuilder,
);

ProductPicture.fromTransientFile({
Expand All @@ -66,6 +68,7 @@ class ProductPicture extends StatefulWidget {
double imageFoundBorder = 0.0,
double imageNotFoundBorder = 0.0,
TextStyle? errorTextStyle,
WidgetBuilder? noImageBuilder,
}) : this._(
transientFile: transientFile,
product: product,
Expand All @@ -81,6 +84,7 @@ class ProductPicture extends StatefulWidget {
errorTextStyle: errorTextStyle,
showObsoleteIcon: showObsoleteIcon,
showOwnerIcon: showOwnerIcon,
noImageBuilder: noImageBuilder,
);

ProductPicture._({
Expand All @@ -98,6 +102,7 @@ class ProductPicture extends StatefulWidget {
this.errorTextStyle,
this.showObsoleteIcon = false,
this.showOwnerIcon = false,
this.noImageBuilder,
super.key,
}) : assert(imageFoundBorder >= 0.0),
assert(imageNotFoundBorder >= 0.0),
Expand Down Expand Up @@ -129,6 +134,9 @@ class ProductPicture extends StatefulWidget {
/// Style when there is no image/an error
final TextStyle? errorTextStyle;

/// Allows to change the placeholder
final WidgetBuilder? noImageBuilder;

@override
State<ProductPicture> createState() => _ProductPictureState();

Expand Down Expand Up @@ -202,9 +210,12 @@ class _ProductPictureState extends State<ProductPicture> {

child = _ProductPictureAssetsSvg(
asset: 'assets/product/product_not_found_text.svg',
imageOverride: widget.noImageBuilder,
semanticsLabel: appLocalizations
.product_page_image_no_image_available_accessibility_label,
text: appLocalizations.product_page_image_no_image_available,
text: widget.noImageBuilder == null
? appLocalizations.product_page_image_no_image_available
: null,
textStyle: TextStyle(
color: context.extension<SmoothColorsThemeExtension>().primaryDark,
).merge(widget.errorTextStyle ?? const TextStyle()),
Expand Down Expand Up @@ -578,6 +589,7 @@ class _ProductPictureAssetsSvg extends StatelessWidget {
required this.textStyle,
required this.size,
required this.child,
this.imageOverride,
this.borderRadius,
this.border = 0.0,
}) : assert(asset.isNotEmpty),
Expand All @@ -591,6 +603,7 @@ class _ProductPictureAssetsSvg extends StatelessWidget {
final Widget? child;
final BorderRadius? borderRadius;
final double border;
final WidgetBuilder? imageOverride;

@override
Widget build(BuildContext context) {
Expand All @@ -603,12 +616,13 @@ class _ProductPictureAssetsSvg extends StatelessWidget {
child: Stack(
children: <Widget>[
Positioned.fill(
child: SvgPicture.asset(
asset,
width: size.width,
height: size.height,
fit: BoxFit.cover,
),
child: imageOverride?.call(context) ??
SvgPicture.asset(
asset,
width: size.width,
height: size.height,
fit: BoxFit.cover,
),
),
if (text != null)
Padding(
Expand Down
Loading
Loading