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.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:flutter_smart_converter/flutter_smart_converter.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Smart Converter Demo',
theme: ThemeData(primarySwatch: Colors.blue),
home: Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
title: const Text('Smart Converter Example'),
elevation: 0,
),
body: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// Length Converter Usage
ConverterCard(
title: '15 Kilometers to Meters',
result:
'${LengthConverter.convert(15, LengthUnit.kilometer, LengthUnit.meter)} m',
icon: Icons.straighten,
color: Colors.deepPurple,
),
// Weight Converter Usage
ConverterCard(
title: '55 Pounds to Kilograms',
result:
'${WeightConverter.convert(55, WeightUnit.pound, WeightUnit.kilogram).toStringAsFixed(2)} kg',
icon: Icons.monitor_weight_outlined,
color: Colors.teal,
),
],
),
),
),
);
}
}