cash_field

Creator: coderz1093

Last updated:

0 purchases

cash_field Image
cash_field Images

Languages

Categories

Add to Cart

Description:

cash field

Cash Field #
A package that aims to help you handling cash value input with addDigit and removeDigit. It's also part of a blog series on my personal blog about how to create and publish pub.dev packages. See more on my website.
Getting started #
Install cash_field with pub using
flutter pub add cash_field
copied to clipboard
or just add to your pubspec.yaml
dependencies:
cash_field: ^0.0.1
copied to clipboard
Usage #
void main() {
// Create a controller
final controller = CashFieldController();

// Add a digit when the user taps a number button
controller.addDigit(1);

// Remove a digit when the user taps the backspace button
controller.removeDigit();

// Get the current value
final value = controller.state.value;

// Get the current value as a double
final valueAsDouble = controller.state.valueAsDouble;

// Get the current value as a string
final valueAsString = controller.state.display;

// Get the current decimal digits
final decimalDigits = controller.state.decimalDigits;

// Get the current symbol
final symbol = controller.state.symbol;

// Update the value when the user taps the clear button
controller.updateValue(0);

// Print the current state
print(
'value: $value, valueAsDouble: $valueAsDouble, valueAsString: $valueAsString, decimalDigits: $decimalDigits, symbol: $symbol',
);
}
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.