Git Product home page Git Product logo

interview_task's Introduction

interview_task

Ventrata interview task by Melvin Salas

Getting Started

To run the application correctly, it is recommended to execute it by command or using VSCode in the following way:

  • Command shell
$ flutter clean
$ flutter pub get
$ flutter run -d chrome --web-renderer html
  • VSCode The .vscode/launch.json file contains the necessary commands for execution under the launch request. So you can use Run & Debug button.

Functionalities:

  1. Authentication Flow:
    • Implement a simple authentication flow with a login page (no registration page needed).
    • Authenticate via a free api - e.g. https://dummyjson.com/docs/auth (or other if you prefer) - and store the auth token for later.
    • Upon successful authentication, navigate the user to a home page where you show the user data with a logout button.
    • On a home page refresh the user data every 10 seconds by calling https://dummyjson.com/auth/me. (Refresh it only when the profile is visible!)
    • If the auth token expires during any api request simply navigate to the login page. (no need to handle redirect after login)
    • Automatically log in if the app is started while an auth token is available and not expired.
    • Restrict navigation to all pages when there’s no auth token. Simply navigate to the login page.
  2. Dynamic products view:
    • Add bottom navigation to the home page - containing “Profile” and “Products” options. (This part is the “Products” option. Move the user details to the “Profile” option.)
    • Request products from https://dummyjson.com/docs/auth/products every 30 seconds, but each time generate a random skip value for the request (total=100. limit=10. randomize only skip=<0;90>). Refresh only when the Products are visible!
    • Add 2 additional fields to the product scheme besides the ones in the api response:
      • refreshed - number of times this product was downloaded. int type (default to 1).
      • amount - number of times this product will be bought. int type (default to 0)
    • When you get new data add them to the ones you already have stored. If it’s a product you didn’t have before, simply add it. If it’s a product that you already had, increment it’s refreshed value by +1 and then override the old one.
    • Show products (also the refreshed and amount fields) in a table and automatically update it based on the stored data. Don’t use StatefulWidget’s setState() for this!
    • When you tap on any product show it’s details in a dialog with +, - buttons that modify it’s amount value, Save button that updates the product and Remove button that sets amount=0. (both “Save” and “Remove” buttons close the dialog)
  3. Nested Navigator (BONUS):
    • Use imperative navigation (= older pre-Router navigation) in this new section only!
    • Add a 3th option - Sale - to the bottom navigation on the home page.
    • First page here is a shopping cart page where you show a list of all products that have amount>0 (just a simple 2x Product name for each is fine) or just Empty if no product is selected and a Checkout button at the bottom.
      • When you tap on any product use the same dialog as in Requirement #2, but don’t forget you use the imperative navigation in this section.
      • When you press the Checkout button navigate to a payment page.
    • On the payment page show a Pay button in the centre and “back” button in top left.
      • When you press the Pay button navigate to a success page.
    • On the success simply show Sale successful and navigate back to the shopping cart page after 5 seconds. Don’t show back button here.
      • set amount=0 on all products as well, so when you get back the cart is empty.

interview_task's People

Contributors

melvinsalas avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.