├── .gitignore
├── .metadata
├── README.md
├── analysis_options.yaml
├── android
├── .gitignore
├── app
│ ├── build.gradle
│ └── src
│ │ ├── debug
│ │ └── AndroidManifest.xml
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── kotlin
│ │ │ └── com
│ │ │ │ └── greaper
│ │ │ │ └── flutter_micro_frontend
│ │ │ │ └── flutter_micro_frontend
│ │ │ │ └── MainActivity.kt
│ │ └── res
│ │ │ ├── drawable-v21
│ │ │ └── launch_background.xml
│ │ │ ├── drawable
│ │ │ └── launch_background.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── values-night
│ │ │ └── styles.xml
│ │ │ └── values
│ │ │ └── styles.xml
│ │ └── profile
│ │ └── AndroidManifest.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
└── settings.gradle
├── assets
└── images
│ └── img_splash.png
├── ios
├── .gitignore
├── Flutter
│ ├── AppFrameworkInfo.plist
│ ├── Debug.xcconfig
│ └── Release.xcconfig
├── Podfile
├── Podfile.lock
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ ├── IDEWorkspaceChecks.plist
│ │ └── WorkspaceSettings.xcsettings
├── Runner
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ ├── Icon-App-20x20@1x.png
│ │ │ ├── Icon-App-20x20@2x.png
│ │ │ ├── Icon-App-20x20@3x.png
│ │ │ ├── Icon-App-29x29@1x.png
│ │ │ ├── Icon-App-29x29@2x.png
│ │ │ ├── Icon-App-29x29@3x.png
│ │ │ ├── Icon-App-40x40@1x.png
│ │ │ ├── Icon-App-40x40@2x.png
│ │ │ ├── Icon-App-40x40@3x.png
│ │ │ ├── Icon-App-60x60@2x.png
│ │ │ ├── Icon-App-60x60@3x.png
│ │ │ ├── Icon-App-76x76@1x.png
│ │ │ ├── Icon-App-76x76@2x.png
│ │ │ └── Icon-App-83.5x83.5@2x.png
│ │ └── LaunchImage.imageset
│ │ │ ├── Contents.json
│ │ │ ├── LaunchImage.png
│ │ │ ├── LaunchImage@2x.png
│ │ │ ├── LaunchImage@3x.png
│ │ │ └── README.md
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── Info.plist
│ └── Runner-Bridging-Header.h
└── RunnerTests
│ └── RunnerTests.swift
├── l10n.yaml
├── lib
├── environments
│ ├── app_environment.dart
│ └── environment.dart
├── main.dart
├── main_production.dart
├── main_staging.dart
├── modules
│ ├── app_modules.dart
│ └── base_module.dart
└── presentation
│ ├── app.dart
│ ├── localization
│ ├── intl_en.arb
│ ├── intl_vi.arb
│ └── localization.dart
│ ├── routes.dart
│ ├── screens
│ ├── home
│ │ └── home_screen.dart
│ ├── screens.dart
│ └── splash
│ │ ├── splash_binding.dart
│ │ ├── splash_controller.dart
│ │ └── splash_screen.dart
│ └── utils
│ └── definition.dart
├── linux
├── .gitignore
├── CMakeLists.txt
├── flutter
│ ├── CMakeLists.txt
│ ├── generated_plugin_registrant.cc
│ ├── generated_plugin_registrant.h
│ └── generated_plugins.cmake
├── main.cc
├── my_application.cc
└── my_application.h
├── macos
├── .gitignore
├── Flutter
│ ├── Flutter-Debug.xcconfig
│ ├── Flutter-Release.xcconfig
│ └── GeneratedPluginRegistrant.swift
├── Podfile
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
├── Runner
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── app_icon_1024.png
│ │ │ ├── app_icon_128.png
│ │ │ ├── app_icon_16.png
│ │ │ ├── app_icon_256.png
│ │ │ ├── app_icon_32.png
│ │ │ ├── app_icon_512.png
│ │ │ └── app_icon_64.png
│ ├── Base.lproj
│ │ └── MainMenu.xib
│ ├── Configs
│ │ ├── AppInfo.xcconfig
│ │ ├── Debug.xcconfig
│ │ ├── Release.xcconfig
│ │ └── Warnings.xcconfig
│ ├── DebugProfile.entitlements
│ ├── Info.plist
│ ├── MainFlutterWindow.swift
│ └── Release.entitlements
└── RunnerTests
│ └── RunnerTests.swift
├── melos.yaml
├── modules
├── auth
│ ├── .gitignore
│ ├── .metadata
│ ├── CHANGELOG.md
│ ├── LICENSE
│ ├── README.md
│ ├── analysis_options.yaml
│ ├── l10n.yaml
│ ├── lib
│ │ ├── auth.dart
│ │ └── src
│ │ │ ├── auth_module.dart
│ │ │ ├── auth_module_imp.dart
│ │ │ ├── data
│ │ │ ├── injection.dart
│ │ │ ├── local
│ │ │ │ ├── get_storage_imp.dart
│ │ │ │ ├── hive_service_imp.dart
│ │ │ │ └── local_service.dart
│ │ │ ├── models
│ │ │ │ ├── login_model.dart
│ │ │ │ ├── login_model.g.dart
│ │ │ │ ├── login_request_model.dart
│ │ │ │ ├── login_request_model.g.dart
│ │ │ │ └── models.dart
│ │ │ ├── remote
│ │ │ │ ├── auth_interceptor.dart
│ │ │ │ └── clients
│ │ │ │ │ ├── remote_client.dart
│ │ │ │ │ └── remote_client.g.dart
│ │ │ └── repository_imp.dart
│ │ │ ├── domain
│ │ │ ├── repository.dart
│ │ │ └── use_cases
│ │ │ │ ├── check_is_logged_in_use_case.dart
│ │ │ │ └── login_use_case.dart
│ │ │ └── presentation
│ │ │ ├── auth_controller.dart
│ │ │ ├── localization
│ │ │ ├── intl_en.arb
│ │ │ ├── intl_vi.arb
│ │ │ └── localization.dart
│ │ │ ├── routes.dart
│ │ │ ├── screens
│ │ │ ├── login
│ │ │ │ ├── field_vm.dart
│ │ │ │ ├── login_controller.dart
│ │ │ │ └── login_screen.dart
│ │ │ ├── login_v2
│ │ │ │ ├── login_bloc.dart
│ │ │ │ ├── login_form_key.dart
│ │ │ │ └── login_screen.dart
│ │ │ └── screens.dart
│ │ │ └── utils
│ │ │ └── defination.dart
│ ├── pubspec.yaml
│ └── pubspec_overrides.yaml
├── core
│ ├── .gitignore
│ ├── .metadata
│ ├── CHANGELOG.md
│ ├── LICENSE
│ ├── README.md
│ ├── analysis_options.yaml
│ ├── l10n.yaml
│ ├── lib
│ │ ├── core.dart
│ │ └── src
│ │ │ ├── base
│ │ │ └── base_module.dart
│ │ │ ├── core_module.dart
│ │ │ ├── core_module_imp.dart
│ │ │ ├── data
│ │ │ ├── data.dart
│ │ │ ├── injection.dart
│ │ │ ├── mappers
│ │ │ │ └── exception_mapper.dart
│ │ │ └── models
│ │ │ │ ├── base_response.dart
│ │ │ │ ├── base_response.g.dart
│ │ │ │ ├── error_model.dart
│ │ │ │ └── models.dart
│ │ │ ├── domain
│ │ │ ├── domain.dart
│ │ │ ├── models
│ │ │ │ ├── exceptions
│ │ │ │ │ ├── app_exception.dart
│ │ │ │ │ ├── exceptions.dart
│ │ │ │ │ ├── net_exception.dart
│ │ │ │ │ ├── no_connection_exception.dart
│ │ │ │ │ └── unknown_exception.dart
│ │ │ │ └── models.dart
│ │ │ └── utils
│ │ │ │ ├── either.dart
│ │ │ │ └── utils.dart
│ │ │ ├── environment.dart
│ │ │ ├── libs.dart
│ │ │ └── presentation
│ │ │ ├── base_bloc
│ │ │ ├── base.dart
│ │ │ ├── base_bloc.dart
│ │ │ ├── base_bloc_event.dart
│ │ │ ├── base_bloc_screen.dart
│ │ │ ├── base_bloc_state.dart
│ │ │ └── base_navigator
│ │ │ │ ├── base_navigator_bloc.dart
│ │ │ │ └── base_navigator_state.dart
│ │ │ ├── base_get
│ │ │ ├── base.dart
│ │ │ ├── base_controller.dart
│ │ │ ├── base_handle_controller.dart
│ │ │ ├── base_screen.dart
│ │ │ ├── base_view_status.dart
│ │ │ └── base_widget.dart
│ │ │ ├── localization
│ │ │ ├── intl_en.arb
│ │ │ ├── intl_vi.arb
│ │ │ └── localization.dart
│ │ │ ├── presentation.dart
│ │ │ └── screens
│ │ │ └── base_handle_view.dart
│ ├── pubspec.yaml
│ └── pubspec_overrides.yaml
├── product
│ ├── .gitignore
│ ├── .metadata
│ ├── CHANGELOG.md
│ ├── LICENSE
│ ├── README.md
│ ├── analysis_options.yaml
│ ├── l10n.yaml
│ ├── lib
│ │ ├── product.dart
│ │ └── src
│ │ │ ├── data
│ │ │ ├── injection.dart
│ │ │ ├── mapper
│ │ │ │ └── data_mapper.dart
│ │ │ ├── models
│ │ │ │ ├── item_model.dart
│ │ │ │ ├── item_model.g.dart
│ │ │ │ └── models.dart
│ │ │ ├── remote
│ │ │ │ └── clients
│ │ │ │ │ ├── remote_client.dart
│ │ │ │ │ └── remote_client.g.dart
│ │ │ └── repository_imp.dart
│ │ │ ├── domain
│ │ │ ├── models
│ │ │ │ ├── item.dart
│ │ │ │ └── models.dart
│ │ │ ├── repository.dart
│ │ │ └── use_cases
│ │ │ │ └── home_product_use_case.dart
│ │ │ ├── presentation
│ │ │ ├── localization
│ │ │ │ ├── intl_en.arb
│ │ │ │ ├── intl_vi.arb
│ │ │ │ └── localization.dart
│ │ │ └── routes.dart
│ │ │ ├── product_module.dart
│ │ │ ├── product_module_imp.dart
│ │ │ └── widgets
│ │ │ ├── home_product_widget
│ │ │ ├── home_product_controller.dart
│ │ │ └── home_product_widget.dart
│ │ │ ├── home_product_widget_v2
│ │ │ ├── home_product_bloc.dart
│ │ │ └── home_product_widget.dart
│ │ │ └── widgets.dart
│ ├── pubspec.yaml
│ └── pubspec_overrides.yaml
└── ui
│ ├── .gitignore
│ ├── .metadata
│ ├── CHANGELOG.md
│ ├── LICENSE
│ ├── README.md
│ ├── analysis_options.yaml
│ ├── assets
│ ├── fonts
│ │ ├── SFProText-Bold.ttf
│ │ ├── SFProText-Medium.ttf
│ │ ├── SFProText-Regular.ttf
│ │ └── SFProText-SemiBold.ttf
│ └── images
│ │ └── default_avatar.png
│ ├── l10n.yaml
│ ├── lib
│ ├── src
│ │ ├── dialogs
│ │ │ ├── dialogs.dart
│ │ │ └── message_dialog.dart
│ │ ├── form_builder
│ │ │ ├── form_builder.dart
│ │ │ ├── form_builder_checkbox.dart
│ │ │ ├── form_builder_decoration.dart
│ │ │ └── form_builder_text_field.dart
│ │ ├── libs.dart
│ │ ├── list_view
│ │ │ ├── grid_view_load_more.dart
│ │ │ ├── list_view.dart
│ │ │ └── list_view_load_more.dart
│ │ ├── localization
│ │ │ ├── intl_en.arb
│ │ │ ├── intl_vi.arb
│ │ │ └── localization.dart
│ │ ├── themes
│ │ │ ├── colors.dart
│ │ │ ├── fonts.dart
│ │ │ └── theme.dart
│ │ └── ui.dart
│ └── ui.dart
│ └── pubspec.yaml
├── pubspec.lock
├── pubspec.yaml
├── web
├── favicon.png
├── icons
│ ├── Icon-192.png
│ ├── Icon-512.png
│ ├── Icon-maskable-192.png
│ └── Icon-maskable-512.png
├── index.html
└── manifest.json
└── windows
├── .gitignore
├── CMakeLists.txt
├── flutter
├── CMakeLists.txt
├── generated_plugin_registrant.cc
├── generated_plugin_registrant.h
└── generated_plugins.cmake
└── runner
├── CMakeLists.txt
├── Runner.rc
├── flutter_window.cpp
├── flutter_window.h
├── main.cpp
├── resource.h
├── resources
└── app_icon.ico
├── runner.exe.manifest
├── utils.cpp
├── utils.h
├── win32_window.cpp
└── win32_window.h
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | **/doc/api/
26 | **/ios/Flutter/.last_build_id
27 | .dart_tool/
28 | .flutter-plugins
29 | .flutter-plugins-dependencies
30 | .packages
31 | .pub-cache/
32 | .pub/
33 | /build/
34 |
35 | # Symbolication related
36 | app.*.symbols
37 |
38 | # Obfuscation related
39 | app.*.map.json
40 |
41 | # Android Studio will place build artifacts here
42 | /android/app/debug
43 | /android/app/profile
44 | /android/app/release
45 | **/generated/
46 |
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: "367f9ea16bfae1ca451b9cc27c1366870b187ae2"
8 | channel: "stable"
9 |
10 | project_type: app
11 |
12 | # Tracks metadata for the flutter migrate command
13 | migration:
14 | platforms:
15 | - platform: root
16 | create_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
17 | base_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
18 | - platform: android
19 | create_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
20 | base_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
21 | - platform: ios
22 | create_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
23 | base_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
24 | - platform: linux
25 | create_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
26 | base_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
27 | - platform: macos
28 | create_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
29 | base_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
30 | - platform: web
31 | create_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
32 | base_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
33 | - platform: windows
34 | create_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
35 | base_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
36 |
37 | # User provided section
38 |
39 | # List of Local paths (relative to this file) that should be
40 | # ignored by the migrate tool.
41 | #
42 | # Files that are not part of the templates will be ignored by default.
43 | unmanaged_files:
44 | - 'lib/main.dart'
45 | - 'ios/Runner.xcodeproj/project.pbxproj'
46 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## About
2 |
3 | With the concept of monorepo, a big project can be split into many small packages (call `service` or `repo`) so we can maintenance or test each module easily.
4 |
5 | ## Guide
6 | Guide is available at [Medium article](https://medium.com/@tungnd.dev/micro-frontend-in-flutter-modularization-application-dde7dea454e4).
7 |
8 |
9 | ## Run
10 | * Install Flutter 3.13.4
11 | * Install `melos` by run `dart pub global activate melos`
12 | * Run `melos bootstrap` to pub get all packages
13 | * Run `melos gen-l10n` to generate language files for all packages
14 | * Run `flutter pub get` to get and sync all libraries
15 | * Run `flutter gen-l10n` to generate language files for main app
16 | * Run on device `flutter run`
17 |
18 | ## Roadmap
19 | * [x] Build shared (ui, core) modules
20 | * [x] Build authetication module
21 | * [x] Build a functional module
22 | * [ ] Testing for shared modules
23 | * [ ] Testing for functional module
24 | * [ ] Create example for fucntional module and run locally (without Main Application)
25 | * [ ] [Improve] Now `successView()` function is confused about generic type
26 | * [ ] [Improve] Consider concept linking `controller` - `screen`, one `controller` has many `blocs`, instead of linking `bloc` - `screen`
27 |
28 |
29 |
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # This file configures the analyzer, which statically analyzes Dart code to
2 | # check for errors, warnings, and lints.
3 | #
4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6 | # invoked from the command line by running `flutter analyze`.
7 |
8 | # The following line activates a set of recommended lints for Flutter apps,
9 | # packages, and plugins designed to encourage good coding practices.
10 | include: package:flutter_lints/flutter.yaml
11 |
12 | linter:
13 | # The lint rules applied to this project can be customized in the
14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
15 | # included above or to enable additional rules. A list of all available lints
16 | # and their documentation is published at https://dart.dev/lints.
17 | #
18 | # Instead of disabling a lint rule for the entire project in the
19 | # section below, it can also be suppressed for a single line of code
20 | # or a specific dart file by using the `// ignore: name_of_lint` and
21 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
22 | # producing the lint.
23 | rules:
24 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
25 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
26 |
27 | # Additional information about this file can be found at
28 | # https://dart.dev/guides/language/analysis-options
29 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 |
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id "com.android.application"
3 | id "kotlin-android"
4 | id "dev.flutter.flutter-gradle-plugin"
5 | }
6 |
7 | def localProperties = new Properties()
8 | def localPropertiesFile = rootProject.file('local.properties')
9 | if (localPropertiesFile.exists()) {
10 | localPropertiesFile.withReader('UTF-8') { reader ->
11 | localProperties.load(reader)
12 | }
13 | }
14 |
15 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
16 | if (flutterVersionCode == null) {
17 | flutterVersionCode = '1'
18 | }
19 |
20 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
21 | if (flutterVersionName == null) {
22 | flutterVersionName = '1.0'
23 | }
24 |
25 | android {
26 | namespace "com.greaper.flutter_micro_frontend.flutter_micro_frontend"
27 | compileSdkVersion flutter.compileSdkVersion
28 | ndkVersion flutter.ndkVersion
29 |
30 | compileOptions {
31 | sourceCompatibility JavaVersion.VERSION_1_8
32 | targetCompatibility JavaVersion.VERSION_1_8
33 | }
34 |
35 | kotlinOptions {
36 | jvmTarget = '1.8'
37 | }
38 |
39 | sourceSets {
40 | main.java.srcDirs += 'src/main/kotlin'
41 | }
42 |
43 | defaultConfig {
44 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
45 | applicationId "com.greaper.flutter_micro_frontend.flutter_micro_frontend"
46 | // You can update the following values to match your application needs.
47 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
48 | minSdkVersion flutter.minSdkVersion
49 | targetSdkVersion flutter.targetSdkVersion
50 | versionCode flutterVersionCode.toInteger()
51 | versionName flutterVersionName
52 | }
53 |
54 | buildTypes {
55 | release {
56 | // TODO: Add your own signing config for the release build.
57 | // Signing with the debug keys for now, so `flutter run --release` works.
58 | signingConfig signingConfigs.debug
59 | }
60 | }
61 | }
62 |
63 | flutter {
64 | source '../..'
65 | }
66 |
67 | dependencies {}
68 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
14 |
18 |
22 |
23 |
24 |
25 |
26 |
27 |
29 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/greaper/flutter_micro_frontend/flutter_micro_frontend/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.greaper.flutter_micro_frontend.flutter_micro_frontend
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.7.10'
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.3.0'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | mavenCentral()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | tasks.register("clean", Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
6 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | def flutterSdkPath = {
3 | def properties = new Properties()
4 | file("local.properties").withInputStream { properties.load(it) }
5 | def flutterSdkPath = properties.getProperty("flutter.sdk")
6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7 | return flutterSdkPath
8 | }
9 | settings.ext.flutterSdkPath = flutterSdkPath()
10 |
11 | includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
12 |
13 | plugins {
14 | id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false
15 | }
16 | }
17 |
18 | include ":app"
19 |
20 | apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle"
21 |
--------------------------------------------------------------------------------
/assets/images/img_splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/assets/images/img_splash.png
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | **/dgph
2 | *.mode1v3
3 | *.mode2v3
4 | *.moved-aside
5 | *.pbxuser
6 | *.perspectivev3
7 | **/*sync/
8 | .sconsign.dblite
9 | .tags*
10 | **/.vagrant/
11 | **/DerivedData/
12 | Icon?
13 | **/Pods/
14 | **/.symlinks/
15 | profile
16 | xcuserdata
17 | **/.generated/
18 | Flutter/App.framework
19 | Flutter/Flutter.framework
20 | Flutter/Flutter.podspec
21 | Flutter/Generated.xcconfig
22 | Flutter/ephemeral/
23 | Flutter/app.flx
24 | Flutter/app.zip
25 | Flutter/flutter_assets/
26 | Flutter/flutter_export_environment.sh
27 | ServiceDefinitions.json
28 | Runner/GeneratedPluginRegistrant.*
29 |
30 | # Exceptions to above rules.
31 | !default.mode1v3
32 | !default.mode2v3
33 | !default.pbxuser
34 | !default.perspectivev3
35 |
--------------------------------------------------------------------------------
/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 11.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | # platform :ios, '11.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def flutter_root
14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15 | unless File.exist?(generated_xcode_build_settings_path)
16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17 | end
18 |
19 | File.foreach(generated_xcode_build_settings_path) do |line|
20 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
21 | return matches[1].strip if matches
22 | end
23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24 | end
25 |
26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27 |
28 | flutter_ios_podfile_setup
29 |
30 | target 'Runner' do
31 | use_frameworks!
32 | use_modular_headers!
33 |
34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35 | target 'RunnerTests' do
36 | inherit! :search_paths
37 | end
38 | end
39 |
40 | post_install do |installer|
41 | installer.pods_project.targets.each do |target|
42 | flutter_additional_ios_build_settings(target)
43 | end
44 | end
45 |
--------------------------------------------------------------------------------
/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Flutter (1.0.0)
3 | - flutter_native_splash (0.0.1):
4 | - Flutter
5 | - path_provider_foundation (0.0.1):
6 | - Flutter
7 | - FlutterMacOS
8 |
9 | DEPENDENCIES:
10 | - Flutter (from `Flutter`)
11 | - flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
12 | - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
13 |
14 | EXTERNAL SOURCES:
15 | Flutter:
16 | :path: Flutter
17 | flutter_native_splash:
18 | :path: ".symlinks/plugins/flutter_native_splash/ios"
19 | path_provider_foundation:
20 | :path: ".symlinks/plugins/path_provider_foundation/darwin"
21 |
22 | SPEC CHECKSUMS:
23 | Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
24 | flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef
25 | path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
26 |
27 | PODFILE CHECKSUM: 70d9d25280d0dd177a5f637cdb0f0b0b12c6a189
28 |
29 | COCOAPODS: 1.15.2
30 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | Flutter Micro Frontend
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | flutter_micro_frontend
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(FLUTTER_BUILD_NUMBER)
25 | LSRequiresIPhoneOS
26 |
27 | UILaunchStoryboardName
28 | LaunchScreen
29 | UIMainStoryboardFile
30 | Main
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 | CADisableMinimumFrameDurationOnPhone
45 |
46 | UIApplicationSupportsIndirectInputEvents
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/ios/RunnerTests/RunnerTests.swift:
--------------------------------------------------------------------------------
1 | import Flutter
2 | import UIKit
3 | import XCTest
4 |
5 | class RunnerTests: XCTestCase {
6 |
7 | func testExample() {
8 | // If you add code to the Runner application, consider adding tests here.
9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest.
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/l10n.yaml:
--------------------------------------------------------------------------------
1 | arb-dir: lib/presentation/localization
2 | template-arb-file: intl_en.arb
3 | synthetic-package: false
4 | output-dir: lib/presentation/localization/generated
5 | output-class: AppLocalizationImp
--------------------------------------------------------------------------------
/lib/environments/app_environment.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_micro_frontend/modules/app_modules.dart';
2 |
3 | import 'environment.dart';
4 |
5 | class AppEnv extends Environment {
6 | AppEnv._({
7 | required super.name,
8 | required super.baseUrl,
9 | required super.modules,
10 | });
11 |
12 | static final dev = AppEnv._(
13 | name: 'development',
14 | baseUrl: "https://bbdd19e4-7ba1-4d22-8960-d3f6cf8b2e29.mock.pstmn.io/api/",
15 | modules: AppModules(),
16 | );
17 |
18 | static final uat = AppEnv._(
19 | name: 'uat',
20 | baseUrl: "https://bbdd19e4-7ba1-4d22-8960-d3f6cf8b2e29.mock.pstmn.io/api/",
21 | modules: AppModules(),
22 | );
23 |
24 | static final production = AppEnv._(
25 | name: 'production',
26 | baseUrl: "https://bbdd19e4-7ba1-4d22-8960-d3f6cf8b2e29.mock.pstmn.io/api/",
27 | modules: AppModules(),
28 | );
29 | }
30 |
--------------------------------------------------------------------------------
/lib/environments/environment.dart:
--------------------------------------------------------------------------------
1 | // variable can change during use app
2 | import '../modules/base_module.dart';
3 |
4 | abstract class Environment {
5 | final String name;
6 | final String baseUrl;
7 | final BaseModules modules;
8 |
9 | const Environment({
10 | required this.name,
11 | required this.baseUrl,
12 | required this.modules,
13 | });
14 | }
15 |
16 | class FlavorConfig {
17 | static Environment? _env;
18 | static bool canAccessDeveloperMode = false;
19 |
20 | static List listEnvs = [];
21 |
22 | static initValue(List envs,
23 | {bool canAccessDevelopmentMode = false}) {
24 | assert(envs.isNotEmpty);
25 | listEnvs = envs;
26 | _env = envs[0];
27 | canAccessDeveloperMode = canAccessDevelopmentMode;
28 | }
29 |
30 | static Environment get env {
31 | if (_env == null) throw Exception('Environment not set');
32 | return _env!;
33 | }
34 |
35 | static set env(Environment env) {
36 | _env = env;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'environments/app_environment.dart';
2 | import 'environments/environment.dart';
3 | import 'presentation/app.dart';
4 |
5 | void main() {
6 | FlavorConfig.initValue([AppEnv.dev, AppEnv.uat],
7 | canAccessDevelopmentMode: true);
8 | startApp();
9 | }
10 |
--------------------------------------------------------------------------------
/lib/main_production.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_micro_frontend/environments/app_environment.dart';
2 |
3 | import 'environments/environment.dart';
4 | import 'presentation/app.dart';
5 |
6 | void main() {
7 | FlavorConfig.initValue([AppEnv.production]);
8 | startApp();
9 | }
10 |
--------------------------------------------------------------------------------
/lib/main_staging.dart:
--------------------------------------------------------------------------------
1 | import 'environments/app_environment.dart';
2 | import 'environments/environment.dart';
3 | import 'presentation/app.dart';
4 |
5 | void main() {
6 | FlavorConfig.initValue([AppEnv.dev, AppEnv.uat],
7 | canAccessDevelopmentMode: true);
8 | startApp();
9 | }
10 |
--------------------------------------------------------------------------------
/lib/modules/app_modules.dart:
--------------------------------------------------------------------------------
1 | import 'package:auth/auth.dart';
2 | import 'package:flutter/widgets.dart';
3 | import 'package:flutter_micro_frontend/modules/base_module.dart';
4 | import 'package:core/core.dart';
5 | import 'package:product/product.dart';
6 | import 'package:ui/ui.dart';
7 |
8 | import '../environments/environment.dart';
9 |
10 | class AppModules extends BaseModules {
11 | AppModules();
12 |
13 | final List modules = [];
14 |
15 | @override
16 | void initEnv() {
17 | modules.addAll([
18 | CoreModule.newInstance(
19 | environment: CoreEnvironment(baseUrl: FlavorConfig.env.baseUrl)),
20 | AuthModule.instance,
21 | ProductModule.instance
22 | ]);
23 | }
24 |
25 | @override
26 | List get localizationsDelegates => [
27 | ...modules.map((e) => e.localizationsDelegate).toList(),
28 | UI.localizationsDelegate
29 | ];
30 |
31 | @override
32 | Future inject() async {
33 | await Future.wait(modules.map((e) => e.inject()).toList());
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/lib/modules/base_module.dart:
--------------------------------------------------------------------------------
1 | import 'package:core/core.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | abstract class BaseModules {
5 | const BaseModules();
6 |
7 | List> get localizationsDelegates;
8 |
9 | void initEnv();
10 |
11 | Future inject();
12 | }
13 |
--------------------------------------------------------------------------------
/lib/presentation/app.dart:
--------------------------------------------------------------------------------
1 | import 'package:core/core.dart';
2 | import 'package:flutter/foundation.dart';
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter/services.dart';
5 | import 'package:flutter_micro_frontend/presentation/localization/localization.dart';
6 | import 'package:flutter_native_splash/flutter_native_splash.dart';
7 | import 'package:ui/ui.dart';
8 |
9 | import '../environments/environment.dart';
10 | import 'routes.dart';
11 |
12 | void startApp() async {
13 | WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
14 | FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
15 | Logger.root.onRecord.listen((record) {
16 | if (kDebugMode) {
17 | print('${record.level.name}: ${record.time}: ${record.message}');
18 | }
19 | });
20 | FlavorConfig.env.modules.initEnv();
21 | await FlavorConfig.env.modules.inject();
22 | SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
23 | statusBarColor: Colors.transparent,
24 | statusBarBrightness: Brightness.dark));
25 | SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
26 | runApp(const MyApp());
27 | }
28 |
29 | class MyApp extends StatefulWidget {
30 | const MyApp({Key? key}) : super(key: key);
31 |
32 | @override
33 | State createState() => MyAppState();
34 |
35 | static MyAppState? of(BuildContext context) =>
36 | context.findAncestorStateOfType();
37 | }
38 |
39 | class MyAppState extends State {
40 | @override
41 | Widget build(BuildContext context) {
42 | return AnnotatedRegion(
43 | value: SystemUiOverlayStyle.dark,
44 | child: GetMaterialApp(
45 | title: 'Flutter Micro Frontend',
46 | theme: uiTheme,
47 | debugShowCheckedModeBanner: false,
48 | localizationsDelegates: [
49 | GlobalMaterialLocalizations.delegate,
50 | GlobalWidgetsLocalizations.delegate,
51 | GlobalCupertinoLocalizations.delegate,
52 | AppLocalization.delegate,
53 | ...FlavorConfig.env.modules.localizationsDelegates
54 | ],
55 | locale: Get.deviceLocale,
56 | supportedLocales: const [
57 | Locale.fromSubtags(languageCode: 'en'),
58 | Locale.fromSubtags(languageCode: 'vi'),
59 | ],
60 | initialRoute: MainRouteName.splash,
61 | getPages: [...MainRoutePages.pages],
62 | ),
63 | );
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/lib/presentation/localization/intl_en.arb:
--------------------------------------------------------------------------------
1 | {
2 |
3 | }
--------------------------------------------------------------------------------
/lib/presentation/localization/intl_vi.arb:
--------------------------------------------------------------------------------
1 | {
2 | }
--------------------------------------------------------------------------------
/lib/presentation/localization/localization.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 | import 'package:flutter/foundation.dart';
3 | import 'package:flutter/widgets.dart';
4 | import 'generated/app_localizations.dart';
5 | import 'generated/app_localizations_en.dart';
6 |
7 | /// The actual `Localizations` class is [AppLocalizationImp], this class exists only for forward compatibility purposes...
8 |
9 | class AppLocalization {
10 | AppLocalization._();
11 |
12 | static AppLocalizationImp of(BuildContext context) {
13 | return Localizations.of(
14 | context, AppLocalizationImp) ??
15 | _default;
16 | }
17 |
18 | static const LocalizationsDelegate delegate =
19 | AppLocalizationsDelegate();
20 | static const List> localizationsDelegates =
21 | AppLocalizationImp.localizationsDelegates;
22 |
23 | static const List supportedLocales =
24 | AppLocalizationImp.supportedLocales;
25 | static final _default = AppLocalizationImpEn();
26 | static AppLocalizationImp? _current;
27 |
28 | static void setCurrentInstance(AppLocalizationImp? current) =>
29 | _current = current;
30 |
31 | static AppLocalizationImp get current => _current ?? _default;
32 | }
33 |
34 | class AppLocalizationsDelegate
35 | extends LocalizationsDelegate {
36 | const AppLocalizationsDelegate();
37 |
38 | @override
39 | Future load(Locale locale) {
40 | final instance = lookupAppLocalizationImp(locale);
41 | AppLocalization.setCurrentInstance(instance);
42 | return SynchronousFuture(instance);
43 | }
44 |
45 | @override
46 | bool isSupported(Locale locale) => AppLocalizationImp.supportedLocales
47 | .map((e) => e.languageCode)
48 | .contains(locale.languageCode);
49 |
50 | @override
51 | bool shouldReload(AppLocalizationsDelegate old) => false;
52 | }
53 |
--------------------------------------------------------------------------------
/lib/presentation/routes.dart:
--------------------------------------------------------------------------------
1 | import 'package:core/core.dart';
2 |
3 | import 'screens/screens.dart';
4 |
5 | class MainRouteName {
6 | static const splash = '/';
7 | static const home = '/home';
8 | }
9 |
10 | class MainRoutePages {
11 | static final pages = [
12 | GetPage(
13 | name: MainRouteName.splash,
14 | page: () => const SplashScreen(),
15 | binding: SplashBinding()),
16 | GetPage(
17 | name: MainRouteName.home,
18 | page: () => const HomeScreen(),
19 | transitionDuration: const Duration(seconds: 0)),
20 | ];
21 | }
22 |
--------------------------------------------------------------------------------
/lib/presentation/screens/home/home_screen.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:product/product.dart';
3 |
4 | class HomeScreen extends StatelessWidget {
5 | const HomeScreen({super.key});
6 |
7 | @override
8 | Widget build(BuildContext context) {
9 | return Scaffold(
10 | appBar: AppBar(
11 | title: const Text('App bar'),
12 | ),
13 | body: SafeArea(child: HomeProductWidget()));
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/lib/presentation/screens/screens.dart:
--------------------------------------------------------------------------------
1 | export 'home/home_screen.dart';
2 | export 'splash/splash_screen.dart';
3 | export 'splash/splash_binding.dart';
--------------------------------------------------------------------------------
/lib/presentation/screens/splash/splash_binding.dart:
--------------------------------------------------------------------------------
1 | import 'package:core/core.dart';
2 | import 'package:flutter_micro_frontend/presentation/screens/splash/splash_controller.dart';
3 |
4 | class SplashBinding extends Bindings {
5 | @override
6 | void dependencies() {
7 | Get.put(SplashController());
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/lib/presentation/screens/splash/splash_controller.dart:
--------------------------------------------------------------------------------
1 | import 'package:auth/auth.dart';
2 | import 'package:core/core.dart';
3 | import 'package:flutter_micro_frontend/presentation/routes.dart';
4 | import 'package:flutter_native_splash/flutter_native_splash.dart';
5 |
6 | class SplashController extends BaseController {
7 | @override
8 | void onReady() async {
9 | super.onReady();
10 | final isAuth = AuthModule.instance.isAuth();
11 | if (isAuth) {
12 | // do other task
13 | _goToHome();
14 | FlutterNativeSplash.remove();
15 | return;
16 | }
17 | FlutterNativeSplash.remove();
18 | await AuthModule.instance.start(Get.context!);
19 | _goToHome();
20 | }
21 |
22 | void _goToHome() {
23 | Get.offNamedUntil(MainRouteName.home, (route) => false);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/lib/presentation/screens/splash/splash_screen.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_micro_frontend/presentation/utils/definition.dart';
3 |
4 | class SplashScreen extends StatelessWidget {
5 | const SplashScreen({super.key});
6 |
7 | @override
8 | Widget build(BuildContext context) {
9 | return Scaffold(
10 | backgroundColor: Colors.black,
11 | body: Center(
12 | child: Image.asset(ImageConst.splash),
13 | ),
14 | );
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/lib/presentation/utils/definition.dart:
--------------------------------------------------------------------------------
1 | class ImageConst {
2 | static const _path = "assets/images/";
3 | static const splash = "${_path}img_splash.png";
4 | }
5 |
--------------------------------------------------------------------------------
/linux/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral
2 |
--------------------------------------------------------------------------------
/linux/flutter/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This file controls Flutter-level build steps. It should not be edited.
2 | cmake_minimum_required(VERSION 3.10)
3 |
4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
5 |
6 | # Configuration provided via flutter tool.
7 | include(${EPHEMERAL_DIR}/generated_config.cmake)
8 |
9 | # TODO: Move the rest of this into files in ephemeral. See
10 | # https://github.com/flutter/flutter/issues/57146.
11 |
12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...),
13 | # which isn't available in 3.10.
14 | function(list_prepend LIST_NAME PREFIX)
15 | set(NEW_LIST "")
16 | foreach(element ${${LIST_NAME}})
17 | list(APPEND NEW_LIST "${PREFIX}${element}")
18 | endforeach(element)
19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE)
20 | endfunction()
21 |
22 | # === Flutter Library ===
23 | # System-level dependencies.
24 | find_package(PkgConfig REQUIRED)
25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
28 |
29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")
30 |
31 | # Published to parent scope for install step.
32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE)
36 |
37 | list(APPEND FLUTTER_LIBRARY_HEADERS
38 | "fl_basic_message_channel.h"
39 | "fl_binary_codec.h"
40 | "fl_binary_messenger.h"
41 | "fl_dart_project.h"
42 | "fl_engine.h"
43 | "fl_json_message_codec.h"
44 | "fl_json_method_codec.h"
45 | "fl_message_codec.h"
46 | "fl_method_call.h"
47 | "fl_method_channel.h"
48 | "fl_method_codec.h"
49 | "fl_method_response.h"
50 | "fl_plugin_registrar.h"
51 | "fl_plugin_registry.h"
52 | "fl_standard_message_codec.h"
53 | "fl_standard_method_codec.h"
54 | "fl_string_codec.h"
55 | "fl_value.h"
56 | "fl_view.h"
57 | "flutter_linux.h"
58 | )
59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/")
60 | add_library(flutter INTERFACE)
61 | target_include_directories(flutter INTERFACE
62 | "${EPHEMERAL_DIR}"
63 | )
64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}")
65 | target_link_libraries(flutter INTERFACE
66 | PkgConfig::GTK
67 | PkgConfig::GLIB
68 | PkgConfig::GIO
69 | )
70 | add_dependencies(flutter flutter_assemble)
71 |
72 | # === Flutter tool backend ===
73 | # _phony_ is a non-existent file to force this command to run every time,
74 | # since currently there's no way to get a full input/output list from the
75 | # flutter tool.
76 | add_custom_command(
77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_
79 | COMMAND ${CMAKE_COMMAND} -E env
80 | ${FLUTTER_TOOL_ENVIRONMENT}
81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE}
83 | VERBATIM
84 | )
85 | add_custom_target(flutter_assemble DEPENDS
86 | "${FLUTTER_LIBRARY}"
87 | ${FLUTTER_LIBRARY_HEADERS}
88 | )
89 |
--------------------------------------------------------------------------------
/linux/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 |
10 | void fl_register_plugins(FlPluginRegistry* registry) {
11 | }
12 |
--------------------------------------------------------------------------------
/linux/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #ifndef GENERATED_PLUGIN_REGISTRANT_
8 | #define GENERATED_PLUGIN_REGISTRANT_
9 |
10 | #include
11 |
12 | // Registers Flutter plugins.
13 | void fl_register_plugins(FlPluginRegistry* registry);
14 |
15 | #endif // GENERATED_PLUGIN_REGISTRANT_
16 |
--------------------------------------------------------------------------------
/linux/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | )
7 |
8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
9 | )
10 |
11 | set(PLUGIN_BUNDLED_LIBRARIES)
12 |
13 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
18 | endforeach(plugin)
19 |
20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
23 | endforeach(ffi_plugin)
24 |
--------------------------------------------------------------------------------
/linux/main.cc:
--------------------------------------------------------------------------------
1 | #include "my_application.h"
2 |
3 | int main(int argc, char** argv) {
4 | g_autoptr(MyApplication) app = my_application_new();
5 | return g_application_run(G_APPLICATION(app), argc, argv);
6 | }
7 |
--------------------------------------------------------------------------------
/linux/my_application.h:
--------------------------------------------------------------------------------
1 | #ifndef FLUTTER_MY_APPLICATION_H_
2 | #define FLUTTER_MY_APPLICATION_H_
3 |
4 | #include
5 |
6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
7 | GtkApplication)
8 |
9 | /**
10 | * my_application_new:
11 | *
12 | * Creates a new Flutter-based application.
13 | *
14 | * Returns: a new #MyApplication.
15 | */
16 | MyApplication* my_application_new();
17 |
18 | #endif // FLUTTER_MY_APPLICATION_H_
19 |
--------------------------------------------------------------------------------
/macos/.gitignore:
--------------------------------------------------------------------------------
1 | # Flutter-related
2 | **/Flutter/ephemeral/
3 | **/Pods/
4 |
5 | # Xcode-related
6 | **/dgph
7 | **/xcuserdata/
8 |
--------------------------------------------------------------------------------
/macos/Flutter/Flutter-Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "ephemeral/Flutter-Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/macos/Flutter/Flutter-Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "ephemeral/Flutter-Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/macos/Flutter/GeneratedPluginRegistrant.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | import FlutterMacOS
6 | import Foundation
7 |
8 | import path_provider_foundation
9 |
10 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
11 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
12 | }
13 |
--------------------------------------------------------------------------------
/macos/Podfile:
--------------------------------------------------------------------------------
1 | platform :osx, '10.14'
2 |
3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
5 |
6 | project 'Runner', {
7 | 'Debug' => :debug,
8 | 'Profile' => :release,
9 | 'Release' => :release,
10 | }
11 |
12 | def flutter_root
13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
14 | unless File.exist?(generated_xcode_build_settings_path)
15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
16 | end
17 |
18 | File.foreach(generated_xcode_build_settings_path) do |line|
19 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
20 | return matches[1].strip if matches
21 | end
22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
23 | end
24 |
25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
26 |
27 | flutter_macos_podfile_setup
28 |
29 | target 'Runner' do
30 | use_frameworks!
31 | use_modular_headers!
32 |
33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
34 | target 'RunnerTests' do
35 | inherit! :search_paths
36 | end
37 | end
38 |
39 | post_install do |installer|
40 | installer.pods_project.targets.each do |target|
41 | flutter_additional_macos_build_settings(target)
42 | end
43 | end
44 |
--------------------------------------------------------------------------------
/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/macos/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/macos/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | @NSApplicationMain
5 | class AppDelegate: FlutterAppDelegate {
6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
7 | return true
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "16x16",
5 | "idiom" : "mac",
6 | "filename" : "app_icon_16.png",
7 | "scale" : "1x"
8 | },
9 | {
10 | "size" : "16x16",
11 | "idiom" : "mac",
12 | "filename" : "app_icon_32.png",
13 | "scale" : "2x"
14 | },
15 | {
16 | "size" : "32x32",
17 | "idiom" : "mac",
18 | "filename" : "app_icon_32.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "32x32",
23 | "idiom" : "mac",
24 | "filename" : "app_icon_64.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "128x128",
29 | "idiom" : "mac",
30 | "filename" : "app_icon_128.png",
31 | "scale" : "1x"
32 | },
33 | {
34 | "size" : "128x128",
35 | "idiom" : "mac",
36 | "filename" : "app_icon_256.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "256x256",
41 | "idiom" : "mac",
42 | "filename" : "app_icon_256.png",
43 | "scale" : "1x"
44 | },
45 | {
46 | "size" : "256x256",
47 | "idiom" : "mac",
48 | "filename" : "app_icon_512.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "512x512",
53 | "idiom" : "mac",
54 | "filename" : "app_icon_512.png",
55 | "scale" : "1x"
56 | },
57 | {
58 | "size" : "512x512",
59 | "idiom" : "mac",
60 | "filename" : "app_icon_1024.png",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tungnddev/flutter_micro_frontend/a50c8031e2df8b3a5f0bd9ea8df15c7c2e93cd28/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png
--------------------------------------------------------------------------------
/macos/Runner/Configs/AppInfo.xcconfig:
--------------------------------------------------------------------------------
1 | // Application-level settings for the Runner target.
2 | //
3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the
4 | // future. If not, the values below would default to using the project name when this becomes a
5 | // 'flutter create' template.
6 |
7 | // The application's name. By default this is also the title of the Flutter window.
8 | PRODUCT_NAME = flutter_micro_frontend
9 |
10 | // The application's bundle identifier
11 | PRODUCT_BUNDLE_IDENTIFIER = com.greaper.fluttermicrofrontend.flutterMicroFrontend
12 |
13 | // The copyright displayed in application information
14 | PRODUCT_COPYRIGHT = Copyright © 2024 com.greaper.flutter_micro_frontend. All rights reserved.
15 |
--------------------------------------------------------------------------------
/macos/Runner/Configs/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Debug.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/macos/Runner/Configs/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Release.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/macos/Runner/Configs/Warnings.xcconfig:
--------------------------------------------------------------------------------
1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings
2 | GCC_WARN_UNDECLARED_SELECTOR = YES
3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES
4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
6 | CLANG_WARN_PRAGMA_PACK = YES
7 | CLANG_WARN_STRICT_PROTOTYPES = YES
8 | CLANG_WARN_COMMA = YES
9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES
10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
12 | GCC_WARN_SHADOW = YES
13 | CLANG_WARN_UNREACHABLE_CODE = YES
14 |
--------------------------------------------------------------------------------
/macos/Runner/DebugProfile.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 | com.apple.security.cs.allow-jit
8 |
9 | com.apple.security.network.server
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/macos/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSMinimumSystemVersion
24 | $(MACOSX_DEPLOYMENT_TARGET)
25 | NSHumanReadableCopyright
26 | $(PRODUCT_COPYRIGHT)
27 | NSMainNibFile
28 | MainMenu
29 | NSPrincipalClass
30 | NSApplication
31 |
32 |
33 |
--------------------------------------------------------------------------------
/macos/Runner/MainFlutterWindow.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | class MainFlutterWindow: NSWindow {
5 | override func awakeFromNib() {
6 | let flutterViewController = FlutterViewController()
7 | let windowFrame = self.frame
8 | self.contentViewController = flutterViewController
9 | self.setFrame(windowFrame, display: true)
10 |
11 | RegisterGeneratedPlugins(registry: flutterViewController)
12 |
13 | super.awakeFromNib()
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/macos/Runner/Release.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/macos/RunnerTests/RunnerTests.swift:
--------------------------------------------------------------------------------
1 | import FlutterMacOS
2 | import Cocoa
3 | import XCTest
4 |
5 | class RunnerTests: XCTestCase {
6 |
7 | func testExample() {
8 | // If you add code to the Runner application, consider adding tests here.
9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest.
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/melos.yaml:
--------------------------------------------------------------------------------
1 | name: flutter-micro-frontend
2 |
3 | packages:
4 | - modules/*
5 |
6 | command:
7 | bootstrap:
8 | runPubGetInParallel: false
9 |
10 | scripts:
11 | gen-l10n:
12 | exec: flutter gen-l10n
13 | ignoreErrors: true
--------------------------------------------------------------------------------
/modules/auth/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
26 | /pubspec.lock
27 | **/doc/api/
28 | .dart_tool/
29 | .packages
30 | build/
31 |
--------------------------------------------------------------------------------
/modules/auth/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: "367f9ea16bfae1ca451b9cc27c1366870b187ae2"
8 | channel: "stable"
9 |
10 | project_type: package
11 |
--------------------------------------------------------------------------------
/modules/auth/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 0.0.1
2 |
3 | * TODO: Describe initial release.
4 |
--------------------------------------------------------------------------------
/modules/auth/LICENSE:
--------------------------------------------------------------------------------
1 | TODO: Add your license here.
2 |
--------------------------------------------------------------------------------
/modules/auth/README.md:
--------------------------------------------------------------------------------
1 |
13 |
14 | TODO: Put a short description of the package here that helps potential users
15 | know whether this package might be useful for them.
16 |
17 | ## Features
18 |
19 | TODO: List what your package can do. Maybe include images, gifs, or videos.
20 |
21 | ## Getting started
22 |
23 | TODO: List prerequisites and provide or point to information on how to
24 | start using the package.
25 |
26 | ## Usage
27 |
28 | TODO: Include short and useful examples for package users. Add longer examples
29 | to `/example` folder.
30 |
31 | ```dart
32 | const like = 'sample';
33 | ```
34 |
35 | ## Additional information
36 |
37 | TODO: Tell users more about the package: where to find more information, how to
38 | contribute to the package, how to file issues, what response they can expect
39 | from the package authors, and more.
40 |
--------------------------------------------------------------------------------
/modules/auth/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | include: package:flutter_lints/flutter.yaml
2 |
3 | # Additional information about this file can be found at
4 | # https://dart.dev/guides/language/analysis-options
5 |
--------------------------------------------------------------------------------
/modules/auth/l10n.yaml:
--------------------------------------------------------------------------------
1 | arb-dir: lib/src/presentation/localization
2 | template-arb-file: intl_en.arb
3 | output-class: ModuleLocalizationImp
4 | synthetic-package: false
5 | output-dir: lib/src/presentation/localization/generated
--------------------------------------------------------------------------------
/modules/auth/lib/auth.dart:
--------------------------------------------------------------------------------
1 | library auth;
2 |
3 | export 'src/auth_module.dart';
4 |
--------------------------------------------------------------------------------
/modules/auth/lib/src/auth_module.dart:
--------------------------------------------------------------------------------
1 | import 'package:core/core.dart';
2 | import 'package:flutter/widgets.dart';
3 |
4 | import 'data/injection.dart';
5 | import 'presentation/auth_controller.dart';
6 | import 'presentation/localization/localization.dart';
7 |
8 | part 'auth_module_imp.dart';
9 |
10 | abstract class AuthModule extends BaseModule {
11 | static final AuthModule _instance = _AuthModuleImp();
12 |
13 | static AuthModule get instance {
14 | return _instance;
15 | }
16 |
17 | Future start(BuildContext context);
18 |
19 | bool isAuth();
20 | }
21 |
--------------------------------------------------------------------------------
/modules/auth/lib/src/auth_module_imp.dart:
--------------------------------------------------------------------------------
1 | part of 'auth_module.dart';
2 |
3 | class _AuthModuleImp extends AuthModule {
4 | _AuthModuleImp();
5 |
6 | @override
7 | Future inject() async {
8 | await DataInjection().inject();
9 | GetIt.instance.registerSingleton(AuthController());
10 | }
11 |
12 | @override
13 | LocalizationsDelegate get localizationsDelegate =>
14 | ModuleLocalization.delegate;
15 |
16 | @override
17 | Future start(BuildContext context) {
18 | return GetIt.instance.get().auth(context);
19 | }
20 |
21 | @override
22 | bool isAuth() {
23 | return GetIt.instance.get().isAuth();
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/modules/auth/lib/src/data/injection.dart:
--------------------------------------------------------------------------------
1 | import 'package:auth/src/data/local/get_storage_imp.dart';
2 | import 'package:core/core.dart';
3 |
4 | import '../domain/repository.dart';
5 | import 'local/local_service.dart';
6 | import 'remote/auth_interceptor.dart';
7 | import 'remote/clients/remote_client.dart';
8 | import 'repository_imp.dart';
9 |
10 | class DataInjection {
11 | final _getIt = GetIt.instance;
12 |
13 | Future inject() async {
14 | await _injectLocalService();
15 | _injectRemoteService();
16 | }
17 |
18 | Future _injectLocalService() async {
19 | _getIt.registerSingleton(GetStorageImp());
20 | await _getIt.get().initialize();
21 | }
22 |
23 | void _injectRemoteService() {
24 | _getIt.registerLazySingleton(() => RemoteClient(_getIt.get()));
25 | _getIt.registerLazySingleton(() => AuthRepositoryImp(
26 | _getIt.get(), _getIt.get()));
27 | _getIt.registerLazySingleton(
28 | () => AuthInterceptor(_getIt.get(), _getIt.get()));
29 |
30 | _getIt.get().interceptors.add(_getIt.get());
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/modules/auth/lib/src/data/local/get_storage_imp.dart:
--------------------------------------------------------------------------------
1 | import 'package:core/core.dart';
2 |
3 | import 'local_service.dart';
4 |
5 | class GetStorageImp extends LocalService {
6 | @override
7 | String? get accessToken => GetStorage(prefBox).read(keyAccessToken);
8 |
9 | @override
10 | Future initialize() {
11 | return GetStorage.init(prefBox);
12 | }
13 |
14 | @override
15 | Future saveAccessToken(String accessToken) {
16 | return GetStorage(prefBox).write(keyAccessToken, accessToken);
17 | }
18 |
19 | @override
20 | String? get refreshToken => GetStorage(prefBox).read(keyRefreshToken);
21 |
22 | @override
23 | Future saveRefreshToken(String refreshToken) {
24 | return GetStorage(prefBox).write(keyRefreshToken, refreshToken);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/modules/auth/lib/src/data/local/hive_service_imp.dart:
--------------------------------------------------------------------------------
1 | import 'package:core/core.dart';
2 |
3 | import 'local_service.dart';
4 |
5 | class HiveServiceImp extends LocalService {
6 | @override
7 | Future saveAccessToken(String accessToken) {
8 | return Hive.box(prefBox).put(keyAccessToken, accessToken);
9 | }
10 |
11 | @override
12 | Future initialize() async {
13 | final appDocumentDirectory = await getApplicationDocumentsDirectory();
14 | Hive.init(appDocumentDirectory.path);
15 | await Hive.openBox(prefBox);
16 | }
17 |
18 | @override
19 | String? get accessToken => Hive.box(prefBox).get(keyAccessToken);
20 |
21 | @override
22 | String? get refreshToken => Hive.box(prefBox).get(keyRefreshToken);
23 |
24 | @override
25 | Future saveRefreshToken(String refreshToken) {
26 | return Hive.box(prefBox).put(keyRefreshToken, refreshToken);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/modules/auth/lib/src/data/local/local_service.dart:
--------------------------------------------------------------------------------
1 | abstract class LocalService {
2 | final String prefBox = "AuthCache";
3 | final String keyAccessToken = "AccessToken";
4 | final String keyRefreshToken = "RefreshToken";
5 |
6 | Future initialize();
7 |
8 | String? get accessToken;
9 |
10 | String? get refreshToken;
11 |
12 | Future saveAccessToken(String accessToken);
13 |
14 | Future saveRefreshToken(String refreshToken);
15 | }
16 |
--------------------------------------------------------------------------------
/modules/auth/lib/src/data/models/login_model.dart:
--------------------------------------------------------------------------------
1 | import 'package:core/core.dart';
2 |
3 | part 'login_model.g.dart';
4 |
5 | @JsonSerializable()
6 | class LoginModel {
7 | String accessToken;
8 | String refreshToken;
9 |
10 | LoginModel(this.accessToken, this.refreshToken);
11 |
12 | factory LoginModel.fromJson(Map json) => _$LoginModelFromJson(json);
13 | }
--------------------------------------------------------------------------------
/modules/auth/lib/src/data/models/login_model.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'login_model.dart';
4 |
5 | // **************************************************************************
6 | // JsonSerializableGenerator
7 | // **************************************************************************
8 |
9 | LoginModel _$LoginModelFromJson(Map json) => LoginModel(
10 | json['accessToken'] as String,
11 | json['refreshToken'] as String,
12 | );
13 |
14 | Map _$LoginModelToJson(LoginModel instance) =>
15 | {
16 | 'accessToken': instance.accessToken,
17 | 'refreshToken': instance.refreshToken,
18 | };
19 |
--------------------------------------------------------------------------------
/modules/auth/lib/src/data/models/login_request_model.dart:
--------------------------------------------------------------------------------
1 | import 'package:core/core.dart';
2 |
3 | part 'login_request_model.g.dart';
4 |
5 | @JsonSerializable()
6 | class LoginRequestModel {
7 | String username;
8 | String password;
9 | LoginRequestModel(this.username, this.password);
10 |
11 | Map toJson() => _$LoginRequestModelToJson(this);
12 | }
--------------------------------------------------------------------------------
/modules/auth/lib/src/data/models/login_request_model.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'login_request_model.dart';
4 |
5 | // **************************************************************************
6 | // JsonSerializableGenerator
7 | // **************************************************************************
8 |
9 | LoginRequestModel _$LoginRequestModelFromJson(Map json) =>
10 | LoginRequestModel(
11 | json['username'] as String,
12 | json['password'] as String,
13 | );
14 |
15 | Map _$LoginRequestModelToJson(LoginRequestModel instance) =>
16 | {
17 | 'username': instance.username,
18 | 'password': instance.password,
19 | };
20 |
--------------------------------------------------------------------------------
/modules/auth/lib/src/data/models/models.dart:
--------------------------------------------------------------------------------
1 | export 'login_model.dart';
2 | export 'login_request_model.dart';
--------------------------------------------------------------------------------
/modules/auth/lib/src/data/remote/auth_interceptor.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:core/core.dart';
4 |
5 | import '../../domain/repository.dart';
6 |
7 | class AuthInterceptor extends QueuedInterceptorsWrapper {
8 | final Dio _dio;
9 | final Repository _repository;
10 |
11 | AuthInterceptor(this._dio, this._repository);
12 |
13 | @override
14 | void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
15 | final token = _repository.cacheAccessToken;
16 | if (token != null) {
17 | options.headers[HttpHeaders.authorizationHeader] = token;
18 | }
19 | super.onRequest(options, handler);
20 | }
21 |
22 | @override
23 | void onError(DioException err, ErrorInterceptorHandler handler) async {
24 | try {
25 | if (err.response?.statusCode == 401) {
26 | // final refreshTokenDio = Dio(_dio.options);
27 | _dio.httpClientAdapter = _dio.httpClientAdapter;
28 | final requestOptions = err.requestOptions;
29 | final currentAuthInterceptor = _dio.interceptors
30 | .firstWhereOrNull((element) => element is AuthInterceptor);
31 | _dio.interceptors.removeWhere((element) => element is AuthInterceptor);
32 | final newToken = await _repository.refreshToken();
33 | if (newToken != null) {
34 | requestOptions.headers[HttpHeaders.authorizationHeader] = newToken;
35 | final response = await _dio.fetch(requestOptions);
36 | if (currentAuthInterceptor != null) {
37 | _dio.interceptors.insert(0, currentAuthInterceptor);
38 | }
39 | return handler.resolve(response);
40 | } else {
41 | if (currentAuthInterceptor != null) {
42 | _dio.interceptors.insert(0, currentAuthInterceptor);
43 | }
44 | super.onError(err, handler);
45 | }
46 | } else {
47 | super.onError(err, handler);
48 | }
49 | } catch (e) {
50 | if (e is DioException) {
51 | super.onError(e, handler);
52 | } else {
53 | super.onError(err.copyWith(error: e), handler);
54 | }
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/modules/auth/lib/src/data/remote/clients/remote_client.dart:
--------------------------------------------------------------------------------
1 | import 'package:core/core.dart';
2 |
3 | import '../../models/models.dart';
4 |
5 | part 'remote_client.g.dart';
6 |
7 | @RestApi()
8 | abstract class RemoteClient {
9 | factory RemoteClient(Dio dio) = _RemoteClient;
10 |
11 | @POST('/refresh_token')
12 | Future> refreshToken(@Field("refreshToken") String refreshToken);
13 |
14 | @POST('/login')
15 | Future> login(@Body() LoginRequestModel model);
16 | }
--------------------------------------------------------------------------------
/modules/auth/lib/src/data/repository_imp.dart:
--------------------------------------------------------------------------------
1 | import 'package:auth/src/data/remote/clients/remote_client.dart';
2 | import 'package:auth/src/domain/repository.dart';
3 | import 'package:core/core.dart';
4 |
5 | import 'local/local_service.dart';
6 | import 'models/models.dart';
7 |
8 | class AuthRepositoryImp extends Repository with ExceptionMapper {
9 | LocalService localService;
10 | RemoteClient authClient;
11 |
12 | AuthRepositoryImp(this.localService, this.authClient);
13 |
14 | @override
15 | String? get cacheAccessToken => localService.accessToken;
16 |
17 | @override
18 | String? get cacheRefreshToken => localService.refreshToken;
19 |
20 | @override
21 | Future saveCacheAccessToken(String accessToken) =>
22 | localService.saveAccessToken(accessToken);
23 |
24 | @override
25 | Future saveCacheRefreshToken(String refreshToken) =>
26 | localService.saveRefreshToken(refreshToken);
27 |
28 | @override
29 | Future refreshToken() async {
30 | final refreshToken = localService.refreshToken;
31 | if (refreshToken == null) return null;
32 | final newToken = await authClient.refreshToken(refreshToken);
33 | if (newToken.data != null) {
34 | await saveCacheAccessToken(newToken.data!);
35 | }
36 | return newToken.data;
37 | }
38 |
39 | @override
40 | Future login(String username, String password) async {
41 | try {
42 | final response =
43 | await authClient.login(LoginRequestModel(username, password));
44 | if (response.data != null) {
45 | await saveCacheAccessToken(response.data!.accessToken);
46 | await saveCacheRefreshToken(response.data!.refreshToken);
47 | }
48 | } catch (e) {
49 | throw mapException(e);
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/modules/auth/lib/src/domain/repository.dart:
--------------------------------------------------------------------------------
1 | abstract class Repository {
2 |
3 | String? get cacheAccessToken;
4 |
5 | String? get cacheRefreshToken;
6 |
7 | Future saveCacheAccessToken(String accessToken);
8 |
9 | Future saveCacheRefreshToken(String refreshToken);
10 |
11 | Future refreshToken();
12 |
13 | Future login(String username, String password);
14 | }
15 |
--------------------------------------------------------------------------------
/modules/auth/lib/src/domain/use_cases/check_is_logged_in_use_case.dart:
--------------------------------------------------------------------------------
1 | import 'package:auth/src/domain/repository.dart';
2 | import 'package:core/core.dart';
3 |
4 | class CheckIsLoggedInUseCase {
5 | final Repository _repository;
6 |
7 | CheckIsLoggedInUseCase(this._repository);
8 |
9 | Either execute() {
10 | try {
11 | final token = _repository.cacheAccessToken;
12 | return Left(token != null);
13 | } on AppException catch (e) {
14 | return Right(e);
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/modules/auth/lib/src/domain/use_cases/login_use_case.dart:
--------------------------------------------------------------------------------
1 | import 'package:auth/src/domain/repository.dart';
2 | import 'package:core/core.dart';
3 |
4 | class LoginUseCase {
5 | final Repository _repository;
6 |
7 | LoginUseCase(this._repository);
8 |
9 | Future> execute(
10 | String username, String password) async {
11 | try {
12 | await _repository.login(username, password);
13 | return const Left(null);
14 | } on AppException catch (e) {
15 | return Right(e);
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/modules/auth/lib/src/presentation/auth_controller.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:auth/src/domain/repository.dart';
4 | import 'package:auth/src/domain/use_cases/check_is_logged_in_use_case.dart';
5 | import 'package:auth/src/presentation/routes.dart';
6 | import 'package:core/core.dart';
7 | import 'package:flutter/cupertino.dart';
8 |
9 | class AuthController with BaseHandleView {
10 | late Completer completer;
11 |
12 | Future auth(BuildContext context) {
13 | completer = Completer();
14 | final result = CheckIsLoggedInUseCase(GetIt.instance.get()).execute();
15 | result.fold((left) {
16 | if (left) {
17 | completer.complete();
18 | } else {
19 | Navigator.pushAndRemoveUntil(context, Routes.checkPhone(), (route) => false);
20 | }
21 | }, (right) {
22 | showError(context, right);
23 | });
24 | return completer.future;
25 | }
26 |
27 | void loginSuccessfully() {
28 | if (!completer.isCompleted) {
29 | completer.complete();
30 | }
31 | }
32 |
33 | bool isAuth() => CheckIsLoggedInUseCase(GetIt.instance.get())
34 | .execute()
35 | .fold((left) => left, (right) => false);
36 |
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/modules/auth/lib/src/presentation/localization/intl_en.arb:
--------------------------------------------------------------------------------
1 | {
2 | "lbl_user_name": "Username",
3 | "lbl_password": "Password",
4 | "btn_login": "Login"
5 | }
--------------------------------------------------------------------------------
/modules/auth/lib/src/presentation/localization/intl_vi.arb:
--------------------------------------------------------------------------------
1 | {
2 | "lbl_user_name": "Tên đăng nhập",
3 | "lbl_password": "Mật khẩu",
4 | "btn_login": "Đăng nhập"
5 | }
--------------------------------------------------------------------------------
/modules/auth/lib/src/presentation/localization/localization.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 | import 'package:core/core.dart';
3 | import 'package:flutter/foundation.dart';
4 | import 'package:flutter/widgets.dart';
5 | import 'generated/app_localizations.dart';
6 | import 'generated/app_localizations_en.dart';
7 |
8 | /// The actual `Localizations` class is [ModuleLocalizationImp], this class exists only for forward compatibility purposes...
9 |
10 | class ModuleLocalization {
11 | ModuleLocalization._();
12 |
13 | static ModuleLocalizationImp of(BuildContext context) {
14 | return Localizations.of(
15 | context, ModuleLocalizationImp) ??
16 | _default;
17 | }
18 |
19 | static const LocalizationsDelegate delegate =
20 | ModuleLocalizationsDelegate();
21 | static const List> localizationsDelegates =
22 | ModuleLocalizationImp.localizationsDelegates;
23 |
24 | static const List supportedLocales =
25 | ModuleLocalizationImp.supportedLocales;
26 | static final _default = ModuleLocalizationImpEn();
27 | static ModuleLocalizationImp? _current;
28 |
29 | static void setCurrentInstance(ModuleLocalizationImp? current) =>
30 | _current = current;
31 |
32 | static ModuleLocalizationImp get current => _current ?? _default;
33 | }
34 |
35 | class ModuleLocalizationsDelegate
36 | extends LocalizationsDelegate {
37 | const ModuleLocalizationsDelegate();
38 |
39 | @override
40 | Future load(Locale locale) {
41 | final instance = lookupModuleLocalizationImp(locale);
42 | ModuleLocalization.setCurrentInstance(instance);
43 | return SynchronousFuture(instance);
44 | }
45 |
46 | @override
47 | bool isSupported(Locale locale) => ModuleLocalizationImp.supportedLocales
48 | .map((e) => e.languageCode)
49 | .contains(locale.languageCode);
50 |
51 | @override
52 | bool shouldReload(ModuleLocalizationsDelegate old) => false;
53 | }
54 |
55 | extension GetModuleLocalization on GetInterface {
56 | ModuleLocalizationImp get moduleLocalization {
57 | if (context == null) throw Exception('Context is null');
58 | return ModuleLocalization.of(context!);
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/modules/auth/lib/src/presentation/routes.dart:
--------------------------------------------------------------------------------
1 | import 'package:core/core.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | import 'screens/screens.dart';
5 |
6 | class RouteName {
7 | static const _prefix = "/auth";
8 | static const login = "${_prefix}_login";
9 | }
10 |
11 | class Routes {
12 | static PageRoute checkPhone() => MaterialPageRoute(
13 | builder: (context) => LoginScreen(),
14 | settings: const RouteSettings(name: RouteName.login));
15 | }
16 |
--------------------------------------------------------------------------------
/modules/auth/lib/src/presentation/screens/login/field_vm.dart:
--------------------------------------------------------------------------------
1 | import 'package:equatable/equatable.dart';
2 |
3 | class FieldVM with EquatableMixin {
4 | String? Function(String content)? validator;
5 | String _content = "";
6 |
7 | set content(String newValue) {
8 | _content = newValue;
9 | initial = false;
10 | }
11 |
12 | String get content => _content;
13 | bool initial = true;
14 |
15 | String? get errorText {
16 | if (initial) return null;
17 | return validate();
18 | }
19 |
20 | String? validate() {
21 | if (validator != null) {
22 | return validator!.call(_content);
23 | }
24 | if (_content.isEmpty) return 'Invalid field';
25 | return null;
26 | }
27 |
28 | FieldVM(this._content);
29 |
30 | @override
31 | List