A modern, feature-rich calculator app built with Flutter that provides basic arithmetic operations with a clean and intuitive user interface.
- Basic Arithmetic Operations: Addition (+), Subtraction (-), Multiplication (×), Division (÷)
- Advanced Functions:
- Percentage calculations (%)
- Decimal point support
- Double zero (00) input for faster entry
- User Interface:
- Clean, modern design with rounded buttons
- Real-time equation display
- Large, easy-to-read result display
- Responsive button layout
- Functionality:
- Clear all (AC) function
- Backspace (⌫) for correcting input
- Error handling for invalid expressions
- Fullscreen toggle mode
- History menu for viewing past calculations
The calculator features a clean interface with:
- Display area showing both the current equation and result
- Number pad with digits 0-9
- Operation buttons with distinctive orange styling
- Function buttons for clear, backspace, and percentage
- History feature to view past calculations
- Flutter SDK (3.7.2 or higher)
- Dart SDK
- Android Studio / VS Code with Flutter extensions
- An Android/iOS device or emulator
- Clone the repository:
git clone <repository-url>
cd calculator- Install dependencies:
flutter pub get- Run the app:
flutter run- flutter: The Flutter SDK
- math_expressions: ^2.4.0 - For parsing and evaluating mathematical expressions
- cupertino_icons: ^1.0.8 - iOS-style icons
- flutter_test: Flutter testing framework
- flutter_lints: ^5.0.0 - Recommended lints for Flutter projects
- Dart SDK: ^3.7.2
- Flutter: Compatible with Flutter 3.7.2+
calculator/
├── android/ # Android-specific files
├── ios/ # iOS-specific files
├── linux/ # Linux-specific files
├── windows/ # Windows-specific files
├── lib/ # Main Dart source code
│ ├── main.dart # Main application entry point
│ ├── buttons/
│ │ └── button.dart # Custom button widgets
│ └── history.dart # History page for viewing past calculations
├── test/ # Unit and widget tests
├── pubspec.yaml # Project dependencies and metadata
├── pubspec.lock # Locked dependency versions
├── analysis_options.yaml # Dart analysis configuration
├── .gitignore # Git ignore rules
└── README.md # Project documentation
This project uses a comprehensive .gitignore file to exclude:
build/- Flutter build outputs.dart_tool/- Dart tooling cache*.iml- IntelliJ module files- Generated plugin registrant files
.idea/- IntelliJ IDEA configuration.vscode/(optional) - VS Code configuration.DS_Store- macOS system files
- Android:
/android/app/debug,/android/app/profile,/android/app/release - iOS: DerivedData, Pods, xcuserdata, and other Xcode artifacts
- Windows/Linux: Generated plugin files
.packages- Package resolution cache.pub-cache/- Pub package cachepubspec.lockis tracked but build artifacts are ignored
.qodo/- Qodo AI assistant files.env*- Environment configuration files*.tmp,*.temp- Temporary files
- Contains the main calculator logic and UI
- Handles button press events and calculations
- Manages state for equation display and results
- Implements error handling for invalid expressions
CustomRawMaterialButton: Standard number buttonsCustomRawMaterialButton2: Operation buttons with orange stylingCustomRawMaterialButton3: Equals button with filled orange background
- Displays past calculations and allows users to recalculate previous entries
- Input Handling: Users tap buttons to input numbers and operations
- Expression Building: The app builds a mathematical expression string
- Real-time Display: Shows both the current equation and result
- Calculation: Uses the
math_expressionspackage to parse and evaluate expressions - Result Display: Shows the calculated result with proper decimal handling
- History Feature: Users can view and recalculate previous entries
- Converts the last entered number to its percentage equivalent
- Works with both standalone numbers and numbers in expressions
- Prevents multiple consecutive operators
- Handles decimal point input validation
- Supports continuing calculations with previous results
- Displays "Error" for invalid mathematical expressions
- Gracefully handles division by zero and other edge cases
flutter build apk --releaseflutter build ios --release- Fork the repository
- Create a feature branch (
git checkout -b feature/new-feature) - Commit your changes (
git commit -am 'Add new feature') - Push to the branch (
git push origin feature/new-feature) - Create a Pull Request
- Implement calculation history storage and display
- Add scientific calculator functions
- Theme customization options
- Memory functions (M+, M-, MR, MC)
- Keyboard input support
- Landscape mode optimization
This project is open source and available under the MIT License.
If you encounter any issues or have suggestions for improvements, please create an issue in the repository.
Built with ❤️ using Flutter By Ardawan M Amin