flutter_smart_converter 0.0.1
flutter_smart_converter: ^0.0.1 copied to clipboard
A beautiful and easy-to-use unit converter package for Flutter. Supports length, weight, and provides beautiful UI widgets natively.
Flutter Smart Converter 🚀 #
A highly professional, elegant, and ready-to-use unit converter package for Flutter. This package provides logic for unit conversions (Length & Weight) along with Beautiful, Glass-morphism inspired UI Cards that are ready to be integrated directly into your Flutter apps!
✨ Features #
- Logical Conversions: Accurately converts between metric and imperial scales.
- Length Units:
meter,kilometer,centimeter,millimeter,mile,yard,foot,inch. - Weight Units:
gram,kilogram,milligram,pound,ounce. - Professional UI Widgets: Built-in
ConverterCardwidget to beautifully display results with customized shadows, colors, and iconography.
🛠 Installation #
Add this block to your pubspec.yaml file:
dependencies:
flutter_smart_converter: ^0.0.1
Then run:
flutter pub get
⚡️ Basic Usage (Logic Only) #
You can directly parse unit conversions anywhere in your controllers or logic blocks down to extreme decimals without needing our UI.
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 is $meters meters'); // Output: 15 km is 15000.0 meters
// Weight Conversion ⚖️
double kg = WeightConverter.convert(55, WeightUnit.pound, WeightUnit.kilogram);
print('55 lbs is $kg kg'); // Output: 55 lbs is 24.947580649791002 kg
}
🎨 Applying Professional UI Widgets #
We provide a beautiful built in component ConverterCard() that wraps everything into an aesthetic container 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: Padding(
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: Weight Card
ConverterCard(
title: 'Parcel Weight (5 lbs to Kg)',
result: '${WeightConverter.convert(5, WeightUnit.pound, WeightUnit.kilogram).toStringAsFixed(2)} kg',
icon: Icons.shopping_bag,
color: Colors.deepOrange, // Matches any app aesthetic
),
],
),
),
);
}
}
🧑💻 Additional Parameters for ConverterCard #
| Property | Type | Description |
|---|---|---|
title |
String |
The small heading to represent context. |
result |
String |
The bold calculated main string. |
icon |
IconData |
Icon to display natively in the leading edge. |
color |
Color |
Master color tone. This automatically adjusts opacity and creates a glowing gradient style shadow! |
🤝 Contribution & Issues #
Designed by [Mahmudul Hasan]. We'd be happy to receive Pull Requests! If you find any issues, please submit an issue on our GitHub repository.