Kazi Allian
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # 不專業教學系列 - Flutter 專案架構 開始前必備的知識! >tag: `Flutter` ## 前情提要 之前我有分享過如何用Flutter實現To-Do List專案,在[文章](https://hackmd.io/@allianRZ/HydmRmbvC)中有提到對於To-Do List專案架構的說明與備註: > 基本上,App的程式碼包括畫面與邏輯都會放在lib資料夾下,未來根據你設計的架構可能會有改動,但目前就先簡單了解就好。 > >==請注意,隨著專案的負責度上升,或是你本身的經驗積累,你可能會將專案中不同的功能進行分類,本文章為了降低複雜度所以才放在同個檔案中!== 那當專案開始變得複雜時,該怎麼安排專案結構呢? 本文在會下方分享較為常見的架構。 ## 專案概述 在Flutter中,每個專案的核心都是根目錄,它是一個結構化的目錄,用於組織應用程式的各個方面: + android/: 此目錄包含 Android 特定的文件,形成一個功能齊全的 Android 應用程式,開發人員可以在其中集成原生 Android 代碼。 + ios/: 與 android/ 目錄類似,這裡包含 iOS 特定的文件,為 Apple 的 iOS 平台量身定制。 + lib/: Flutter 應用程式的核心,Dart 代碼在此處存活並運行。 + test/: 專門用於 Dart 測試,確保您的應用程式的可靠性和穩定性。 + web/: 包含運行 Flutter 應用程式在 Web 瀏覽器中所需的文件。 + Linux/、Windows/、Macos/: 這些目錄存在於針對桌面應用程式的專案中,包含每個桌面操作系統的特定代碼。 + .dart_tool/: Flutter 的內部支持目錄,不打算手動修改。 + .flutter-plugins: 此文件列出了專案的依賴項。 + .flutter-plugins-dependencies: 提供有關插件依賴項的詳細信息。 + .packages: 一個傳統文件,主要被 pubspec.lock 取代,用於包管理。 + pubspec.yaml: 一個重要文件,在其中聲明專案的依賴項、Flutter 版本、資產等。 + README.md: 一個用於記錄專案的 markdown 文件。 ## 開發核心 `lib/` 目錄是大多數應用程式開發進行的地方。儘管這種結構通常使用,但它完全是可選的,可以根據你的專案具體需求進行調整: * main.dart: 應用程式的起點。 * screens/: 此文件夾通常包含應用程式的各個畫面,有助於組織使用者界面組件。 * widgets/: 存放可重用的小部件,可以在應用程式的不同畫面或組件中使用。 * models/: 包含應用程式使用的資料模型,為資料提供結構化格式。 * services/: 用於網路服務調用、資料庫串聯和應用程式所需的其他服務功能。 * utils/: 存放實用程式或輔助功能,可以在整個應用程式中用於執行常見任務。 * constants/: 保存常量值,如顏色、文字樣式和其他在應用程式中提供一致性的常量。 ## 資產管理與在地化 * assets/: 存放圖片、字體和其他媒體文件。 * l10n/: 存放多語言程式支持的在地化文件。 ## 測試文件 * unit/: 用於單元測試個別功能或類。 * widget/: 專注於測試單個小部件。 * integration/: 確保應用程式的不同部分能夠無縫協作。 ## 其他設定 * analysis_options.yaml: 允許開發人員設置 Dart/Flutter 的 lint(Bug檢查工具) 規則。 * .gitignore: Git 專案中的標準,指示哪些文件或資料夾應該被版本控制忽略。 ## 結語 學習好專案架構能夠讓你在開發時有更高的可讀性,並且在多人協作時可以對於專案更有共識,讓不同的功能待在該待的地方,抱持程式碼整潔總是好的! 但凡事過猶不及,一個專案到底要如何設計架構還是要看具體需求,如果沒有必要卻還是切了一堆東西出來,最後累的還是自己。 希望這次的文章能幫助到你,謝謝觀看!

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully