numeric_to_word 0.0.5 copy "numeric_to_word: ^0.0.5" to clipboard
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))
                    ]),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
1
likes
130
points
38
downloads

Publisher

unverified uploader

Weekly Downloads

Numeric to word for English Lao Thai Chinese Vietnamese

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface, web

More

Packages that depend on numeric_to_word