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

Revamped single product page #105

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ManavSarkar
Copy link

Program

  • CodePeak
  • Script Winter of Code
  • None

Issue

Fixes #(Mention the issue ID here)
issue-22-revamp-product-page

Description

The product page of the app was somewhat dull and not much engaging. Inspired by other e-commerce applications, designed the product page with a new and natural design.

Type of change

You can write manually also

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation change

Screenshot

Screenshot.
146412153-91f0bff5-6aa0-4a81-8046-25194883d50c

Checklist:

  • My code follows the style guidelines of this project
  • The app runs properly
  • I have performed a self-review of my code
  • I have formatted and commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Copy link
Owner

@Saransh-cpp Saransh-cpp left a comment

Choose a reason for hiding this comment

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

Thanks, @ManavSarkar! Looks great! You will have to fix the tests before I can review the PR. You can click on the details button present on the lint-check to see where they are failing!

pubspec.lock Outdated
@@ -7,7 +7,7 @@ packages:
name: async
Copy link
Owner

Choose a reason for hiding this comment

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

@ManavSarkar, we don't need changes in this file, this should be removed.

git reset --soft HEAD~1
git restore --staged pubspec.lock
git commit -m "<Your message>"
git push -f

This will -

  1. Remove the last commit but keep all the changes
  2. Remove the pubspec.lock file from staged changes
  3. Commit the new changes
  4. And force push the commit (as remote and local have different commit histories now)

Copy link
Author

Choose a reason for hiding this comment

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

I have done the changes and fixed the lint errors.

@Saransh-cpp
Copy link
Owner

@ManavSarkar the pubspec.lock file is still added in this PR

@ManavSarkar ManavSarkar force-pushed the issue-22-revamp-product-page branch from aadbee4 to 0098bab Compare December 30, 2021 03:47
@ManavSarkar
Copy link
Author

@ManavSarkar the pubspec.lock file is still added in this PR

fixed

Copy link
Owner

@Saransh-cpp Saransh-cpp left a comment

Choose a reason for hiding this comment

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

Thanks, @ManavSarkar! Looks awesome. While running the app, if I selected a different period of time then it gave me the following error -

======== Exception caught by widgets library =======================================================
The following assertion was thrown while applying parent data.:
Incorrect use of ParentDataWidget.

The ParentDataWidget Expanded(flex: 1) wants to apply ParentData of type FlexParentData to a RenderObject, which has been set up to accept ParentData of incompatible type BoxParentData.

Usually, this means that the Expanded widget has the wrong ancestor RenderObjectWidget. Typically, Expanded widgets are placed directly inside Flex widgets.
The offending Expanded is currently placed inside a Padding widget.

The ownership chain for the RenderObject that received the incompatible parent data was:
  RichText ← Text ← Expanded ← Padding ← Row ← RepaintBoundary ← IndexedSemantics ← NotificationListener<KeepAliveNotification> ← KeepAlive ← AutomaticKeepAlive ← ⋯
