cash_input_formatter 0.1.0+1 copy "cash_input_formatter: ^0.1.0+1" to clipboard
cash_input_formatter: ^0.1.0+1 copied to clipboard

outdated

Another cash formatter

example/main.dart

import 'package:cash_input_formatter/cash_input_formatter.dart';
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Cash Input Formatter Example',
      theme: ThemeData(
        primarySwatch: Colors.green,
      ),
      home: const MyHomePage(title: 'Cash Input Formatter Example'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  final String title;

  const MyHomePage({super.key, required this.title});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Padding(
          padding: const EdgeInsets.symmetric(horizontal: 20),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              const Align(
                alignment: Alignment.centerLeft,
                child: Text("With symbol:"),
              ),
              Padding(
                padding: const EdgeInsets.symmetric(vertical: 16.0),
                child: Column(
                  children: [
                    const Text("Enter amount here"),
                    Padding(
                      padding: const EdgeInsets.symmetric(
                        horizontal: 50,
                      ),
                      child: TextFormField(
                        textAlign: TextAlign.center,
                        inputFormatters: const [
                          CashInputFormatter(),
                        ],
                      ),
                    ),
                  ],
                ),
              ),
              const Padding(
                padding: EdgeInsets.symmetric(vertical: 40.0),
              ),
              const Align(
                  alignment: Alignment.centerLeft,
                  child: Text("Without symbol:")),
              Padding(
                padding: const EdgeInsets.symmetric(vertical: 16.0),
                child: Column(
                  children: [
                    const Text("Enter amount here"),
                    Padding(
                      padding: const EdgeInsets.symmetric(horizontal: 50),
                      child: TextFormField(
                        textAlign: TextAlign.center,
                        inputFormatters: const [
                          CashInputFormatter(useSymbol: false)
                        ],
                      ),
                    )
                  ],
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
3
likes
0
points
1
downloads

Publisher

unverified uploader

Weekly Downloads

Another cash formatter

Homepage

License

unknown (license)

Dependencies

cupertino_icons, flutter, intl

More

Packages that depend on cash_input_formatter