import 'package:admin/models/student_table.dart';

import 'package:flutter/material.dart';

import '../../../constants.dart';

class StudentsTable extends StatelessWidget {
  const StudentsTable({
    Key? key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.all(defaultPadding),
      decoration: BoxDecoration(
        color: secondaryColor,
        borderRadius: const BorderRadius.all(Radius.circular(10)),
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Text(
            "Alunos",
            style: Theme.of(context).textTheme.titleMedium,
          ),
          SizedBox(
            width: double.infinity,
            child: DataTable(
              columnSpacing: defaultPadding,
              // minWidth: 600,
              columns: [
                DataColumn(
                  label: Text("Nome de Usuario"),
                ),
                DataColumn(
                  label: Text("Ultimo Acesso"),
                ),
              ],
              rows: List.generate(
                demoStudentTable.length,
                (index) => recentFileDataRow(demoStudentTable[index]),
              ),
            ),
          ),
        ],
      ),
    );
  }
}

DataRow recentFileDataRow(StudentTable fileInfo) {
  return DataRow(
    cells: [
      DataCell(Text(fileInfo.title!)),
      DataCell(Text(fileInfo.date!)),
    ],
  );
}
