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.
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
Property | Type | Description | Required | Default |
---|---|---|---|---|
backgroundColor | Color | Background color of the tile | ||
border | Border | Border of the tile | ||
borderRadius | double | Border radius of the tile | ||
mainAxisAlignment | MainAxisAlignment | Main axis alignment for the row inside the tile | MainAxisAlignment.start | |
padding | EdgeInsets | Padding from exterior bounds (borders) | EdgeInsets.all(12) | |
height | double | Height of the tile | ||
width | double | Width of the tile | double.infinity | |
margin | double | Margin between tiles | 12.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.