Skip to main content

LMFeedTile

LMFeedTile is a customizable widget designed for displaying tiles within the Flutter UI library. It provides a flexible layout for displaying various content elements, such as leading, title, subtitle, and trailing widgets, along with support for tap actions and styling options.


LMFeedTile

The LMFeedTile widget is a versatile component that can be used to create list items, cards, or any other type of tile-based UI element. It allows you to customize the appearance and behavior of the tile, including background color, border, border radius, padding, and more.

Properties

  • onTap (VoidCallback)

An optional callback function that is invoked when the tile is tapped.

  • style (LMFeedTileStyle)

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

  • leading (Widget)

An optional widget to be displayed at the leading edge of the tile, typically used for displaying an icon, image, or other content.

  • title (Widget)

An optional widget to be displayed as the title of the tile.

  • subtitle (Widget)

An optional widget to be displayed as the subtitle of the tile.

  • trailing (Widget)

An optional widget to be displayed at the trailing edge of the tile, typically used for displaying action buttons or other controls.

Styling

The LMFeedTileStyle class provides a way to define the visual style of the tile. It includes properties for background color, border, border radius, main axis alignment, padding, height, width, and margin.

Customization variables

PropertyTypeDescriptionRequiredDefault
backgroundColorColorBackground color of the tile
borderBorderBorder of the tile
borderRadiusdoubleBorder radius of the tile
mainAxisAlignmentMainAxisAlignmentMain axis alignment for the row inside the tileMainAxisAlignment.start
paddingEdgeInsetsPadding from exterior bounds (borders)EdgeInsets.all(12)
heightdoubleHeight of the tile
widthdoubleWidth of the tiledouble.infinity
margindoubleMargin between tiles12.0

Usage Example

LMFeedTile(
onTap: () {
// Handle tile tap
},
style: LMFeedTileStyle(
backgroundColor: Colors.grey.withOpacity(0.2),
borderRadius: 8,
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
),
leading: LMFeedIcon(
type: LMFeedIconType.icon,
icon: Icons.account_circle,
style: LMFeedIconStyle(
size: 48,
color: Colors.blue,
),
),
title: LMFeedText(
text: 'John Doe',
style: LMFeedTextStyle(
textStyle: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
),
),
),
subtitle: LMFeedText(
text: 'Software Engineer',
style: LMFeedTextStyle(
textStyle: TextStyle(
color: Colors.grey,
fontSize: 14,
),
),
),
trailing: LMFeedButton(
style: LMFeedButtonStyle(
icon: LMFeedIcon(
type: LMFeedIconType.icon,
icon: Icons.chevron_right,
),
),
),
),

This example creates an LMFeedTile with a leading profile icon, a title displaying "John Doe", a subtitle displaying "Software Engineer", and a trailing chevron icon button. The tile is styled with a semi-transparent grey background color, a border radius of 8 pixels, and horizontal padding of 16 pixels. When tapped, it triggers the onTap callback function, allowing you to handle the tile's action.