digit_to_persian_word 1.0.5

  • Readme
  • Changelog
  • Example
  • Installing
  • 68

digit_to_persian_word #

The Flutter package for changing digit to the Persian word and add separate to an integer

demo:

Add dependency #

dependencies:
  digit_to_persian_word: ^1.0.5

Usage #

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


void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
      debugShowCheckedModeBanner: false,
    );
  }
}

class MyHomePage extends StatelessWidget {
  
  @override
  Widget build(BuildContext context) {

    return Scaffold(
      appBar: AppBar(
        title: Text("Flutter Digit To Persian Word'"),
      ),
      body: Column(
        crossAxisAlignment: CrossAxisAlignment.end,
        children: <Widget>[
          //تبدیل رقم به حروف بدون تبدیل اعداد
          Text(DigitToWord.toWord("123456",StrType.NumWord,isMoney: true)),// 123 هزارو 456 تومان
          //)تبدیل عدد به حروف همراه با تبدیل اعداد
          Text(DigitToWord.toWord("123456",StrType.StrWord),),//صد و بیست و سه هزارو چهارصدو پنجاه و شش
          //تبدیل رقم به حروف 
          Text(DigitToWord.toWord("123.456",StrType.NumWord,isMoney: true,separator: ".")),// 123 هزارو 456 تومان
          //جدا سازی سه رقمی اعداد به صورت معمول
          Text(DigitFormat.convert("123456",separator: ","),),//123,456
          //به جدا سازی سه رقمی اعداد به صورت (TextInputFormatter)
          TextFormField(inputFormatters: [DigitInputFormat()]),
        ],
      ),
    );
  }
}

example #

example

An example showing how to use

[1.0.5] - 27-Dec-2019 #


  • change image of demo

[1.0.4] - 27-Dec-2019 #


  • fix bug DigitToWord and add new feature
  • add DigitFormat
  • add DigitInputFormat

[1.0.3] - 23-Dec-2019 #


  • fix image demo issues

[1.0.2] - 23-Dec-2019 #


  • add image of demo

[1.0.1] - 23-Dec-2019 #


  • fix link in README.md

[1.0.0] - 23-Dec-2019 #


  • fix analysis issues

[0.0.1] - 23-Dec-2019 #


  • changing digit to the Persian word

example/lib/main.dart

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


