Skip to main content

LMFeedText

LMFeedText is a widget designed for displaying customizable text within the Flutter UI library. It offers extensive styling options and interactivity, such as tap actions.


LMFeedText

The LMFeedText widget is utilized to display text with customizable styling and behavior. It supports text alignment, overflow, maximum lines, and tap actions, making it versatile for various UI components.

Properties

  • text (String)

The text content to be displayed.

  • style (LMFeedTextStyle)

An optional style class to customize the appearance of the text, including font size, color, weight, and more.

  • onTap (Function())

An optional callback function that is invoked when the text is tapped. This can be used to add interactivity to the text.

Styling

The LMFeedTextStyle class provides a way to define the visual style of the text. It includes properties for text alignment, overflow behavior, maximum lines, and the text style itself. It also has copyWith() functionality to allow reusability of styles throughout the feed.

Customization variables

PropertyTypeDescriptionRequiredDefault
selectableboolDetermines if the text is selectable.false
maxLinesintMaximum number of lines for the text.1
overflowTextOverflowOverflow behavior for the text.ellipsis
textAlignTextAlignAlignment of the text.start
textStyleTextStyleFlutter text style for font size, color, weight.

Usage Example

LMFeedText(
text: "Tap me!",
style: LMFeedTextStyle(
textStyle: TextStyle(
color: Colors.blue,
fontWeight: FontWeight.bold,
fontSize: 16,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
onTap: () {
// Custom logic for tap action
},
),

This example demonstrates how to create a LMFeedText widget with custom styling and a tap action. The text "Tap me!" is styled with a bold, blue font and is limited to two lines with ellipsis overflow. When tapped, it triggers a custom logic defined in the onTap callback.