Skip to content
qutadPublic

About

Calculator written in Dart in the Material Design 3

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

M3Calc

M3Calc is a cross-platform calculator built with Flutter and Material Design 3

It includes a dark modern interface, circular buttons, live result preview, calculation history, and desktop window size control

Features

  • Material Design 3 UI
  • Dark calculator theme
  • Circular calculator buttons
  • Basic arithmetic operations
  • Live result preview
  • Calculation history
  • Persistent local storage
  • Desktop minimum window size
  • Responsive keypad layout
  • Cross-platform Flutter support

Supported Platforms

  • Android
  • iOS
  • macOS
  • Windows
  • Linux
  • Web

Project Structure

lib/
  main.dart
  app.dart

  core/
    theme/
      app_theme.dart
      colors.dart
    storage/
      history_storage.dart

  features/
    calculator/
      calculator_screen.dart
      calculator_controller.dart
      calculator_engine.dart
      widgets/
        calc_button.dart
        keypad.dart
        display.dart

Architecture

The app is separated into small responsibilities

main.dart

Starts Flutter and configures desktop window behavior.

app.dart

Contains the root MaterialApp.

core/theme

Contains global colors and Material 3 theme configuration.

core/storage

Contains local history storage logic.

features/calculator/calculator_engine.dart

Contains calculator math logic. This file is independent from Flutter UI code, so it can be tested separately.

features/calculator/calculator_controller.dart

Manages calculator state:

  • current expression
  • preview result
  • final result
  • button input
  • calculation history

features/calculator/calculator_screen.dart

Builds the main calculator page.

features/calculator/widgets

Contains reusable calculator UI widgets:

  • display
  • keypad
  • calculator button

Dependencies

dependencies: flutter: sdk: flutter

shared_preferences: ^2.3.2 window_manager: ^0.4.3

shared_preferences

Used to save calculator history locally.

window_manager

Used to configure desktop window size and minimum window size.

Getting Started

Check Flutter installation: flutter doctor Install dependencies: flutter pub get Run the app: flutter run Run static analysis: flutter analyze Run tests: flutter test

Desktop Window Configuration

Desktop window settings are configured in lib/main.dart. const windowOptions = WindowOptions( size: Size(420, 760), minimumSize: Size(420, 760), center: true, title: 'M3Calc', ); This keeps the calculator layout stable on desktop platforms.

Mobile Builds

Android and iOS use the application identifier io.github.qutad.m3calc. Both mobile targets are portrait-only for the current calculator layout.

For a local signed Android build, create android/key.properties:

storePassword=YOUR_KEYSTORE_PASSWORD
keyPassword=YOUR_KEY_PASSWORD
keyAlias=upload
storeFile=/absolute/path/to/m3calc-upload.jks

Then build the APK:

flutter build apk --release

The signed APK is written to build/app/outputs/flutter-apk/app-release.apk.

The mobile GitHub Actions workflow requires these repository secrets:

  • ANDROID_KEYSTORE_BASE64
  • ANDROID_KEYSTORE_PASSWORD
  • ANDROID_KEY_ALIAS
  • ANDROID_KEY_PASSWORD (optional when it matches the keystore password)
  • IOS_CERTIFICATE_BASE64
  • IOS_CERTIFICATE_PASSWORD
  • IOS_PROVISIONING_PROFILE_BASE64

The Android workflow supports JKS and PKCS #12 keystores. It validates the keystore password and alias separately before starting the Flutter build, then passes credentials directly to Gradle without writing passwords to a properties file. The original M3Calc key generation command used the alias upload.

Compare the local keystore with the safe size and SHA-256 values printed by CI:

wc -c < "$HOME/.android-keystores/m3calc-upload.jks"
shasum -a 256 "$HOME/.android-keystores/m3calc-upload.jks"

The iOS certificate must be an Apple Distribution certificate exported with its private key as a password-protected PKCS #12 file. The provisioning profile must be an Ad Hoc profile for io.github.qutad.m3calc and include each test device. The workflow reads the team and profile identifiers directly from the profile and uploads signed Android APK and iOS IPA artifacts.

Set the repository variable ENABLE_IOS_SIGNING to true only after all iOS signing secrets are configured. Until then, the workflow skips iOS and still builds Android successfully.

Calculator Engine Example

final engine = CalculatorEngine(); final result = engine.evaluate('16×(0.5+2.5)'); Expected result: 48

Design

The design is inspired by modern Material Design 3 calculator interfaces. Main visual style:

  • dark navy background
  • purple number buttons
  • blue action button
  • pink equals button
  • pink preview result
  • large readable display

License

MIT License

About

Calculator written in Dart in the Material Design 3

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages