1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] Format date and time column in datatable should not show the same value in all rows

Discussão em 'Mobile' iniciado por Stack, Novembro 7, 2024 às 18:32.

  1. Stack

    Stack Membro Participativo

    I am using Flutter datatable class.

    I need to show a different date and time value in each row.

    The issue is that all rows show the same value.

    Preferably, I need to show the date created date and time, but Flutter has only date modified.

    Could you please provide your feedback.

    Thank You

    Here is my code:

    DateFormat dateFormat = DateFormat();
    List<DataRow> myDataRow = [];
    DateTime FileLastModified=DateTime.timestamp();

    Future<List<DataRow>> myTest() async {
    Directory dir = Directory('C:/test');
    final List<FileSystemEntity> entities = await dir.list().toList();
    for(var file in entities) {
    if(file.path.isNotEmpty){
    File(file.path).lastModified().then((value){
    FileLastModified = value;
    });
    myDataRow.add(DataRow(cells: <DataCell>[
    DataCell(Text(dateFormat.format(FileLastModified).toString())),
    ]));
    }
    }
    return myDataRow;
    }


    Issue: I see the same value in all rows.

    [​IMG]

    Continue reading...

Compartilhe esta Página