搜索插件、代码仓与 APP 分类

插件详情v0.0.1

live_icon

一个可在实时更改应用图标和标签的 Flutter 插件。

AndroidiOS
近 30 天下载
8
喜欢数
37
Pub 分数
150

安装插件

flutter pub add live_icon

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

Live Icon 是一个 Flutter 插件,可实现应用图标和标签在设备主屏幕上的实时更改。它允许开发者在运行时动态更新应用的视觉标识,适用于主题切换、品牌更新或交互式用户体验。该插件支持 Android 和 iOS 平台,可与 Flutter 应用无缝集成。它利用原生平台功能,在无需重启应用的情况下刷新应用图标。非常适合希望根据用户偏好或应用状态提供个性化或上下文感知图标的 App。

适合场景

  • 动态应用品牌
  • 主题应用图标
  • 基于用户偏好的图标更改
  • 互动应用体验
  • 实时图标更新

主要特点

  • 实时图标和标签更新
  • 对 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.

所属分类

源码仓库

使用此插件的项目

暂无相关数据。