Skip to main content

如何開始

歡迎來到校務通系列共用工程,此套件提供給使用 Flutter 開發校務系統 App 的工具

事前準備

安裝流程

確認你需要的範圍

v0.26 以後套件依據程式語言 Dart、框架 Flutter 及作業系統原生套件整合將套件拆成以下圖

drawing

可能會有哪些使用情境

  1. 使用套件所有功能

    可直接使用 ap_common,在 pubspec.yaml 中加入 package

    pubspec.yaml
      # 官方多國語套件
    dependencies:
    flutter_localizations:
    sdk: flutter
    ap_common: ^0.26.0

    在檔案中加入 main.dart registerOneForAll();

    main.dart
    void main() {
    WidgetsFlutterBinding.ensureInitialized();
    /// Register all ap_common injection util
    registerOneForAll();

    runApp(MyApp());
    }
  2. 如果你只需要此只需要 UI,不希望整合過多原生作業系統套件,則

    pubspec.yaml 中加入 package

    pubspec.yaml
    dependencies:
    # 官方多國語套件
    flutter_localizations:
    sdk: flutter
    ap_common_flutter_core: ^0.1.0
    ap_common_flutter_ui: ^0.1.0

    因沒使用套件 ap_common_flutter_platorm,每個此用到的介面會有特定 Util 類別需要實作,以 CourseScaffold 來說,就需要實作 NotificationUtilPlatformCalendarUtil,並在 main.dart 註冊你使用的實作:

    main.dart
    void main() {
    WidgetsFlutterBinding.ensureInitialized();

    registerApCommonFlutter({
    ui: YourUiUtil(),
    platform: YourPlatformUtil(),
    media: YourMediaUtil(),
    platformCalendar: YourPlatformCalendarUtil(),
    notification: YourNotificationUtil(),
    appStore: YourAppStoreUtil(),
    });

    registerApCommonCore(
    preference: YourPreferenceUtil(),
    );

    runApp(MyApp());
    }

執行取得套件

  flutter pub get

執行範例專案(可選)

可嘗試執行範例專案測試環境可以正常使用此套件

GitHub 下載 專案

  git clone https://github.com/abc873693/ap_common/

切換目錄至 example

  cd apps/example/ 

並執行

  flutter run