pretty_numbers

Creator: coderz1093

Last updated:

0 purchases

pretty_numbers Image
pretty_numbers Images
Add to Cart

Description:

pretty numbers

Pretty Numbers #
Pretty Numbers is a Flutter package that formats your numeric input fields beautifully, making them easy to read and visually appealing for your users.
Installation #
Add this to your package's pubspec.yaml file:
dependencies:
pretty_numbers: ^0.0.1
copied to clipboard
Simple Example #

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

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

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Pretty Numbers Example'),
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: ExampleForm(),
),
),
);
}
}

class ExampleForm extends StatefulWidget {
@override
_ExampleFormState createState() => _ExampleFormState();
}

class _ExampleFormState extends State<ExampleForm> {
final _controller = TextEditingController();
final _focusNode = FocusNode();

@override
void dispose() {
_controller.dispose();
_focusNode.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
return Column(
children: [
PrettyNumbers(
controller: _controller,
focusNode: _focusNode,
hintText: 'Enter amount',
suffixIcon: Icon(Icons.check_circle),
prefixIcon: Icon(Icons.attach_money),
),
],
);
}
}


copied to clipboard
Another Exciting Example #
import 'package:flutter/material.dart';
import 'package:pretty_numbers/pretty_numbers.dart';

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

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: ComplexExampleScreen(),
);
}
}

class ComplexExampleScreen extends StatefulWidget {
@override
_ComplexExampleScreenState createState() => _ComplexExampleScreenState();
}

class _ComplexExampleScreenState extends State<ComplexExampleScreen> {
final _numberController = TextEditingController();
final _otherFieldController = TextEditingController();
final _formKey = GlobalKey<FormState>();

@override
void dispose() {
_numberController.dispose();
_otherFieldController.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Exciting Pretty Numbers Example')),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Form(
key: _formKey,
child: Column(
children: [
PrettyNumbers(
controller: _numberController,
hintText: 'Enter a number',
prefixIcon: Icon(Icons.attach_money),
suffixIcon: Icon(Icons.check),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.green, width: 2.0),
borderRadius: BorderRadius.all(Radius.circular(8)),
),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.red, width: 2.0),
borderRadius: BorderRadius.all(Radius.circular(8)),
),
border: OutlineInputBorder(
borderSide: BorderSide(color: Colors.grey, width: 1.0),
borderRadius: BorderRadius.all(Radius.circular(8)),
),
hintStyle: TextStyle(color: Colors.grey, fontSize: 16),
),
SizedBox(height: 20),
TextFormField(
controller: _otherFieldController,
decoration: InputDecoration(
labelText: 'Another Field',
border: OutlineInputBorder(),
),
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter some text';
}
return null;
},
),
SizedBox(height: 20),
ElevatedButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
// Process data.
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Processing Data')),
);
}
},
child: Text('Submit'),
),
],
),
),
),
);
}
}


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.