Skip to main content

LMFeedIcon

LMFeedIcon is a versatile widget designed for displaying icons within the Flutter UI library. It supports three types of icons: Material Design icons, PNG images, and SVG images. Additionally, it offers extensive customization options through the LMFeedIconStyle class.


LMFeedIcon

The LMFeedIcon widget provides a unified interface for displaying icons of various formats, including Material Design icons, PNG images, and SVG images. It allows developers to easily incorporate icons into their user interfaces while maintaining a consistent appearance and behavior throughout the application.

Properties

  • type (LMFeedIconType)

An enum value that specifies the type of icon to be displayed. The available options are:

  • LMFeedIconType.icon: For Material Design icons

  • LMFeedIconType.svg: For SVG images

  • LMFeedIconType.webp: For PNG images

  • icon (IconData)

The IconData representing the Material Design icon to be displayed. This property is required when type is set to LMFeedIconType.icon.

  • assetPath (String)

The asset path for the PNG or SVG image to be displayed. This property is required when type is set to LMFeedIconType.webp or LMFeedIconType.svg.

  • style (LMFeedIconStyle)

An optional style class that allows customization of the icon's appearance, such as color, size, background color, padding, and more.

Styling

The LMFeedIconStyle class provides a way to define the visual style of the icon. It includes properties for icon color, size, background color, padding, border radius, and more.

Customization variables

PropertyTypeDescriptionRequiredDefault
colorColorColor of the icon (not applicable for PNG icons)
sizedoubleSquare size of the icon24.0
boxSizedoubleSquare size of the box surrounding the icon
boxBorderdoubleWeight of the border around the box
boxBorderRadiusdoubleRadius of the box around the icon
boxPaddingdoublePadding around the icon with respect to the box0.0
backgroundColorColorColor of the box or background color of the icon
fitBoxFitHow the icon should be fit inside the boxBoxFit.contain

Usage Example

LMFeedIcon(
type: LMFeedIconType.icon,
icon: Icons.favorite,
style: LMFeedIconStyle(
color: Colors.red,
size: 32,
boxSize: 48,
boxBorderRadius: 8,
backgroundColor: Colors.grey.withOpacity(0.2),
),
),

This example creates a LMFeedIcon widget displaying a Material Design icon (Icons.favorite). The icon is styled with a red color, a size of 32 pixels, and is placed inside a box with a size of 48 pixels, a border radius of 8 pixels, and a semi-transparent grey background color.