This commit is contained in:
erfan
2021-06-21 14:14:54 +04:30
parent 2c045f43f1
commit e2b8fab7d9
60 changed files with 4078 additions and 3928 deletions
+233 -231
View File
@@ -1,11 +1,11 @@
import 'package:cssd/providers/test_results.dart';
import 'package:cssd/widgets/TestResultScreens/Main/search_box.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../config/routes.dart';
import '../models/test_result_models.dart';
import '../providers/auth.dart';
import '../providers/test_results.dart';
import '../widgets/TestResultScreens/Main/search_box.dart';
class TestVerifyScreen extends StatefulWidget {
// static const route = '/TestVerifyScreen';
@@ -70,236 +70,238 @@ class _TestVerifyScreenState extends State<TestVerifyScreen> {
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100;
return Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Home'),
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
size: 35,
return SafeArea(
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Home'),
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
),
onPressed: () => Navigator.of(context).pop(),
),
),
body: Padding(
padding: EdgeInsets.only(top: 20, left: 20, right: 20, bottom: 60),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
// crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
// padding: EdgeInsets.only(top: 20, bottom: 40),
child: Text(
'TESTS TO VERIFY',
// textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black,
fontSize: 6 * _deviceBlockSize,
fontWeight: FontWeight.w700,
letterSpacing: 2,
body: Padding(
padding: EdgeInsets.only(top: 20, left: 20, right: 20, bottom: 60),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
// crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
// padding: EdgeInsets.only(top: 20, bottom: 40),
child: Text(
'TESTS TO VERIFY',
// textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black,
fontSize: 6 * _deviceBlockSize,
fontWeight: FontWeight.w700,
letterSpacing: 2,
),
),
),
),
// Spacer(),
// InkWell(
// onTap: () {
// Navigator.of(context)
// .popAndPushNamed(Routes.testFilterScreen);
// },
// child: Container(
// padding: EdgeInsets.all(7),
// child: Icon(
// FontAwesomeIcons.filter,
// size: 7 * _deviceBlockSize,
// ),
// ),
// ),
],
),
SizedBox(
height: 20,
),
// Consumer<TestResultsProvider>(
// builder: (context, testResult, _) {
// return Container(
// height: 50,
// child: ListView(
// scrollDirection: Axis.horizontal,
// shrinkWrap: true,
// children: <Widget>[
// InkWell(
// onTap: () {
// Navigator.of(context)
// .popAndPushNamed(Routes.testFilterScreen);
// },
// child: Chip(
// backgroundColor: Colors.black,
// label: Text(
// 'Filters',
// style: TextStyle(
// color: Colors.white,
// ),
// ),
// deleteIcon: Icon(
// FontAwesomeIcons.filter,
// color: Colors.white,
// size: 4 * _deviceBlockSize,
// ),
// onDeleted: () {
// Navigator.of(context)
// .popAndPushNamed(Routes.testFilterScreen);
// },
// ),
// ),
// testResult.filters.id != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'ID',
// id: '',
// labelID: testResult.filters.labelID,
// testType: testResult.filters.testType,
// hospital: testResult.filters.hospital,
// username: testResult.filters.userName,
// fDate: testResult.filters.fDate,
// uDate: testResult.filters.uDate,
// )
// : Container(),
// testResult.filters.labelID != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'Label ID',
// id: testResult.filters.id,
// labelID: '',
// testType: testResult.filters.testType,
// hospital: testResult.filters.hospital,
// username: testResult.filters.userName,
// fDate: testResult.filters.fDate,
// uDate: testResult.filters.uDate,
// )
// : Container(),
// testResult.filters.testType != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'Test Type',
// id: testResult.filters.id,
// labelID: testResult.filters.labelID,
// testType: '',
// hospital: testResult.filters.hospital,
// username: testResult.filters.userName,
// fDate: testResult.filters.fDate,
// uDate: testResult.filters.uDate,
// )
// : Container(),
// testResult.filters.hospital != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'Hospital',
// id: testResult.filters.id,
// labelID: testResult.filters.labelID,
// testType: testResult.filters.testType,
// hospital: '',
// username: testResult.filters.userName,
// fDate: testResult.filters.fDate,
// uDate: testResult.filters.uDate,
// )
// : Container(),
// testResult.filters.userName != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'Username',
// id: testResult.filters.id,
// labelID: testResult.filters.labelID,
// testType: testResult.filters.testType,
// hospital: testResult.filters.hospital,
// username: '',
// fDate: testResult.filters.fDate,
// uDate: testResult.filters.uDate,
// )
// : Container(),
// testResult.filters.fDate != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'From Date',
// id: testResult.filters.id,
// labelID: testResult.filters.labelID,
// testType: testResult.filters.testType,
// hospital: testResult.filters.hospital,
// username: testResult.filters.userName,
// fDate: '',
// uDate: testResult.filters.uDate,
// )
// : Container(),
// testResult.filters.uDate != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'Until Date',
// id: testResult.filters.id,
// labelID: testResult.filters.labelID,
// testType: testResult.filters.testType,
// hospital: testResult.filters.hospital,
// username: testResult.filters.userName,
// fDate: testResult.filters.fDate,
// uDate: '',
// )
// : Container(),
// ],
// ),
// );
// },
// ),
TestResultSearchBox(
searchCTRL: searchCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 20,
),
Expanded(
child: Consumer<TestResultsProvider>(
builder: (context, testResults, _) {
return testResults.isloading
? Center(
child: CircularProgressIndicator(),
)
: ListView.builder(
controller: sc,
itemBuilder: (context, index) =>
(testResults.items[index].verified == 'None' &&
userData['roles']
.contains('Supervisor')) ||
userData['roles'].contains('Admin')
? TestItemBox(
deviceBlockSize: _deviceBlockSize,
item: testResults.items[index],
id: testResults.items[index].id,
userData: userData,
)
: Container(),
// Column(
// children: <Widget>[
// Text(testResults.items[index].name),
// Text(testResults.items[index].isVerified.toString()),
// Text(testResults.items[index].hospital),
// Text(testResults.items[index].date),
// ],
// ),
// ChangeNotifierProvider.value(
// value: testResults.items[index],
// child: ResultCard(
// isAdmin: widget.isAdmin,
// ),
// ),
itemCount: testResults.items.length,
shrinkWrap: true,
);
},
// Spacer(),
// InkWell(
// onTap: () {
// Navigator.of(context)
// .popAndPushNamed(Routes.testFilterScreen);
// },
// child: Container(
// padding: EdgeInsets.all(7),
// child: Icon(
// FontAwesomeIcons.filter,
// size: 7 * _deviceBlockSize,
// ),
// ),
// ),
],
),
),
],
SizedBox(
height: 20,
),
// Consumer<TestResultsProvider>(
// builder: (context, testResult, _) {
// return Container(
// height: 50,
// child: ListView(
// scrollDirection: Axis.horizontal,
// shrinkWrap: true,
// children: <Widget>[
// InkWell(
// onTap: () {
// Navigator.of(context)
// .popAndPushNamed(Routes.testFilterScreen);
// },
// child: Chip(
// backgroundColor: Colors.black,
// label: Text(
// 'Filters',
// style: TextStyle(
// color: Colors.white,
// ),
// ),
// deleteIcon: Icon(
// FontAwesomeIcons.filter,
// color: Colors.white,
// size: 4 * _deviceBlockSize,
// ),
// onDeleted: () {
// Navigator.of(context)
// .popAndPushNamed(Routes.testFilterScreen);
// },
// ),
// ),
// testResult.filters.id != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'ID',
// id: '',
// labelID: testResult.filters.labelID,
// testType: testResult.filters.testType,
// hospital: testResult.filters.hospital,
// username: testResult.filters.userName,
// fDate: testResult.filters.fDate,
// uDate: testResult.filters.uDate,
// )
// : Container(),
// testResult.filters.labelID != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'Label ID',
// id: testResult.filters.id,
// labelID: '',
// testType: testResult.filters.testType,
// hospital: testResult.filters.hospital,
// username: testResult.filters.userName,
// fDate: testResult.filters.fDate,
// uDate: testResult.filters.uDate,
// )
// : Container(),
// testResult.filters.testType != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'Test Type',
// id: testResult.filters.id,
// labelID: testResult.filters.labelID,
// testType: '',
// hospital: testResult.filters.hospital,
// username: testResult.filters.userName,
// fDate: testResult.filters.fDate,
// uDate: testResult.filters.uDate,
// )
// : Container(),
// testResult.filters.hospital != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'Hospital',
// id: testResult.filters.id,
// labelID: testResult.filters.labelID,
// testType: testResult.filters.testType,
// hospital: '',
// username: testResult.filters.userName,
// fDate: testResult.filters.fDate,
// uDate: testResult.filters.uDate,
// )
// : Container(),
// testResult.filters.userName != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'Username',
// id: testResult.filters.id,
// labelID: testResult.filters.labelID,
// testType: testResult.filters.testType,
// hospital: testResult.filters.hospital,
// username: '',
// fDate: testResult.filters.fDate,
// uDate: testResult.filters.uDate,
// )
// : Container(),
// testResult.filters.fDate != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'From Date',
// id: testResult.filters.id,
// labelID: testResult.filters.labelID,
// testType: testResult.filters.testType,
// hospital: testResult.filters.hospital,
// username: testResult.filters.userName,
// fDate: '',
// uDate: testResult.filters.uDate,
// )
// : Container(),
// testResult.filters.uDate != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'Until Date',
// id: testResult.filters.id,
// labelID: testResult.filters.labelID,
// testType: testResult.filters.testType,
// hospital: testResult.filters.hospital,
// username: testResult.filters.userName,
// fDate: testResult.filters.fDate,
// uDate: '',
// )
// : Container(),
// ],
// ),
// );
// },
// ),
TestResultSearchBox(
searchCTRL: searchCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 20,
),
Expanded(
child: Consumer<TestResultsProvider>(
builder: (context, testResults, _) {
return testResults.isloading
? Center(
child: CircularProgressIndicator(),
)
: ListView.builder(
controller: sc,
itemBuilder: (context, index) =>
(testResults.items[index].verified == 'None' &&
userData['roles']
.contains('Supervisor')) ||
userData['roles'].contains('Admin')
? TestItemBox(
deviceBlockSize: _deviceBlockSize,
item: testResults.items[index],
id: testResults.items[index].id,
userData: userData,
)
: Container(),
// Column(
// children: <Widget>[
// Text(testResults.items[index].name),
// Text(testResults.items[index].isVerified.toString()),
// Text(testResults.items[index].hospital),
// Text(testResults.items[index].date),
// ],
// ),
// ChangeNotifierProvider.value(
// value: testResults.items[index],
// child: ResultCard(
// isAdmin: widget.isAdmin,
// ),
// ),
itemCount: testResults.items.length,
shrinkWrap: true,
);
},
),
),
],
),
),
),
);
@@ -401,7 +403,7 @@ class TestItemBox extends StatelessWidget {
content: Text(
'Are you sure for verify this test?'),
actions: <Widget>[
FlatButton(
TextButton(
onPressed: () async {
Provider.of<TestResultsProvider>(
context)
@@ -418,7 +420,7 @@ class TestItemBox extends StatelessWidget {
},
child: Text('Yes'),
),
FlatButton(
TextButton(
onPressed: () {
Navigator.of(ctx).pop();
},
@@ -454,7 +456,7 @@ class TestItemBox extends StatelessWidget {
content: Text(
'Are you sure for reject this test?'),
actions: <Widget>[
FlatButton(
TextButton(
onPressed: () async {
await Provider.of<TestResultsProvider>(
context)
@@ -471,7 +473,7 @@ class TestItemBox extends StatelessWidget {
},
child: Text('Yes'),
),
FlatButton(
TextButton(
onPressed: () {
Navigator.of(ctx).pop();
},