getText method

List<Widget> getText()

Implementation

List<Widget> getText() {
  bool disabled = files.length > 0 || widget.options!.disabled;

  if (reading) {
    return [
      Text("Preparing files...",
          style: GoogleFonts.getFont('Open Sans',
              fontSize: 16,
              fontWeight: FontWeight.w700,
              color: Colors.blueGrey)),
    ];
  }

  if (files.length == 0) {
    var file = widget.block["file"] ?? {};
    String format = file["format"] ?? "";
    format = format.replaceAll(".", "").split(",").join(", ");
    return [
      Text("Choose a $format file",
          style: GoogleFonts.getFont('Open Sans',
              fontSize: 16,
              fontWeight: FontWeight.w700,
              color: disabled ? Colors.grey.shade500 : Colors.blueGrey)),
      Text(" or drag it here.",
          style: GoogleFonts.getFont('Open Sans',
              fontSize: 16,
              fontWeight: FontWeight.w400,
              color: disabled ? Colors.grey.shade500 : Colors.blueGrey))
    ];
  }

  List<Widget> names = [
    Column(
      crossAxisAlignment: CrossAxisAlignment.center,
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        Text("Done!",
            style: GoogleFonts.getFont('Open Sans',
                fontSize: 16,
                fontWeight: FontWeight.w700,
                color: Colors.blueGrey)),
      ],
    )
  ];

  for (var file in files.keys) {
    names.add(Column(
      children: [
        Text(file.name,
            style: GoogleFonts.getFont('Open Sans',
                fontSize: 14,
                fontWeight: FontWeight.w700,
                color: Colors.blueGrey)),
      ],
    ));
  }

  return [
    Column(
      children: names,
    )
  ];
}