flutter_android_dynamic_icon 1.0.3
flutter_android_dynamic_icon: ^1.0.3 copied to clipboard
Flutter plugin which allows you to change the app icon dynamically (only supported on Android)
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:flutter_android_dynamic_icon/android_dynamic_icon.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final _androidDynamicIconPlugin = AndroidDynamicIcon();
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
GestureDetector(
onTap: () async {
await _androidDynamicIconPlugin.changeIcon(
bundleId: "com.example.app",
isNewIcon: false,
iconName: "",
iconNames: ['ic_launcher_new']);
},
child: const Center(
child: Text('Change Icon'),
),
),
const SizedBox(height: 50),
GestureDetector(
onTap: () async {
await _androidDynamicIconPlugin.changeIcon(
bundleId: "com.example.app",
isNewIcon: true,
iconName: "ic_launcher_new",
iconNames: ['ic_launcher_new']);
},
child: const Center(
child: Text('Change Icon'),
),
),
],
),
),
);
}
}