Skip to content

Commit

Permalink
Merge pull request #333 from YujithIsura/main
Browse files Browse the repository at this point in the history
Small attendance dashboard change added
  • Loading branch information
YujithIsura authored Jan 21, 2024
2 parents 868d23b + 07821b7 commit 9e68a4c
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class _AttendanceMissedBySecurityState
columns: [
DataColumn(
label: Text(
"Digital ID",
"Student Name",
style: TextStyle(
fontSize: 13,
fontWeight: FontWeight.w500,
Expand Down Expand Up @@ -102,11 +102,11 @@ DataRow recentFileDataRow(ActivityAttendance fileInfo) {
DataCell(
Row(
children: [
Icon(Icons.usb_rounded, color: Colors.white, size: 20.0),
// Icon(Icons.verified_user, color: Colors.white, size: 20.0),
Padding(
padding: const EdgeInsets.symmetric(horizontal: defaultPadding),
child: Text(
fileInfo.digital_id!,
fileInfo.preferred_name!,
style: TextStyle(
fontSize: 13,
fontWeight: FontWeight.w500,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,51 @@ class LineChartWidget extends StatelessWidget {

@override
Widget build(BuildContext context) {
return AspectRatio(
aspectRatio: 2,
child: LineChart(
LineChartData(
lineBarsData: points.isNotEmpty
? [
LineChartBarData(
spots: points
.where((point) => point.x != null && point.y != null)
.map((point) => FlSpot(point.x!, point.y!))
.toList(),
isCurved: false,
dotData: FlDotData(
show: true,
),
),
]
: [],
borderData: FlBorderData(
border: const Border(bottom: BorderSide(), left: BorderSide()),
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Student Count",
style: TextStyle(
fontSize: 14,
),
gridData: FlGridData(show: false),
titlesData: FlTitlesData(
bottomTitles: AxisTitles(sideTitles: _bottomTitles),
leftTitles: AxisTitles(sideTitles: _leftTitles),
topTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)),
rightTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)),
),
SizedBox(height: 10),
AspectRatio(
aspectRatio: 2,
child: LineChart(
LineChartData(
lineBarsData: points.isNotEmpty
? [
LineChartBarData(
spots: points
.where(
(point) => point.x != null && point.y != null)
.map((point) => FlSpot(point.x!, point.y!))
.toList(),
isCurved: false,
dotData: FlDotData(
show: true,
),
),
]
: [],
borderData: FlBorderData(
border: const Border(bottom: BorderSide(), left: BorderSide()),
),
gridData: FlGridData(show: false),
titlesData: FlTitlesData(
bottomTitles: AxisTitles(sideTitles: _bottomTitles),
leftTitles: AxisTitles(sideTitles: _leftTitles),
topTitles:
AxisTitles(sideTitles: SideTitles(showTitles: false)),
rightTitles:
AxisTitles(sideTitles: SideTitles(showTitles: false)),
),
),
),
),
),
],
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,6 @@ class _AttendanceDashboardScreenState extends State<AttendanceDashboardScreen> {
Widget build(BuildContext context) {
final Size _size = MediaQuery.of(context).size;
bool isMobile = MediaQuery.of(context).size.width < 600;
final dialogWidth = 510.0;
final offsetX = (_size.width - dialogWidth) / 2;
return SafeArea(
child: SingleChildScrollView(
primary: false,
Expand All @@ -312,6 +310,23 @@ class _AttendanceDashboardScreenState extends State<AttendanceDashboardScreen> {
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
ElevatedButton(
onPressed: () => showDateRangePickerDialog(
context: context,
builder: datePickerBuilder,
offset: Offset(20, 155)),
style: ButtonStyle(
padding: MaterialStateProperty.all(EdgeInsets.all(16.0)),
textStyle: MaterialStateProperty.all(
const TextStyle(fontSize: 16),
),
elevation: MaterialStateProperty.all(20),
backgroundColor:
MaterialStateProperty.all(Colors.greenAccent),
foregroundColor: MaterialStateProperty.all(Colors.black),
),
child: Text(formattedStartDate + " - " + formattedEndDate),
),
Expanded(
child: Container(
margin: EdgeInsets.only(left: 8.0),
Expand Down Expand Up @@ -397,23 +412,6 @@ class _AttendanceDashboardScreenState extends State<AttendanceDashboardScreen> {
]),
]),
)),
ElevatedButton(
onPressed: () => showDateRangePickerDialog(
context: context,
builder: datePickerBuilder,
offset: Offset(offsetX, 170)),
style: ButtonStyle(
padding: MaterialStateProperty.all(EdgeInsets.all(16.0)),
textStyle: MaterialStateProperty.all(
const TextStyle(fontSize: 16),
),
elevation: MaterialStateProperty.all(20),
backgroundColor:
MaterialStateProperty.all(Colors.greenAccent),
foregroundColor: MaterialStateProperty.all(Colors.black),
),
child: Text(formattedStartDate + " - " + formattedEndDate),
),
],
),
if (isMobile)
Expand Down Expand Up @@ -571,7 +569,7 @@ class _AttendanceDashboardScreenState extends State<AttendanceDashboardScreen> {
onPressed: () => showDateRangePickerDialog(
context: context,
builder: datePickerBuilderMobile,
offset: Offset(10, 220)),
offset: Offset(5, 220)),
style: ButtonStyle(
padding:
MaterialStateProperty.all(EdgeInsets.all(16.0)),
Expand All @@ -596,7 +594,7 @@ class _AttendanceDashboardScreenState extends State<AttendanceDashboardScreen> {
// Existing Column
Column(
children: [
SizedBox(height: defaultPadding),
SizedBox(height: 10),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expand Down Expand Up @@ -632,10 +630,12 @@ class _AttendanceDashboardScreenState extends State<AttendanceDashboardScreen> {
if (Responsive.isMobile(context))
SizedBox(height: defaultPadding),
if (Responsive.isMobile(context))
StorageDetails(
fetchedPieChartData: this._fetchedPieChartData,
totalStudentCount: this.totalStudentCount,
totalAttendance: this.totalAttendance),
if (this.totalStudentCount > 0)
StorageDetails(
fetchedPieChartData:
this._fetchedPieChartData,
totalStudentCount: this.totalStudentCount,
totalAttendance: this.totalAttendance),
],
),
),
Expand Down Expand Up @@ -668,13 +668,14 @@ class _AttendanceDashboardScreenState extends State<AttendanceDashboardScreen> {
if (!Responsive.isMobile(context))
SizedBox(width: defaultPadding),
if (!Responsive.isMobile(context))
Expanded(
flex: 2,
child: StorageDetails(
fetchedPieChartData: this._fetchedPieChartData,
totalStudentCount: this.totalStudentCount,
totalAttendance: this.totalAttendance),
),
if (this.totalStudentCount > 0)
Expanded(
flex: 2,
child: StorageDetails(
fetchedPieChartData: this._fetchedPieChartData,
totalStudentCount: this.totalStudentCount,
totalAttendance: this.totalAttendance),
),
],
)
],
Expand Down

0 comments on commit 9e68a4c

Please sign in to comment.