amount_input

A new Flutter package project.

Getting Started

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Usage

// to make changes to the amount entered
AmountInput amountInput = new AmountInput();
                controller.text = await amountInput.inputAmout(
                    controllerText: controller.text,
                    onChangedString: str,
                    textEditingController: controller);
                    
//move the cursor to the right
amountInput.moveCursorToTheRight(controller);

Examples

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

  
  TextEditingController controller;

  @override
  initState() {
    super.initState();
    controller = new TextEditingController(text: "0.00");
    controller.selection = TextSelection.fromPosition(
        TextPosition(offset: controller.text.length));
  }

   TextFormField(
            cursorWidth: 0,
            keyboardType: TextInputType.number,
            controller: controller,
            onChanged: (str) async {
            controller.text = await _manageInputAmount(
                TextField(
              cursorWidth: 0,
              keyboardType: TextInputType.number,
              controller: controller,
              onChanged: (str) async {
                AmountInput amountInput = new AmountInput();
                controller.text = await amountInput.inputAmout(
                    controllerText: controller.text,
                    onChangedString: str,
                    textEditingController: controller);
                amountInput.moveCursorToTheRight(controller);
              },
            ),
            },
    ),

Libraries

amount_input