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: Step-by-step fast-track #4698

Merged
merged 17 commits into from
Nov 15, 2023

Conversation

surajitbasak
Copy link
Contributor

Product Design page is now split into multiple pages

Product.Design.Recording.mp4

Let me know if I have made any mistakes or anything need to be changed further

@surajitbasak surajitbasak requested a review from a team as a code owner October 4, 2023 08:58
@github-actions github-actions bot added 🥫 Product page Product addition The easier it is to add a product and get Nutri-Score, Eco-Score, the happier the users. dependencies 🌐 l10n labels Oct 4, 2023
@g123k
Copy link
Collaborator

g123k commented Oct 5, 2023

Perfect, before reviewing your code, could you:

  • Ensure to be on a "full screen" page (= I mean without the bottom tabs
  • Add a back button, please?

@surajitbasak
Copy link
Contributor Author

Okay
Do you mean the screen should be without the 'Profile' 'scan' 'list' bottom tabs
and
There should be an Arrow type back button at the top-left corner of the page.
Is my understanding correct?

@g123k
Copy link
Collaborator

g123k commented Oct 5, 2023

Okay Do you mean the screen should be without the 'Profile' 'scan' 'list' bottom tabs and There should be an Arrow type back button at the top-left corner of the page. Is my understanding correct?

Yes exactly, basically for the first one, you juste need to use the parent Navigator.

@surajitbasak
Copy link
Contributor Author

I have committed the changes.

WhatsApp.Video.2023-10-06.at.1.48.22.AM.mp4

Let me know if these are okay or not :)

@teolemon teolemon changed the title Product Info Design has been split. feat: Step-by-step fast-track Oct 6, 2023
@g123k
Copy link
Collaborator

g123k commented Oct 6, 2023

Perfect in terms of UI
You still have warnings to fix from the GitHub Action: https://github.com/openfoodfacts/smooth-app/actions/runs/6423997267/job/17466600750?pr=4698

);

// await Navigator.push<void>(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you comment this code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was the previous code that opened the AddProductInformation page with the Tabs Below it.
So I Commented it and added new code Above it just to open that page from Parent Navigator.
Should I Remove that commented code?

