bangla_converter 0.0.2 bangla_converter: ^0.0.2 copied to clipboard
Flutter package for convert Bangla Number to English Number or vice versa.
import 'package:flutter/material.dart';
///import [bangla_converter] package
import 'package:bangla_converter/bangla_converter.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Bangla Convertor',
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
String banglaPhoneNumber = "০১৭৩৩-৪৫২XXX";
String englishPhoneNumber = "01733-452XXX";
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: const Text('Flutter Bangla Converter Page'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'Bangla To English Converter',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
Text(
"Input: $banglaPhoneNumber",
),
Text(
"Output: ${BanglaConverter.banToEng(banglaPhoneNumber)}",
),
const SizedBox(height: 10),
const Text(
'English To Bangla Converter',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
Text(
"Input: $englishPhoneNumber",
),
Text(
"Output: ${BanglaConverter.engToBan(englishPhoneNumber)}",
),
const SizedBox(height: 10),
const Text(
'You have pushed the button this\nmany times in Bangla Language:',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
Text(
BanglaConverter.engToBan('$_counter'),
style: Theme.of(context).textTheme.headlineMedium,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}