Coder Social home page Coder Social logo

rohan20 / flutter-products-tutorial Goto Github PK

View Code? Open in Web Editor NEW
129.0 9.0 84.0 182 KB

A Flutter e-commerce starter kit built using ScopedModel

Home Page: https://fluttermarket.com/view/flutter-e-commerce-backend

Kotlin 1.37% Swift 1.60% Objective-C 0.15% Dart 96.89%
flutter dart google cross-platform android ios scoped-model

flutter-products-tutorial's Introduction

Flutter E-Commerce App

A Flutter e-commerce starter kit built using ScopedModel for state management that allows you to view a list of paginated products and its details. Originally built by the Flutter team at GeekyAnts.

You can checkout the complete starter kit on Flutter Market: Link

Medium tutorial: Link

Docs for Admin dashboard: Link

Setup

You need to add a remote_config.dart file in the lib>util directory as follows:

class RemoteConfig {
  static final Map<dynamic, String> config = {
    "AuthorizationToken":
        "YOUR_API_KEY",
    "BASE_URL": "www.BASE_URL.com",
    "BASE_PRODUCTS_URL": "/BASE_PRODUCTS_URL/products/categoryId=1",
  };
}

flutter-products-tutorial's People

Contributors

rohan20 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flutter-products-tutorial's Issues

Showing only an even number of products and no products if exist only one or an odd number of products.

Hi @rohan20 , very useful repo about the above use case.

I’m using a similar use case only a brief change on products_list_page if I'm not wrong.
The current condition will show only an even number of products but if the category have only one product or an odd number of products like 9,11 ect… will lose one product.

I’ve add the following conditions as a workaround in order to show all products inside the condition else if (index % 2 == 0).

} else if (index % 2 == 0) {


  // if we have odd number of products 7,9,11 ect show the last one
  if (index == model.getProductsCount() - 1) {
    return ProductsListItem(
      product1: model.productsList[index],
      product2: null,
    );

  // if we have only one product
  } else if ( model.getProductsCount() == 1) {
    return ProductsListItem(
      product1: model.productsList[0],
      product2: null,
    );
  } else {
    //2nd, 4th, 6th.. index would contain nothing since this would
    //be handled by the odd indexes where the row contains 2 items
    return Container();
  }

}

Thanks for sharing the repo! :)

remote_config.dart

i can't able to see the remote_config.dart in the lib of util folder

and when added using the code mentioned in the page getting with error at
Future _getProductsByCategory(categoryId, pageIndex) async {
var response = await http.get(
RemoteConfig.config["BASE_URL"] +" "+
RemoteConfig.config["BASE_PRODUCTS_URL"] + " " +
"&category=$categoryId&per_page=6&page=$pageIndex",

on product_scoped_model.dart file
please help with this.

Misconfiguration

remote_config.dart file not responding due

"BASE_PRODUCTS_URL": "/BASE_PRODUCTS_URL/products/categoryId=1"

error message {"code":"rest_no_route","message":"No route was found matching the URL and request method","data":{"status":404}}

As per API documentation tried "BASE_PRODUCTS_URL": "/wp-json/wc/v3/products"

Got a response but the display changed from continuously revolving to "No product available"

Can anybody give the correct code or correct method

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.