/flutter_dice_roller

A simple Flutter app that displays a dice and allows users to roll it by tapping a button.

Primary LanguageC++

Flutter Dice Roller

A simple Flutter app that displays a dice and allows users to roll it by tapping a button.

Features

  • Interactive dice rolling with random results (1-6)
  • Visual dice images that update based on roll results
  • Clean, minimal UI with styled button

Getting Started

Prerequisites

  • Flutter SDK installed
  • Dart SDK (comes with Flutter)

Running the App

flutter run

Building for Different Targets

Android APK:

flutter build apk

iOS:

flutter build ios

Web:

flutter build web --base-href /build/web/

Windows:

flutter build windows

macOS:

flutter build macos

Linux:

flutter build linux

Web Development & Deployment

Local Development

To test the web build locally:

  1. Build: flutter build web --base-href /build/web/
  2. Install Live Server extension in VS Code
  3. Right-click build/web/index.html → "Open with Live Server"

Deployment

After building, the web files are in build/web/. To deploy:

  1. Copy contents of build/web/ to your web server or GitHub Pages
  2. For GitHub Pages: commit the build/web/ contents to a gh-pages branch
  3. Enable GitHub Pages in repository settings

Project Structure

  • lib/main.dart - App entry point
  • lib/my_container.dart - Main container
  • lib/dice_roller.dart - Main dice rolling widget
  • assets/images/ - Dice image assets
  • build/web/ - Web build output (after flutter build web)

Web demo

Click here to Preview