How blink616/share works
1. Overall shape
- This repo is a hybrid Flutter + Unity AR application.
- Flutter owns the app shell, screens, and non-AR UI; Unity owns the real-time AR drawing experience.
- The architecture is split into three main parts: lib/ for Flutter, unity/ardoodle/ for the Unity module, and android/ / ios/ for native packaging.
2. Flutter presentation layer
- The Flutter app starts in lib/main.dart and is organized around screens in lib/screens/.
- Key screens suggest the app flow: authentication (loginscreen.dart, registrationscreen.dart), home/navigation (home.dart), drawing entry points (drawing.dart, ar_draw.dart, ar_controls.dart), social browsing (doodles.dart), and map views (map.dart, map-old.dart).
- Flutter is responsible for the app’s UI/UX, navigation, and any non-AR interactions.
3. AR drawing subsystem
- The actual AR drawing mechanics live in Unity under unity/ardoodle/Assets/Scripts/.
- ARDraw.cs, ColorPicker.cs, Follow.cs, and OpenClose.cs indicate Unity handles line creation, tool/color selection, object positioning, and toggling of AR UI elements.
- The Unity scene set is centered on SampleScene.unity, with a Line.prefab used as the drawing primitive.
4. Flutter ↔ Unity integration boundary
- The repo uses flutter-unity-widget / FlutterUnityIntegration to embed Unity inside Flutter.
- That bridge is implemented by the integration assets in unity/ardoodle/Assets/FlutterUnityIntegration/ and the Flutter-side screen(s) that host the Unity view.
- This boundary is important: Flutter sends commands into Unity, and Unity can send messages back through the integration layer.
5. Interaction/data flow
- A typical flow is: user enters the drawing experience in Flutter, Unity renders the AR canvas, the user creates a doodle, then Flutter handles the surrounding app actions such as sharing/uploading and browsing other drawings.
- The README describes drawings being “uploaded,” “explored,” and “pinned on maps,” so the AR output is treated as a shareable artifact, not just a local rendering.
6. Social/explore/map layer
- lib/screens/doodles.dart and the map screens indicate a discovery layer for browsing shared AR drawings.
- The README says the Explore tab shows drawings within a 25-meter radius of the user’s location, which implies location-aware filtering and geotagged content.
- The map screens represent a separate visualization boundary: content is shown spatially rather than in the AR canvas itself.
7. Domain models
- lib/models/doodle_model.dart and lib/models/user_model.dart define the app’s core data entities.
- These models likely carry user identity, drawing metadata, and location-related fields needed by the explore/map features.
- The model layer sits between the UI and whatever persistence or backend service is used.
8. Native platform wrappers
- Android and iOS projects are present to package the Flutter app and host the embedded Unity runtime.
- Android entrypoints include MainActivity.kt and standard Gradle setup; iOS includes AppDelegate.swift, Podfile, and GoogleService-Info.plist.
- These platform projects are the boundary where Flutter, Unity, and any native plugins are assembled into runnable mobile apps.
9. AR and device capability configuration
- Unity is configured with AR Foundation, ARCore, and ARKit assets, so the AR layer is cross-platform at the Unity level.
- The Unity project contains loader/settings assets for both Android and iOS, showing that device AR support is a first-class concern.
- The Flutter shell itself is not doing low-level AR; it delegates that capability to Unity.
10. Assets and presentation resources
- Flutter assets live under assets/ and fonts/, while Unity manages its own prefabs, scenes, icons, and plugin assets.
- This means UI assets and AR scene assets are intentionally separated by runtime: Flutter assets for app chrome, Unity assets for immersive content.
- The separation is important for drawing a diagram because the two runtimes do not share a single asset pipeline.
11. Backend/service boundary
- The repo strongly suggests some remote storage or sync layer because drawings are uploaded and shared, but that implementation is not visible here.
- For architecture purposes, treat persistence, authentication, and content retrieval as an external boundary behind the Flutter models/screens.
- The visible code only shows the client-side front end and AR module, not the server.
12. Other platform surfaces
- A web/ directory exists, but the README is clearly centered on mobile AR, so web appears to be a Flutter scaffold rather than the primary runtime.
- The main architecture to diagram is therefore mobile-first, with Flutter as the host and Unity as the AR engine.
Main entry points: ARDraw.cs ARDraw · FlutterUnityIntegration Unity bridge · home.dart Home · doodle_model.dart Doodle model
Components 23
Flutter app
Mobile shell, screens, and domain models.
- Main app · Bootstraps the Flutter application and app shell.
lib/main.dart - Home · Primary navigation and launch hub.
lib/screens/home.dart - Login · Authentication entry screen.
lib/screens/loginscreen.dart - Register · Account creation screen.
lib/screens/registrationscreen.dart - Drawing · Entry point into the drawing experience.
lib/screens/drawing.dart - AR draw · Hosts or routes into the Unity AR view.
lib/screens/ar_draw.dart - AR controls · Surrounding UI for AR tool controls.
lib/screens/ar_controls.dart - Doodles · Browse and discover shared drawings.
lib/screens/doodles.dart - Map · Geographic view for nearby shared content.
lib/screens/map.dart - Old map · Legacy map view kept alongside the current one.
lib/screens/map-old.dart - Doodle model · Drawing metadata and location-aware content shape.
lib/models/doodle_model.dart - User model · User identity and profile data used by the app.
lib/models/user_model.dart
Unity AR
Embedded AR drawing runtime and scene assets.
- Unity bridge · Messaging and embedding layer connecting Flutter and Unity.
unity/ardoodle/Assets/FlutterUnityIntegration - Game manager · Integration-side coordination for messages and runtime state.
unity/ardoodle/Assets/FlutterUnityIntegration/GameManager.cs - ARDraw · Core AR drawing logic and line creation.
unity/ardoodle/Assets/Scripts/ARDraw.cs - Color picker · Tool and color selection for drawing.
unity/ardoodle/Assets/Scripts/ColorPicker.cs - Follow · Positions or tracks AR elements in the scene.
unity/ardoodle/Assets/Scripts/Follow.cs - Open close · Toggles AR interface elements open and closed.
unity/ardoodle/Assets/Scripts/OpenClose.cs - Sample scene · Main Unity scene for the AR doodle experience.
unity/ardoodle/Assets/Scenes/SampleScene.unity - Line prefab · Reusable drawing primitive instantiated in AR.
unity/ardoodle/Assets/Prefab/Line.prefab
Native packaging
Android and iOS host projects for the combined app.
- Android host · Android packaging and launch entry for the app.
android - iOS host · iOS packaging and launch entry for the app.
ios
Web scaffold
Flutter web entry surface present in the repo.
- Web entry · Web scaffold and browser entry surface.
web/index.html
Connections 23
- Main app → Home: starts · Launches the app into the main navigation flow.
- Home → Login: auth · Routes to sign-in.
- Home → Register: auth · Routes to account creation.
- Home → Drawing: launch · Enters the drawing experience.
- Drawing → AR draw: AR entry · Moves from app flow into the AR drawing screen.
- AR draw → Unity bridge: hosts · Embeds the Unity runtime inside Flutter.
- AR controls → Unity bridge: controls · Sends UI actions into the embedded Unity view.
- Unity bridge → Game manager: messages · Bridges Flutter commands and Unity runtime state.
- Game manager → ARDraw: coordinates · Delegates drawing behavior to the AR script.
- ARDraw → Color picker: uses · Consumes selected tools and colors.
- ARDraw → Follow: positions · Relies on scene tracking and object placement.
- ARDraw → Open close: toggles · Shows or hides AR controls.
- ARDraw → Line prefab: instantiates · Creates drawn strokes from the line prefab.
- Sample scene → ARDraw: contains · Scene wires in the core AR script.
- Sample scene → Line prefab: uses · References the drawing primitive.
- Doodles → Doodle model: reads · Uses doodle metadata for browse and explore views.
- Map → Doodle model: maps · Visualizes location-bound doodles.
- Old map → Doodle model: maps · Legacy map visualization over the same data.
- Login → User model: binds · Authenticates against user data shape.
- Register → User model: creates · Creates new user records.
- Android host → Unity bridge: packages · Bundles the Flutter app with the Unity module on Android.
- iOS host → Unity bridge: packages · Bundles the Flutter app with the Unity module on iOS.
- Web entry → Main app: boots · Browser scaffold points to the Flutter app entry.