credit_card_input_form 1.2.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 82

This package provides visually beautiful UX through animation of credit card information input form.

Preview #

Installing #

  1. Add dependency to pubspec.yaml

    Get the latest version in the 'Installing' tab on pub.dartlang.org

dependencies:
    credit_card_input_form: ^1.2.0
  1. Import the package
import 'package:credit_card_input_form/credit_card_input_form.dart';
  1. Adding CreditCardInputForm

With optional parameters

 CreditCardInputForm(
   cardHeight: 170,
   frontCardColor: Colors.red,
   backCardColor: Colors.blueAccent,
   showResetButton : true,
   onStateChange: (currentState, cardInfo) {
     print(currentState);
     print(cardInfo);
   },
   customCaptions: {...}  // translate and customize captions (see Example)
),

How to use #

Check out the example app in the example directory or the 'Example' tab on pub.dartlang.org for a more complete example.

3rd party library #

Flip card #

https://pub.dev/packages/flip_card

For use card flip animation

Provider #

https://pub.dev/packages/provider

For use state management

Reference #

This package's animation is inspired from from this Dribbble art

TODO List #

  • [x] add RESET button

1.0.0 #

  • First Release

1.0.1 #

  • Adjust flutter format

1.0.2 #

  • update lastest provider library

1.0.3 #

  • update README

1.0.4 #

  • update README
    • change homepage

1.0.5 #

  • Fixed isssue when calling setState () with onStateChange () callback

1.1.0 #

  • Add RESETbutton

1.1.1 #

  • update README

1.2.0 #

  • added custom captions feature

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:credit_card_input_form/credit_card_input_form.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  // translate and customize captions
  final Map<String, String> customCaptions = {
    'PREV': 'Prev',
    'NEXT': 'Next',
    'DONE': 'Done',
    'CARD_NUMBER': 'Card Number',
    'CARDHOLDER_NAME': 'Cardholder Name',
    'VALID_THRU': 'Valid Thru',
    'SECURITY_CODE_CVC': 'Security Code (CVC)',
    'NAME_SURNAME': 'Name Surname',
    'MM_YY': 'MM/YY',
    'RESET': 'Reset',
  };

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: SafeArea(
          child: AnimatedContainer(
            duration: Duration(milliseconds: 300),
            // color: currentColor,
            child: Stack(children: [
              CreditCardInputForm(
                showResetButton: true,
                onStateChange: (currentState, cardInfo) {
                  print(currentState);
                  print(cardInfo);
                },
                customCaptions: customCaptions,
              ),
            ]),
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  credit_card_input_form: ^1.2.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:credit_card_input_form/credit_card_input_form.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
63
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
82
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because:

  • package:credit_card_input_form/credit_card_input_form.dart that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because:

  • package:credit_card_input_form/credit_card_input_form.dart that declares support for platforms: android, ios

Package does not support Flutter platform web

Because:

  • package:credit_card_input_form/credit_card_input_form.dart that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because:

  • package:credit_card_input_form/credit_card_input_form.dart that declares support for platforms: android, ios

Package not compatible with SDK dart

Because:

  • credit_card_input_form that is a package requiring null.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
cupertino_icons ^0.1.2 0.1.3
flip_card ^0.4.4 0.4.4
flutter 0.0.0
provider ^4.1.2 4.3.1
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
nested 0.0.4
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test