When the exception was thrown, this was the stack: 
#0      RenderObjectElement._updateParentData.<anonymous closure> (package:flutter/src/widgets/framework.dart:5835:11)
#1      RenderObjectElement._updateParentData (package:flutter/src/widgets/framework.dart:5851:6)
#2      ParentDataElement._applyParentData.applyParentDataToChild (package:flutter/src/widgets/framework.dart:5053:15)
#3      ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4719:14)
#4      ParentDataElement._applyParentData.applyParentDataToChild (package:flutter/src/widgets/framework.dart:5056:15)
#5      ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4719:14)
#6      ParentDataElement._applyParentData (package:flutter/src/widgets/framework.dart:5059:5)
#7      ParentDataElement.notifyClients (package:flutter/src/widgets/framework.dart:5103:5)
#8      ProxyElement.updated (package:flutter/src/widgets/framework.dart:5030:5)
#9      ProxyElement.update (package:flutter/src/widgets/framework.dart:5018:5)
#10     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#11     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6202:14)
#12     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#13     RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:5700:32)
#14     MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6356:17)
#15     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#16     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6202:14)
#17     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#18     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6202:14)
#19     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#20     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#21     Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#22     StatelessElement.update (package:flutter/src/widgets/framework.dart:4746:5)
#23     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#24     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#25     Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#26     ProxyElement.update (package:flutter/src/widgets/framework.dart:5020:5)
#27     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#28     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#29     StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4840:11)
#30     Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#31     StatefulElement.update (package:flutter/src/widgets/framework.dart:4872:5)
#32     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#33     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#34     Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#35     StatelessElement.update (package:flutter/src/widgets/framework.dart:4746:5)
#36     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#37     SliverMultiBoxAdaptorElement.updateChild (package:flutter/src/widgets/sliver.dart:1242:37)
#38     SliverMultiBoxAdaptorElement.performRebuild.processElement (package:flutter/src/widgets/sliver.dart:1147:35)
#39     Iterable.forEach (dart:core/iterable.dart:279:35)
#40     SliverMultiBoxAdaptorElement.performRebuild (package:flutter/src/widgets/sliver.dart:1191:24)
#41     SliverMultiBoxAdaptorElement.update (package:flutter/src/widgets/sliver.dart:1125:7)
#42     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#43     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#44     Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#45     ProxyElement.update (package:flutter/src/widgets/framework.dart:5020:5)
#46     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#47     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6202:14)
#48     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#49     RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:5700:32)
#50     MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6356:17)
#51     _ViewportElement.update (package:flutter/src/widgets/viewport.dart:228:11)
#52     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#53     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6202:14)
#54     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#55     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6202:14)
#56     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#57     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6202:14)
#58     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#59     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6202:14)
#60     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#61     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#62     StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4840:11)
#63     Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#64     StatefulElement.update (package:flutter/src/widgets/framework.dart:4872:5)
#65     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#66     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6202:14)
#67     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#68     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#69     Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#70     ProxyElement.update (package:flutter/src/widgets/framework.dart:5020:5)
#71     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#72     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6202:14)
#73     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#74     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6202:14)
#75     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#76     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6202:14)
#77     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#78     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6202:14)
#79     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#80     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#81     Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#82     StatelessElement.update (package:flutter/src/widgets/framework.dart:4746:5)
#83     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#84     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#85     StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4840:11)
#86     Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#87     StatefulElement.update (package:flutter/src/widgets/framework.dart:4872:5)
#88     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#89     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#90     StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4840:11)
#91     Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#92     StatefulElement.update (package:flutter/src/widgets/framework.dart:4872:5)
#93     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#94     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#95     Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#96     ProxyElement.update (package:flutter/src/widgets/framework.dart:5020:5)
#97     Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#98     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#99     Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#100    StatelessElement.update (package:flutter/src/widgets/framework.dart:4746:5)
#101    Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#102    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#103    Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#104    StatelessElement.update (package:flutter/src/widgets/framework.dart:4746:5)
#105    Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#106    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#107    Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#108    ProxyElement.update (package:flutter/src/widgets/framework.dart:5020:5)
#109    Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#110    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#111    Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#112    ProxyElement.update (package:flutter/src/widgets/framework.dart:5020:5)
#113    Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#114    RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:5700:32)
#115    MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6356:17)
#116    Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#117    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#118    StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4840:11)
#119    Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#120    StatefulElement.update (package:flutter/src/widgets/framework.dart:4872:5)
#121    Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#122    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#123    Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#124    ProxyElement.update (package:flutter/src/widgets/framework.dart:5020:5)
#125    Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#126    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#127    StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4840:11)
#128    Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#129    StatefulElement.update (package:flutter/src/widgets/framework.dart:4872:5)
#130    Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#131    SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6202:14)
#132    Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#133    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#134    Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#135    StatelessElement.update (package:flutter/src/widgets/framework.dart:4746:5)
#136    Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#137    SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6202:14)
#138    Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#139    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#140    StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4840:11)
#141    Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#142    StatefulElement.update (package:flutter/src/widgets/framework.dart:4872:5)
#143    Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#144    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#145    StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4840:11)
#146    Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#147    StatefulElement.update (package:flutter/src/widgets/framework.dart:4872:5)
#148    Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#149    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#150    Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#151    ProxyElement.update (package:flutter/src/widgets/framework.dart:5020:5)
#152    Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#153    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#154    Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#155    StatelessElement.update (package:flutter/src/widgets/framework.dart:4746:5)
#156    Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#157    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#158    StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4840:11)
#159    Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#160    StatefulElement.update (package:flutter/src/widgets/framework.dart:4872:5)
#161    Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#162    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#163    Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#164    ProxyElement.update (package:flutter/src/widgets/framework.dart:5020:5)
#165    Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#166    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#167    StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4840:11)
#168    Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#169    StatefulElement.update (package:flutter/src/widgets/framework.dart:4872:5)
#170    Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#171    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#172    Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#173    ProxyElement.update (package:flutter/src/widgets/framework.dart:5020:5)
#174    Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#175    SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6202:14)
#176    Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#177    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#178    Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#179    StatelessElement.update (package:flutter/src/widgets/framework.dart:4746:5)
#180    Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#181    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#182    StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4840:11)
#183    Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#184    BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2620:33)
#185    WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:882:21)
#186    RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:319:5)
#187    SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1143:15)
#188    SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1080:9)
#189    SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:996:5)
#193    _invoke (dart:ui/hooks.dart:166:10)
#194    PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:270:5)
#195    _drawFrame (dart:ui/hooks.dart:129:31)
(elided 3 frames from dart:async)

Also adding some comments below -

appBar: AppBar(
elevation: 0,
child: Scaffold(
key: _key,
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
key: _key,

bool success = await userProvider.addToFav(
product: widget.product);
if (success) {
_key.currentState.showSnackBar(
Copy link
Owner

Choose a reason for hiding this comment

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

Please use ScaffoldMessenger here, instead of _key.currentState

appProvider.changeIsLoading();
return;
} else {
_key.currentState.showSnackBar(SnackBar(
Copy link
Owner

Choose a reason for hiding this comment

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

Ditto!

});
},
),
// RaisedButton(
Copy link
Owner

Choose a reason for hiding this comment

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

Why this commented code? I think it can be removed

}

Widget detailsTile(String title, List<Widget> children) {
return ExpansionTile(
Copy link
Owner

Choose a reason for hiding this comment

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

Please don't use ExpansionTile, the content should always be visible.

@Saransh-cpp Saransh-cpp linked an issue Dec 30, 2021 that may be closed by this pull request
@Saransh-cpp Saransh-cpp added moderate Moderate level issue SWoC ui/ux Editing the UI/UX labels Dec 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
moderate Moderate level issue SWoC ui/ux Editing the UI/UX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Revamp the single product screen
2 participants