void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(

        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Digit To Persian Word'),
      debugShowCheckedModeBanner: false,
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  TextEditingController _controller;
  TextEditingController _controllerInputFromat;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    _controller = new TextEditingController();
    _controllerInputFromat = new TextEditingController();
  }


  @override
  Widget build(BuildContext context) {

    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: SingleChildScrollView(
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.end,
          children: <Widget>[
            Padding(
              padding: const EdgeInsets.symmetric(horizontal: 8,vertical: 12),
              child: TextFormField(
                keyboardType: TextInputType.number,
                controller: _controller,
                textAlign: TextAlign.center,
                style: TextStyle(
                    fontWeight: FontWeight.bold,
                    fontSize: 18,
                    fontFamily: "Vazir"
                ),
                onChanged: (str)=>setState(() {}),
                decoration: new InputDecoration(
                  contentPadding: const EdgeInsets.only(
                      top: 10, right: 5, bottom: 10, left: 5),
                  enabledBorder: OutlineInputBorder(
                      borderSide: BorderSide(color: Colors.grey, width: 2)),
                  border: OutlineInputBorder(
                      borderSide: BorderSide(color: Colors.redAccent, width: 2)),
                  errorStyle: TextStyle(color: Colors.redAccent),
                ),
              ),
            ),
            Padding(
              padding: const EdgeInsets.symmetric(vertical: 8,horizontal: 8),
              child: Text("قابلیتهای پکیج:",
                textDirection: TextDirection.rtl,
                style: TextStyle(
                    fontWeight: FontWeight.bold,
                    fontSize: 14,
                    fontFamily: "Vazir"
                ),
              ),
            ),
            Padding(
              padding: const EdgeInsets.symmetric(vertical: 8,horizontal: 8),
              child: Text("1.تبدیل رقم به حروف (بدون تبدیل اعداد):",
                textDirection: TextDirection.rtl,
                style: TextStyle(
                    fontWeight: FontWeight.bold,
                    fontSize: 14,
                    fontFamily: "Vazir"
                ),
              ),
            ),
            Padding(
              padding: const EdgeInsets.symmetric(vertical: 4,horizontal: 8),
              child: Text(DigitToWord.toWord(_controller.value.text,StrType.NumWord,isMoney: true,separator: "."),
                textDirection: TextDirection.rtl,
                style: TextStyle(
                    fontWeight: FontWeight.bold,
                    fontSize: 18,
                    fontFamily: "Vazir"
                ),
              ),
            ),
            Padding(
              padding: const EdgeInsets.symmetric(vertical: 8,horizontal: 8),
              child: Text("2.تبدیل رقم به حروف (همراه با تبدیل اعداد):",
                textDirection: TextDirection.rtl,
                style: TextStyle(
                    fontWeight: FontWeight.bold,
                    fontSize: 14,
                    fontFamily: "Vazir"
                ),
              ),
            ),
            Padding(
              padding: const EdgeInsets.symmetric(vertical: 4,horizontal: 8),
              child: Text(DigitToWord.toWord(_controller.value.text,StrType.StrWord),
                textDirection: TextDirection.rtl,
                style: TextStyle(
                    fontWeight: FontWeight.bold,
                    fontSize: 18,
                    fontFamily: "Vazir"
                ),
              ),
            ),
            Padding(
              padding: const EdgeInsets.symmetric(vertical: 8,horizontal: 8),
              child: Text("3.جداسازی سه رقمی اعداد به صورت معمول:",
                textDirection: TextDirection.rtl,
                style: TextStyle(
                    fontWeight: FontWeight.bold,
                    fontSize: 14,
                    fontFamily: "Vazir"
                ),
              ),
            ),
            Padding(
              padding: const EdgeInsets.symmetric(vertical: 4,horizontal: 8),
              child: Text(DigitFormat.convert(_controller.value.text),
                textDirection: TextDirection.rtl,
                style: TextStyle(
                    fontWeight: FontWeight.bold,
                    fontSize: 18,
                    fontFamily: "Vazir"
                ),
              ),
            ),
            Padding(
              padding: const EdgeInsets.symmetric(vertical: 8,horizontal: 8),
              child: Text("4.جداسازی سه رقمی اعداد به صورت (TextInputFormatter):",
                textDirection: TextDirection.rtl,
                style: TextStyle(
                    fontWeight: FontWeight.bold,
                    fontSize: 14,
                    fontFamily: "Vazir"
                ),
              ),
            ),
            Padding(
              padding: const EdgeInsets.symmetric(horizontal: 8,vertical: 12),
              child: TextFormField(
                keyboardType: TextInputType.number,
                controller: _controllerInputFromat,
                textAlign: TextAlign.center,
                inputFormatters: [DigitInputFormat()],
                style: TextStyle(
                    fontWeight: FontWeight.bold,
                    fontSize: 18,
                    fontFamily: "Vazir"
                ),
                onChanged: (str)=>setState(() {}),
                decoration: new InputDecoration(
                  contentPadding: const EdgeInsets.only(
                      top: 10, right: 5, bottom: 10, left: 5),
                  enabledBorder: OutlineInputBorder(
                      borderSide: BorderSide(color: Colors.grey, width: 2)),
                  border: OutlineInputBorder(
                      borderSide: BorderSide(color: Colors.redAccent, width: 2)),
                  errorStyle: TextStyle(color: Colors.redAccent),
                ),
              ),
            ),

          ],
        ),
      ),

    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  digit_to_persian_word: ^1.0.5

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:digit_to_persian_word/digit_to_persian_word.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
36
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
68
Learn more about scoring.

We analyzed this package on Apr 7, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health suggestions

Format lib/digit_to_persian_word.dart.

Run flutter format to format lib/digit_to_persian_word.dart.

Format lib/src/DigitInputFormat.dart.

Run flutter format to format lib/src/DigitInputFormat.dart.

Format lib/src/DigitToWord.dart.

Run flutter format to format lib/src/DigitToWord.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test