Skip to main content

flutter_smart_converter 0.1.1 copy "flutter_smart_converter: ^0.1.1" to clipboard
flutter_smart_converter: ^0.1.1 copied to clipboard

A beautiful and easy-to-use unit converter package for Flutter. Supports length, weight, temperature, and area conversions. Provides beautiful UI widgets natively.

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!

Pub Version Flutter Badge Open Source License


โœจ 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 ConverterCard widget to beautifully display results.

๐Ÿ›  Installation #

Add this block to your pubspec.yaml file:

dependencies:
  flutter_smart_converter: ^0.1.0

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

0
likes
135
points
58
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A beautiful and easy-to-use unit converter package for Flutter. Supports length, weight, temperature, and area conversions. Provides beautiful UI widgets natively.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_smart_converter