搜尋套件、儲存庫與 APP 分類

套件詳情v0.0.1

live_icon

一個可在即時變更應用程式圖示和標籤的 Flutter 外掛程式。

AndroidiOS
近 30 天下載
8
喜歡數
37
Pub 分數
150

安裝套件

flutter pub add live_icon

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

Live Icon 是一個 Flutter 插件,可實現應用程式圖示與標籤在裝置主畫面的即時變更。它允許開發者在執行時期動態更新應用程式的視覺識別,適用於主題切換、品牌更新或互動式使用者體驗。此插件支援 Android 與 iOS 平台,可與 Flutter 應用程式無縫整合。它利用原生平台功能,在不需重新啟動的情況下更新應用程式圖示。非常適合希望根據使用者偏好或應用狀態提供個人化或情境感知圖示的應用程式。

適用情境

  • 動態應用品牌
  • 主題應用圖示
  • 基於用戶偏好之圖示變更
  • 互動應用體驗
  • 即時圖示更新

主要特色

  • 即時圖示和標籤更新
  • 對 Android 和 iOS 的支援
  • 無需重新啟動應用程式
  • 簡單 API 結合
  • 原生平台相容性

適合對象

  • 具有動態品牌標識的應用程式
  • 主題啟用的應用程式
  • 互動式使用者介面
  • 可自訂的應用身分
  • 尋求主畫面自定義的開發者

使用建議

  • 需要平台特定的設定
  • 僅限支援的裝置
  • 可能無法在所有啟動器上運作
  • 某些 Android 版本可能需要權限
  • 行為在iOS和Android實作之間有所不同

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Live Icon

Live_Icon

GitHub GitHub code size in bytes GitHub top language GitHub language count GitHub tag (latest by date) GitHub issues

GitHub Repo stars GitHub forks

Compatibility

✅   Android
❌   iOS (active issue: iOS support)

Features

All the features listed below can be performed at the runtime.

✅   Change App Icons
✅   Change App Label

Quick Start

Step 1: Include plugin to your project
dependencies:
  live_icon: <latest version>
Step 2: Add activity-alias in AndroidManifest.xml
...
...
<application
    android:label="live_icon_example"
    android:icon="@mipmap/ic_launcher">
    <activity
        android:name=".MainActivity"
        android:launchMode="singleTop"
        android:theme="@style/LaunchTheme"
        android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
        android:hardwareAccelerated="true"
        android:windowSoftInputMode="adjustResize">
        <meta-data
            android:name="io.flutter.embedding.android.NormalTheme"
            android:resource="@style/NormalTheme"
            />
        <meta-data
            android:name="io.flutter.embedding.android.SplashScreenDrawable"
            android:resource="@drawable/launch_background"
            />
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>

    <!-- Live Icon Addition -->
    <activity-alias
        android:name=".DarkTheme"
        android:enabled="false"
        android:icon="@mipmap/dark_theme"
        android:label="DarkThemeLabel"
        android:targetActivity=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity-alias>

    <activity-alias
        android:name=".LightTheme"
        android:enabled="false"
        android:icon="@mipmap/light_theme"
        android:label="LightThemeLabel"
        android:targetActivity=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity-alias>
    <!-- Live Icon Addition -->

    <meta-data
        android:name="flutterEmbedding"
        android:value="2" />

</application>
...
...
Step 3: Create classes

Create java/kotlin files with the same name as provided in activity-alias.

In the above AndroidManifest.xml example, 2 activity-alias are provided, so the number of java/kotlin files will be 2. Example:

1. DarkTheme.java
package com.hackthedeveloper.live_icon_example;

public class DarkTheme {
}
2. LightTheme.java
package com.hackthedeveloper.live_icon_example;

public class LightTheme {
}

One thing to note here is that, we have added two extra activity as activity-alias, and we now have 3 activity in total.

Step 4: Initialise plugin

List all the activity-alias class names. NOTE: MainActivity will also be added here as it containes the launch intent.

LiveIcon.initialize(
    classNames: ['MainActivity', 'DarkTheme', 'LightTheme'],
);
Step 5: Switch App icon

Use switchIconTo to switch app icons. It takes in the className that must match the desired activity-alias android:name.

await liveIcon.switchIconTo(
    className: 'DarkTheme',
);

Project Created & Maintained By

Subham Praharaj

GitHub followers

Divyanshu Shekhar

GitHub followers

Contributions

Contributions are welcomed!

If you feel that a hook is missing, feel free to open a pull-request.

For a custom-hook to be merged, you will need to do the following:

Describe the use-case.

  • Open an issue explaining why we need this hook, how to use it, ... This is important as a hook will not get merged if the hook doens't appeal to a large number of people.

  • If your hook is rejected, don't worry! A rejection doesn't mean that it won't be merged later in the future if more people shows an interest in it. In the mean-time, feel free to publish your hook as a package on https://pub.dev.

  • A hook will not be merged unles fully tested, to avoid breaking it inadvertendly in the future.

Copyright & License

Code and documentation Copyright (c) 2021 Devs On Flutter. Code released under the BSD 3-Clause License.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。