mobileApplicationsKonectarApp/lib/views/notification_screen.dart

237 lines
7.6 KiB
Dart
Raw Permalink Normal View History

2024-01-04 07:06:37 +00:00
import 'package:flutter/material.dart';
class NotificationCustomScreen extends StatefulWidget {
const NotificationCustomScreen({super.key});
@override
State<NotificationCustomScreen> createState() =>
_NotificationCustomScreenState();
}
class _NotificationCustomScreenState extends State<NotificationCustomScreen> {
List<TableRow> tableDataRows = <TableRow>[
const TableRow(
children: [
TableCell(
child: Text('Row 1, Column 1'),
),
TableCell(
child: Text('Row 1, Column 2'),
),
],
),
const TableRow(
children: [
TableCell(
child: Text('Row 2, Column 1'),
),
TableCell(
child: Text('Row 2, Column 2'),
),
],
),
const TableRow(
children: [
TableCell(
child: Text('Row 3, Column 1'),
),
TableCell(
child: Text('Row 3, Column 2'),
),
],
),
const TableRow(
children: [
TableCell(
child: Text('Row 4, Column 1'),
),
TableCell(
child: Text('Row 4, Column 2'),
),
],
),
const TableRow(
children: [
TableCell(
child: Text('Row 5, Column 1'),
),
TableCell(
child: Text('Row 5, Column 2'),
),
],
),
];
@override
Widget build(BuildContext context) {
var headers = ["Start date", "End date", "Note", "Created by"];
var list = [
{
'Start date': "06/09/2023",
"End date": "11/10/2023",
"notification": "Test notifications",
"createdby": "Sneha"
},
{
'Start date': "06/09/2023",
"End date": "11/09/2023",
"notification": "Test notifications",
"createdby": "Sneha"
},
];
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Notifications'),
backgroundColor: const Color.fromARGB(255, 11, 60, 144),
2024-01-04 07:06:37 +00:00
),
body: Padding(
padding: const EdgeInsets.all(20.0),
child: Center(
child: Column(
children: [
Table(
border: TableBorder.all(color: Colors.black),
columnWidths: {
0: FixedColumnWidth(
MediaQuery.of(context).size.height * 0.30),
1: FixedColumnWidth(
MediaQuery.of(context).size.height * 0.30),
2: FixedColumnWidth(
MediaQuery.of(context).size.height * 0.30),
3: FixedColumnWidth(
MediaQuery.of(context).size.height * 0.30)
},
children: [
// for (var item in headers)
TableRow(children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: Text(
headers[0],
style: const TextStyle(fontSize: 18.0),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: Text(
headers[1],
style: const TextStyle(fontSize: 18.0),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: Text(
headers[2],
style: const TextStyle(fontSize: 18.0),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: Text(
headers[3],
style: const TextStyle(fontSize: 18.0),
),
),
),
// Text(item[1]),
// Text(item[2]),
])
]),
Table(
border: TableBorder.all(color: Colors.black),
columnWidths: {
0: FixedColumnWidth(
MediaQuery.of(context).size.height * 0.30),
1: FixedColumnWidth(
MediaQuery.of(context).size.height * 0.30),
2: FixedColumnWidth(
MediaQuery.of(context).size.height * 0.30),
3: FixedColumnWidth(
MediaQuery.of(context).size.height * 0.30)
},
children: [
for (var item in list)
TableRow(children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
item['Start date']!,
style: const TextStyle(fontSize: 18.0),
2024-01-04 07:06:37 +00:00
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
item['End date']!,
style: const TextStyle(fontSize: 18.0),
2024-01-04 07:06:37 +00:00
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
item['notification']!,
style: const TextStyle(fontSize: 18.0),
2024-01-04 07:06:37 +00:00
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
item['createdby']!,
style: const TextStyle(fontSize: 18.0),
2024-01-04 07:06:37 +00:00
),
),
])
]),
],
),
),
),
floatingActionButton: FloatingActionButton(
backgroundColor: const Color.fromARGB(255, 11, 60, 144),
2024-01-04 07:06:37 +00:00
onPressed: () {
setState(() {
// Update the list of table data rows
tableDataRows = [
const TableRow(
children: [
TableCell(
child: Text('Row 1, Column 1 (updated)'),
),
TableCell(
child: Text('Row 1, Column 2 (updated)'),
),
],
),
const TableRow(
children: [
TableCell(
child: Text('Row 2, Column 1 (updated)'),
),
TableCell(
child: Text('Row 2, Column 2 (updated)'),
),
],
),
];
});
},
child: const Icon(Icons.refresh),
2024-01-04 07:06:37 +00:00
),
),
);
}
}