t static method

Widget t(
  1. String text,
  2. VoidCallback? onPressed, {
  3. Color? textColor,
  4. double textDimen = 0,
  5. String? fontFamily,
  6. Color? background,
  7. double? width,
  8. double? height,
  9. Color? borderLine,
  10. double? borderRadius,
  11. Decoration? decoration,
  12. VoidCallback? onLongPress,
  13. EdgeInsets? margin,
  14. EdgeInsets? padding,
  15. LevelDS levelDS = LevelDS.l1,
  16. TextAlign textAlign = TextAlign.center,
  17. 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;
}