Master Windows Taskbar Utilities with Flutter Plugins
Published on by Flutter News Hub
Windows Taskbar offers a range of customization options to enhance your app's user experience. With the help of the windows_taskbar
Flutter plugin, you can easily tap into these capabilities and provide a seamless experience for your Windows users. Here's a comprehensive guide to get you started:
Set a Custom Thumbnail Toolbar
Add a customizable toolbar to your app's taskbar thumbnail:
WindowsTaskbar.setThumbnailToolbar([
ThumbnailToolbarButton(
ThumbnailToolbarAssetIcon('assets/camera.ico'),
'Turn On Camera',
() {},
),
ThumbnailToolbarButton(
ThumbnailToolbarAssetIcon('assets/microphone.ico'),
'Mute',
() {},
mode: ThumbnailToolbarButtonMode.disabled | ThumbnailToolbarButtonMode.dismissionClick,
),
ThumbnailToolbarButton(
ThumbnailToolbarAssetIcon('assets/end_call.ico'),
'Disconnect',
() {},
),
]);
Remove the Thumbnail Toolbar
Remove the custom toolbar when needed:
WindowsTaskbar.resetThumbnailToolbar();
Control Progress Mode and Progress
Set the progress mode and update the progress bar:
WindowsTaskbar.setProgressMode(TaskbarProgressMode.indeterminate);
WindowsTaskbar.setProgress(69, 100);
Add a Thumbnail Tooltip
Provide additional information to users when hovering over the taskbar thumbnail:
WindowsTaskbar.setThumbnailTooltip('Awesome Flutter window.');
Flash the Windows Taskbar App Icon
Grab users' attention by flashing the app icon in the taskbar:
WindowsTaskbar.setFlashTaskbarAppIcon(
mode: TaskbarFlashMode.all | TaskbarFlashMode.timernofg,
timeout: const Duration(milliseconds: 500),
);
Stop Flashing the App Icon
Return the icon to its normal state:
WindowsTaskbar.resetFlashTaskbarAppIcon();
Add an Overlay Icon (Badge)
Display a badge on the taskbar icon to indicate notifications or other relevant information:
WindowsTaskbar.setOverlayIcon(
ThumbnailToolbarAssetIcon('assets/red_slash.ico'),
tooltip: 'Stop',
);
Remove the Overlay Icon
Clear the badge from the taskbar icon:
WindowsTaskbar.resetOverlayIcon();
Set and Reset the Window Title (Taskbar Button Label)
Customize the window title displayed on the taskbar button:
WindowsTaskbar.setWindowTitle('Never Gonna Give You Up');
WindowsTaskbar.resetWindowTitle();
Additional Resources
Conclusion
With the windows_taskbar
plugin, you can enhance your Flutter app's presence in the Windows environment, providing users with a more immersive and engaging experience. By leveraging these utilities, you can customize the taskbar thumbnail, control progress indicators, display notifications, and much more.