Flutter Smart Converter ๐
A highly professional, elegant, and ready-to-use unit converter package for Flutter.
Provides lightning-fast logic for multi-category unit conversions combined with
Beautiful, Glass-morphism inspired UI Cards that are drop-in ready for your apps!
โจ Features at a Glance
- ๐งฎ Logical Conversions: Accurately converts metric and imperial scales with deep precision.
- ๐ Length Units:
Meter,Kilometer,Centimeter,Millimeter,Mile,Yard,Foot,Inch. - โ๏ธ Weight Units:
Gram,Kilogram,Milligram,Pound,Ounce. - ๐ก๏ธ Temperature Units:
Celsius,Fahrenheit,Kelvin. (NEW) - ๐ Area Units:
Square Meter,Square Kilometer,Acre,Hectare, etc. (NEW) - ๐จ Professional UI Widgets: Built-in
ConverterCardwidget to beautifully display results.
๐ Installation
Add this block to your pubspec.yaml file:
dependencies:
flutter_smart_converter: ^0.1.2
Then run the command to fetch the package:
flutter pub get
โก๏ธ Basic Usage (Logic Only)
You can directly process unit conversions anywhere in your controllers, services, or logical layers without needing our UI. It's strictly typed and lightning-fast!
import 'package:flutter_smart_converter/flutter_smart_converter.dart';
void main() {
// ๐ Length Conversion
double meters = LengthConverter.convert(15, LengthUnit.kilometer, LengthUnit.meter);
print('15 km = $meters m');
// โ๏ธ Weight Conversion
double kg = WeightConverter.convert(55, WeightUnit.pound, WeightUnit.kilogram);
print('55 lbs = $kg kg');
// ๐ก๏ธ Temperature Conversion
double temp = TemperatureConverter.convert(98.6, TemperatureUnit.fahrenheit, TemperatureUnit.celsius);
print('98.6ยฐF = $tempยฐC');
}
๐จ Applying Professional UI Widgets
Don't want to design conversion result cards from scratch? We provide a beautiful built-in component ConverterCard() that wraps the results into an aesthetic UI natively inside Flutter.
Simply drop the ConverterCard inside your columns, lists, or paddings!
import 'package:flutter/material.dart';
import 'package:flutter_smart_converter/flutter_smart_converter.dart';
class MyConverterScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Smart Converter View')),
body: SingleChildScrollView(
padding: const EdgeInsets.all(20),
child: Column(
children: [
// Example 1: Length Card
ConverterCard(
title: 'Distance Walked (10 km to Miles)',
result: '${LengthConverter.convert(10, LengthUnit.kilometer, LengthUnit.mile).toStringAsFixed(2)} mi',
icon: Icons.directions_walk,
color: Colors.blue, // Easily change the theme!
),
// Example 2: Temperature Card
ConverterCard(
title: 'Current Room Temp (F to C)',
result: '${TemperatureConverter.convert(98.6, TemperatureUnit.fahrenheit, TemperatureUnit.celsius).toStringAsFixed(1)} ยฐC',
icon: Icons.thermostat_outlined,
color: Colors.orange, // Matches any app aesthetic
),
],
),
),
);
}
}
๐งโ๐ป Additional Parameters for ConverterCard
You can deeply customize the component to match your app's specific aesthetic constraints.
| Property | Type | Default | Description |
|---|---|---|---|
title |
String |
Required | The small heading to represent context. |
result |
String |
Required | The bold calculated main string. |
icon |
IconData |
Required | Icon to display natively in the leading edge. |
color |
Color |
Colors.blueAccent |
Master color tone. Automatically controls shadows and glow! |
๐ค Contribution & Issues
Loved the package? We'd be incredibly happy to receive Pull Requests or feature requests!
If you find any issues, please submit an issue on our GitHub repository.
Designed & Maintained by Mahmudul Hasan