numeric_to_word 0.0.5
numeric_to_word: ^0.0.5 copied to clipboard
Numeric to word for English Lao Thai Chinese Vietnamese
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:numeric_to_word/numeric_to_word.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final _controller = TextEditingController(text: '987654321');
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Numeric to Word Example'),
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextField(
controller: _controller,
onChanged: (value) {
setState(() {
// _controller.text = value;
});
},
keyboardType: TextInputType.number,
decoration:
const InputDecoration(label: Text('Input number'))),
SelectableText.rich(
TextSpan(
text: 'English: ',
style: const TextStyle(color: Colors.red),
children: [
TextSpan(
text:
NumericToWord.numericToEnglish(_controller.text),
style: const TextStyle(color: Colors.black))
]),
),
SelectableText.rich(
TextSpan(
text: 'Lao: ',
style: const TextStyle(color: Colors.blue),
children: [
TextSpan(
text: NumericToWord.numericToLao(_controller.text),
style: const TextStyle(color: Colors.black))
]),
),
SelectableText.rich(
TextSpan(
text: 'Chinese: ',
style: const TextStyle(color: Colors.orange),
children: [
TextSpan(
text:
NumericToWord.numericToChinese(_controller.text),
style: const TextStyle(color: Colors.black))
]),
),
SelectableText.rich(
TextSpan(
text: 'Vietnamese: ',
style: const TextStyle(color: Colors.green),
children: [
TextSpan(
text: NumericToWord.numericToVietnamese(
_controller.text),
style: const TextStyle(color: Colors.black))
]),
),
SelectableText.rich(
TextSpan(
text: 'Thai: ',
style: const TextStyle(color: Colors.purple),
children: [
TextSpan(
text: NumericToWord.numericToThai(_controller.text),
style: const TextStyle(color: Colors.black))
]),
),
],
),
),
),
);
}
}