Monday Hero
Website
V2
V2
  • Overview
  • Workflow Basics
  • Getting Started
    • Installing the Desktop App
    • Log In & Create a Project
    • Prepare Design to Get the Best Code Results
    • Import Design Files into Monday Hero
      • Import Figma Design Files into Monday Hero
        • Import Your Figma Text Style and Color Library
      • Import Adobe XD Design Files into Monday Hero
      • Import Sketch Design Files Into Monday Hero
    • Share Your Project & Manage Roles
  • DESIGN TO FLUTTER
    • Convert Design to Flutter
    • Create Flutter Components
      • System Components
        • Material & Cupertino Components
        • Flutter Supported Components
      • Custom Components
    • Create Responsive Code
    • Colors
    • Text Styles
    • Assets
    • Sync Code
    • Flutter Project Base
      • Fast Start with Monday Hero Starter Project
      • Integrate Monday Hero to your Existing Project
    • Shadows, Gradients, and Other Design Elements
    • Troubleshooting Guide
      • Checklist for Design Element Review and Code Generation
      • Github Monday Hero Starter Project Troubleshooting
  • DESIGN TO SWIFT
    • Convert Design to Swift
    • Create Swift Components
      • System Components
        • Views
        • Texts
        • Images
        • Button
        • TextField/EditText
        • Text Area
        • Status Bar
        • Search Bar
        • List
        • Grid
        • Swift Supported Components
      • Custom Components
      • Video Player Code Component
    • Colors
    • Text Styles
    • Assets
    • Shadows, Gradients, and Other Design Elements
    • Firebase
      • How to get Video URL from Firebase
    • Export Code
      • Integrating Exported Files into an Existing Xcode Project
  • Hero AI Assistant
    • Hero AI Assistant
  • Design to React
    • Convert Design to React
  • Step-By-Step Tutorials
    • 🏖️Travel App
  • Support
    • Roadmap
    • Suggest a New Feature
    • Report a Bug
    • Product Announcements
    • Mail to Support
    • Frequently Asked Questions
  • Join & Follow Us
    • YouTube
    • Discord Community
    • GitHub
    • Twitter
    • LinkedIn
    • Blog
    • Instagram
    • Facebook
Powered by GitBook
On this page
  • Setting Up The Localization Requirements
  • Setting Up The App Router

Was this helpful?

  1. DESIGN TO FLUTTER
  2. Flutter Project Base

Integrate Monday Hero to your Existing Project

Manually add dependencies and sync code for integration

PreviousFast Start with Monday Hero Starter ProjectNextShadows, Gradients, and Other Design Elements

Last updated 1 year ago

Was this helpful?

If you already have a Flutter project, you can integrate it into Monday Hero by manually installing the dependencies in your workspace. After you complete the instructions on this page, use the sync function as explained on the next page. Monday Hero will automatically create the missing folders/files.

Setting Up The Localization Requirements

MHLocalizationAssetLoader is an essential custom asset loader for managing app-specific localization files and Monday Hero-generated localization files. This allows translation files under both assets/translations and assets/translations/mh_generated to be used in the app and managed separately.

Step 1: Add the 'easy_localization' package in your pubspec.yaml and complete installation by executing the following command in your project root. Check out for more information if needed.

flutter pub add easy_localization

Step 2: Declare your asset directories in the pubspec.yaml file.

assets:
    #Localization Files
    - assets/translations/
    # Localization Files generated by Monday Hero
    - assets/translations/mh_generated/
    - assets/images/

Step 3: Navigate to the file where your project's main() function is located. By default, this is the main.dart file. Add the following imports:

import 'package:easy_localization/easy_localization.dart';
import 'core/localization/mh_localization_asset_loader.dart';

Step 4: Call 'await EasyLocalization.ensureInitialized();' in your main function.

  • Set the path as 'assets/translations'

  • Set assetLoader as const MHLocalizationAssetLoader()

  • Set child as your app instance.

Sample Configuration:

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await EasyLocalization.ensureInitialized();
  runApp(
    EasyLocalization(
      supportedLocales: const [
        Locale('en', 'US'),
      ],
      path: 'assets/translations',
      assetLoader: const MHLocalizationAssetLoader(),
      fallbackLocale: const Locale('en', 'US'),
      child: const MyApp(),
    ),
  );
}

Setting Up The App Router

Flutter features an idiomatic declarative routing mechanism similar to the build methods used with widgets. To implement this mechanism in your projects with Monday Hero, you need to adjust your app definition from the MaterialApp() widget.

Step 1: Navigate to your app definition and delete the home value if your app has one.

Step 2: Set initialRoute and onGenerateRoute as follows:

MaterialApp(
   // ...
   initialRoute: AppRoutes.init,
   onGenerateRoute: (settings) => AppRouter.generateRoute(settings),
   // ...
    )

You're all set! Next, synchronize the project with your local directory to obtain the missing folders and files.

the package documentation