Code Monkey home page Code Monkey logo

checkout_screen_ui's Introduction

A Widget representing a checkout screen that accepts native and credit card payments along with a button for cash payments if your system has 'in person' payments. This is a UI only widget and is meant to compliment whatever third party transaction api system you are using.

Includes a CreditCardForm widget that allows you to utilize only the credit card form without the rest of the checkout screen if desired.

A gif demonstrating the radio group in action.

Installation

In the pubspec.yaml of your flutter project, add the following dependency:

checkout_screen_ui: ^1.0.1

Import it to each file you use it in:

import 'package:checkout_screen_ui/checkout_page.dart';

Usage

Example 1

This example is a very basic checkout page.

/// Build a list of what the user is buying
final List<PriceItem> _priceItems = [
    PriceItem(name: 'Product A', quantity: 1, totalPriceCents: 5200),
    PriceItem(name: 'Product B', quantity: 2, totalPriceCents: 8599),
    PriceItem(name: 'Product C', quantity: 1, totalPriceCents: 2499),
    PriceItem(name: 'Delivery Charge', quantity: 1, totalPriceCents: 1599, canEditQuantity: false),
];

// build the checkout ui
CheckoutPage(
    priceItems: _priceItems,
    taxRate: 0.07, // 7% tax rate
    payToName: 'Vendor Name Here',
    displayNativePay: true,
    onNativePay: (checkoutResults) => print('Native Pay Clicked'),
    isApple: Platform.isIOS,
    onCardPay: (paymentInfo, checkoutResults){
        // add your own logic to handle the payment

        // paymentInfo: contains information related to the card being used

        // checkoutResults: contains the final list of items and costs the user expects to pay.
        // NOTE: the user has the ability to change the quantity of items in the checkout screen
        // so the final list of items and costs may differ from the original list of items and costs
        // you provided to the checkout screen. MAKE SURE to handle this in your payment logic.
    } ,
    onBack: ()=> Navigator.of(context).pop(),
);

Additional information

If a feature is missing (the Dart language is always evolving) or you'd like an easier or better way to do something, consider opening a pull request. You can always file an issue, but generally speaking feature requests will be on a best-effort basis.

checkout_screen_ui's People

Contributors

officialflutterbutter avatar

Stargazers

 avatar Ghassen Ben Zahra avatar Marcos Maliki avatar Andres Garcia avatar Dickson Neoh avatar

Watchers

James Cloos avatar  avatar

checkout_screen_ui's Issues

Multiply _priceCents with quantity .

you are not multiplying _priceCents with item.qantity . if a item has quantity more than one , then it would be added to total amount . so please just change one line in your checkout screen.
int _priceCents = 0;
for (var item in priceItems) {
_priceCents += item.totalPriceCents * item.quantity;
}
do like this.

Typo

Hi, typo issue in the readme file

In the pubspec.yaml of your flutter project, add the following dependency:

checkout_ui_screen: ^1.0.0


should be checkout_screen_ui: ^1.0.1

appreciate the amazing work

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.