Skip to content

About

This is a First basic Flutter App which i make for my practice that how the thing run inside in the flutter app.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

USD → INR Currency Converter

A small Flutter app I built to learn Flutter & Dart.

Flutter Dart UI Level


Preview

Screenshot of the currency converter app

Screenshot file: Screenshot 2026-11-29 at 1.08.38 AM.png


📌 At a glance

What it does Converts US dollars (USD) into Indian rupees (INR)
Exchange rate Fixed: 1 USD = 81.00 INR
Built with Flutter + Dart
UI style Cupertino (iOS-style), dark violet theme
Screens One screen: CurrencyConverter

✨ Features

  • ✅ Type a USD amount and tap Convert to INR
  • ✅ Result shown as ₹8,100.00 with thousands separators
  • ✅ Friendly errors for empty, invalid, or negative amounts
  • ✅ Clear amount button to reset everything
  • ✅ Press done on the keyboard to convert
  • ✅ Drag to dismiss the keyboard while scrolling

Example: 100 USD → tap convert → ₹8,100.00


🧠 How it works

Type amount  →  tap "Convert to INR"  →  parse + validate  →  amount × 81  →  show ₹ result
                                              ↓
                                     setState() rebuilds UI

📂 Project structure

my_first_app/
├── lib/
│   ├── main.dart              ← starts the app & sets the theme
│   └── currency_converter.dart ← the UI + conversion logic
├── pubspec.yaml               ← dependencies (flutter, cupertino_ui, http, ...)
├── test/
│   └── widget_test.dart
└── README.md                  ← this file 👋

🔍 The two files, explained

1️⃣ lib/main.dart — the entry point

What it does: starts the app and sets its look and feel.

  • main() calls runApp(const CurrencyApp())
  • CurrencyApp is a StatelessWidget — it just configures the app
  • Uses CupertinoApp instead of MaterialApp, with the debug banner hidden
  • CupertinoThemeData sets dark mode, lavender primary color (#C5A7FF), dark background (#100C1B), and default text color
  • home: CurrencyConverter() opens the converter screen

2️⃣ lib/currency_converter.dart — the screen

What it does: takes input, converts it, and shows the result.

  • CurrencyConverter is a StatefulWidget; its state holds:
    • _amountController → reads what you type
    • _result → the converted amount
    • _error → the message shown when input is invalid
  • _convert() parses text with double.tryParse, checks for invalid/negative values, multiplies by _rate, then calls setState()
  • _clear() resets the field and result
  • dispose() cleans up the controller to avoid a memory leak
  • Layout used: CupertinoPageScaffold, SafeArea, Stack, Positioned, Row, Column, Expanded, SingleChildScrollView, FittedBox
  • Widgets used: CupertinoTextField, CupertinoButton.filled, CupertinoButton, CupertinoIcons, Text
  • Styling used: BoxDecoration, LinearGradient, BorderRadius, BoxShadow, and translucent colors with Color.withValues(alpha: ...)
  • Formatting: toStringAsFixed(2) + RegExp.replaceAllMapped to add ₹ and digit grouping
  • Small private helper methods (_topBar, _converterCard, _currencyInput, _resultDisplay, and more) keep build() clean

📚 What I learned

Concept Where I used it
Widget tree main() → runApp() → CurrencyApp → CurrencyConverter
Stateless vs Stateful App setup is stateless; the converter changes state
Rebuilding the UI setState() after converting, clearing, or fixing an error
Text input TextEditingController, numeric keyboard, onSubmitted, onChanged
Validation double.tryParse, isFinite, negative-number check
Layout SafeArea, Stack, Row, Column, Expanded, SingleChildScrollView
Styling Gradients, borders, shadows, rounded corners, alpha colors
Dart basics const, final, nullable types (double?), private names (_), spread operator (...)
Formatting numbers toStringAsFixed(2) and RegExp.replaceAllMapped

▶️ Run it

flutter pub get
flutter run

Optional check:

flutter analyze

🚀 Ideas for later

  • 🌐 Fetch a live exchange rate using the http package (already in pubspec.yaml)
  • 💱 Add more currencies with a currency picker
  • 🧪 Add widget tests for convert, clear, and error cases

Made with Flutter ☁️ and lots of learning ☕

About

This is a First basic Flutter App which i make for my practice that how the thing run inside in the flutter app.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages