LMFeedUserTile
LMFeedUserTile
is a customised widget that extends the LMFeedTile
widget, designed for displaying user information within the Flutter UI library. It provides a consistent and customizable layout for displaying user details such as profile picture, name, and subtitle (e.g., username or other information).
The LMFeedUserTile
widget leverages the LMFeedTile
widget to create a user-centric tile component. It automatically renders the user's profile picture, name, and an optional subtitle based on the provided LMUserViewData
object. Additionally, it allows for customization of the tile's appearance and behavior through various styling options and callbacks.
Properties
user
(LMUserViewData)
A required LMUserViewData
object that contains the user's information, such as their name, image URL, and other relevant data.
onTap
(VoidCallback)
An optional callback function that is invoked when the user 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.
title
(Widget)
An optional widget to be displayed as the title of the user tile. If not provided, the user's name from the LMUserViewData
object will be displayed.
subtitle
(Widget)
An optional widget to be displayed as the subtitle of the user tile. If not provided, the user's username (derived from their name) will be displayed.
Styling
The LMFeedUserTile
widget inherits the styling capabilities from the LMFeedTile
widget. You can customize the appearance of the user tile by providing a LMFeedTileStyle
object to the style
property.
Additionally, the LMFeedUserTile
widget applies its own default styling to the profile picture and text components based on the current LMFeedThemeData
.
Usage Example
LMFeedUserTile(
user: LMUserViewData(
name: 'John Doe',
imageUrl: 'https://example.com/profile.jpg',
// Additional user data
),
onTap: () {
// Handle user tile tap
},
style: LMFeedTileStyle(
backgroundColor: Colors.grey.shade200,
borderRadius: 8,
),
),
This example creates an LMFeedUserTile
widget with the user's name and profile picture. The tile is styled with a light grey background color and a border radius of 8 pixels. When tapped, it triggers the onTap
callback function, allowing you to handle the user tile's action.