Kseg class
A widget that displays text with different styles for Khmer and Latin scripts.
The Kseg widget automatically detects and segments text by script type (Khmer, Latin, or other) and applies the appropriate styling to each segment. This enables proper typographic treatment of mixed-script text, ensuring that each script is displayed with appropriate font, size, and styling.
Kseg supports both system fonts and Google Fonts, with Google Fonts enabled by default. For each script type (Khmer and Latin), you can specify a wide range of styling properties, including font family, size, weight, color, letter spacing, and text decoration.
Example:
Kseg(
text: "តេស្តTest អក្សរខ្មែរ Latin script",
khFont: "Battambang",
latinFont: "Roboto",
khFontSize: 18,
latinFontSize: 16,
khColor: Colors.blue,
latinColor: Colors.black,
)
- Inheritance
Constructors
-
Kseg({Key? key, required String text, double? khFontSize, FontWeight? khFontWeight, FontStyle? khFontStyle, String? khFont, Color? khColor, Color? khBackgroundColor, double? khLetterSpacing, double? khWordSpacing, TextBaseline? khTextBaseline, double? khHeight, List<
Shadow> ? khShadows, TextDecoration? khDecoration, Color? khDecorationColor, TextDecorationStyle? khDecorationStyle, double? khDecorationThickness, bool khUseGoogleFont = true, double? latinFontSize, FontWeight? latinFontWeight, FontStyle? latinFontStyle, String? latinFont, Color? latinColor, Color? latinBackgroundColor, double? latinLetterSpacing, double? latinWordSpacing, TextBaseline? latinTextBaseline, double? latinHeight, List<Shadow> ? latinShadows, TextDecoration? latinDecoration, Color? latinDecorationColor, TextDecorationStyle? latinDecorationStyle, double? latinDecorationThickness, bool latinUseGoogleFont = true, TextAlign? textAlign, TextDirection? textDirection, Locale? locale, TextOverflow? overflow, int? maxLines, bool? softWrap, TextWidthBasis? textWidthBasis, TextHeightBehavior? textHeightBehavior}) -
Creates a new Kseg widget with support for both system fonts and Google Fonts.
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- khBackgroundColor → Color?
-
Background color for Khmer text
final
- khColor → Color?
-
Text color for Khmer text
final
- khDecoration → TextDecoration?
-
Text decoration for Khmer text
final
- khDecorationColor → Color?
-
Text decoration color for Khmer text
final
- khDecorationStyle → TextDecorationStyle?
-
Text decoration style for Khmer text
final
- khDecorationThickness → double?
-
Text decoration thickness for Khmer text
final
- khFont → String?
-
Font family for Khmer text (system font or Google Font name)
final
- khFontSize → double?
-
Font size for Khmer text
final
- khFontStyle → FontStyle?
-
Font style for Khmer text
final
- khFontWeight → FontWeight?
-
Font weight for Khmer text
final
- khHeight → double?
-
Height for Khmer text
final
- khLetterSpacing → double?
-
Letter spacing for Khmer text
final
-
khShadows
→ List<
Shadow> ? -
Shadows for Khmer text
final
- khTextBaseline → TextBaseline?
-
Text baseline for Khmer text
final
- khUseGoogleFont → bool
-
Whether to use Google Fonts for the Khmer font
final
- khWordSpacing → double?
-
Word spacing for Khmer text
final
- latinBackgroundColor → Color?
-
Background color for Latin text
final
- latinColor → Color?
-
Text color for Latin text
final
- latinDecoration → TextDecoration?
-
Text decoration for Latin text
final
- latinDecorationColor → Color?
-
Text decoration color for Latin text
final
- latinDecorationStyle → TextDecorationStyle?
-
Text decoration style for Latin text
final
- latinDecorationThickness → double?
-
Text decoration thickness for Latin text
final
- latinFont → String?
-
Font family for Latin text (system font or Google Font name)
final
- latinFontSize → double?
-
Font size for Latin text
final
- latinFontStyle → FontStyle?
-
Font style for Latin text
final
- latinFontWeight → FontWeight?
-
Font weight for Latin text
final
- latinHeight → double?
-
Height for Latin text
final
- latinLetterSpacing → double?
-
Letter spacing for Latin text
final
-
latinShadows
→ List<
Shadow> ? -
Shadows for Latin text
final
- latinTextBaseline → TextBaseline?
-
Text baseline for Latin text
final
- latinUseGoogleFont → bool
-
Whether to use Google Fonts for the Latin font
final
- latinWordSpacing → double?
-
Word spacing for Latin text
final
- locale → Locale?
-
Locale for the entire widget
final
- maxLines → int?
-
Maximum lines for the entire widget
final
- overflow → TextOverflow?
-
Overflow behavior for the entire widget
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- softWrap → bool?
-
Soft wrap for the entire widget
final
- text → String
-
The text to display
final
- textAlign → TextAlign?
-
Text align for the entire widget
final
- textDirection → TextDirection?
-
Text direction for the entire widget
final
- textHeightBehavior → TextHeightBehavior?
-
Text height behavior for the entire widget
final
- textWidthBasis → TextWidthBasis?
-
Text width basis for the entire widget
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited