flutter_shopping/packages/flutter_shopping_cart
2024-06-26 15:18:10 +02:00
..
example feat: add flutter_shopping_cart package 2024-06-26 15:18:10 +02:00
lib feat: add flutter_shopping_cart package 2024-06-26 15:18:10 +02:00
.gitignore feat: add flutter_shopping_cart package 2024-06-26 15:18:10 +02:00
analysis_options.yaml feat: add flutter_shopping_cart package 2024-06-26 15:18:10 +02:00
CHANGELOG.md feat: add flutter_shopping_cart package 2024-06-26 15:18:10 +02:00
CONTRIBUTING.md feat: add flutter_shopping_cart package 2024-06-26 15:18:10 +02:00
LICENSE feat: add flutter_shopping_cart package 2024-06-26 15:18:10 +02:00
pubspec.yaml feat: add flutter_shopping_cart package 2024-06-26 15:18:10 +02:00
README.md feat: add flutter_shopping_cart package 2024-06-26 15:18:10 +02:00

flutter_shopping_cart

This component contains a shopping cart screen and the functionality for shopping carts that contain products.

Features

  • Shopping cart screen
  • Shopping cart products

Usage

First, create your own product by extending the Product class:

class ExampleProduct extends Product {
  ExampleProduct({
    requried super.id,
    required super.name,
    required super.price,
    required this.image,
    super.quantity,
  });

  final String image;
}

Next, you can create the ShoppingCartScreen widget like this:

var myProductService = ProductService<ExampleProduct>([]);

ShoppingCartScreen<ExampleProduct>(
    configuration: ShoppingCartConfig<ExampleProduct>(
        productService: myProductService,
        //
        productItemBuilder: (
            BuildContext context,
            Locale locale,
            ExampleProduct product,
        ) =>
            ListTile(
            title: Text(product.name),
            subtitle: Text(product.price.toString()),
        ),
        //
        onConfirmOrder: (List<ExampleProduct> products) {
            print("Placing order with products: $products");
        },
    ),
);

For a more detailed example you can see the example.

Or, you could run the example yourself:

git clone https://github.com/Iconica-Development/flutter_shopping_cart.git

cd flutter_shopping_cart

cd example

flutter run

Issues

Please file any issues, bugs or feature request as an issue on our GitHub page. Commercial support is available if you need help with integration with your app or services. You can contact us at support@iconica.nl.

Want to contribute

If you would like to contribute to the component (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our contribution guide and send us your pull request.

Author

This flutter_shopping_cart for Flutter is developed by Iconica. You can contact us at support@iconica.nl