flutter_multi_formatter 1.1.6 copy "flutter_multi_formatter: ^1.1.6" to clipboard
flutter_multi_formatter: ^1.1.6 copied to clipboard

outdated

A package of formatters for international phone numbers, credit / debit cards and a masked formatter

example/lib/main.dart

import 'package:example/pages/credit_card_format_page.dart';
import 'package:example/pages/money_format_page.dart';
import 'package:example/pages/phone_format_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';


void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Multi formatter demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {

  void openPage(Widget page) {
    Navigator.of(context).push(CupertinoPageRoute(
      builder: (BuildContext context) {
        return page;
      }
    ));
  }


  @override
  Widget build(BuildContext context) {
    
    return Scaffold(
      appBar: AppBar(
        title: Text('Formatters Demo App'),
        centerTitle: true,
      ),
      body: Center(
        child: Padding(
          padding: const EdgeInsets.all(30.0),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Container(
                height: 50,
                child: RaisedButton(
                  textColor: Colors.white,
                  color: Colors.lightGreen,
                  onPressed: () {
                    openPage(PhoneFormatPage());
                  },
                  child: Row(
                    children: <Widget>[
                      Icon(Icons.phone),
                      Expanded(child: Center(child: Text('Phone Formatter Demo'))),
                    ],
                  ),
                ),
              ),
              SizedBox(
                height: 50.0,
              ),
              Container(
                height: 50,
                child: RaisedButton(
                  textColor: Colors.white,
                  color: Colors.lightBlue,
                  onPressed: () {
                    openPage(CreditCardFormatPage());
                  },
                  child: Row(
                    children: <Widget>[
                      Icon(Icons.credit_card),
                      Expanded(child: Center(child: Text('Credit Card Formatter Demo'))),
                    ],
                  ),
                ),
              ),
              SizedBox(
                height: 50.0,
              ),
              Container(
                height: 50,
                child: RaisedButton(
                  textColor: Colors.white,
                  color: Colors.orange,
                  onPressed: () {
                    openPage(MoneyFormatPage());
                  },
                  child: Row(
                    children: <Widget>[
                      Icon(Icons.attach_money),
                      Expanded(child: Center(child: Text('Money formatter'))),
                    ],
                  ),
                ),
              )
            ],
          ),
        ),
      ),
    );
  }
}
508
likes
0
pub points
98%
popularity

Publisher

verified publishersoftmaestri.com

A package of formatters for international phone numbers, credit / debit cards and a masked formatter

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_multi_formatter