t static method
Widget
t(
- String text,
- VoidCallback? onPressed, {
- Color? textColor,
- double textDimen = 0,
- String? fontFamily,
- Color? background,
- double? width,
- double? height,
- Color? borderLine,
- double? borderRadius,
- Decoration? decoration,
- VoidCallback? onLongPress,
- EdgeInsets? margin,
- EdgeInsets? padding,
- LevelDS levelDS = LevelDS.l1,
- TextAlign textAlign = TextAlign.center,
- Alignment? gravityLayout,
read parameter types to use it in your UserInterface
Implementation
static Widget t(String text, VoidCallback? onPressed,
{
Color? textColor ,
double textDimen = 0,
String? fontFamily,
Color? background,
double? width,
double? height,
//decoration
Color? borderLine,
double? borderRadius,
Decoration? decoration, // must before use this use also width fixed and height
VoidCallback? onLongPress,
EdgeInsets? margin,
EdgeInsets? padding,
LevelDS levelDS = LevelDS.l1,
TextAlign textAlign = TextAlign.center,
Alignment? gravityLayout //container alignment
}) {
//text dimen, text color, button color, font
double textDimen_ds =
DesignSystemTools.getDimenDesignSystem_text(levelDS, textDimen);
Color textColor_ds =
DesignSystemTools.getColorDesignSystem_buttonText(levelDS, textColor);
Color backgroundColor_ds =
DesignSystemTools.getColorDesignSystem_buttonBackground(
levelDS, background);
String font_ds =
DesignSystemTools.getFontDesignSystem_button(levelDS, fontFamily);
//padding default
// padding ??= EdgeInsets.only(left: 3.7, right: 3.7, top: 3.7, bottom: 3.7);
padding ??= EdgeInsets.symmetric(
horizontal: DSDimen.button_padding_horizontal,
vertical: DSDimen.button_padding_vertical
);
//margin fix
margin = EdgeInsetsTools.fixDefaultSpace(margin, 6);
//text
var txt = _getText(text, textAlign, textColor_ds, textDimen_ds, padding, font_ds);
//style button
ButtonStyle style = _getButtonStyle(backgroundColor_ds,
width, height, borderLine, borderRadius, textDimen);
//button
var bt = ElevatedButton(
onPressed: onPressed,
onLongPress: onLongPress,
child: txt,
style: style,
);
//container
var ct = Container(
width: width,
height: height,
margin: margin,
alignment: gravityLayout,
child: bt,
decoration: decoration,
);
return ct;
}