LN Code Editor Logo # LN Code Editor **A modern, lightweight mobile code editor and portable IDE built for Android** [![Flutter](https://img.shields.io/badge/Flutter-%2302569B.svg?style=flat&logo=Flutter&logoColor=white)](https://flutter.dev) [![Dart](https://img.shields.io/badge/Dart-%230175C2.svg?style=flat&logo=dart&logoColor=white)](https://dart.dev) [![Platform](https://img.shields.io/badge/Platform-Android%20(ARM64%20%7C%20ARM32%20%7C%20x86__64)-green.svg)](https://gitea.lzxnone.cloud/lzxnone/LN-Code-Editor) [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](LICENSE) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://gitea.lzxnone.cloud/lzxnone/LN-Code-Editor) [็ฎ€ไฝ“ไธญๆ–‡](README.md) | **English**
--- ## ๐Ÿ“– Introduction **LN Code Editor** is a high-performance mobile code editor and pocket IDE crafted for Android. Fully optimized for touch-screen workflows, it features multi-language syntax highlighting, smart code completion and real-time diagnostics, a visual Git conflict resolver, and a **rootless built-in Linux container with a full PTY shell**, enabling developers to read, write, and debug code seamlessly on phones and tablets. --- ## โœจ Key Features ### 1. ๐Ÿ“ Professional Code Editing Experience - **Multi-Language Syntax Highlighting**: Powered by `re_editor` and `re_highlight` for fast, accurate lexical coloring. - **Smart Completion & Real-Time Diagnostics**: - Real-time auto-completion suggestions for variables, functions, and keywords. - Inline wavy underlines for syntax errors and gutter indicators by line number. - **Master toggle + independent Completion / Diagnostics switches** to fit both distraction-free reading and rapid coding. - **Pinch-to-Zoom & Typography**: Smooth two-finger pinch zoom for font sizing, bundled with JetBrains Mono and Fira Code Nerd Fonts. ### 2. ๐ŸŒฟ Visual Git Conflict Resolver - **Automatic Conflict Detection**: Detects all `<<<<<<<`, `=======`, and `>>>>>>>` conflict blocks in a file. - **Inline Diff Comparison**: Highlights current and incoming changes clearly side by side. - **Quick Resolution Actions**: - *Accept Current* - *Accept Incoming* - *Accept Both* - *Manual Edit* - **Mobile-Friendly Interaction**: Overflow-safe horizontal scrolling and coordinated menu/drawer dismissal during conflict editing. ### 3. ๐Ÿง Rootless Built-in Linux Container & Terminal - **Real Shell Environment**: Wraps a lightweight Alpine Linux container via PRoot (and optional Chroot mode when Root is available) to provide native Linux CLI capabilities without requiring Root. - **Smooth Terminal Interaction**: Built on a customized `xterm.dart` and `flutter_pty` with long-press and gesture text selection, crisp typography, and virtual shortcut keys. - **Rich CLI Ecosystem**: Run `git`, `apk`, `curl`, `python`, and other standard Linux tools directly on Android. ### 4. ๐ŸŽจ Swiss Minimalist Design - Immersive dark theme designed to keep the focus on your code. - High-contrast dual-tone Swiss minimalist icon with full Android 8.0+ Adaptive Icon support. ### 5. ๐ŸŒ Full Internationalization (l10n) - Native support for Simplified Chinese (`zh`) and English (`en`), following your system locale or manual selection. --- ## ๐Ÿ› ๏ธ Tech Stack & Architecture | Module | Stack | Description | | :--- | :--- | :--- | | **Framework** | Flutter 3.x / Dart 3.x | High-performance cross-platform rendering engine | | **Code Editor** | `re_editor` / `re_highlight` | High-performance mobile code editor and syntax highlighter | | **Terminal Emulator** | `xterm` / `flutter_pty` | Enhanced terminal selection and PTY pseudo-terminal bridge | | **Container Sandbox** | PRoot + Alpine Linux / Shims | Native C/C++ cross-architecture compatibility layer & runtime | | **App Icons** | `flutter_launcher_icons` | Automated generation of Android mipmaps and adaptive icons | | **State & Storage** | `provider` / `shared_preferences` | Reactive state management and persistent preferences | --- ## ๐Ÿš€ Installation & Build ### Option 1: Install Release APK Directly (Recommended) Download the release APK from the [Gitea Releases](https://gitea.lzxnone.cloud/lzxnone/LN-Code-Editor/releases) page (or check `releases/`): * **`LN-Code-Editor--universal.apk`** (Universal all-in-one APK) * **`LN-Code-Editor--arm64-v8a.apk`** (Recommended for most modern ARM64 phones) * **`LN-Code-Editor--armeabi-v7a.apk`** (For legacy 32-bit ARM devices) * **`LN-Code-Editor--x86_64.apk`** (For Android emulators, WSA, or ChromeOS) ### Option 2: Build from Source #### 1. Prerequisites - [Flutter SDK](https://docs.flutter.dev/get-started/install) (`>= 3.24.0`) - Android SDK (API 34) & NDK (`28.2.13676358`) - JDK 11 or 17 #### 2. Fetch Dependencies & Run ```bash # Install dependencies flutter pub get # Run on a connected Android device or emulator flutter run ``` #### 3. Build Release APKs Build a universal release APK: ```bash flutter build apk --release ``` Or use the included PowerShell script to build all ABI splits + universal APK into `releases/`: ```powershell # Windows PowerShell .\tools\build\build-release-apks.ps1 ``` --- ## ๐Ÿ“ Project Structure ```text โ”œโ”€โ”€ android/ # Android native config, JNI libraries, and MethodChannel bridge โ”œโ”€โ”€ assets/ # Bundled fonts (JetBrains/Fira), Linux rootfs, icons, and shims โ”‚ โ”œโ”€โ”€ fonts/ # Nerd Font monospace programming fonts โ”‚ โ”œโ”€โ”€ icon/ # High-resolution adaptive app icons โ”‚ โ””โ”€โ”€ shims/ # Container architecture compatibility shims โ”œโ”€โ”€ lib/ # Flutter / Dart application source code โ”‚ โ”œโ”€โ”€ l10n/ # Localization ARB files (zh / en) โ”‚ โ”œโ”€โ”€ models/ # Core data models (Git conflicts, file trees, etc.) โ”‚ โ”œโ”€โ”€ providers/ # State management (settings, workspace, terminal, tabs) โ”‚ โ”œโ”€โ”€ services/ # Native & container services (Linux distro, updater, Git, LSP) โ”‚ โ”œโ”€โ”€ views/ # Core screens (main editor, settings, completion, conflicts) โ”‚ โ””โ”€โ”€ widgets/ # Reusable UI widgets (editor, Git conflict panel, file tree) โ”œโ”€โ”€ packages/ # Customized & patched third-party packages (re_editor, xterm) โ”œโ”€โ”€ tools/ # Build and utility scripts (build-release-apks.ps1, etc.) โ””โ”€โ”€ test/ # Unit tests and widget tests ``` --- ## ๐Ÿงช Automated Testing Run the test suite: ```bash flutter test ``` --- ## ๐Ÿ“„ License This project is open-sourced under the [GNU General Public License v3.0 (GPL-3.0)](LICENSE).