@@ -42,7 +40,7 @@ class SmoothLargeButtonWithIcon extends StatelessWidget {

return SmoothSimpleButton(
minWidth: double.infinity,
padding: padding ?? const EdgeInsets.all(10),
padding: padding ?? const EdgeInsets.symmetric(vertical: 10),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By changing this button, it will have an impact on the whole app.
Please provide specific values when you need it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually in figma design those buttons' horizontal padding was slightly high that is why i made this change.
However i will revert back to the original, no issue.

@@ -17,7 +17,7 @@ const double MINIMUM_TOUCH_SIZE = kMinInteractiveDimension;
const double DEFAULT_ICON_SIZE = 24.0;

/// Background, e.g SmoothCard
const Radius ROUNDED_RADIUS = Radius.circular(20.0);
const Radius ROUNDED_RADIUS = Radius.circular(10.0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By changing this button, it will have an impact on the whole app.
Please provide specific radiuses when you need it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, in Figma the corners looked less than 20px,
However, I will revert back to the original.

child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
/*if (widget.displayPictures) _buildCard(_getImageRows(context)),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question as before, why do you comment this code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh Sorry, I will remove that comment.
That commented part is used from the Line Number : 230


Widget _backButton() {
return Container(
margin: const EdgeInsets.only(left: 10, right: 10, top: 10),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use EdgeInsetsDirectional instead

return Container(
margin: const EdgeInsets.only(left: 10, right: 10, top: 10),
width: 20,
height: 20,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ues, by convention, please write it as 20.0

onPressed: () {
_onWillPop().then((bool leaveThePage) => leaveThePage ? Navigator.of(context).pop() : null);
},
child: const Text('Cancel', style: TextStyle(color: Colors.black, fontSize: 20, fontWeight: FontWeight.bold)),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't hardcode i11n

@surajitbasak
Copy link
Contributor Author

Hey @g123k , I have committed the Reviewed changes. Can you please go through that? Thanks :)

@surajitbasak
Copy link
Contributor Author

After the changes the design looks like this
image

Copy link
Collaborator

@g123k g123k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the double format + trailing commas + don't hardcode values
Tkx

child: Text(appLocalizations.new_product_additional_ecoscore,
style: TextStyle(
color: Theme.of(context).colorScheme.onPrimary))),
const SizedBox(width: 5),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

child: Row(children: <Widget>[
Icon(Icons.filter_2,
color: Theme.of(context).colorScheme.onPrimary),
const SizedBox(width: 15),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double

title: Text(appLocalizations.new_product_additional_ecoscore),
trailing: Icon(
_ecoscoreExpanded ? Icons.expand_less : Icons.expand_more,
const SizedBox(height: 15),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double

@@ -296,20 +390,39 @@ class _AddNewProductPageState extends State<AddNewProductPage>
final Attribute? attribute = _getAttribute(Attribute.ATTRIBUTE_ECOSCORE);
return <Widget>[
AddNewProductTitle(appLocalizations.new_product_title_ecoscore),
const SizedBox(height: 15),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double

List<Widget> _getNutriscoreRows(final BuildContext context) {
final AppLocalizations appLocalizations = AppLocalizations.of(context);
final Attribute? attribute = _getAttribute(Attribute.ATTRIBUTE_NUTRISCORE);
return <Widget>[
AddNewProductTitle(appLocalizations.new_product_title_nutriscore),
const SizedBox(height: 15),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double

icon: const Icon(Icons.arrow_back)));
}

Widget _getButtons({String doneBtnText = 'Next'}) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No hardcoded sentence, please

children: <Widget>[
ElevatedButton(
style: ElevatedButton.styleFrom(
minimumSize: Size(MediaQuery.of(context).size.width * 0.35, 40),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double

minimumSize: Size(MediaQuery.of(context).size.width * 0.35, 40),
backgroundColor: Theme.of(context).colorScheme.secondary,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20))),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double + trailing comma

Comment on lines 332 to 333
fontSize: 20,
fontWeight: FontWeight.bold)),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double + trailing comma

fontSize: 20,
fontWeight: FontWeight.bold)),
),
const SizedBox(width: 10),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double

@codecov-commenter
Copy link

Codecov Report

Merging #4698 (cc382f6) into develop (8ac2fa9) will decrease coverage by 0.04%.
Report is 1 commits behind head on develop.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           develop   #4698      +/-   ##
==========================================
- Coverage     9.90%   9.86%   -0.04%     
==========================================
  Files          310     310              
  Lines        15815   15871      +56     
==========================================
  Hits          1566    1566              
- Misses       14249   14305      +56     
Files Coverage Δ
packages/smooth_app/lib/themes/color_schemes.dart 85.71% <ø> (ø)
...s/product_cards/smooth_product_card_not_found.dart 0.00% <0.00%> (ø)
.../smooth_app/lib/helpers/image_field_extension.dart 0.00% <0.00%> (ø)
.../smooth_app/lib/pages/navigator/app_navigator.dart 0.00% <0.00%> (ø)
..._app/lib/pages/product/add_new_product_helper.dart 0.00% <0.00%> (ø)
...th_app/lib/pages/product/add_new_product_page.dart 0.00% <0.00%> (ø)

... and 7 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@surajitbasak
Copy link
Contributor Author

Hey @g123k , I have made the changes & Committed, Let me know if any other changes need to be made :)

Copy link
Collaborator

@g123k g123k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few last comments

const SizedBox(height: MINIMUM_TOUCH_SIZE),
],
),
body: SafeArea(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you get rid of the Scaffold?
One of the goals is to have a consustent color for the status bar on Android and iOS

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@surajitbasak Any reason?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for?
This the way all screens are implemented in the app

decoration: BoxDecoration(
gradient: LinearGradient(
colors: <Color>[
Theme.of(context).colorScheme.inversePrimary,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you call of(context) several times, please ensure to cache this (by storing it in a variable)

margin: EdgeInsets.zero,
elevation: 15.0,
child: SizedBox(
height: MediaQuery.of(context).size.height * 0.1,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we use the latest version of Flutter, you can simplify by using MediaQuery.sizeOf()

Widget _backButton() {
return Container(
margin: const EdgeInsetsDirectional.only(
start: 10.0, end: 10.0, top: 10.0, bottom: 0.0),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the missing trailing comma at the end

ElevatedButton(
style: ElevatedButton.styleFrom(
minimumSize: Size(MediaQuery.of(context).size.width * 0.35, 40.0),
backgroundColor: Theme.of(context).colorScheme.secondary,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here for of() + MediaQuery

ElevatedButton(
style: ElevatedButton.styleFrom(
minimumSize: Size(MediaQuery.of(context).size.width * 0.35, 40.0),
backgroundColor: const Color(0xFF341100),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make this color a constant

onPressed: () {
_pageController.nextPage(
duration: SmoothAnimationsDuration.short,
curve: Curves.easeOut);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the trailing comma

@surajitbasak
Copy link
Contributor Author

Hey @g123k , I have committed the changes, Let me know if it's okay or not :)


@override
void didChangeDependencies() {
print('Mummy di');
Copy link
Collaborator

@g123k g123k Oct 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No print please
and why do you need to fetch the colorScheme here?

Edit: Just get it at the beginning of the build() method

@surajitbasak
Copy link
Contributor Author

@g123k , i made the changes, please check once :)

}

@override
Widget build(BuildContext context) {
final AppLocalizations appLocalizations = AppLocalizations.of(context);
_colorScheme = _colorScheme = Theme.of(context).colorScheme;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, please just remove the attribute from the class, as it's not used anymore

const SizedBox(height: MINIMUM_TOUCH_SIZE),
],
),
body: SafeArea(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@surajitbasak Any reason?

Copy link
Collaborator

@g123k g123k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just 2 comments

@g123k
Copy link
Collaborator

g123k commented Oct 24, 2023

Just 2 comments

Do you make any progress on this PR @surajitbasak?
Do you need any help?

@surajitbasak
Copy link
Contributor Author

Just 2 comments

Do you make any progress on this PR @surajitbasak? Do you need any help?

No i didn't make any further changes,
And yes you can help me to guide if you want me to add the App bar on that page.

Comment on lines 53 to 56
style: const TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That wont look good on small devices, please use

Theme.of(context).textTheme.displaySmall

or another one which is most fitting and edit it with .copyWith()

@teolemon
Copy link
Member

teolemon commented Nov 9, 2023

@surajitbasak could you fix the 3 little merge conflicts, so that we can rebase the PR ?

@surajitbasak
Copy link
Contributor Author

@surajitbasak could you fix the 3 little merge conflicts, so that we can rebase the PR ?

I have resolved those merge conflicts, Please let me know if i need to do anything else :)

Copy link
Collaborator

@g123k g123k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, let's go for this PR.
In the case, where there are some changes required, I will open a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies 🌐 l10n PR: needs rebase Product addition The easier it is to add a product and get Nutri-Score, Eco-Score, the happier the users. 🥫 Product page
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants