Skip to content

Flutter App Setup Guide ​

Welcome to the Smarty mobile application documentation. This guide will help you set up, customize, and build the Flutter app for Android and iOS.

INFO

Prerequisites: Ensure you have Flutter SDK installed (version >= 3.0.0) and an IDE like VS Code or Android Studio.


1. Project Setup ​

Follow these steps to initialize the project:

  1. Unzip the smarty_app source code.
  2. Open the project folder in your IDE (VS Code or Android Studio).
  3. Open a terminal in the project root and run:
    bash
    flutter pub get

Running the App ​

To run the app on a connected device or emulator:

  1. Connect your Android device (enable USB Debugging) or start an iOS Simulator / Android Emulator.
  2. Run:
    bash
    flutter run

TIP

You can also press F5 in VS Code or click the Run button in Android Studio.


2. API Configuration ​

Connect the app to your backend server.

  1. Navigate to lib/config/app_config.dart.
  2. Update the baseUrl variable with your backend URL.
dart
// lib/config/app_config.dart

class AppConfig {
  // Replace with your actual domain
  static const String baseUrl = 'https://yourdomain.com'; 
  ...
}

WARNING

Ensure your backend is running and accessible via HTTPS.


3. AI Chat Configuration ​

The app includes an intelligent AI Assistant powered by Google Gemini.

1. Admin Panel Setup ​

  1. Log in to the Admin Panel.
  2. Navigate to System Settings > Gemini AI Configuration.
  3. Enter your Google Gemini API Key.
  4. Select a Model ID (e.g., gemini-1.5-flash).
  5. Toggle the status to Enable and click Save.

INFO

Obtain an API key from Google AI Studio.

2. Mobile App Setup ​

The mobile app connects to the AI assistant via the backend API.

  • Ensure your backend allows access to the /api/ai/chat endpoint.
  • The app uses the same authentication token as other requests.
  • Prebuilt Suggestions: The app automatically suggests queries like "What is my balance?" or "How do I deposit money?".

3. Payment Gateway Sync ​

The AI dynamically checks active payment gateways.

  • Example: If you disable "Stripe" in Admin > Payment Gateways, the AI will stop suggesting it as a deposit method.

4. Branding & Customization ​

Change App Name ​

To change the display name of the app:

  1. Open lib/config/app_config.dart and update the appName variable.
  2. Run:
    bash
    flutter pub run rename_app:main all="Your New App Name"

Change Package Name ​

To change the package name (Bundle ID), run:

bash
flutter pub run change_app_package_name:main com.yourcompany.appname

The app uses flutter_launcher_icons to generate app icons.

  1. Replace the logo file at assets/images/logo.png with your own (recommended size: 1024x1024px).
  2. Open pubspec.yaml and verify the configuration:
    yaml
    flutter_launcher_icons:
      android: "launcher_icon"
      ios: true
      image_path: "assets/images/logo.png"
  3. Run:
    bash
    flutter pub run flutter_launcher_icons

Change App Colors ​

To change the primary theme color:

  1. Open lib/config/app_config.dart.
  2. Update the primaryColor variable.
    dart
    // lib/config/app_config.dart
    
    class AppConfig {
      ...
      static const Color primaryColor = Color(0xFFE2136E); // Change hex code here
      ...
    }

5. Build & Deploy ​

Once ready to publish, use these commands to build release artifacts.

Android (APK & App Bundle) ​

bash
# Build APK
flutter build apk --release

# Build App Bundle (AAB) for Play Store
flutter build appbundle --release

iOS (IPA) ​

bash
# Build IPA for App Store
flutter build ipa --release

Generated files are in build/app/outputs/flutter-apk/ (Android) or verify the archive in Xcode (iOS).