This commit is contained in:
erfan hayat'bakhsh
2020-08-01 14:16:20 +04:30
parent 30f10dca2e
commit e4d29c4e3c
71 changed files with 5018 additions and 2319 deletions
+1 -1
View File
@@ -39,7 +39,7 @@ android {
defaultConfig { defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.cssd" applicationId "com.example.cssd"
minSdkVersion 18 minSdkVersion 21
targetSdkVersion 28 targetSdkVersion 28
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
+1 -1
View File
@@ -9,7 +9,7 @@
FlutterApplication and put your custom class here. --> FlutterApplication and put your custom class here. -->
<application <application
android:name="io.flutter.app.FlutterApplication" android:name="io.flutter.app.FlutterApplication"
android:label="cssd" android:label="CSSD"
android:icon="@mipmap/ic_launcher"> android:icon="@mipmap/ic_launcher">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 310 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 932 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

+9 -2
View File
@@ -1,4 +1,4 @@
class Routes{ class Routes {
static const cycleAddScreen = '/CycleAddScreen'; static const cycleAddScreen = '/CycleAddScreen';
static const cycleDetailScreen = '/CycleDetailScreen'; static const cycleDetailScreen = '/CycleDetailScreen';
static const cycleFilterScreen = '/CycleFilterScreen'; static const cycleFilterScreen = '/CycleFilterScreen';
@@ -6,15 +6,22 @@ class Routes{
static const cycleScanScreen = '/CycleScanScreen'; static const cycleScanScreen = '/CycleScanScreen';
static const homePage = '/HomePage'; static const homePage = '/HomePage';
static const labelAddScreen = '/LabelAddScreen'; static const labelAddScreen = '/LabelAddScreen';
static const labelUpdateScreen = '/LabelUpdateScreen';
static const labelDetailScreen = '/LabelDetailScreen'; static const labelDetailScreen = '/LabelDetailScreen';
static const labelFilterScreen = '/LabelFilterScreen'; static const labelFilterScreen = '/LabelFilterScreen';
static const labelResultScreen = '/LabelResultScreen'; static const labelResultScreen = '/LabelResultScreen';
static const labelScanScreen = '/LabelScanScreen'; static const labelScanScreen = '/LabelScanScreen';
static const loginScreen = '/LoginScreen'; static const loginScreen = '/LoginScreen';
static const forgetPassScreen = '/ForgetPassScreen';
static const sendCodeScreen = '/SendCodeScreen';
static const rePassScreen = '/RePassScreen';
static const myInfoScreen = '/MyInfoScreen'; static const myInfoScreen = '/MyInfoScreen';
static const testResultAddScreen = '/TestResultAddScreen'; static const testResultAddScreen = '/TestResultAddScreen';
static const testDetailsScreen = '/TestDetailsScreen'; static const testDetailsScreen = '/TestDetailsScreen';
static const testFilterScreen = '/TestFilterScreen'; static const testFilterScreen = '/TestFilterScreen';
static const testResultScreen = '/TestResultScreen'; static const testResultScreen = '/TestResultScreen';
static const testVerifyScreen = '/TestVerifyScreen'; static const testVerifyScreen = '/TestVerifyScreen';
} static const testScanScreen = '/TestScanScreen';
static const captureImageScreen = '/captureImageScreen';
}
+18 -2
View File
@@ -15,10 +15,24 @@ class Url {
static const String packageItems = '$baseUrl/GetPackages'; static const String packageItems = '$baseUrl/GetPackages';
static String testResults(int id) { static const String requestResetPass = '$baseUrl/password/phone';
static const String verifyResetPass = '$baseUrl/password/verifyCode';
static const String sendResetPass = '$baseUrl/password/reset';
static const String addImage = '$baseUrl/UploadFile';
static String testResults(int id) {
return '$baseUrl/TestResults?page=$id'; return '$baseUrl/TestResults?page=$id';
} }
static String testResultVerification(String id,String value) {
return '$baseUrl/TestResults/Verify/$id/$value';
}
static String labelResults(int id) { static String labelResults(int id) {
return '$baseUrl/Labels?page=$id'; return '$baseUrl/Labels?page=$id';
} }
@@ -26,7 +40,6 @@ static String testResults(int id) {
static String cycleResults(int id) { static String cycleResults(int id) {
return '$baseUrl/Cycles?page=$id'; return '$baseUrl/Cycles?page=$id';
} }
// static const String cycleResults = '$baseUrl/Cycles';
static String verifyTest(int id) { static String verifyTest(int id) {
return '$baseUrl/TestResults/Verify/$id'; return '$baseUrl/TestResults/Verify/$id';
@@ -46,6 +59,9 @@ static String testResults(int id) {
static const String createLabelResult = '$baseUrl/Labels'; static const String createLabelResult = '$baseUrl/Labels';
static String updateLabelResult(String id) {
return '$baseUrl/Labels/$id';
}
static String getTestResult(String id) { static String getTestResult(String id) {
return '$baseUrl/TestResults/$id'; return '$baseUrl/TestResults/$id';
+50 -38
View File
@@ -1,35 +1,41 @@
import 'package:cssd/config/routes.dart'; import 'package:cssd/pages/rePass_screen.dart';
import 'package:cssd/pages/test_add_screen.dart'; import 'package:cssd/widgets/TestResultScreens/Add/capture_image.dart';
import 'package:cssd/pages/cycle_add_screen.dart';
import 'package:cssd/pages/cycle_detail_screen.dart';
import 'package:cssd/pages/cycle_filter_screen.dart';
import 'package:cssd/pages/cycle_result_screen.dart';
import 'package:cssd/pages/cycle_scan_screen.dart';
import 'package:cssd/pages/label_add_screen.dart';
import 'package:cssd/pages/label_detail_screen.dart';
import 'package:cssd/pages/label_filter_screen.dart';
import 'package:cssd/pages/label_result_screen.dart';
import 'package:cssd/pages/label_scan_screen.dart';
import 'package:cssd/pages/login_screen.dart';
import 'package:cssd/pages/my_info_screen.dart';
import 'package:cssd/pages/test_detail_screen.dart';
import 'package:cssd/pages/test_result_screen.dart';
import 'package:cssd/pages/test_filter_screen.dart';
import 'package:cssd/pages/test_verify_screen.dart';
import 'package:cssd/providers/connectivity.dart';
import 'package:cssd/providers/cycles.dart';
import 'package:cssd/providers/input.dart';
import 'package:cssd/providers/auth.dart';
import 'package:cssd/providers/labels.dart';
import 'package:cssd/providers/my_info.dart';
import 'package:cssd/providers/test_results.dart';
import 'package:cssd/widgets/Global/splash_screen.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_phoenix/flutter_phoenix.dart'; import 'package:flutter_phoenix/flutter_phoenix.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import './pages/home_screen.dart'; import './pages/home_screen.dart';
import 'config/routes.dart';
import 'pages/cycle_add_screen.dart';
import 'pages/cycle_detail_screen.dart';
import 'pages/cycle_filter_screen.dart';
import 'pages/cycle_result_screen.dart';
import 'pages/cycle_scan_screen.dart';
import 'pages/forget_pass_screen.dart';
import 'pages/label_add_screen.dart';
import 'pages/label_detail_screen.dart';
import 'pages/label_filter_screen.dart';
import 'pages/label_result_screen.dart';
import 'pages/label_scan_screen.dart';
import 'pages/label_update_screen.dart';
import 'pages/login_screen.dart';
import 'pages/my_info_screen.dart';
import 'pages/test_add_screen.dart';
import 'pages/test_detail_screen.dart';
import 'pages/test_filter_screen.dart';
import 'pages/test_result_screen.dart';
import 'pages/test_scan_screen.dart';
import 'pages/test_verify_screen.dart';
import 'pages/verify_pass_screen.dart';
import 'providers/auth.dart';
import 'providers/connectivity.dart';
import 'providers/cycles.dart';
import 'providers/input.dart';
import 'providers/labels.dart';
import 'providers/my_info.dart';
import 'providers/test_results.dart';
import 'widgets/Global/splash_screen.dart';
void main() { void main() {
runApp(Phoenix(child: MyApp())); runApp(Phoenix(child: MyApp()));
@@ -83,18 +89,18 @@ class MyApp extends StatelessWidget {
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
title: 'CSSD-DOC', title: 'CSSD-DOC',
theme: ThemeData( theme: ThemeData(
primaryColor: Colors.black, primaryColor: Colors.black,
cursorColor: Colors.black, cursorColor: Colors.black,
fontFamily: 'montserrat', fontFamily: 'montserrat',
primaryTextTheme: TextTheme( // primaryTextTheme: TextTheme(
body1: TextStyle( // body1: TextStyle(
color: Colors.black, // color: Colors.black,
), // ),
) // )
// textTheme: TextTheme( // textTheme: TextTheme(
// body2: TextStyle(color: Colors.white, fontSize: 16), // body2: TextStyle(color: Colors.white, fontSize: 16),
// ), // ),
), ),
home: auth.isAuth home: auth.isAuth
? HomePage() ? HomePage()
: FutureBuilder( : FutureBuilder(
@@ -108,6 +114,7 @@ class MyApp extends StatelessWidget {
routes: { routes: {
Routes.homePage: (ctx) => HomePage(), Routes.homePage: (ctx) => HomePage(),
Routes.loginScreen: (ctx) => LoginScreen(), Routes.loginScreen: (ctx) => LoginScreen(),
Routes.forgetPassScreen: (ctx) => ForgetPassScreen(),
Routes.myInfoScreen: (ctx) => MyInfoScreen(), Routes.myInfoScreen: (ctx) => MyInfoScreen(),
Routes.testResultScreen: (ctx) => TestResultScreen(), Routes.testResultScreen: (ctx) => TestResultScreen(),
Routes.testDetailsScreen: (ctx) => TestDetailsScreen(), Routes.testDetailsScreen: (ctx) => TestDetailsScreen(),
@@ -122,9 +129,14 @@ class MyApp extends StatelessWidget {
Routes.labelScanScreen: (ctx) => LabelScanScreen(), Routes.labelScanScreen: (ctx) => LabelScanScreen(),
Routes.cycleAddScreen: (ctx) => CycleAddScreen(), Routes.cycleAddScreen: (ctx) => CycleAddScreen(),
Routes.labelAddScreen: (ctx) => LabelAddScreen(), Routes.labelAddScreen: (ctx) => LabelAddScreen(),
Routes.labelUpdateScreen: (ctx) => LabelUpdateScreen(),
Routes.labelResultScreen: (ctx) => LabelResultScreen(), Routes.labelResultScreen: (ctx) => LabelResultScreen(),
Routes.cycleResultScreen: (ctx) => CycleResultScreen(), Routes.cycleResultScreen: (ctx) => CycleResultScreen(),
Routes.testVerifyScreen: (ctx) => TestVerifyScreen(), Routes.testVerifyScreen: (ctx) => TestVerifyScreen(),
Routes.testScanScreen: (ctx) => TestScanScreen(),
Routes.sendCodeScreen: (ctx) => VerifyPassScreen(),
Routes.rePassScreen: (ctx) => RePassScreen(),
Routes.captureImageScreen: (ctx) => CaptureImage(),
}, },
); );
}, },
+9 -6
View File
@@ -13,18 +13,21 @@ class CycleResultObject {
} }
class CycleDetailObject { class CycleDetailObject {
final String id; // final String id;
final String description; // final String description;
final String createDate; // final String createDate;
final String date; // final String hospitalName;
final String sterileId; //
final String cycleNumber; // final String date;
final String sterileId;
final String cycleNumber;
final List<String> labels; final List<String> labels;
CycleDetailObject({ CycleDetailObject({
@required this.id, @required this.id,
@required this.description, @required this.description,
@required this.createDate, @required this.createDate,
@required this.hospitalName,
@required this.date, @required this.date,
@required this.sterileId, @required this.sterileId,
@required this.cycleNumber, @required this.cycleNumber,
+7
View File
@@ -3,11 +3,13 @@ import 'package:flutter/cupertino.dart';
class LabelResultObject { class LabelResultObject {
final String id; final String id;
final String package; final String package;
final String packageId;
final String expireDate; final String expireDate;
LabelResultObject({ LabelResultObject({
@required this.id, @required this.id,
@required this.package, @required this.package,
@required this.packageId,
@required this.expireDate, @required this.expireDate,
}); });
} }
@@ -15,6 +17,9 @@ class LabelResultObject {
class LabelDetailsObject { class LabelDetailsObject {
final String id; final String id;
final String package; final String package;
final String packageId;
final String hospitalName;
final String createDate; final String createDate;
final String expireDate; final String expireDate;
final String sterileDate; final String sterileDate;
@@ -25,6 +30,8 @@ class LabelDetailsObject {
LabelDetailsObject({ LabelDetailsObject({
@required this.id, @required this.id,
@required this.package, @required this.package,
@required this.packageId,
@required this.hospitalName,
@required this.createDate, @required this.createDate,
@required this.expireDate, @required this.expireDate,
@required this.sterileDate, @required this.sterileDate,
+2 -3
View File
@@ -7,6 +7,7 @@ class TestResultObject {
final String result; final String result;
final String date; final String date;
final String hospital; final String hospital;
final String verified;
TestResultObject({ TestResultObject({
@required this.id, @required this.id,
@@ -15,7 +16,7 @@ class TestResultObject {
@required this.result, @required this.result,
@required this.date, @required this.date,
@required this.hospital, @required this.hospital,
@required this.verified,
}); });
} }
@@ -28,7 +29,6 @@ class TestResultFilterObject {
final String fDate; final String fDate;
final String uDate; final String uDate;
TestResultFilterObject({ TestResultFilterObject({
@required this.id, @required this.id,
@required this.labelID, @required this.labelID,
@@ -37,6 +37,5 @@ class TestResultFilterObject {
@required this.testType, @required this.testType,
@required this.fDate, @required this.fDate,
@required this.uDate, @required this.uDate,
}); });
} }
+193 -184
View File
@@ -5,7 +5,7 @@ import 'package:cssd/providers/cycles.dart';
import 'package:cssd/widgets/CycleScreens/Add/add_label_box.dart'; import 'package:cssd/widgets/CycleScreens/Add/add_label_box.dart';
import 'package:cssd/widgets/CycleScreens/Add/date_picker.dart'; import 'package:cssd/widgets/CycleScreens/Add/date_picker.dart';
import 'package:cssd/widgets/CycleScreens/Add/save_button.dart'; import 'package:cssd/widgets/CycleScreens/Add/save_button.dart';
import 'package:cssd/widgets/Global/splash_screen%20copy.dart'; import 'package:cssd/widgets/Global/internet_error.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
@@ -76,202 +76,211 @@ class _CycleAddScreenState extends State<CycleAddScreen> {
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return Scaffold( return WillPopScope(
appBar: AppBar( onWillPop: () async {
titleSpacing: -10, Navigator.pushReplacementNamed(
title: Text('Cycles'), context,
leading: IconButton( Routes.cycleResultScreen,
icon: Icon( );
Icons.keyboard_arrow_left, return true;
size: 35, },
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Cycles'),
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
size: 35,
),
onPressed: () => Navigator.of(context)
.pushReplacementNamed(Routes.cycleResultScreen),
), ),
onPressed: () => Navigator.of(context)
.pushReplacementNamed(Routes.cycleResultScreen),
), ),
), body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) { return connection.conStatus != 'offline'
return connection.conStatus != 'offline' ? isInit
? isInit ? Center(
? Center( child: CircularProgressIndicator(),
child: CircularProgressIndicator(), )
) : Form(
: Form( key: _form,
key: _form, child: Padding(
child: Padding( padding: EdgeInsets.all(20),
padding: EdgeInsets.all(20), child: ListView(
child: ListView( // crossAxisAlignment: CrossAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
children: <Widget>[ Text(
Text( 'ADD A CYCLE',
'ADD A CYCLE',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 6 * _deviceBlockSize,
letterSpacing: 3,
),
),
SizedBox(
height: 20,
),
TextFormField(
validator: (val) {
if (val.isEmpty) {
return 'Strilizer ID required!';
}
return null;
},
controller: striizerIdCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Strilizer ID',
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.visiblePassword,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_cycleNumberFocusNode);
},
),
SizedBox(
height: 30,
),
TextFormField(
validator: (val) {
if (val.isEmpty) {
return 'Cycle number required!';
}
return null;
},
controller: cycleNumberCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Cycle Number',
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _cycleNumberFocusNode,
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_descriptionFocosNode);
},
),
SizedBox(
height: 20,
),
Container(
margin: EdgeInsets.symmetric(vertical: 10),
child: Text(
'LABELS INCLUDED',
style: TextStyle( style: TextStyle(
color: Colors.deepOrange, fontWeight: FontWeight.w700,
letterSpacing: 2, fontSize: 6 * _deviceBlockSize,
letterSpacing: 3,
),
),
SizedBox(
height: 20,
),
TextFormField(
validator: (val) {
if (val.isEmpty) {
return 'Strilizer ID required!';
}
return null;
},
controller: striizerIdCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Strilizer ID',
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize, fontSize: 5 * _deviceBlockSize,
), ),
keyboardType: TextInputType.visiblePassword,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_cycleNumberFocusNode);
},
), ),
), SizedBox(
Consumer<CyclesProvider>( height: 30,
builder: (ctx, cycleProvider, _) => ),
ListView.builder( TextFormField(
physics: NeverScrollableScrollPhysics(), validator: (val) {
shrinkWrap: true, if (val.isEmpty) {
itemBuilder: (ctx, index) => CycleAddLabelBox( return 'Cycle number required!';
deviceBlockSize: _deviceBlockSize, }
labelValues: cycleProvider.labelValues[index], return null;
labelVals: cycleProvider.labelVals, },
initialLabelValue: controller: cycleNumberCTRL,
cycleProvider.initialLabelValue, decoration: InputDecoration(
index: index, icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Cycle Number',
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
), ),
itemCount: cycleProvider.labelValues.length, style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _cycleNumberFocusNode,
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_descriptionFocosNode);
},
), ),
),
CycleAddDatePicker( SizedBox(
dateCTRL: dateCTRL, height: 20,
deviceBlockSize: _deviceBlockSize),
SizedBox(
height: 30,
),
TextFormField(
controller: descriptionCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Description',
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
), ),
style: TextStyle( Container(
fontWeight: FontWeight.w700, margin: EdgeInsets.symmetric(vertical: 10),
fontSize: 5 * _deviceBlockSize, child: Text(
'LABELS INCLUDED',
style: TextStyle(
color: Colors.deepOrange,
letterSpacing: 2,
fontSize: 5 * _deviceBlockSize,
),
),
),
Consumer<CyclesProvider>(
builder: (ctx, cycleProvider, _) =>
ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (ctx, index) => CycleAddLabelBox(
deviceBlockSize: _deviceBlockSize,
labelValues: cycleProvider.labelValues[index],
labelVals: cycleProvider.labelVals,
initialLabelValue:
cycleProvider.initialLabelValue,
index: index,
),
itemCount: cycleProvider.labelValues.length,
),
), ),
keyboardType: TextInputType.multiline,
focusNode: _descriptionFocosNode,
minLines: 1,
maxLines: 5,
),
SizedBox(
height: 70,
),
CycleAddSaveButton(
form: _form,
labelValues: Provider.of<CyclesProvider>(context,
listen: false)
.labelValues,
cycleNumberCTRL: cycleNumberCTRL,
dateValue: dateCTRL.text,
descriptionCTRL: descriptionCTRL,
striizerIdCTRL: striizerIdCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 100,
),
// DropDownBox(values: ['Washer ID']), CycleAddDatePicker(
], dateCTRL: dateCTRL,
deviceBlockSize: _deviceBlockSize),
SizedBox(
height: 30,
),
TextFormField(
controller: descriptionCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Description',
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.multiline,
focusNode: _descriptionFocosNode,
minLines: 1,
maxLines: 5,
),
SizedBox(
height: 70,
),
CycleAddSaveButton(
form: _form,
labelValues: Provider.of<CyclesProvider>(context,
listen: false)
.labelValues,
cycleNumberCTRL: cycleNumberCTRL,
dateValue: dateCTRL.text,
descriptionCTRL: descriptionCTRL,
striizerIdCTRL: striizerIdCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 100,
),
// DropDownBox(values: ['Washer ID']),
],
),
), ),
), )
) : ConnectionErrorBox();
: ConnectionErrorBox(); }),
}), ),
); );
} }
} }
+1 -1
View File
@@ -2,7 +2,7 @@ import 'package:cssd/models/cycles_models.dart';
import 'package:cssd/providers/connectivity.dart'; import 'package:cssd/providers/connectivity.dart';
import 'package:cssd/providers/cycles.dart'; import 'package:cssd/providers/cycles.dart';
import 'package:cssd/widgets/CycleScreens/Details/datas_box.dart'; import 'package:cssd/widgets/CycleScreens/Details/datas_box.dart';
import 'package:cssd/widgets/Global/splash_screen%20copy.dart'; import 'package:cssd/widgets/Global/internet_error.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
+179 -163
View File
@@ -1,16 +1,16 @@
import 'package:cssd/config/routes.dart'; import 'package:flutter/cupertino.dart';
import 'package:cssd/models/cycles_models.dart';
import 'package:cssd/providers/connectivity.dart';
import 'package:cssd/providers/cycles.dart';
import 'package:cssd/widgets/CycleScreens/Filter/date_picker.dart';
import 'package:cssd/widgets/CycleScreens/Filter/save_button.dart';
import 'package:cssd/widgets/CycleScreens/Filter/selector_box.dart';
import 'package:cssd/widgets/Global/splash_screen%20copy.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:intl/intl.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:flutter/cupertino.dart';
import '../config/routes.dart';
import '../models/cycles_models.dart';
import '../providers/connectivity.dart';
import '../providers/cycles.dart';
import '../widgets/CycleScreens/Filter/date_picker.dart';
import '../widgets/CycleScreens/Filter/save_button.dart';
import '../widgets/CycleScreens/Filter/selector_box.dart';
import '../widgets/Global/internet_error.dart';
class CycleFilterScreen extends StatefulWidget { class CycleFilterScreen extends StatefulWidget {
// static const route = '/CycleFilterScreen'; // static const route = '/CycleFilterScreen';
@@ -40,7 +40,8 @@ class _CycleFilterScreenState extends State<CycleFilterScreen> {
filters = Provider.of<CyclesProvider>(context, listen: false).filters; filters = Provider.of<CyclesProvider>(context, listen: false).filters;
cycleIdCTRL.text = filters.id; cycleIdCTRL.text = filters.id;
cycleNumberCTRL.text = filters.cycleNumber; cycleNumberCTRL.text = filters.cycleNumber;
dateCTRL.text = DateFormat('y-M-d').format(DateTime.now()); // dateCTRL.text = DateFormat('y-M-d').format(DateTime.now());
dateCTRL.text = '';
striizerIdCTRL.text = filters.sterilizerId; striizerIdCTRL.text = filters.sterilizerId;
// dateValue = DateFormat('y-M-d').format(DateTime.now()); // dateValue = DateFormat('y-M-d').format(DateTime.now());
super.initState(); super.initState();
@@ -56,7 +57,12 @@ class _CycleFilterScreenState extends State<CycleFilterScreen> {
(result) { (result) {
setState( setState(
() { () {
hospitalVals = result; hospitalVals = [
{'id': '', 'name': ''}
];
for (var hospital in result) {
hospitalVals.add(hospital);
}
filters.hospital == '' filters.hospital == ''
? hospitalCTRL.text = hospitalVals[0]['name'] ? hospitalCTRL.text = hospitalVals[0]['name']
: hospitalVals.forEach( : hospitalVals.forEach(
@@ -82,160 +88,170 @@ class _CycleFilterScreenState extends State<CycleFilterScreen> {
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return Scaffold( return WillPopScope(
appBar: AppBar( onWillPop: () async {
titleSpacing: -10, Navigator.pushReplacementNamed(
title: Text('Cycles'), context,
leading: IconButton( Routes.cycleResultScreen,
icon: Icon( );
Icons.keyboard_arrow_left, return true;
size: 35, },
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Cycles'),
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
size: 35,
),
onPressed: () => Navigator.of(context)
.pushReplacementNamed(Routes.cycleResultScreen),
), ),
onPressed: () => Navigator.of(context)
.pushReplacementNamed(Routes.cycleResultScreen),
), ),
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(),
)
: Padding(
padding: EdgeInsets.all(20),
child: ListView(
// crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'FILTER RESULTS',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
),
SizedBox(
height: 20,
),
TextFormField(
controller: cycleIdCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Cycle ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_cycleNumberFocusNode);
},
),
SizedBox(
height: 30,
),
TextFormField(
controller: cycleNumberCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Cycle Number',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _cycleNumberFocusNode,
keyboardType: TextInputType.visiblePassword,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_strilizerIdFocusNode);
},
),
SizedBox(
height: 30,
),
TextField(
controller: striizerIdCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Strilizer ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _strilizerIdFocusNode,
keyboardType: TextInputType.visiblePassword,
textInputAction: TextInputAction.done,
),
SizedBox(
height: 20,
),
CycleFilterSelectorBox(
deviceBlockSize: _deviceBlockSize,
hospitalCTRL: hospitalCTRL,
hospitalVals: hospitalVals,
label: 'Hospital',
),
SizedBox(
height: 20,
),
CycleFilterDatePicker(
dateCTRL: dateCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 70,
),
CycleFilterSaveButton(
hospitalVals: hospitalVals,
hospitalCTRL: hospitalCTRL,
cycleIdCTRL: cycleIdCTRL,
cycleNumberCTRL: cycleNumberCTRL,
striizerIdCTRL: striizerIdCTRL,
dateCTRL: dateCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 100,
),
],
),
)
: ConnectionErrorBox();
}),
), ),
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(),
)
: Padding(
padding: EdgeInsets.all(20),
child: ListView(
// crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'FILTER RESULTS',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
),
SizedBox(
height: 20,
),
TextFormField(
controller: cycleIdCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Cycle ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_cycleNumberFocusNode);
},
),
SizedBox(
height: 30,
),
TextFormField(
controller: cycleNumberCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Cycle Number',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _cycleNumberFocusNode,
keyboardType: TextInputType.visiblePassword,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_strilizerIdFocusNode);
},
),
SizedBox(
height: 30,
),
TextField(
controller: striizerIdCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Strilizer ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _strilizerIdFocusNode,
keyboardType: TextInputType.visiblePassword,
textInputAction: TextInputAction.done,
),
SizedBox(
height: 20,
),
CycleFilterSelectorBox(
deviceBlockSize: _deviceBlockSize,
hospitalCTRL: hospitalCTRL,
hospitalVals: hospitalVals,
),
SizedBox(
height: 20,
),
CycleFilterDatePicker(
dateCTRL: dateCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 70,
),
CycleFilterSaveButton(
hospitalVals: hospitalVals,
hospitalCTRL: hospitalCTRL,
cycleIdCTRL: cycleIdCTRL,
cycleNumberCTRL: cycleNumberCTRL,
striizerIdCTRL: striizerIdCTRL,
dateCTRL: dateCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 100,
),
],
),
)
: ConnectionErrorBox();
}),
); );
} }
} }
+1 -1
View File
@@ -5,7 +5,7 @@ import 'package:cssd/widgets/CycleScreens/Result/banner.dart';
import 'package:cssd/widgets/CycleScreens/Result/data_box.dart'; import 'package:cssd/widgets/CycleScreens/Result/data_box.dart';
import 'package:cssd/widgets/CycleScreens/Result/filter_objects.dart'; import 'package:cssd/widgets/CycleScreens/Result/filter_objects.dart';
import 'package:cssd/widgets/CycleScreens/Result/search_box.dart'; import 'package:cssd/widgets/CycleScreens/Result/search_box.dart';
import 'package:cssd/widgets/Global/splash_screen%20copy.dart'; import 'package:cssd/widgets/Global/internet_error.dart';
import '../providers/cycles.dart'; import '../providers/cycles.dart';
+15 -9
View File
@@ -1,12 +1,12 @@
import 'package:cssd/config/routes.dart';
import 'package:cssd/providers/connectivity.dart'; import 'package:cssd/providers/connectivity.dart';
import 'package:cssd/widgets/Global/splash_screen%20copy.dart'; import 'package:cssd/widgets/Global/internet_error.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:barcode_scan/barcode_scan.dart'; import 'package:barcode_scan/barcode_scan.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
class CycleScanScreen extends StatefulWidget { class CycleScanScreen extends StatefulWidget {
// static const route = '/cycleScanScreen'; // static const route = '/cycleScanScreen';
@@ -86,10 +86,13 @@ class _CycleScanScreenState extends State<CycleScanScreen> {
} else if (result == 'access') { } else if (result == 'access') {
print('access'); print('access');
} else { } else {
Navigator.of(context).pushNamed( launch(
Routes.cycleDetailScreen, 'https://cssd-doc.com/Show/Cycle/$result',
arguments: result,
); );
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: result,
// );
} }
}, },
); );
@@ -149,17 +152,20 @@ class _CycleScanScreenState extends State<CycleScanScreen> {
if (!_form.currentState.validate()) { if (!_form.currentState.validate()) {
return; return;
} }
Navigator.of(context).pushNamed( launch(
Routes.cycleDetailScreen, 'https://cssd-doc.com/Show/Cycle/${idCTRL.text}',
arguments: idCTRL.text,
); );
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: idCTRL.text,
// );
}, },
child: Container( child: Container(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize, horizontal: 5 * _deviceBlockSize,
vertical: 10, vertical: 10,
), ),
margin: EdgeInsets.symmetric(horizontal: 20), margin: EdgeInsets.only(bottom: 50,left: 20,right: 20),
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(
colors: [Colors.red, Colors.orange], colors: [Colors.red, Colors.orange],
+198
View File
@@ -0,0 +1,198 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../config/routes.dart';
import '../providers/auth.dart';
import '../providers/connectivity.dart';
import '../widgets/Global/internet_error.dart';
class ForgetPassScreen extends StatefulWidget {
// static const route = '/HomeScreen';
@override
State<StatefulWidget> createState() {
return _ForgetPassScreenState();
}
}
class _ForgetPassScreenState extends State<ForgetPassScreen> {
final _form = GlobalKey<FormState>();
bool _isLoading = false;
final cellNumberController = TextEditingController();
@override
void initState() {
cellNumberController.text = '';
super.initState();
}
@override
void dispose() {
super.dispose();
}
void _showDialog(String message) {
showDialog(
context: context,
builder: (ctx) => AlertDialog(
title: Text('Error'),
content: Text(message),
actions: <Widget>[
FlatButton(
child: Text('Ok'),
onPressed: () {
Navigator.of(ctx).pop();
},
),
],
),
);
}
void _requestCode() async {
if (!_form.currentState.validate()) {
return;
}
_form.currentState.save();
setState(() {
_isLoading = true;
});
// try {
await Provider.of<Auth>(context)
.requestCode(
cellNumberController.text,
)
.then(
(result) {
if (result == 'NotUser') {
_showDialog('User Not Found!!!');
setState(
() {
_isLoading = false;
},
);
} else{
// _showDialog('User or password incorrect!');
Navigator.of(context).popAndPushNamed(Routes.sendCodeScreen);
// setState(
// () {
// _isLoading = false;
// },
// );
}
},
);
}
@override
Widget build(BuildContext context) {
final _media = MediaQuery.of(context);
// 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(
centerTitle: true,
title: Text('CSSD'),
),
body: Selector<ConnectivityProvider, String>(
builder: (ctx, value, _) => value != 'offline'
? _isLoading
? Center(
child: CircularProgressIndicator(),
)
: Form(
key: _form,
child: ListView(
padding: EdgeInsets.symmetric(horizontal: 20),
children: <Widget>[
Container(
padding: EdgeInsets.symmetric(vertical: 20),
child: Text(
'FORGET PASSWORD',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black,
fontSize: 5 * _deviceBlockSize,
letterSpacing: 3,
fontWeight: FontWeight.w700,
),
),
),
TextFormField(
validator: (value) {
if (value.isEmpty) {
return 'Cell number is required.';
}
RegExp regExp =
RegExp(r'^09[0,1,2,3,9]{1}[0-9]{8}$');
if (!regExp.hasMatch(value)) {
return 'Enter a valid cell number';
}
return null;
},
controller: cellNumberController,
decoration: InputDecoration(
icon: Icon(
Icons.call,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Cell Number',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.phone,
textInputAction: TextInputAction.next,
onSaved: (value) {
cellNumberController.text = value;
},
),
SizedBox(height: 40),
Row(
children: <Widget>[
InkWell(
onTap: () => _requestCode(),
child: Container(
width: 40 * _deviceBlockSize,
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
// margin:
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue, Colors.green],
),
borderRadius: BorderRadius.circular(7),
),
child: Text(
'Request Code',
style: TextStyle(color: Colors.white),
),
),
),
Spacer(),
],
),
SizedBox(height: 10),
],
),
)
: ConnectionErrorBox(),
selector: (_, connectivity) => connectivity.conStatus,
),
);
}
}
+28 -20
View File
@@ -1,16 +1,17 @@
import 'package:cssd/pages/cycle_result_screen.dart';
import 'package:cssd/pages/label_result_screen.dart';
// import 'package:cssd/pages/my_test_result.dart';
import 'package:cssd/pages/test_result_screen.dart';
import 'package:cssd/providers/auth.dart';
import 'package:cssd/providers/connectivity.dart';
import 'package:cssd/widgets/Global/drawer.dart';
import 'package:cssd/widgets/Global/splash_screen%20copy.dart';
import 'package:double_back_to_close_app/double_back_to_close_app.dart'; import 'package:double_back_to_close_app/double_back_to_close_app.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_phoenix/flutter_phoenix.dart'; import 'package:flutter_phoenix/flutter_phoenix.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import './my_info_screen.dart'; import './my_info_screen.dart';
import '../providers/auth.dart';
import '../providers/connectivity.dart';
import '../widgets/Global/drawer.dart';
import '../widgets/Global/internet_error.dart';
import 'cycle_result_screen.dart';
import 'label_result_screen.dart';
import 'test_result_screen.dart';
import 'test_verify_screen.dart';
class HomePage extends StatelessWidget { class HomePage extends StatelessWidget {
// 09338736511 // 09338736511
@@ -18,7 +19,8 @@ class HomePage extends StatelessWidget {
// static const route = '/HomeScreen'; // static const route = '/HomeScreen';
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final userData = Provider.of<Auth>(context).user; final userData = Provider.of<Auth>(context,listen: false).user;
// print(userData['roles']);
return Scaffold( return Scaffold(
resizeToAvoidBottomPadding: false, resizeToAvoidBottomPadding: false,
drawer: Selector<ConnectivityProvider, String>( drawer: Selector<ConnectivityProvider, String>(
@@ -84,8 +86,8 @@ class HomePage extends StatelessWidget {
child: Container( child: Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
top: 0, bottom: 10, left: 20, right: 20), top: 0, bottom: 10, left: 20, right: 20),
child: Column( child: ListView(
crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Container( Container(
margin: EdgeInsets.only(top: 20, bottom: 10), margin: EdgeInsets.only(top: 20, bottom: 10),
@@ -134,16 +136,22 @@ class HomePage extends StatelessWidget {
secondLine: 'List, Details & Add a one', secondLine: 'List, Details & Add a one',
onTap: CycleResultScreen(), onTap: CycleResultScreen(),
), ),
userData['roles'].contains('Admin') // SelectionItem(
// startColor: Color(0xFFA7CCE1),
// endColor: Color(0xFFECF7ED),
// firstLine: 'image',
// secondLine: 'image',
// onTap: CaptureImage(),
// ),
userData['roles'].contains('User')
? Container() ? Container()
// SelectionItem( : SelectionItem(
// startColor: Color(0xFFA7CCE1), startColor: Color(0xFFA7CCE1),
// endColor: Color(0xFFECF7ED), endColor: Color(0xFFECF7ED),
// firstLine: 'TEST TO VERIFY', firstLine: 'TEST TO VERIFY',
// secondLine: 'List, Details & Add a one', secondLine: 'List, Details & Add a one',
// onTap: TestVerifyScreen(), onTap: TestVerifyScreen(),
// ) ),
: Container(),
], ],
), ),
), ),
+191 -180
View File
@@ -1,15 +1,16 @@
import 'package:cssd/config/routes.dart';
import 'package:cssd/providers/connectivity.dart';
import 'package:cssd/providers/labels.dart';
import 'package:cssd/widgets/Global/splash_screen%20copy.dart';
import 'package:cssd/widgets/LabelScreens/Add/date_picker.dart';
import 'package:cssd/widgets/LabelScreens/Add/save_button.dart';
import 'package:cssd/widgets/LabelScreens/Add/selector_box.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:intl/intl.dart' as DateEditor; import 'package:intl/intl.dart' as DateEditor;
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../config/routes.dart';
import '../providers/connectivity.dart';
import '../providers/labels.dart';
import '../widgets/Global/internet_error.dart';
import '../widgets/LabelScreens/Add/date_picker.dart';
import '../widgets/LabelScreens/Add/save_button.dart';
import '../widgets/LabelScreens/Add/selector_box.dart';
class LabelAddScreen extends StatefulWidget { class LabelAddScreen extends StatefulWidget {
// static const route = '/LabelAddScreen'; // static const route = '/LabelAddScreen';
@@ -75,194 +76,204 @@ class _LabelAddScreenState extends State<LabelAddScreen> {
final _media = MediaQuery.of(context); final _media = MediaQuery.of(context);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return Scaffold( return WillPopScope(
appBar: AppBar( onWillPop: () async {
titleSpacing: -10, Navigator.pushReplacementNamed(
title: Text('Labels'), context,
leading: IconButton( Routes.labelResultScreen,
icon: Icon( );
Icons.keyboard_arrow_left, return true;
size: 35, },
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Labels'),
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
size: 35,
),
onPressed: () => Navigator.of(context)
.pushReplacementNamed(Routes.labelResultScreen),
), ),
onPressed: () => Navigator.of(context).pushReplacementNamed(Routes.labelResultScreen),
), ),
), body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) { return connection.conStatus != 'offline'
return connection.conStatus != 'offline' ? isInit
? isInit ? Center(
? Center( child: CircularProgressIndicator(),
child: CircularProgressIndicator(), )
) : Form(
: Form( key: _form,
key: _form, child: Padding(
child: Padding( padding: EdgeInsets.all(20),
padding: EdgeInsets.all(20), child: ListView(
child: ListView( children: <Widget>[
children: <Widget>[ Text(
Text( 'ADD A LABEL',
'ADD A LABEL', style: TextStyle(
style: TextStyle( fontWeight: FontWeight.w700,
fontWeight: FontWeight.w700, fontSize: 6 * _deviceBlockSize,
fontSize: 6 * _deviceBlockSize, letterSpacing: 3,
letterSpacing: 3,
),
),
SizedBox(
height: 20,
),
TextFormField(
onChanged: (val) {
setState(() {
lotNumberCTRL.text =
val + ' - ' + cycleNumberCTRL.text;
});
},
validator: (val) {
if (val.isEmpty) {
return 'Strilizer ID required!';
}
return null;
},
controller: striizerIdCTRL,
decoration: InputDecoration(
icon: Icon(FontAwesomeIcons.sortNumericDown,
size: 7 * _deviceBlockSize),
isDense: true,
labelText: 'Strilizer ID',
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
), ),
), ),
style: TextStyle( SizedBox(
fontWeight: FontWeight.w700, height: 20,
fontSize: 5 * _deviceBlockSize,
), ),
keyboardType: TextInputType.visiblePassword, TextFormField(
textInputAction: TextInputAction.next, onChanged: (val) {
onFieldSubmitted: (_) { setState(() {
FocusScope.of(context)
.requestFocus(_cycleNumberFocusNode);
},
),
SizedBox(
height: 20,
),
TextFormField(
onChanged: (val) {
setState(
() {
lotNumberCTRL.text = lotNumberCTRL.text =
striizerIdCTRL.text + ' - ' + val; val + ' - ' + cycleNumberCTRL.text;
}, });
); },
}, validator: (val) {
validator: (val) { if (val.isEmpty) {
if (val.isEmpty) { return 'Strilizer ID required!';
return 'Cycle number required!'; }
} return null;
return null; },
}, controller: striizerIdCTRL,
controller: cycleNumberCTRL, decoration: InputDecoration(
decoration: InputDecoration( icon: Icon(FontAwesomeIcons.sortNumericDown,
icon: Icon( size: 7 * _deviceBlockSize),
FontAwesomeIcons.sortNumericDown, isDense: true,
size: 7 * _deviceBlockSize, labelText: 'Strilizer ID',
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
), ),
labelStyle: TextStyle( style: TextStyle(
fontWeight: FontWeight.w100, fontWeight: FontWeight.w700,
fontSize: 4 * _deviceBlockSize, fontSize: 5 * _deviceBlockSize,
), ),
isDense: true, keyboardType: TextInputType.visiblePassword,
labelText: 'Cycle Number', textInputAction: TextInputAction.next,
contentPadding: EdgeInsets.symmetric( onFieldSubmitted: (_) {
vertical: 2, horizontal: 3), FocusScope.of(context)
.requestFocus(_cycleNumberFocusNode);
},
), ),
style: TextStyle( SizedBox(
fontWeight: FontWeight.w700, height: 20,
fontSize: 5 * _deviceBlockSize,
), ),
focusNode: _cycleNumberFocusNode, TextFormField(
keyboardType: TextInputType.number, onChanged: (val) {
textInputAction: TextInputAction.done, setState(
), () {
SizedBox( lotNumberCTRL.text =
height: 20, striizerIdCTRL.text + ' - ' + val;
), },
TextFormField( );
readOnly: true, },
controller: lotNumberCTRL, validator: (val) {
decoration: InputDecoration( if (val.isEmpty) {
icon: Icon( return 'Cycle number required!';
FontAwesomeIcons.sortNumericDown, }
size: 7 * _deviceBlockSize, return null;
},
controller: cycleNumberCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Cycle Number',
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
), ),
labelStyle: TextStyle( style: TextStyle(
fontWeight: FontWeight.w100, fontWeight: FontWeight.w700,
fontSize: 4 * _deviceBlockSize, fontSize: 5 * _deviceBlockSize,
),
isDense: true,
labelText: 'Lot Number',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
), ),
focusNode: _cycleNumberFocusNode,
keyboardType: TextInputType.number,
textInputAction: TextInputAction.done,
), ),
style: TextStyle( SizedBox(
fontWeight: FontWeight.w700, height: 20,
fontSize: 5 * _deviceBlockSize,
), ),
keyboardType: TextInputType.visiblePassword, TextFormField(
), readOnly: true,
SizedBox( controller: lotNumberCTRL,
height: 20, decoration: InputDecoration(
), icon: Icon(
LabelAddSelectorBox( FontAwesomeIcons.sortNumericDown,
deviceBlockSize: _deviceBlockSize, size: 7 * _deviceBlockSize,
packageCTRL: packageCTRL, ),
packageVals: packageVals, labelStyle: TextStyle(
packageValue: packageValue, fontWeight: FontWeight.w100,
), fontSize: 4 * _deviceBlockSize,
SizedBox( ),
height: 10, isDense: true,
), labelText: 'Lot Number',
LabelAddDatePicker( contentPadding: EdgeInsets.symmetric(
dateCTRL: sDateCTRL, vertical: 2,
deviceBlockSize: _deviceBlockSize, horizontal: 3,
label: 'Sterile Date', ),
), ),
SizedBox( style: TextStyle(
height: 20, fontWeight: FontWeight.w700,
), fontSize: 5 * _deviceBlockSize,
LabelAddDatePicker( ),
dateCTRL: eDateCTRL, keyboardType: TextInputType.visiblePassword,
deviceBlockSize: _deviceBlockSize, ),
label: 'Sterile Date', SizedBox(
), height: 20,
SizedBox( ),
height: 70, LabelAddSelectorBox(
), deviceBlockSize: _deviceBlockSize,
LabelAddSaveButton( packageCTRL: packageCTRL,
form: _form, packageVals: packageVals,
lotNumberCTRL: lotNumberCTRL, packageValue: packageValue,
cycleNumberCTRL: cycleNumberCTRL, ),
sDateCTRL: sDateCTRL, SizedBox(
packageValue: packageValue, height: 10,
eDateCTRL: eDateCTRL, ),
striizerIdCTRL: striizerIdCTRL, LabelAddDatePicker(
deviceBlockSize: _deviceBlockSize, dateCTRL: sDateCTRL,
), deviceBlockSize: _deviceBlockSize,
SizedBox( label: 'Sterile Date',
height: 100, ),
), SizedBox(
], height: 20,
),
LabelAddDatePicker(
dateCTRL: eDateCTRL,
deviceBlockSize: _deviceBlockSize,
label: 'Expire Date',
),
SizedBox(
height: 70,
),
LabelAddSaveButton(
form: _form,
lotNumberCTRL: lotNumberCTRL,
cycleNumberCTRL: cycleNumberCTRL,
sDateCTRL: sDateCTRL,
packageValue: packageValue,
eDateCTRL: eDateCTRL,
striizerIdCTRL: striizerIdCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 100,
),
],
),
), ),
), )
) : ConnectionErrorBox();
: ConnectionErrorBox(); }),
}), ),
); );
} }
} }
+1 -1
View File
@@ -1,7 +1,7 @@
import 'package:cssd/models/label_models.dart'; import 'package:cssd/models/label_models.dart';
import 'package:cssd/providers/connectivity.dart'; import 'package:cssd/providers/connectivity.dart';
import 'package:cssd/providers/labels.dart'; import 'package:cssd/providers/labels.dart';
import 'package:cssd/widgets/Global/splash_screen%20copy.dart'; import 'package:cssd/widgets/Global/internet_error.dart';
import 'package:cssd/widgets/LabelScreens/Detail/datas_box.dart'; import 'package:cssd/widgets/LabelScreens/Detail/datas_box.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
+154 -139
View File
@@ -2,7 +2,7 @@ import 'package:cssd/config/routes.dart';
import 'package:cssd/models/label_models.dart'; import 'package:cssd/models/label_models.dart';
import 'package:cssd/providers/connectivity.dart'; import 'package:cssd/providers/connectivity.dart';
import 'package:cssd/providers/labels.dart'; import 'package:cssd/providers/labels.dart';
import 'package:cssd/widgets/Global/splash_screen%20copy.dart'; import 'package:cssd/widgets/Global/internet_error.dart';
import 'package:cssd/widgets/LabelScreens/Filter/save_button.dart'; import 'package:cssd/widgets/LabelScreens/Filter/save_button.dart';
import 'package:cssd/widgets/LabelScreens/Filter/selector_box.dart'; import 'package:cssd/widgets/LabelScreens/Filter/selector_box.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -50,7 +50,13 @@ class _LabelFilterScreenState extends State<LabelFilterScreen> {
(result) { (result) {
setState( setState(
() { () {
hospitalVals = result; hospitalVals = [
{'id': '', 'name': ''}
];
for (var hospital in result) {
hospitalVals.add(hospital);
}
// hospitalVals = result;
filters.hospital == '' filters.hospital == ''
? hospitalCTRL.text = hospitalVals[0]['name'] ? hospitalCTRL.text = hospitalVals[0]['name']
: hospitalVals.forEach( : hospitalVals.forEach(
@@ -74,154 +80,163 @@ class _LabelFilterScreenState extends State<LabelFilterScreen> {
final _media = MediaQuery.of(context); final _media = MediaQuery.of(context);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return Scaffold( return WillPopScope(
appBar: AppBar( onWillPop: () async {
titleSpacing: -10, Navigator.pushReplacementNamed(
title: Text('Labels'), context,
leading: IconButton( Routes.labelResultScreen,
icon: Icon( );
Icons.keyboard_arrow_left, return true;
size: 35, },
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Labels'),
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
size: 35,
),
onPressed: () => Navigator.of(context)
.pushReplacementNamed(Routes.labelResultScreen),
), ),
onPressed: () => Navigator.of(context)
.pushReplacementNamed(Routes.labelResultScreen),
), ),
), body: Consumer<ConnectivityProvider>(
body: Consumer<ConnectivityProvider>( builder: (ct, connection, _) {
builder: (ct, connection, _) { return connection.conStatus != 'offline'
return connection.conStatus != 'offline' ? isInit
? isInit ? Center(
? Center( child: CircularProgressIndicator(),
child: CircularProgressIndicator(), )
) : Padding(
: Padding( padding: EdgeInsets.all(20),
padding: EdgeInsets.all(20), child: ListView(
child: ListView( children: <Widget>[
children: <Widget>[ Text(
Text( 'FILTER RESULTS',
'FILTER RESULTS', style: TextStyle(
style: TextStyle( fontWeight: FontWeight.w700,
fontWeight: FontWeight.w700, fontSize: 5 * _deviceBlockSize,
fontSize: 5 * _deviceBlockSize,
),
),
SizedBox(
height: 20,
),
TextFormField(
controller: labelIdCTRl,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
), ),
labelStyle: TextStyle( ),
fontWeight: FontWeight.w100, SizedBox(
fontSize: 4 * _deviceBlockSize, height: 20,
),
TextFormField(
controller: labelIdCTRl,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Label ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
), ),
labelText: 'Label ID', style: TextStyle(
isDense: true, fontWeight: FontWeight.w700,
contentPadding: EdgeInsets.symmetric( fontSize: 5 * _deviceBlockSize,
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_cycleNumberFocusNode);
},
),
SizedBox(
height: 30,
),
TextFormField(
controller: cycleNumberCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
), ),
labelStyle: TextStyle( keyboardType: TextInputType.number,
fontWeight: FontWeight.w100, textInputAction: TextInputAction.next,
fontSize: 4 * _deviceBlockSize, onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_cycleNumberFocusNode);
},
),
SizedBox(
height: 30,
),
TextFormField(
controller: cycleNumberCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Cycle Number',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
), ),
labelText: 'Cycle Number', style: TextStyle(
isDense: true, fontWeight: FontWeight.w700,
contentPadding: EdgeInsets.symmetric( fontSize: 5 * _deviceBlockSize,
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _cycleNumberFocusNode,
keyboardType: TextInputType.visiblePassword,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_strilizerIdFocusNode);
},
),
SizedBox(
height: 30,
),
TextFormField(
controller: striizerIdCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
), ),
labelStyle: TextStyle( focusNode: _cycleNumberFocusNode,
fontWeight: FontWeight.w100, keyboardType: TextInputType.visiblePassword,
fontSize: 4 * _deviceBlockSize, textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_strilizerIdFocusNode);
},
),
SizedBox(
height: 30,
),
TextFormField(
controller: striizerIdCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Strilizer ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
), ),
labelText: 'Strilizer ID', style: TextStyle(
isDense: true, fontWeight: FontWeight.w700,
contentPadding: EdgeInsets.symmetric( fontSize: 5 * _deviceBlockSize,
vertical: 2, horizontal: 3), ),
textInputAction: TextInputAction.done,
keyboardType: TextInputType.visiblePassword,
focusNode: _strilizerIdFocusNode,
), ),
style: TextStyle( SizedBox(
fontWeight: FontWeight.w700, height: 30,
fontSize: 5 * _deviceBlockSize,
), ),
textInputAction: TextInputAction.done,
keyboardType: TextInputType.visiblePassword,
focusNode: _strilizerIdFocusNode,
),
SizedBox(
height: 30,
),
LabelFilterSelectorBox( LabelFilterSelectorBox(
deviceBlockSize: _deviceBlockSize, deviceBlockSize: _deviceBlockSize,
hospitalCTRL: hospitalCTRL, hospitalCTRL: hospitalCTRL,
hospitalVals: hospitalVals, hospitalVals: hospitalVals,
), ),
SizedBox( SizedBox(
height: 70, height: 70,
), ),
LabelFilterSaveButton( LabelFilterSaveButton(
hospitalVals: hospitalVals, hospitalVals: hospitalVals,
hospitalCTRL: hospitalCTRL, hospitalCTRL: hospitalCTRL,
labelIdCTRl: labelIdCTRl, labelIdCTRl: labelIdCTRl,
cycleNumberCTRL: cycleNumberCTRL, cycleNumberCTRL: cycleNumberCTRL,
striizerIdCTRL: striizerIdCTRL, striizerIdCTRL: striizerIdCTRL,
deviceBlockSize: _deviceBlockSize, deviceBlockSize: _deviceBlockSize,
), ),
SizedBox( SizedBox(
height: 50, height: 50,
), ),
// DropDownBox(values: ['Washer ID']), // DropDownBox(values: ['Washer ID']),
], ],
), ),
) )
: ConnectionErrorBox(); : ConnectionErrorBox();
}, },
),
), ),
); );
} }
+1 -1
View File
@@ -1,7 +1,7 @@
import 'package:cssd/config/routes.dart'; import 'package:cssd/config/routes.dart';
import 'package:cssd/providers/connectivity.dart'; import 'package:cssd/providers/connectivity.dart';
import 'package:cssd/widgets/Global/page_header.dart'; import 'package:cssd/widgets/Global/page_header.dart';
import 'package:cssd/widgets/Global/splash_screen%20copy.dart'; import 'package:cssd/widgets/Global/internet_error.dart';
import 'package:cssd/widgets/LabelScreens/Result/data_box.dart'; import 'package:cssd/widgets/LabelScreens/Result/data_box.dart';
import 'package:cssd/widgets/LabelScreens/Result/filter_chip_box.dart'; import 'package:cssd/widgets/LabelScreens/Result/filter_chip_box.dart';
import 'package:cssd/widgets/LabelScreens/Result/floating_buttons.dart'; import 'package:cssd/widgets/LabelScreens/Result/floating_buttons.dart';
+1 -1
View File
@@ -1,5 +1,5 @@
import 'package:cssd/providers/connectivity.dart'; import 'package:cssd/providers/connectivity.dart';
import 'package:cssd/widgets/Global/splash_screen%20copy.dart'; import 'package:cssd/widgets/Global/internet_error.dart';
import 'package:cssd/widgets/LabelScreens/Scan/input_box.dart'; import 'package:cssd/widgets/LabelScreens/Scan/input_box.dart';
import 'package:cssd/widgets/LabelScreens/Scan/save_button.dart'; import 'package:cssd/widgets/LabelScreens/Scan/save_button.dart';
import 'package:cssd/widgets/LabelScreens/Scan/scan_box.dart'; import 'package:cssd/widgets/LabelScreens/Scan/scan_box.dart';
+303
View File
@@ -0,0 +1,303 @@
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:intl/intl.dart' as DateEditor;
import 'package:provider/provider.dart';
import '../config/routes.dart';
import '../models/label_models.dart';
import '../providers/connectivity.dart';
import '../providers/labels.dart';
import '../widgets/Global/internet_error.dart';
import '../widgets/LabelScreens/Add/date_picker.dart';
import '../widgets/LabelScreens/Add/selector_box.dart';
import '../widgets/LabelScreens/Add/update_button.dart';
class LabelUpdateScreen extends StatefulWidget {
// static const route = '/LabelUpdateScreen';
@override
_LabelUpdateScreenState createState() => _LabelUpdateScreenState();
}
class _LabelUpdateScreenState extends State<LabelUpdateScreen> {
final _cycleNumberFocusNode = FocusNode();
TextEditingController lotNumberCTRL = new TextEditingController();
TextEditingController cycleNumberCTRL = new TextEditingController();
TextEditingController striizerIdCTRL = new TextEditingController();
TextEditingController sDateCTRL = new TextEditingController();
TextEditingController eDateCTRL = new TextEditingController();
TextEditingController packageCTRL = new TextEditingController();
DateTime dateTimeS;
// String sDateValue;
// String eDateValue;
final _form = GlobalKey<FormState>();
List<Map<String, String>> packageVals = [];
List<String> packageValue = [];
bool isEmpty = false;
bool isInit = true;
LabelDetailsObject datas;
// CycleFilterObject filters;
List<TextEditingController> labelsCTRL = [TextEditingController()];
int curLabelVal = 1;
@override
void initState() {
sDateCTRL.text = DateEditor.DateFormat('y-M-d').format(DateTime.now());
// sDateValue = DateEditor.DateFormat('y-M-d').format(DateTime.now());
eDateCTRL.text = DateEditor.DateFormat('y-M-d').format(DateTime.now());
// eDateValue = DateEditor.DateFormat('y-M-d').format(DateTime.now());
super.initState();
}
@override
void didChangeDependencies() async {
if (isInit) {
var _id = ModalRoute.of(context).settings.arguments;
await Provider.of<LabelsProvider>(context, listen: false)
.showLabelResult(_id.toString())
.then(
(result) {
setState(
() {
// if (result.id == 'null') {
// isEmpty = true;
// }
datas = result;
lotNumberCTRL.text = datas.lotNumber;
cycleNumberCTRL.text = datas.cycleNumber;
striizerIdCTRL.text = datas.sterileId;
sDateCTRL.text = datas.sterileDate;
eDateCTRL.text = datas.expireDate;
packageValue.add(datas.packageId);
packageValue.add(datas.package);
packageCTRL.text = datas.package;
},
);
},
);
Provider.of<LabelsProvider>(context, listen: false)
.getPackageFilters()
.then(
(result) {
setState(
() {
packageVals = result;
isInit = false;
},
);
},
);
}
super.didChangeDependencies();
}
@override
Widget build(BuildContext context) {
final _media = MediaQuery.of(context);
final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100;
return WillPopScope(
onWillPop: () async {
Navigator.pushReplacementNamed(
context,
Routes.labelResultScreen,
);
return true;
},
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Labels'),
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
size: 35,
),
onPressed: () => Navigator.of(context)
.pushReplacementNamed(Routes.labelResultScreen),
),
),
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(),
)
: Form(
key: _form,
child: Padding(
padding: EdgeInsets.all(20),
child: ListView(
children: <Widget>[
Text(
'Update A LABEL',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 6 * _deviceBlockSize,
letterSpacing: 3,
),
),
SizedBox(
height: 20,
),
TextFormField(
onChanged: (val) {
setState(() {
lotNumberCTRL.text =
val + ' - ' + cycleNumberCTRL.text;
});
},
validator: (val) {
if (val.isEmpty) {
return 'Strilizer ID required!';
}
return null;
},
controller: striizerIdCTRL,
decoration: InputDecoration(
icon: Icon(FontAwesomeIcons.sortNumericDown,
size: 7 * _deviceBlockSize),
isDense: true,
labelText: 'Strilizer ID',
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.visiblePassword,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_cycleNumberFocusNode);
},
),
SizedBox(
height: 20,
),
TextFormField(
onChanged: (val) {
setState(
() {
lotNumberCTRL.text =
striizerIdCTRL.text + ' - ' + val;
},
);
},
validator: (val) {
if (val.isEmpty) {
return 'Cycle number required!';
}
return null;
},
controller: cycleNumberCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Cycle Number',
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _cycleNumberFocusNode,
keyboardType: TextInputType.number,
textInputAction: TextInputAction.done,
),
SizedBox(
height: 20,
),
TextFormField(
readOnly: true,
controller: lotNumberCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Lot Number',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.visiblePassword,
),
SizedBox(
height: 20,
),
LabelAddSelectorBox(
deviceBlockSize: _deviceBlockSize,
packageCTRL: packageCTRL,
packageVals: packageVals,
packageValue: packageValue,
),
SizedBox(
height: 10,
),
LabelAddDatePicker(
dateCTRL: sDateCTRL,
deviceBlockSize: _deviceBlockSize,
label: 'Sterile Date',
),
SizedBox(
height: 20,
),
LabelAddDatePicker(
dateCTRL: eDateCTRL,
deviceBlockSize: _deviceBlockSize,
label: 'Expire Date',
),
SizedBox(
height: 70,
),
LabelUpdateButton(
form: _form,
id: datas.id,
lotNumberCTRL: lotNumberCTRL,
cycleNumberCTRL: cycleNumberCTRL,
sDateCTRL: sDateCTRL,
packageValue: packageValue,
eDateCTRL: eDateCTRL,
striizerIdCTRL: striizerIdCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 100,
),
],
),
),
)
: ConnectionErrorBox();
}),
),
);
}
}
+4 -2
View File
@@ -1,6 +1,7 @@
import 'package:cssd/config/routes.dart';
import 'package:cssd/providers/auth.dart'; import 'package:cssd/providers/auth.dart';
import 'package:cssd/providers/connectivity.dart'; import 'package:cssd/providers/connectivity.dart';
import 'package:cssd/widgets/Global/splash_screen%20copy.dart'; import 'package:cssd/widgets/Global/internet_error.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@@ -281,7 +282,8 @@ class _LoginScreenState extends State<LoginScreen> {
), ),
), ),
), ),
onPressed: () {}, onPressed: () => Navigator.of(context)
.pushNamed(Routes.forgetPassScreen),
), ),
], ],
), ),
+25 -5
View File
@@ -1,6 +1,6 @@
// import 'package:cssd/widgets/LabelScreens/LabelDetails/header.dart'; // import 'package:cssd/widgets/LabelScreens/LabelDetails/header.dart';
import 'package:cssd/providers/connectivity.dart'; import 'package:cssd/providers/connectivity.dart';
import 'package:cssd/widgets/Global/splash_screen%20copy.dart'; import 'package:cssd/widgets/Global/internet_error.dart';
import 'package:cssd/widgets/LabelScreens/Detail/header.dart'; import 'package:cssd/widgets/LabelScreens/Detail/header.dart';
import 'package:cssd/widgets/MyInfo/input_box.dart'; import 'package:cssd/widgets/MyInfo/input_box.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -73,6 +73,7 @@ class _MyInfoScreenState extends State<MyInfoScreen> {
deviceBlockSize: _deviceBlockSize, deviceBlockSize: _deviceBlockSize,
label: 'Full Name', label: 'Full Name',
icon: FontAwesomeIcons.sortNumericDown, icon: FontAwesomeIcons.sortNumericDown,
inputType: TextInputType.text,
), ),
SizedBox( SizedBox(
height: 20, height: 20,
@@ -110,6 +111,7 @@ class _MyInfoScreenState extends State<MyInfoScreen> {
deviceBlockSize: _deviceBlockSize, deviceBlockSize: _deviceBlockSize,
label: 'Email Address', label: 'Email Address',
icon: FontAwesomeIcons.envelope, icon: FontAwesomeIcons.envelope,
inputType: TextInputType.emailAddress,
), ),
SizedBox( SizedBox(
height: 40, height: 40,
@@ -138,10 +140,28 @@ class _MyInfoScreenState extends State<MyInfoScreen> {
onTap: () async { onTap: () async {
await Provider.of<Auth>(context, listen: false) await Provider.of<Auth>(context, listen: false)
.setUserData( .setUserData(
user['id'], user['id'],
usernameCTRL.text, usernameCTRL.text,
emailCTRL.text, emailCTRL.text,
); )
.then(
(value) async => await showDialog(
context: context,
builder: (ctx) => AlertDialog(
content: Text(
'Info changed successfully.',
),
actions: <Widget>[
FlatButton(
child: Text('Ok'),
onPressed: () {
Navigator.of(ctx).pop();
},
),
],
),
),
);
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
), ),
+240
View File
@@ -0,0 +1,240 @@
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
import '../providers/auth.dart';
import '../providers/connectivity.dart';
import '../widgets/Global/internet_error.dart';
class RePassScreen extends StatefulWidget {
// static const route = '/HomeScreen';
@override
State<StatefulWidget> createState() {
return _RePassScreenState();
}
}
class _RePassScreenState extends State<RePassScreen> {
final _form = GlobalKey<FormState>();
bool _isLoading = false;
// final cellNumberController = TextEditingController();
final passwordController = new TextEditingController();
final rePasswordController = new TextEditingController();
String token = 'Bearer ';
// String token = 'Bearer ';
bool _hidePass = true;
bool _hideRePass = true;
bool isInit = true;
@override
void didChangeDependencies() {
if (isInit) {
token += ModalRoute.of(context).settings.arguments;
isInit = false;
}
super.didChangeDependencies();
}
Future<void> _showDialog(String message) async{
await showDialog(
context: context,
builder: (ctx) => AlertDialog(
content: Text(message),
actions: <Widget>[
FlatButton(
child: Text('Ok'),
onPressed: () {
Navigator.of(ctx).pop();
},
),
],
),
);
}
void _sendRePass() async {
if (!_form.currentState.validate()) {
return;
}
_form.currentState.save();
setState(() {
_isLoading = true;
});
await Provider.of<Auth>(context)
.sendRePass(passwordController.text, token)
.then((value) async{
if (value == 'done') {
await _showDialog('Password changed successfully.Now login to your account.');
Navigator.of(context).pop();
}
});
}
@override
Widget build(BuildContext context) {
final _media = MediaQuery.of(context);
// 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(
centerTitle: true,
title: Text('CSSD'),
),
body: Selector<ConnectivityProvider, String>(
builder: (ctx, value, _) => value != 'offline'
? _isLoading
? Center(
child: CircularProgressIndicator(),
)
: Form(
key: _form,
child: ListView(
padding: EdgeInsets.symmetric(horizontal: 20),
children: <Widget>[
Container(
padding: EdgeInsets.symmetric(vertical: 20),
child: Text(
'CHANGE PASSWORD',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black,
fontSize: 6 * _deviceBlockSize,
letterSpacing: 3,
fontWeight: FontWeight.w700,
),
),
),
TextFormField(
validator: (value) {
if (value.isEmpty) {
return 'Password is required.';
}
if (value.length < 8) {
return 'Password at least is 8 characters.';
}
return null;
},
obscureText: _hidePass,
controller: passwordController,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.starOfLife,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Password',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
suffixIcon: InkWell(
child: Icon(FontAwesomeIcons.eye),
onTap: () {
setState(() {
_hidePass = !_hidePass;
});
},
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
textInputAction: TextInputAction.done,
onFieldSubmitted: (_) {
_sendRePass();
},
keyboardType: TextInputType.visiblePassword,
),
SizedBox(
height: 30,
),
TextFormField(
validator: (value) {
if (value.length < 8) {
return 'Password at least is 8 characters.';
}
if (value != passwordController.text) {
return 'Password doesnt match!';
}
return null;
},
obscureText: _hideRePass,
controller: rePasswordController,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.starOfLife,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Confirm Password',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
suffixIcon: InkWell(
child: Icon(FontAwesomeIcons.eye),
onTap: () {
setState(() {
_hideRePass = !_hideRePass;
});
},
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
textInputAction: TextInputAction.done,
onFieldSubmitted: (_) {
_sendRePass();
},
keyboardType: TextInputType.visiblePassword,
),
SizedBox(height: 40),
Row(
children: <Widget>[
InkWell(
onTap: () => _sendRePass(),
child: Container(
width: 40 * _deviceBlockSize,
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
// margin:
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue, Colors.green],
),
borderRadius: BorderRadius.circular(7),
),
child: Text(
'Change',
style: TextStyle(
color: Colors.white,
),
textAlign: TextAlign.center,
),
),
),
Spacer(),
],
),
SizedBox(height: 10),
],
),
)
: ConnectionErrorBox(),
selector: (_, connectivity) => connectivity.conStatus,
));
}
}
+196 -184
View File
@@ -1,6 +1,6 @@
import 'package:cssd/config/routes.dart'; import 'package:cssd/config/routes.dart';
import 'package:cssd/providers/connectivity.dart'; import 'package:cssd/providers/connectivity.dart';
import 'package:cssd/widgets/Global/splash_screen%20copy.dart'; import 'package:cssd/widgets/Global/internet_error.dart';
import 'package:cssd/widgets/TestResultScreens/Add/selector_box.dart'; import 'package:cssd/widgets/TestResultScreens/Add/selector_box.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@@ -51,203 +51,215 @@ class _TestResultAddScreenState extends State<TestResultAddScreen> {
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return Scaffold( return WillPopScope(
appBar: AppBar( onWillPop: () async {
titleSpacing: -10, Navigator.pushReplacementNamed(
title: Text('Test Results'), context,
leading: IconButton( Routes.testResultScreen,
icon: Icon( );
Icons.keyboard_arrow_left, return true;
size: 35, },
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Test Results'),
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
size: 35,
),
// padding: EdgeInsets.all(0),
onPressed: () =>
Navigator.of(context).popAndPushNamed(Routes.testResultScreen),
), ),
// padding: EdgeInsets.all(0),
onPressed: () =>
Navigator.of(context).popAndPushNamed(Routes.testResultScreen),
), ),
), body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) { return connection.conStatus != 'offline'
return connection.conStatus != 'offline' ? isInit
? isInit ? Center(
? Center( child: CircularProgressIndicator(),
child: CircularProgressIndicator(), )
) : ListView(
: ListView( padding:
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 20), EdgeInsets.symmetric(horizontal: 20, vertical: 20),
children: <Widget>[ children: <Widget>[
Container( Container(
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: 10, top: 10,
),
child: Text(
'ADD A TEST RESULT',
style: TextStyle(
color: Colors.black,
fontSize: 5 * _deviceBlockSize,
letterSpacing: 3,
fontWeight: FontWeight.w700,
), ),
), child: Text(
), 'ADD A TEST RESULT',
GestureDetector( style: TextStyle(
child: Container( color: Colors.black,
margin: EdgeInsets.only(top: 5, bottom: 30), fontSize: 5 * _deviceBlockSize,
padding: EdgeInsets.all(10), letterSpacing: 3,
height: 200, fontWeight: FontWeight.w700,
decoration: BoxDecoration(border: Border.all()),
child: Center(
child: Text(
'PLEASE SCAN THE TEST BARCODE',
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.grey,
fontSize: 5 * _deviceBlockSize,
fontWeight: FontWeight.w100,
letterSpacing: 3,
),
), ),
), ),
), ),
onTap: () { GestureDetector(
scan().then( child: Container(
(String result) { margin: EdgeInsets.only(top: 5, bottom: 30),
if (result == 'cancel') { padding: EdgeInsets.all(10),
print('cancel'); height: 200,
} else if (result == 'error') { decoration: BoxDecoration(border: Border.all()),
print('error'); child: Center(
} else if (result == 'access') { child: Text(
print('access'); 'PLEASE SCAN THE TEST BARCODE',
} else { textAlign: TextAlign.center,
Navigator.pushReplacement( style: TextStyle(
context, color: Colors.grey,
MaterialPageRoute( fontSize: 5 * _deviceBlockSize,
builder: (context) { fontWeight: FontWeight.w100,
return FormPage( letterSpacing: 3,
uniqueCode: result, ),
);
},
),
);
}
},
);
},
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
width: 70 * _deviceBlockSize,
child: TestResultAddSelectorBox(
deviceBlockSize: _deviceBlockSize,
dataCTRL: testTypeCTRL,
dataVals: testTypeVals,
label: 'Choose a Test Type'),
), ),
Row( ),
crossAxisAlignment: CrossAxisAlignment.end, ),
children: <Widget>[ onTap: () {
Text( scan().then(
'OR', (String result) {
style: TextStyle( if (result == 'cancel') {
fontWeight: FontWeight.w700, print('cancel');
fontSize: 7 * _deviceBlockSize, } else if (result == 'error') {
), print('error');
), } else if (result == 'access') {
SizedBox( print('access');
width: 8 * _deviceBlockSize, } else {
), Navigator.pushReplacement(
Container( context,
width: 50 * _deviceBlockSize, MaterialPageRoute(
child: TextFormField( builder: (context) {
onChanged: (val) { return FormPage(
if (val != '') { uniqueCode: result,
setState(() { );
testTypeCTRL.text = '';
});
} else {
setState(() {
testTypeCTRL.text = testTypeVals[0];
});
}
}, },
controller: testIdCTRL,
decoration: InputDecoration(
isDense: true,
icon: Icon(
FontAwesomeIcons.sortNumericDown,
),
labelText: 'Enter a Test Code',
labelStyle: TextStyle(
fontSize: 3 * _deviceBlockSize),
contentPadding:
EdgeInsets.only(bottom: 5, top: 5),
),
keyboardType: TextInputType.number,
), ),
), );
], }
) },
], );
), },
SizedBox( ),
width: 5 * _deviceBlockSize, Row(
), mainAxisAlignment: MainAxisAlignment.spaceBetween,
Expanded( crossAxisAlignment: CrossAxisAlignment.center,
child: Container( mainAxisSize: MainAxisSize.max,
height: 100, children: <Widget>[
child: FlatButton( Column(
padding: EdgeInsets.all(0), crossAxisAlignment: CrossAxisAlignment.start,
color: Color(0xFFEB4A64), children: <Widget>[
shape: RoundedRectangleBorder( Container(
borderRadius: BorderRadius.circular(10), width: 70 * _deviceBlockSize,
child: TestResultAddSelectorBox(
deviceBlockSize: _deviceBlockSize,
dataCTRL: testTypeCTRL,
dataVals: testTypeVals,
label: 'Choose a Test Type'),
), ),
child: Text( Row(
'GO', crossAxisAlignment: CrossAxisAlignment.end,
textAlign: TextAlign.center, children: <Widget>[
style: TextStyle( Text(
color: Colors.white, 'OR',
fontSize: 6 * _deviceBlockSize, style: TextStyle(
fontWeight: FontWeight.w700), fontWeight: FontWeight.w700,
), fontSize: 7 * _deviceBlockSize,
onPressed: () {
if (testIdCTRL.text != '') {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return FormPage(
uniqueCode: testIdCTRL.text);
},
), ),
); ),
} else if (testTypeCTRL.text != '') { SizedBox(
Navigator.pushReplacement( width: 8 * _deviceBlockSize,
context, ),
MaterialPageRoute( Container(
builder: (context) { width: 50 * _deviceBlockSize,
return FormPage( child: TextFormField(
name: testTypeCTRL.text, onChanged: (val) {
); if (val != '') {
setState(() {
testTypeCTRL.text = '';
});
} else {
setState(() {
testTypeCTRL.text =
testTypeVals[0];
});
}
}, },
controller: testIdCTRL,
decoration: InputDecoration(
isDense: true,
icon: Icon(
FontAwesomeIcons.sortNumericDown,
),
labelText: 'Enter a Test Code',
labelStyle: TextStyle(
fontSize: 3 * _deviceBlockSize),
contentPadding: EdgeInsets.only(
bottom: 5, top: 5),
),
keyboardType: TextInputType.number,
), ),
); ),
} ],
// print(testCode); )
}, ],
),
), ),
) SizedBox(
], width: 5 * _deviceBlockSize,
), ),
], Expanded(
) child: Container(
: ConnectionErrorBox(); height: 100,
}), margin: EdgeInsets.only(bottom: 50),
child: FlatButton(
padding: EdgeInsets.all(0),
color: Color(0xFFEB4A64),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
child: Text(
'GO',
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 6 * _deviceBlockSize,
fontWeight: FontWeight.w700),
),
onPressed: () {
if (testIdCTRL.text != '') {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return FormPage(
uniqueCode: testIdCTRL.text);
},
),
);
} else if (testTypeCTRL.text != '') {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) {
return FormPage(
name: testTypeCTRL.text,
);
},
),
);
}
// print(testCode);
},
),
),
)
],
),
],
)
: ConnectionErrorBox();
}),
),
); );
} }
+1 -1
View File
@@ -1,6 +1,6 @@
import 'package:cssd/providers/connectivity.dart'; import 'package:cssd/providers/connectivity.dart';
import 'package:cssd/providers/test_results.dart'; import 'package:cssd/providers/test_results.dart';
import 'package:cssd/widgets/Global/splash_screen%20copy.dart'; import 'package:cssd/widgets/Global/internet_error.dart';
import 'package:cssd/widgets/TestResultScreens/Details/datas_box.dart'; import 'package:cssd/widgets/TestResultScreens/Details/datas_box.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
+224 -212
View File
@@ -1,16 +1,15 @@
import 'package:cssd/config/routes.dart'; import 'package:flutter/cupertino.dart';
import 'package:cssd/models/test_result_models.dart';
import 'package:cssd/providers/connectivity.dart';
import 'package:cssd/providers/test_results.dart';
import 'package:cssd/widgets/Global/splash_screen%20copy.dart';
import 'package:cssd/widgets/TestResultScreens/Filter/date_picker.dart';
import 'package:cssd/widgets/TestResultScreens/Filter/selector_box.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:intl/intl.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:flutter/cupertino.dart';
import '../config/routes.dart';
import '../models/test_result_models.dart';
import '../providers/connectivity.dart';
import '../providers/test_results.dart';
import '../widgets/Global/internet_error.dart';
import '../widgets/TestResultScreens/Filter/date_picker.dart';
import '../widgets/TestResultScreens/Filter/selector_box.dart';
class TestFilterScreen extends StatefulWidget { class TestFilterScreen extends StatefulWidget {
// static const route = '/TestFilterScreen'; // static const route = '/TestFilterScreen';
@@ -34,8 +33,9 @@ class _TestFilterScreenState extends State<TestFilterScreen> {
DateTime dateTimeUntil; DateTime dateTimeUntil;
final List<String> labelIDVals = [ final List<String> labelIDVals = [
'',
'Washer ID', 'Washer ID',
'Autocleave ID', 'Autoclave ID',
'Sterilizer ID', 'Sterilizer ID',
'Seal Machine ID', 'Seal Machine ID',
'Patiant ID', 'Patiant ID',
@@ -44,8 +44,8 @@ class _TestFilterScreenState extends State<TestFilterScreen> {
'OR ID', 'OR ID',
'Insrtument ID', 'Insrtument ID',
'Basket ID', 'Basket ID',
'Impalent ID', 'Implant ID',
'None', // 'None',
]; ];
// String curLabelIDVal; // String curLabelIDVal;
@@ -53,7 +53,7 @@ class _TestFilterScreenState extends State<TestFilterScreen> {
Map<String, String> testTypes; Map<String, String> testTypes;
final List<String> hospitalVals = []; final List<String> hospitalVals = [];
Map<String, String> hospitals; Map<String, String> hospitals = {};
// String curhospitalVal; // String curhospitalVal;
bool isInit = true; bool isInit = true;
@@ -71,8 +71,10 @@ class _TestFilterScreenState extends State<TestFilterScreen> {
@override @override
void didChangeDependencies() { void didChangeDependencies() {
if (isInit) { if (isInit) {
fDateCTRL.text = DateFormat('y-M-d').format(DateTime.now()); // fDateCTRL.text = DateFormat('y-M-d').format(DateTime.now());
uDateCTRL.text = DateFormat('y-M-d').format(DateTime.now()); // uDateCTRL.text = DateFormat('y-M-d').format(DateTime.now());
fDateCTRL.text = '';
uDateCTRL.text = '';
var testResultProviderObject = var testResultProviderObject =
Provider.of<TestResultsProvider>(context, listen: false); Provider.of<TestResultsProvider>(context, listen: false);
TestResultFilterObject filters = testResultProviderObject.filters; TestResultFilterObject filters = testResultProviderObject.filters;
@@ -85,10 +87,11 @@ class _TestFilterScreenState extends State<TestFilterScreen> {
testResultProviderObject.getFilterItems().then((result) { testResultProviderObject.getFilterItems().then((result) {
hospitals = result[0]; hospitals = result[0];
testTypes = result[1]; testTypes = result[1];
hospitalVals.add('');
for (var hospital in result[0].keys) { for (var hospital in result[0].keys) {
hospitalVals.add(hospital); hospitalVals.add(hospital);
} }
testTypeVals.add('');
for (var testType in result[1].keys) { for (var testType in result[1].keys) {
testTypeVals.add(testType); testTypeVals.add(testType);
} }
@@ -118,219 +121,228 @@ class _TestFilterScreenState extends State<TestFilterScreen> {
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return Scaffold( return WillPopScope(
appBar: AppBar( onWillPop: () async {
titleSpacing: -10, Navigator.pushReplacementNamed(
title: Text('Tests'), context,
leading: IconButton( Routes.testResultScreen,
icon: Icon( );
Icons.keyboard_arrow_left, return true;
size: 35, },
), child: Scaffold(
onPressed: () => Navigator.of(context).popAndPushNamed( appBar: AppBar(
Routes.testResultScreen, titleSpacing: -10,
title: Text('Tests'),
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
size: 35,
),
onPressed: () => Navigator.of(context).popAndPushNamed(
Routes.testResultScreen,
),
), ),
), ),
), body: Consumer<ConnectivityProvider>(
body: Consumer<ConnectivityProvider>( builder: (ct, connection, _) {
builder: (ct, connection, _) { return connection.conStatus != 'offline'
return connection.conStatus != 'offline' ? isInit
? isInit ? Center(
? Center( child: CircularProgressIndicator(),
child: CircularProgressIndicator(), )
) : Padding(
: Padding( padding: EdgeInsets.all(20),
padding: EdgeInsets.all(20), child: ListView(
child: ListView( // crossAxisAlignment: CrossAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
children: <Widget>[ Text(
Text( 'FILTER RESULTS',
'FILTER RESULTS', style: TextStyle(
style: TextStyle( fontWeight: FontWeight.w700,
fontWeight: FontWeight.w700, fontSize: 5 * _deviceBlockSize,
fontSize: 5 * _deviceBlockSize,
),
),
SizedBox(
height: 20,
),
TextFormField(
controller: idCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
), ),
labelStyle: TextStyle( ),
fontWeight: FontWeight.w100, SizedBox(
fontSize: 4 * _deviceBlockSize, height: 20,
),
TextFormField(
controller: idCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
), ),
labelText: 'ID', style: TextStyle(
isDense: true, fontWeight: FontWeight.w700,
contentPadding: EdgeInsets.symmetric( fontSize: 5 * _deviceBlockSize,
vertical: 2, horizontal: 3), ),
keyboardType: TextInputType.text,
textInputAction: TextInputAction.next,
// onFieldSubmitted: (_) {
// FocusScope.of(context)
// .requestFocus(_cycleNumberFocusNode);
// },
), ),
style: TextStyle( SizedBox(
fontWeight: FontWeight.w700, height: 25,
fontSize: 5 * _deviceBlockSize, ),
TestResultFilterSelectorBox(
deviceBlockSize: _deviceBlockSize,
dataCTRL: labelIdCTRL,
dataVals: labelIDVals,
label: 'Label ID',
),
SizedBox(
height: 25,
), ),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
// onFieldSubmitted: (_) {
// FocusScope.of(context)
// .requestFocus(_cycleNumberFocusNode);
// },
),
SizedBox(
height: 25,
),
TestResultFilterSelectorBox(
deviceBlockSize: _deviceBlockSize,
dataCTRL: labelIdCTRL,
dataVals: labelIDVals,
label: 'Label ID',
),
SizedBox(
height: 25,
),
TextFormField( TextFormField(
controller: usernameCTRL, controller: usernameCTRL,
decoration: InputDecoration( decoration: InputDecoration(
icon: Icon( icon: Icon(
FontAwesomeIcons.sortNumericDown, FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize, size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Username',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
), ),
labelStyle: TextStyle( style: TextStyle(
fontWeight: FontWeight.w100, fontWeight: FontWeight.w700,
fontSize: 4 * _deviceBlockSize, fontSize: 5 * _deviceBlockSize,
), ),
labelText: 'Username', keyboardType: TextInputType.visiblePassword,
isDense: true, textInputAction: TextInputAction.next,
contentPadding: EdgeInsets.symmetric( // onFieldSubmitted: (_) {
vertical: 2, horizontal: 3), // FocusScope.of(context)
// .requestFocus(_cycleNumberFocusNode);
// },
), ),
style: TextStyle( SizedBox(
fontWeight: FontWeight.w700, height: 25,
fontSize: 5 * _deviceBlockSize, ),
TestResultFilterSelectorBox(
deviceBlockSize: _deviceBlockSize,
dataCTRL: testTypeCTRL,
dataVals: testTypeVals,
label: 'Test Type',
),
SizedBox(
height: 25,
),
TestResultFilterSelectorBox(
deviceBlockSize: _deviceBlockSize,
dataCTRL: hospitalCTRL,
dataVals: hospitalVals,
label: 'Hospital',
),
SizedBox(
height: 25,
), ),
keyboardType: TextInputType.visiblePassword,
textInputAction: TextInputAction.next,
// onFieldSubmitted: (_) {
// FocusScope.of(context)
// .requestFocus(_cycleNumberFocusNode);
// },
),
SizedBox(
height: 25,
),
TestResultFilterSelectorBox(
deviceBlockSize: _deviceBlockSize,
dataCTRL: testTypeCTRL,
dataVals: testTypeVals,
label: 'Test Type',
),
SizedBox(
height: 25,
),
TestResultFilterSelectorBox(
deviceBlockSize: _deviceBlockSize,
dataCTRL: hospitalCTRL,
dataVals: hospitalVals,
label: 'Hospital',
),
SizedBox(
height: 25,
),
TestResultFilterDatePicker( TestResultFilterDatePicker(
dateCTRL: fDateCTRL, dateCTRL: fDateCTRL,
deviceBlockSize: _deviceBlockSize, deviceBlockSize: _deviceBlockSize,
label: 'Date From', label: 'Date From',
), ),
SizedBox( SizedBox(
height: 25, height: 25,
), ),
TestResultFilterDatePicker( TestResultFilterDatePicker(
dateCTRL: uDateCTRL, dateCTRL: uDateCTRL,
deviceBlockSize: _deviceBlockSize, deviceBlockSize: _deviceBlockSize,
label: 'Date Until', label: 'Date Until',
), ),
SizedBox( SizedBox(
height: 70, height: 70,
), ),
InkWell( InkWell(
onTap: () { onTap: () {
Provider.of<TestResultsProvider>(context) Provider.of<TestResultsProvider>(context)
.setFilters( .setFilters(
idCTRL.text, idCTRL.text,
labelIdCTRL.text != 'None' labelIdCTRL.text != ''
? labelIdCTRL.text ? labelIdCTRL.text
: '', : '',
usernameCTRL.text, usernameCTRL.text,
testTypeCTRL.text != 'None' testTypeCTRL.text != ''
? testTypes[testTypeCTRL.text] ? testTypes[testTypeCTRL.text]
: '', : '',
hospitalCTRL.text != 'None' hospitalCTRL.text != ''
? hospitals[hospitalCTRL.text] ? hospitals[hospitalCTRL.text]
: '', : '',
fDateCTRL.text, fDateCTRL.text,
uDateCTRL.text, uDateCTRL.text,
); );
showDialog( showDialog(
context: context, context: context,
builder: (ctx) => AlertDialog( builder: (ctx) => AlertDialog(
content: Text('Filters changed.'), content: Text('Filters changed.'),
actions: <Widget>[ actions: <Widget>[
FlatButton( FlatButton(
onPressed: () { onPressed: () {
Navigator.of(ctx).pop(); Navigator.of(ctx).pop();
// Navigator.of(context).pop(); // Navigator.of(context).pop();
}, },
child: Text('Ok'), child: Text('Ok'),
) )
], ],
),
).then(
(_) => Navigator.of(context).popAndPushNamed(
Routes.testResultScreen,
),
);
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
), ),
).then( // margin:
(_) => Navigator.of(context).popAndPushNamed( // EdgeInsets.symmetric(horizontal: 35, vertical: 15),
Routes.testResultScreen, decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue, Colors.green],
),
borderRadius: BorderRadius.circular(7),
), ),
); child: Align(
}, alignment: Alignment.center,
child: Container( child: Text(
padding: EdgeInsets.symmetric( 'FILTER',
horizontal: 5 * _deviceBlockSize, style: TextStyle(
vertical: 10, color: Colors.white,
), fontSize: 5 * _deviceBlockSize,
// margin: ),
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue, Colors.green],
),
borderRadius: BorderRadius.circular(7),
),
child: Align(
alignment: Alignment.center,
child: Text(
'FILTER',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
), ),
), ),
), ),
), ),
), SizedBox(
SizedBox( height: 70,
height: 70, ),
), // DropDownBox(values: ['Washer ID']),
// DropDownBox(values: ['Washer ID']), ],
], ),
), )
) : ConnectionErrorBox();
: ConnectionErrorBox(); },
}, ),
), ),
); );
} }
+104 -91
View File
@@ -4,6 +4,7 @@ import 'package:cssd/providers/test_results.dart';
import 'package:cssd/widgets/TestResultScreens/Add/form_creator.dart'; import 'package:cssd/widgets/TestResultScreens/Add/form_creator.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:random_string/random_string.dart';
class FormPage extends StatefulWidget { class FormPage extends StatefulWidget {
final String name; final String name;
@@ -26,39 +27,41 @@ class _FormPageState extends State<FormPage> {
List<Map<String, dynamic>> formInputs; List<Map<String, dynamic>> formInputs;
void _saveForm() { void _saveForm() {
final batchId = randomString(10);
formatData(formInputs); formatData(formInputs);
if (this.widget.testResultId != null && this.widget.testResultId !=''){ var prvObject = Provider.of<TestResultsProvider>(context, listen: false);
if (this.widget.testResultId != null && this.widget.testResultId != '') {
values['_method'] = 'put'; values['_method'] = 'put';
TestResultsProvider.updateTestResult(this.widget.testResultId, values).then((_){ TestResultsProvider.updateTestResult(this.widget.testResultId, values)
.then((_) {
Navigator.of(context).pop(); Navigator.of(context).pop();
}); });
} else { } else {
setState(() { setState(() {
_isLoading = true; _isLoading = true;
}); });
TestResultsProvider.createTestResult(values).then((_) { prvObject.createTestResult(values, batchId).then((result) {
setState(() { setState(() {
_isLoading = false; _isLoading = false;
}); });
showDialog( if (result == 'done') {
context: context, showDialog(
builder: (ctx) => AlertDialog( context: context,
content: Text('Test added.'), builder: (ctx) => AlertDialog(
actions: <Widget>[ content: Text('Test added.'),
FlatButton( actions: <Widget>[
onPressed: () { FlatButton(
Navigator.of(ctx).pop(); onPressed: () {
}, Navigator.of(ctx).pop();
child: Text('Ok'), },
) child: Text('Ok'),
], )
), ],
).then((_) { ),
Navigator.of(context).popAndPushNamed(Routes.testResultScreen); ).then((value) =>
}); Navigator.of(context).popAndPushNamed(Routes.testResultScreen));
}
}); });
} }
} }
@@ -70,11 +73,10 @@ class _FormPageState extends State<FormPage> {
}); });
Provider.of<Inputs>(context) Provider.of<Inputs>(context)
.getInputs( .getInputs(
testResultId: this.widget.testResultId ?? "", testResultId: this.widget.testResultId ?? "",
name: this.widget.name ?? "", name: this.widget.name ?? "",
uniqueCode: this.widget.uniqueCode ?? "", uniqueCode: this.widget.uniqueCode ?? "",
testTypeId: this.widget.testTypeId ?? "" testTypeId: this.widget.testTypeId ?? "")
)
.then((_) { .then((_) {
setState(() { setState(() {
_isLoading = false; _isLoading = false;
@@ -87,81 +89,93 @@ class _FormPageState extends State<FormPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return WillPopScope(
appBar: AppBar( onWillPop: () async {
centerTitle: true, Navigator.pushReplacementNamed(
title: Text('Add Test Result'), context,
actions: <Widget>[ Routes.testResultAddScreen,
IconButton( );
icon: Icon(Icons.save), return true;
},
child: Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text('Add Test Result'),
actions: <Widget>[
IconButton(
icon: Icon(Icons.save),
onPressed: () {
_saveForm();
},
)
],
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
size: 35,
),
onPressed: () { onPressed: () {
_saveForm(); Navigator.of(context).popAndPushNamed(Routes.testResultScreen);
}, },
)
],
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
size: 35,
), ),
onPressed: () {
Navigator.of(context).popAndPushNamed(Routes.testResultScreen);
},
), ),
), body: Column(
body: Column( children: <Widget>[
children: <Widget>[ Expanded(
Expanded( child: _isLoading
child: _isLoading ? Center(child: CircularProgressIndicator())
? Center(child: CircularProgressIndicator()) : Form(
: Form( key: _form,
key: _form, child: Consumer<Inputs>(
child: Consumer<Inputs>( builder: (context, inputs, _) {
builder: (context, inputs, _) { formInputs = inputs.inputItems;
formInputs = inputs.inputItems; return formInputs.length != 0
// print(formInputs); ? FormCreator(
return formInputs.length != 0 ? FormCreator( form: inputs.inputItems,
form: inputs.inputItems, onChanged: (value) {
onChanged: (value) { formInputs = value;
formInputs = value; },
}, )
) : Center(child: Text('An error happen!!!'),); : Center(
}, child: Text('An error happen!!!'),
);
},
),
), ),
), ),
), // https://www.cssd-doc.com/api/GetInfo
// https://www.cssd-doc.com/api/GetInfo // InkWell(
// InkWell( // onTap: () {
// onTap: () { // _saveForm();
// _saveForm(); // },
// }, // child: Container(
// child: Container( // padding: EdgeInsets.symmetric(horizontal: 60, vertical: 15),
// padding: EdgeInsets.symmetric(horizontal: 60, vertical: 15), // margin: EdgeInsets.symmetric(vertical: 20, horizontal: 50),
// margin: EdgeInsets.symmetric(vertical: 20, horizontal: 50), // decoration: BoxDecoration(
// decoration: BoxDecoration( // gradient: LinearGradient(colors: [Colors.blue, Colors.green]),
// gradient: LinearGradient(colors: [Colors.blue, Colors.green]), // borderRadius: BorderRadius.circular(10),
// borderRadius: BorderRadius.circular(10), // ),
// ), // child: Text(
// child: Text( // 'Save',
// 'Save', // style: TextStyle(color: Colors.white, fontSize: 17),
// style: TextStyle(color: Colors.white, fontSize: 17), // textAlign: TextAlign.center,
// textAlign: TextAlign.center, // ),
// ), // ),
// ), // ),
// ), ],
], )),
)); );
} }
void formatData(inputs) { void formatData(inputs) {
for (var input in inputs) { for (var input in inputs) {
if(input['type'] != 'Form') { if (input['type'] != 'Form') {
if(input['key'] == 'result') { if (input['key'] == 'result') {
values[input["key"]] = input["value"] ? "Accept" : "Reject"; values[input["key"]] = input["value"] ? "Accept" : "Reject";
// print('${input["key"]} : ${input["value"] ? "Accept" : "Reject"}'); // print('${input["key"]} : ${input["value"] ? "Accept" : "Reject"}');
} else if(input['key'] == 'date') { } else if (input['key'] == 'date') {
var date = input["value"]; var date = input["value"];
values[input["key"]] = "${date.year}-${date.month}-${date.day}"; values[input["key"]] = "${date.year}-${date.month}-${date.day}";
} else { } else {
values[input["key"]] = input["value"]; values[input["key"]] = input["value"];
@@ -172,7 +186,6 @@ class _FormPageState extends State<FormPage> {
formatData(input['children']); formatData(input['children']);
} }
} }
print(values); print(values);
} }
} }
+54 -54
View File
@@ -3,7 +3,7 @@ import 'package:cssd/models/test_result_models.dart';
import 'package:cssd/providers/connectivity.dart'; import 'package:cssd/providers/connectivity.dart';
// import 'package:cssd/providers/test_result.dart'; // import 'package:cssd/providers/test_result.dart';
import 'package:cssd/providers/test_results.dart'; import 'package:cssd/providers/test_results.dart';
import 'package:cssd/widgets/Global/splash_screen%20copy.dart'; import 'package:cssd/widgets/Global/internet_error.dart';
import 'package:cssd/widgets/TestResultScreens/Main/filter_chip_box.dart'; import 'package:cssd/widgets/TestResultScreens/Main/filter_chip_box.dart';
import 'package:cssd/widgets/TestResultScreens/Main/floating_button.dart'; import 'package:cssd/widgets/TestResultScreens/Main/floating_button.dart';
import 'package:cssd/widgets/TestResultScreens/Main/search_box.dart'; import 'package:cssd/widgets/TestResultScreens/Main/search_box.dart';
@@ -342,10 +342,10 @@ class TestItemBox extends StatelessWidget {
SizedBox( SizedBox(
height: 15, height: 15,
), ),
item.result == 'Verified' item.result == 'Accepted'
? Text( ? Text(
'Verified', 'Accepted',
style: TextStyle(color: Colors.blueAccent), style: TextStyle(color: Colors.green),
) )
: Text( : Text(
'Rejected', 'Rejected',
@@ -366,56 +366,56 @@ class TestItemBox extends StatelessWidget {
Row( Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[ children: <Widget>[
item.result != 'Verified' // item.result != 'Accepted'
? InkWell( // ? InkWell(
onTap: () { // onTap: () {
showDialog( // showDialog(
context: context, // context: context,
builder: (ctx) => AlertDialog( // builder: (ctx) => AlertDialog(
title: Text('Delete'), // title: Text('Delete'),
content: Text( // content: Text(
'Are you sure for delete this test?'), // 'Are you sure for delete this test?'),
actions: <Widget>[ // actions: <Widget>[
FlatButton( // FlatButton(
onPressed: () { // onPressed: () {
Provider.of<TestResultsProvider>( // Provider.of<TestResultsProvider>(
context) // context)
.removeTestResult( // .removeTestResult(
item.id.toString()) // item.id.toString())
.then((_) { // .then((_) {
Navigator.of(ctx).pop(); // Navigator.of(ctx).pop();
}); // });
}, // },
child: Text('Yes'), // child: Text('Yes'),
), // ),
FlatButton( // FlatButton(
onPressed: () { // onPressed: () {
Navigator.of(ctx).pop(); // Navigator.of(ctx).pop();
}, // },
child: Text('No'), // child: Text('No'),
), // ),
], // ],
), // ),
); // );
}, // },
child: Container( // child: Container(
padding: EdgeInsets.all(7), // padding: EdgeInsets.all(7),
width: 10 * _deviceBlockSize, // width: 10 * _deviceBlockSize,
decoration: BoxDecoration( // decoration: BoxDecoration(
shape: BoxShape.circle, // shape: BoxShape.circle,
color: Colors.red, // color: Colors.red,
), // ),
child: Icon( // child: Icon(
Icons.delete, // Icons.delete,
size: 6 * _deviceBlockSize, // size: 6 * _deviceBlockSize,
color: Colors.white, // color: Colors.white,
), // ),
), // ),
) // )
: Container(), // : Container(),
SizedBox( // SizedBox(
width: _deviceBlockSize, // width: _deviceBlockSize,
), // ),
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
+213
View File
@@ -0,0 +1,213 @@
import 'package:cssd/providers/connectivity.dart';
import 'package:cssd/widgets/Global/internet_error.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:barcode_scan/barcode_scan.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
class TestScanScreen extends StatefulWidget {
// static const route = '/TestScanScreen';
@override
State<StatefulWidget> createState() {
return _TestScanScreenState();
}
}
class _TestScanScreenState extends State<TestScanScreen> {
String testCode = "";
TextEditingController idCTRL = new TextEditingController();
final _form = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
final _media = MediaQuery.of(context);
// 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(
centerTitle: true,
titleSpacing: -10,
title: Text('CSSD'),
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
),
),
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? ListView(
padding: EdgeInsets.symmetric(horizontal: 20),
children: <Widget>[
Container(
padding: EdgeInsets.only(top: 30),
child: Text(
'LOOKING FOR A Test Result?',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black,
fontSize: 5.5 * _deviceBlockSize,
fontWeight: FontWeight.w700,
letterSpacing: 3,
),
),
),
GestureDetector(
child: Container(
margin: EdgeInsets.symmetric(vertical: 10),
height: 200,
decoration: BoxDecoration(border: Border.all()),
child: Center(
child: Text(
'Please Scan The Test Result Barcode',
style: TextStyle(
color: Colors.black,
fontSize: 5 * _deviceBlockSize,
fontWeight: FontWeight.w100,
letterSpacing: 3,
),
textAlign: TextAlign.center,
),
),
),
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
launch(
'https://cssd-doc.com/Show/TestResult/$result',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: result,
// );
}
},
);
},
),
Form(
key: _form,
child: TextFormField(
validator: (val) {
if (val.isEmpty) {
return 'Id required!!';
}
return null;
},
controller: idCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Or enter a Test Result ID',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
focusedBorder: UnderlineInputBorder(
// borderRadius: BorderRadius.only(Radius.circular(4)),
borderSide: BorderSide(
color: Colors.grey,
),
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
),
),
SizedBox(
height: 40,
),
Divider(
color: Colors.black,
thickness: 3,
),
SizedBox(
height: 30,
),
InkWell(
onTap: () {
if (!_form.currentState.validate()) {
return;
}
launch(
'https://cssd-doc.com/Show/TestResult/${idCTRL.text}',
);
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
margin: EdgeInsets.only(bottom: 50, left: 20, right: 20),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.red, Colors.orange],
),
borderRadius: BorderRadius.circular(7),
),
child: Align(
alignment: Alignment.center,
child: Text(
'GO!',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
),
),
),
),
),
],
)
: ConnectionErrorBox();
}),
);
}
Future<String> scan() async {
try {
var barcode = await BarcodeScanner.scan();
if (barcode.type.name == 'Cancelled') {
return 'cancel';
} else if (barcode.type.name == 'Failed') {
return 'error';
}
try {
var id = barcode.rawContent.contains('www.cssd-doc.com')
? barcode.rawContent.split('/')[5]
: barcode.rawContent;
return id;
} catch (_) {
return 'null';
}
} on PlatformException catch (_) {
return 'access';
} catch (_) {
return 'error';
}
}
}
+287 -238
View File
@@ -1,18 +1,17 @@
import 'package:cssd/config/routes.dart';
import 'package:cssd/models/test_result_models.dart';
// import 'package:cssd/providers/test_result.dart';
import 'package:cssd/providers/test_results.dart'; import 'package:cssd/providers/test_results.dart';
import 'package:cssd/widgets/TestResultScreens/Main/filter_chip_box.dart';
import 'package:cssd/widgets/TestResultScreens/Main/search_box.dart'; import 'package:cssd/widgets/TestResultScreens/Main/search_box.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../config/routes.dart';
import '../models/test_result_models.dart';
import '../providers/auth.dart';
class TestVerifyScreen extends StatefulWidget { class TestVerifyScreen extends StatefulWidget {
// static const route = '/TestVerifyScreen'; // static const route = '/TestVerifyScreen';
final bool isAdmin; // final bool isAdmin;
TestVerifyScreen({this.isAdmin}); // TestVerifyScreen({this.isAdmin});
@override @override
_TestVerifyScreenState createState() => _TestVerifyScreenState(); _TestVerifyScreenState createState() => _TestVerifyScreenState();
@@ -41,6 +40,7 @@ class _TestVerifyScreenState extends State<TestVerifyScreen> {
var testResults = var testResults =
Provider.of<TestResultsProvider>(context, listen: false); Provider.of<TestResultsProvider>(context, listen: false);
testResults.setLoading(); testResults.setLoading();
testResults.resetFilters();
testResults.resetPageNumber(); testResults.resetPageNumber();
testResults.getTestResults().then((_) { testResults.getTestResults().then((_) {
testResults.resetLoading(); testResults.resetLoading();
@@ -64,6 +64,8 @@ class _TestVerifyScreenState extends State<TestVerifyScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final userData = Provider.of<Auth>(context, listen: false).user;
final _media = MediaQuery.of(context); final _media = MediaQuery.of(context);
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
@@ -101,153 +103,153 @@ class _TestVerifyScreenState extends State<TestVerifyScreen> {
), ),
), ),
), ),
Spacer(), // Spacer(),
InkWell( // InkWell(
onTap: () { // onTap: () {
Navigator.of(context) // Navigator.of(context)
.popAndPushNamed(Routes.testFilterScreen); // .popAndPushNamed(Routes.testFilterScreen);
}, // },
child: Container( // child: Container(
padding: EdgeInsets.all(7), // padding: EdgeInsets.all(7),
child: Icon( // child: Icon(
FontAwesomeIcons.filter, // FontAwesomeIcons.filter,
size: 7 * _deviceBlockSize, // size: 7 * _deviceBlockSize,
), // ),
), // ),
), // ),
], ],
), ),
SizedBox( SizedBox(
height: 20, height: 20,
), ),
Consumer<TestResultsProvider>( // Consumer<TestResultsProvider>(
builder: (context, testResult, _) { // builder: (context, testResult, _) {
return Container( // return Container(
height: 50, // height: 50,
child: ListView( // child: ListView(
scrollDirection: Axis.horizontal, // scrollDirection: Axis.horizontal,
shrinkWrap: true, // shrinkWrap: true,
children: <Widget>[ // children: <Widget>[
InkWell( // InkWell(
onTap: () { // onTap: () {
Navigator.of(context) // Navigator.of(context)
.popAndPushNamed(Routes.testFilterScreen); // .popAndPushNamed(Routes.testFilterScreen);
}, // },
child: Chip( // child: Chip(
backgroundColor: Colors.black, // backgroundColor: Colors.black,
label: Text( // label: Text(
'Filters', // 'Filters',
style: TextStyle( // style: TextStyle(
color: Colors.white, // color: Colors.white,
), // ),
), // ),
deleteIcon: Icon( // deleteIcon: Icon(
FontAwesomeIcons.filter, // FontAwesomeIcons.filter,
color: Colors.white, // color: Colors.white,
size: 4 * _deviceBlockSize, // size: 4 * _deviceBlockSize,
), // ),
onDeleted: () { // onDeleted: () {
Navigator.of(context) // Navigator.of(context)
.popAndPushNamed(Routes.testFilterScreen); // .popAndPushNamed(Routes.testFilterScreen);
}, // },
), // ),
), // ),
testResult.filters.id != '' // testResult.filters.id != ''
? TestResultChip( // ? TestResultChip(
deviceBlockSize: _deviceBlockSize, // deviceBlockSize: _deviceBlockSize,
label: 'ID', // label: 'ID',
id: '', // id: '',
labelID: testResult.filters.labelID, // labelID: testResult.filters.labelID,
testType: testResult.filters.testType, // testType: testResult.filters.testType,
hospital: testResult.filters.hospital, // hospital: testResult.filters.hospital,
username: testResult.filters.userName, // username: testResult.filters.userName,
fDate: testResult.filters.fDate, // fDate: testResult.filters.fDate,
uDate: testResult.filters.uDate, // uDate: testResult.filters.uDate,
) // )
: Container(), // : Container(),
testResult.filters.labelID != '' // testResult.filters.labelID != ''
? TestResultChip( // ? TestResultChip(
deviceBlockSize: _deviceBlockSize, // deviceBlockSize: _deviceBlockSize,
label: 'Label ID', // label: 'Label ID',
id: testResult.filters.id, // id: testResult.filters.id,
labelID: '', // labelID: '',
testType: testResult.filters.testType, // testType: testResult.filters.testType,
hospital: testResult.filters.hospital, // hospital: testResult.filters.hospital,
username: testResult.filters.userName, // username: testResult.filters.userName,
fDate: testResult.filters.fDate, // fDate: testResult.filters.fDate,
uDate: testResult.filters.uDate, // uDate: testResult.filters.uDate,
) // )
: Container(), // : Container(),
testResult.filters.testType != '' // testResult.filters.testType != ''
? TestResultChip( // ? TestResultChip(
deviceBlockSize: _deviceBlockSize, // deviceBlockSize: _deviceBlockSize,
label: 'Test Type', // label: 'Test Type',
id: testResult.filters.id, // id: testResult.filters.id,
labelID: testResult.filters.labelID, // labelID: testResult.filters.labelID,
testType: '', // testType: '',
hospital: testResult.filters.hospital, // hospital: testResult.filters.hospital,
username: testResult.filters.userName, // username: testResult.filters.userName,
fDate: testResult.filters.fDate, // fDate: testResult.filters.fDate,
uDate: testResult.filters.uDate, // uDate: testResult.filters.uDate,
) // )
: Container(), // : Container(),
testResult.filters.hospital != '' // testResult.filters.hospital != ''
? TestResultChip( // ? TestResultChip(
deviceBlockSize: _deviceBlockSize, // deviceBlockSize: _deviceBlockSize,
label: 'Hospital', // label: 'Hospital',
id: testResult.filters.id, // id: testResult.filters.id,
labelID: testResult.filters.labelID, // labelID: testResult.filters.labelID,
testType: testResult.filters.testType, // testType: testResult.filters.testType,
hospital: '', // hospital: '',
username: testResult.filters.userName, // username: testResult.filters.userName,
fDate: testResult.filters.fDate, // fDate: testResult.filters.fDate,
uDate: testResult.filters.uDate, // uDate: testResult.filters.uDate,
) // )
: Container(), // : Container(),
testResult.filters.userName != '' // testResult.filters.userName != ''
? TestResultChip( // ? TestResultChip(
deviceBlockSize: _deviceBlockSize, // deviceBlockSize: _deviceBlockSize,
label: 'Username', // label: 'Username',
id: testResult.filters.id, // id: testResult.filters.id,
labelID: testResult.filters.labelID, // labelID: testResult.filters.labelID,
testType: testResult.filters.testType, // testType: testResult.filters.testType,
hospital: testResult.filters.hospital, // hospital: testResult.filters.hospital,
username: '', // username: '',
fDate: testResult.filters.fDate, // fDate: testResult.filters.fDate,
uDate: testResult.filters.uDate, // uDate: testResult.filters.uDate,
) // )
: Container(), // : Container(),
testResult.filters.fDate != '' // testResult.filters.fDate != ''
? TestResultChip( // ? TestResultChip(
deviceBlockSize: _deviceBlockSize, // deviceBlockSize: _deviceBlockSize,
label: 'From Date', // label: 'From Date',
id: testResult.filters.id, // id: testResult.filters.id,
labelID: testResult.filters.labelID, // labelID: testResult.filters.labelID,
testType: testResult.filters.testType, // testType: testResult.filters.testType,
hospital: testResult.filters.hospital, // hospital: testResult.filters.hospital,
username: testResult.filters.userName, // username: testResult.filters.userName,
fDate: '', // fDate: '',
uDate: testResult.filters.uDate, // uDate: testResult.filters.uDate,
) // )
: Container(), // : Container(),
testResult.filters.uDate != '' // testResult.filters.uDate != ''
? TestResultChip( // ? TestResultChip(
deviceBlockSize: _deviceBlockSize, // deviceBlockSize: _deviceBlockSize,
label: 'Until Date', // label: 'Until Date',
id: testResult.filters.id, // id: testResult.filters.id,
labelID: testResult.filters.labelID, // labelID: testResult.filters.labelID,
testType: testResult.filters.testType, // testType: testResult.filters.testType,
hospital: testResult.filters.hospital, // hospital: testResult.filters.hospital,
username: testResult.filters.userName, // username: testResult.filters.userName,
fDate: testResult.filters.fDate, // fDate: testResult.filters.fDate,
uDate: '', // uDate: '',
) // )
: Container(), // : Container(),
], // ],
), // ),
); // );
}, // },
), // ),
TestResultSearchBox( TestResultSearchBox(
searchCTRL: searchCTRL, searchCTRL: searchCTRL,
deviceBlockSize: _deviceBlockSize, deviceBlockSize: _deviceBlockSize,
@@ -264,11 +266,18 @@ class _TestVerifyScreenState extends State<TestVerifyScreen> {
) )
: ListView.builder( : ListView.builder(
controller: sc, controller: sc,
itemBuilder: (context, index) => TestItemBox( itemBuilder: (context, index) =>
deviceBlockSize: _deviceBlockSize, (testResults.items[index].verified == 'None' &&
item: testResults.items[index], userData['roles']
id: testResults.items[index].id, .contains('Supervisor')) ||
), userData['roles'].contains('Admin')
? TestItemBox(
deviceBlockSize: _deviceBlockSize,
item: testResults.items[index],
id: testResults.items[index].id,
userData: userData,
)
: Container(),
// Column( // Column(
// children: <Widget>[ // children: <Widget>[
// Text(testResults.items[index].name), // Text(testResults.items[index].name),
@@ -303,11 +312,12 @@ class TestItemBox extends StatelessWidget {
Key key, Key key,
@required String id, @required String id,
@required double deviceBlockSize, @required double deviceBlockSize,
this.item, @required this.item,
@required this.userData,
}) : _deviceBlockSize = deviceBlockSize, }) : _deviceBlockSize = deviceBlockSize,
// _id = id, // _id = id,
super(key: key); super(key: key);
final Map<String, dynamic> userData;
final double _deviceBlockSize; final double _deviceBlockSize;
// final String _id; // final String _id;
@@ -348,17 +358,24 @@ class TestItemBox extends StatelessWidget {
SizedBox( SizedBox(
height: 15, height: 15,
), ),
item.result == 'Verified' item.verified == 'None'
? Text( ? Text(
'Verified',
style: TextStyle(color: Colors.blueAccent),
)
: Text(
'Awaiting Verification', 'Awaiting Verification',
style: TextStyle( style: TextStyle(color: Colors.orange),
color: Colors.orange, )
), : item.verified == 'Verified'
), ? Text(
'Verified',
style: TextStyle(
color: Colors.blueAccent,
),
)
: Text(
'Rejected',
style: TextStyle(
color: Colors.red,
),
),
], ],
), ),
Spacer(), Spacer(),
@@ -372,85 +389,117 @@ class TestItemBox extends StatelessWidget {
Row( Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[ children: <Widget>[
item.result != 'Verified' Row(
? InkWell( mainAxisAlignment: MainAxisAlignment.center,
onTap: () { children: <Widget>[
showDialog( InkWell(
context: context, onTap: () {
builder: (ctx) => AlertDialog( showDialog(
title: Text('Verify'), context: context,
content: Text( builder: (ctx) => AlertDialog(
'Are you sure for verify this test?'), title: Text('Verify'),
actions: <Widget>[ content: Text(
FlatButton( 'Are you sure for verify this test?'),
onPressed: () { actions: <Widget>[
// TestResultsProvider.updateTestResult( FlatButton(
// _id, onPressed: () async {
// {}) Provider.of<TestResultsProvider>(
// .then((_) { context)
// Navigator.of(context).pop(); .changeVerification(
// }); item.id, 'Verified')
// Provider.of<TestResultsProvider>( .then((result) {
// context) if (result) {
// .removeTestResult( print('true');
// item.id.toString()) }
// .then((_) {
// Navigator.of(ctx).pop();
// });
Navigator.of(ctx).pop(); Navigator.of(ctx).pop();
}, Navigator.of(context).popAndPushNamed(
child: Text('Yes'), Routes.testVerifyScreen);
), });
FlatButton( },
onPressed: () { child: Text('Yes'),
Navigator.of(ctx).pop(); ),
}, FlatButton(
child: Text('No'), onPressed: () {
), Navigator.of(ctx).pop();
], },
), child: Text('No'),
); ),
}, ],
child: Container(
padding: EdgeInsets.all(7),
width: 10 * _deviceBlockSize,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color.fromRGBO(0, 190, 190, 1),
),
child: Icon(
Icons.check,
size: 6 * _deviceBlockSize,
color: Colors.white,
), ),
);
},
child: Container(
padding: EdgeInsets.all(7),
width: 10 * _deviceBlockSize,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color.fromRGBO(0, 190, 190, 1),
), ),
) child: Icon(
: Container(), Icons.check,
size: 6 * _deviceBlockSize,
color: Colors.white,
),
),
),
SizedBox(
width: 3,
),
InkWell(
onTap: () {
showDialog(
context: context,
builder: (ctx) => AlertDialog(
title: Text('Reject'),
content: Text(
'Are you sure for reject this test?'),
actions: <Widget>[
FlatButton(
onPressed: () async {
await Provider.of<TestResultsProvider>(
context)
.changeVerification(
item.id, 'NotVerified')
.then((result) {
if (result) {
print('true');
}
Navigator.of(ctx).pop();
Navigator.of(context).popAndPushNamed(
Routes.testVerifyScreen);
});
},
child: Text('Yes'),
),
FlatButton(
onPressed: () {
Navigator.of(ctx).pop();
},
child: Text('No'),
),
],
),
);
},
child: Container(
padding: EdgeInsets.all(7),
width: 10 * _deviceBlockSize,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Icon(
Icons.close,
size: 6 * _deviceBlockSize,
color: Colors.white,
),
),
),
],
),
SizedBox( SizedBox(
width: _deviceBlockSize, width: _deviceBlockSize,
), ),
InkWell(
onTap: () {
Navigator.of(context).pushNamed(
Routes.testDetailsScreen,
arguments: item.id,
);
// TestDetail(testResultId: item.id.toString());
},
child: Container(
padding: EdgeInsets.all(7),
width: 10 * _deviceBlockSize,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
FontAwesomeIcons.fileAlt,
size: 6 * _deviceBlockSize,
color: Colors.white,
),
),
),
], ],
) )
], ],
+194
View File
@@ -0,0 +1,194 @@
import 'package:cssd/config/routes.dart';
import 'package:cssd/providers/auth.dart';
import 'package:cssd/providers/connectivity.dart';
import 'package:cssd/widgets/Global/internet_error.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
class VerifyPassScreen extends StatefulWidget {
// static const route = '/HomeScreen';
@override
State<StatefulWidget> createState() {
return _VerifyPassScreenState();
}
}
class _VerifyPassScreenState extends State<VerifyPassScreen> {
final _form = GlobalKey<FormState>();
bool _isLoading = false;
final codeCTRL = TextEditingController();
@override
void initState() {
codeCTRL.text = '';
super.initState();
}
@override
void dispose() {
super.dispose();
}
void _showDialog(String message) {
showDialog(
context: context,
builder: (ctx) => AlertDialog(
title: Text('Error'),
content: Text(message),
actions: <Widget>[
FlatButton(
child: Text('Ok'),
onPressed: () {
Navigator.of(ctx).pop();
},
),
],
),
);
}
void _sendCode() async {
if (!_form.currentState.validate()) {
return;
}
_form.currentState.save();
setState(() {
_isLoading = true;
});
// try {
await Provider.of<Auth>(context)
.sendCode(
codeCTRL.text,
)
.then(
(result) {
if (result == 'wrong') {
_showDialog('Code is wrong!!!');
setState(
() {
_isLoading = false;
},
);
} else {
Navigator.of(context)
.popAndPushNamed(Routes.rePassScreen, arguments: result);
}
},
);
}
@override
Widget build(BuildContext context) {
final _media = MediaQuery.of(context);
// 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(
centerTitle: true,
title: Text('CSSD'),
),
body: Selector<ConnectivityProvider, String>(
builder: (ctx, value, _) => value != 'offline'
? _isLoading
? Center(
child: CircularProgressIndicator(),
)
: Form(
key: _form,
child: ListView(
padding: EdgeInsets.symmetric(horizontal: 20),
children: <Widget>[
Container(
padding: EdgeInsets.symmetric(vertical: 20),
child: Text(
'Send Verification Code',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black,
fontSize: 5 * _deviceBlockSize,
letterSpacing: 3,
fontWeight: FontWeight.w700,
),
),
),
TextFormField(
validator: (value) {
if (value.isEmpty) {
return 'Code is required.';
}
if (value.length != 6) {
return 'Code most be 6 characters';
}
return null;
},
controller: codeCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.starOfLife,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Code',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
letterSpacing: 3,
),
keyboardType: TextInputType.number,
onSaved: (value) {
codeCTRL.text = value;
},
maxLength: 6,
),
SizedBox(height: 40),
Row(
children: <Widget>[
InkWell(
onTap: () => _sendCode(),
child: Container(
width: 40 * _deviceBlockSize,
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
// margin:
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue, Colors.green],
),
borderRadius: BorderRadius.circular(7),
),
child: Text(
'Send Code',
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white),
),
),
),
Spacer(),
],
),
SizedBox(height: 10),
],
),
)
: ConnectionErrorBox(),
selector: (_, connectivity) => connectivity.conStatus,
),
);
}
}
+74 -3
View File
@@ -30,6 +30,78 @@ class Auth with ChangeNotifier {
return {..._user}; return {..._user};
} }
Future<String> requestCode(String cellNumber) async {
final response = await http.post(
Url.requestResetPass,
body: {
'cell_number': cellNumber,
},
// headers: {'X-Requested-With': 'XMLHttpRequest'},
);
final responseData = json.decode(response.body);
if (responseData['status'] == 'Faild') {
return 'NotUser';
} else {
return 'Done';
}
// print(responseData);
}
Future<String> sendCode(String code) async {
final response = await http.post(
Url.verifyResetPass,
body: {
'code': code,
},
// headers: {'X-Requested-With': 'XMLHttpRequest'},
);
final responseData = json.decode(response.body);
// if (responseData['status']=='Faild') {
// return 'NotUser';
// } else {
// return 'Done';
// }
print(responseData);
if (responseData['status']=='Faild') {
return 'wrong';
}
else{
return responseData['access_token'];
}
}
Future<String> sendRePass(String password, String token) async {
print(password);
print(token);
final response = await http.post(
Url.sendResetPass,
body: {
'password': password,
'password_confirmation': password,
},
headers: {
'Authorization': token,
'X-Requested-With': 'XMLHttpRequest'
},
// headers: {'X-Requested-With': 'XMLHttpRequest'},
);
final responseData = json.decode(response.body);
// if (responseData['status']=='Faild') {
// return 'NotUser';
// } else {
// return 'Done';
// }
print(responseData);
if (responseData['status']=='Success') {
return 'done';
}
else{
return 'error';
}
}
Future<String> login(String cellNumber, String password) async { Future<String> login(String cellNumber, String password) async {
final response = await http.post( final response = await http.post(
Url.login, Url.login,
@@ -40,12 +112,11 @@ class Auth with ChangeNotifier {
// headers: {'X-Requested-With': 'XMLHttpRequest'}, // headers: {'X-Requested-With': 'XMLHttpRequest'},
); );
final responseData = json.decode(response.body); final responseData = json.decode(response.body);
// print(responseData); print(responseData);
if (response.statusCode == 401) { if (response.statusCode == 401) {
if (responseData['message'] == 'The user credentials were incorrect.') { if (responseData['message'] == 'The user credentials were incorrect.') {
return 'badinput'; // incorrect user or pass return 'badinput'; // incorrect user or pass
} } else {
else{
return 'error'; return 'error';
} }
} }
+3
View File
@@ -222,6 +222,7 @@ class CyclesProvider extends ChangeNotifier {
id: 'null', id: 'null',
description: 'null', description: 'null',
createDate: 'null', createDate: 'null',
hospitalName: 'null',
date: '2020-01-01', date: '2020-01-01',
sterileId: 'null', sterileId: 'null',
cycleNumber: 'null', cycleNumber: 'null',
@@ -233,10 +234,12 @@ class CyclesProvider extends ChangeNotifier {
for (var label in data['labels']) { for (var label in data['labels']) {
lablesList.add(label['id'].toString()); lablesList.add(label['id'].toString());
} }
print(data);
result = CycleDetailObject( result = CycleDetailObject(
id: data['id'].toString(), id: data['id'].toString(),
description: data['note'] != null ? data['note'] : '', description: data['note'] != null ? data['note'] : '',
createDate: data['created_at'] != null ? data['created_at'] : '', createDate: data['created_at'] != null ? data['created_at'] : '',
hospitalName: data['user']['medical_center']['name'],
date: data['date'] != null ? data['date'] : '', date: data['date'] != null ? data['date'] : '',
sterileId: data['sterilizer_id'] != null ? data['sterilizer_id'] : '', sterileId: data['sterilizer_id'] != null ? data['sterilizer_id'] : '',
cycleNumber: data['cycle_number'] != null ? data['cycle_number'] : '', cycleNumber: data['cycle_number'] != null ? data['cycle_number'] : '',
+52 -24
View File
@@ -6,16 +6,21 @@ import 'package:cssd/config/urls.dart';
import 'package:cssd/config/user.dart'; import 'package:cssd/config/user.dart';
class Inputs with ChangeNotifier { class Inputs with ChangeNotifier {
List<Map<String, dynamic>> inputItems = []; List<Map<String, dynamic>> inputItems = [];
Future<bool> getInputs({String testResultId = "", String name = "", String uniqueCode = "", String testTypeId = ""}) async { Future<bool> getInputs(
print({ {String testResultId = "",
'test_type_id': testTypeId, String name = "",
'test_result_id': testResultId, String uniqueCode = "",
'name': name, String testTypeId = ""}) async {
'unique_code': uniqueCode, print(
},); {
'test_type_id': testTypeId,
'test_result_id': testResultId,
'name': name,
'unique_code': uniqueCode,
},
);
var response = await http.post( var response = await http.post(
Url.getInputs, Url.getInputs,
body: { body: {
@@ -35,15 +40,13 @@ class Inputs with ChangeNotifier {
return false; return false;
} }
final responseData = json.decode(response.body); final responseData = json.decode(response.body);
// print(responseData); // print(responseData);
Map<String, dynamic> values; Map<String, dynamic> values;
if (testResultId.isNotEmpty) { if (testResultId.isNotEmpty) {
response = await http.get(Url.testResultFormValues(testResultId), response = await http.get(Url.testResultFormValues(testResultId),
headers: { headers: {'Authorization': User.token});
'Authorization': User.token
});
values = json.decode(response.body)['data']; values = json.decode(response.body)['data'];
} }
@@ -56,20 +59,41 @@ class Inputs with ChangeNotifier {
String deviceLabel; String deviceLabel;
if (values != null && values.isNotEmpty) { if (values != null && values.isNotEmpty) {
result = values['result'] == 'Accept' ? true : false; result = values['result'] == 'Accept' ? true : false;
dateTime = values['date'] == null ? DateTime.now() : DateTime.parse(values['date']); dateTime = values['date'] == null
? DateTime.now()
: DateTime.parse(values['date']);
deviceLabel = values['device_id'] ?? ''; deviceLabel = values['device_id'] ?? '';
} }
inputItems.add({'type': 'Label', 'key': 'test_type_id', 'name': general['name'], 'value': general['id']}); inputItems.add({
'type': 'Label',
'key': 'test_type_id',
'name': general['name'],
'value': general['id']
});
inputItems.add({
'type': 'Text',
'key': 'device_id',
'name': general['device_label'],
'value': deviceLabel
});
inputItems.add(
{'type': 'Date', 'key': 'date', 'name': 'date', 'value': dateTime});
inputItems.add(
{'type': 'Switch', 'key': 'result', 'name': 'Result', 'value': result});
inputItems.add({'type': 'Text', 'key': 'device_id', 'name': general['device_label'], 'value': deviceLabel});
inputItems.add({'type': 'Date', 'key': 'date' , 'name': 'date', 'value': dateTime});
inputItems.add({'type': 'Switch', 'key': 'result', 'name': 'Result', 'value': result});
setValues(inputs, values); setValues(inputs, values);
for (var input in inputs) { for (var input in inputs) {
inputItems.add(input as Map<String, dynamic>); inputItems.add(input as Map<String, dynamic>);
} }
inputItems.add({
'type': 'Image',
'key': 'test_type_id',
'name': general['name'],
'value': general['id']
});
notifyListeners(); notifyListeners();
return true; return true;
} }
@@ -81,13 +105,17 @@ class Inputs with ChangeNotifier {
} }
var key = "${input['name']}_${input['id']}"; var key = "${input['name']}_${input['id']}";
input['key'] = key; input['key'] = key;
if(values != null && values.isNotEmpty && values.containsKey(key)) { if (values != null && values.isNotEmpty && values.containsKey(key)) {
if (input['type'] == 'Range' || input['type'] == 'Temperature' || input['type'] == 'Pressure') { if (input['type'] == 'Range' ||
input['type'] == 'Temperature' ||
input['type'] == 'Pressure') {
input['value'] = double.parse(values[key]); input['value'] = double.parse(values[key]);
} else if (input['type'] == 'Switch'){ } else if (input['type'] == 'Switch') {
input['value'] = values[key] == "1" ? true : false; input['value'] = values[key] == "1" ? true : false;
} else if (input['type'] == 'Time'){ } else if (input['type'] == 'Time') {
input['value'] = values[key] == null ? '' : values[key].substring(0, 2) + ":" + values[key].substring(2, 4); input['value'] = values[key] == null
? ''
: values[key].substring(0, 2) + ":" + values[key].substring(2, 4);
} else { } else {
input['value'] = values[key]; input['value'] = values[key];
} }
+44
View File
@@ -102,6 +102,41 @@ class LabelsProvider extends ChangeNotifier {
print(response.body); print(response.body);
} }
Future<void> updateLabelResult(
id,
lotNumber,
cycleNumber,
sterileDate,
package,
expireDate,
sterilizerId,
) async {
// print(labs);
var response = await http.put(Url.updateLabelResult(id),
body: json.encode(
{
'sterile_date': sterileDate,
'expire_date': expireDate,
'sterilizer_id': sterilizerId,
'cycle_number': cycleNumber,
'lot_number': lotNumber,
'package_id': package['id']
// 'package': {
// 'id': package['id'],
// 'name': package['name'],
// },
},
),
headers: {
'Authorization': User.token,
'X-Requested-With': 'XMLHttpRequest',
"Content-Type": "application/json",
"Accept": "application/json"
});
print(response.body);
}
void setFilters(id, cycleNumber, sterilizerId, hospital) { void setFilters(id, cycleNumber, sterilizerId, hospital) {
pageNumber = 1; pageNumber = 1;
filters = LabelFilterObject( filters = LabelFilterObject(
@@ -165,11 +200,13 @@ class LabelsProvider extends ChangeNotifier {
} }
for (var item in testResultData['data']['data']) { for (var item in testResultData['data']['data']) {
// print(item);
originalItems.add( originalItems.add(
LabelResultObject( LabelResultObject(
expireDate: item['expire_date'], expireDate: item['expire_date'],
id: item['id'].toString(), id: item['id'].toString(),
package: item['package']['name'], package: item['package']['name'],
packageId: item['package']['id'].toString(),
), ),
); );
} }
@@ -188,6 +225,8 @@ class LabelsProvider extends ChangeNotifier {
return LabelDetailsObject( return LabelDetailsObject(
id: 'null', id: 'null',
package: 'null', package: 'null',
packageId: 'null',
hospitalName: 'null',
createDate: 'null', createDate: 'null',
expireDate: 'null', expireDate: 'null',
sterileDate: 'null', sterileDate: 'null',
@@ -198,9 +237,14 @@ class LabelsProvider extends ChangeNotifier {
} }
var data = json.decode(response.body)['data']; var data = json.decode(response.body)['data'];
print(data);
result = LabelDetailsObject( result = LabelDetailsObject(
id: data['id'].toString(), id: data['id'].toString(),
package: data['package']['name'] != null ? data['package']['name'] : '', package: data['package']['name'] != null ? data['package']['name'] : '',
packageId: data['package']['id'].toString() != 'null'
? data['package']['id'].toString()
: '',
hospitalName: data['user']['medical_center']['name'],
createDate: data['created_at'] != null ? data['created_at'] : '', createDate: data['created_at'] != null ? data['created_at'] : '',
expireDate: data['expire_date'] != null ? data['expire_date'] : '', expireDate: data['expire_date'] != null ? data['expire_date'] : '',
sterileDate: data['sterile_date'] != null ? data['sterile_date'] : '', sterileDate: data['sterile_date'] != null ? data['sterile_date'] : '',
+142 -9
View File
@@ -1,4 +1,8 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
// import 'dart:typed_data';
import 'package:dio/dio.dart' as di;
import 'package:cssd/config/urls.dart'; import 'package:cssd/config/urls.dart';
import 'package:cssd/config/user.dart'; import 'package:cssd/config/user.dart';
@@ -6,8 +10,47 @@ import 'package:cssd/models/test_result_models.dart';
// import 'package:cssd/providers/test_result.dart'; // import 'package:cssd/providers/test_result.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:random_string/random_string.dart';
// import 'package:multi_image_picker/multi_image_picker.dart';
class TestResultsProvider with ChangeNotifier { class TestResultsProvider with ChangeNotifier {
List<File> catchImages = [];
List<Uint8List> images = [];
setImages() async {
images = [];
for (var image in catchImages) {
var result = image.readAsBytesSync();
// final batchId = randomString(10);
// addImage(batchId, result, image.path);
images.add(result.buffer
.asUint8List(result.offsetInBytes, result.lengthInBytes));
}
notifyListeners();
}
setCatchImages(List<File> images) {
catchImages = images;
notifyListeners();
}
removeImage(int index) {
catchImages.removeAt(index);
notifyListeners();
}
// Future<String> addImage() async {
// Map<dynamic, dynamic> imgs = {};
// var counter = 0;
// for (var image in images) {
// imgs[counter.toString()] =
// di.MultipartFile.fromBytes(image, filename: 'test$counter.jpg');
// counter += 1;
// }
// return 'True';
// }
String searchBoxValue = ''; String searchBoxValue = '';
bool filterOn = false; bool filterOn = false;
List<TestResultObject> items; List<TestResultObject> items;
@@ -157,14 +200,16 @@ class TestResultsProvider with ChangeNotifier {
items = []; items = [];
} }
for (var item in testResultData['data']['data']) { for (var item in testResultData['data']['data']) {
// print(item);
originalItems.add( originalItems.add(
TestResultObject( TestResultObject(
id: item['id'].toString(), id: item['id'].toString(),
name: item['test_type']['name'], name: item['test_type']['name'],
deviceId: item['device_id'].toString(), deviceId: item['device_id'].toString(),
result: item['verified'] == 'Verified' ? 'Verified' : 'Not Verified', result: item['result'] == 'Accept' ? 'Accepted' : 'Not Accepted',
date: item['date'], date: item['created_at'].toString().substring(0, 10),
hospital: item['user']['medical_center']['name'], hospital: item['user']['medical_center']['name'],
verified: item['verified'].toString(),
), ),
); );
} }
@@ -187,16 +232,75 @@ class TestResultsProvider with ChangeNotifier {
print(response.body); print(response.body);
} }
static Future<void> createTestResult(values) async { Future<String> addImage(String batchId, dynamic file, String fileName) async {
var response = await http var imageListInt = file.cast<int>();
.post(Url.createTestResult, body: json.encode(values), headers: { var dio = new di.Dio();
dio.options.headers = {
'Authorization': User.token, 'Authorization': User.token,
'X-Requested-With': 'XMLHttpRequest', 'X-Requested-With': 'XMLHttpRequest',
"Content-Type": "application/json", 'Content-Type': 'application/json',
"Accept": "application/json" };
di.FormData formData = new di.FormData.fromMap({
"batch_id": batchId,
'model_type': 'TestResult',
"file": di.MultipartFile.fromBytes(imageListInt, filename: fileName)
}); });
print(response.body); var response = await dio.post(
Url.addImage,
data: formData,
);
// print(response.statusCode);
// print(response.statusMessage);
// print(response.data);
return 'Added';
}
Future<String> createTestResult(values, batchId) async {
final batchId = randomString(10);
for (var image in catchImages) {
await addImage(batchId, image.readAsBytesSync(), image.path);
}
dynamic vals = values;
vals['file_batch_id'] = batchId;
// int counter = 0;
// if (images.length != 0) {
// for (var image in images) {
// vals['imgs'][counter.toString()] = base64Encode(
// image,
// );
// counter += 1;
// }
// }
var dio = new di.Dio();
dio.options.headers = {
'Authorization': User.token,
// 'X-Requested-With': 'XMLHttpRequest'
};
var response = await dio.post(
Url.createTestResult,
data: vals,
);
print(response.data);
if (response.data['status'] == 'Success') {
catchImages = [];
return 'done';
} else {
return 'error';
}
// var response = await http
// .post(Url.createTestResult, body: json.encode(values), headers: {
// 'Authorization': User.token,
// 'X-Requested-With': 'XMLHttpRequest',
// "Content-Type": "application/json",
// "Accept": "application/json"
// });
// print(response.body);
} }
Future<Map<String, dynamic>> showTestResult(String id) async { Future<Map<String, dynamic>> showTestResult(String id) async {
@@ -213,11 +317,16 @@ class TestResultsProvider with ChangeNotifier {
: '', : '',
'test_code': data['test_type_id'] != null ? data['test_type_id'] : '', 'test_code': data['test_type_id'] != null ? data['test_type_id'] : '',
'date': data['created_at'] != null ? data['created_at'] : '', 'date': data['created_at'] != null ? data['created_at'] : '',
'verified': data['verified'] != null ? data['verified'] : '', 'accepted': originalItems
.firstWhere((element) => element.id == data['id'].toString())
.result, //az api safheye asli estefade mishavad
'description': 'description':
data['inputs']['Note'] != null ? data['inputs']['Note'] : '', data['inputs']['Note'] != null ? data['inputs']['Note'] : '',
'test_type_name': 'test_type_name':
data['test_type']['name'] != null ? data['test_type']['name'] : '', data['test_type']['name'] != null ? data['test_type']['name'] : '',
'hospital': originalItems
.firstWhere((element) => element.id == data['id'].toString())
.hospital // az api safheye asli estefade mi shavad
}; };
return result; return result;
} }
@@ -238,4 +347,28 @@ class TestResultsProvider with ChangeNotifier {
notifyListeners(); notifyListeners();
return true; return true;
} }
Future<bool> changeVerification(String id, String value) async {
print(id);
print(value);
var response = await http.post(
Url.testResultVerification(id, value),
headers: {
'Authorization': User.token,
'X-Requested-With': 'XMLHttpRequest',
"Content-Type": "application/json",
"Accept": "application/json"
},
);
var testResultData = json.decode(response.body);
// print(response.body);
try {
if (testResultData['status'] == 'Success') {
return true;
} else {
return false;
}
} catch (e) {}
return false;
}
} }
+266 -206
View File
@@ -1,6 +1,8 @@
import 'package:cssd/models/cycles_models.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../../models/cycles_models.dart';
class CycleDetailsDataBox extends StatelessWidget { class CycleDetailsDataBox extends StatelessWidget {
const CycleDetailsDataBox({ const CycleDetailsDataBox({
@@ -17,215 +19,273 @@ class CycleDetailsDataBox extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Padding( return Padding(
padding: EdgeInsets.all(20), padding: EdgeInsets.all(20),
child: ListView(children: <Widget>[ child: ListView(
SizedBox( children: <Widget>[
height: 10, SizedBox(
), height: 10,
Text(
'CYCLE DETAILS',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
letterSpacing: 3,
), ),
), Text(
SizedBox( 'CYCLE DETAILS',
height: 10, style: TextStyle(
), fontWeight: FontWeight.w700,
Container( fontSize: 5 * _deviceBlockSize,
padding: EdgeInsets.all(10), letterSpacing: 3,
decoration: BoxDecoration( ),
color: Color.fromRGBO(235, 235, 235, 1), ),
border: Border( SizedBox(
left: BorderSide( height: 10,
color: Colors.black54, ),
width: 2, Container(
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
color: Color.fromRGBO(235, 235, 235, 1),
border: Border(
left: BorderSide(
color: Colors.black54,
width: 2,
),
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
DateFormat.yMMMd().format(
DateTime.parse(
datas.createDate,
),
),
style: TextStyle(
color: Colors.red,
),
),
Divider(),
Text(
'ID: ${datas.id}',
style: TextStyle(
color: Colors.red,
fontWeight: FontWeight.w700,
),
),
SizedBox(
height: 30,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Sterilizer ID',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas.sterileId.toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Cycle Number',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas.cycleNumber.toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Date',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
DateFormat('d-M-y').format(
DateTime.parse(
datas.date,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Description',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas.description.toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Hospital Name',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas.hospitalName,
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 30,
),
Text(
'LABELS INCLUDED',
style: TextStyle(
color: Colors.orange,
letterSpacing: 3,
fontWeight: FontWeight.w700,
fontSize: 4.5 * _deviceBlockSize,
),
),
Container(
width: double.infinity,
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 20),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
border: Border.all(
color: Colors.grey,
),
),
child: ListView.separated(
shrinkWrap: true,
itemBuilder: (ctx, index) => RichText(
text: TextSpan(
text: 'Label ID ',
style: TextStyle(
color: Colors.grey,
fontFamily: 'montserrat',
),
// style: DefaultTextStyle.of(context).style,
children: <TextSpan>[
TextSpan(
text: datas.labels[index],
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.orange,
),
),
],
),
),
separatorBuilder: (ctx, index) => Divider(),
itemCount: datas.labels.length,
),
),
SizedBox(
height: 50,
)
],
),
),
SizedBox(height: 20,),
InkWell(
onTap: () async=> await launch(
'https://cssd-doc.com/Show/Cycle/${datas.id.toString()}',
// forceSafariVC: true,
// forceWebView: true,
// headers: <String, String>{'my_header_key': 'my_header_value'},
// child: Text('Show Full Details'),
),
child: Container(
padding: EdgeInsets.symmetric(vertical: 20),
width: double.infinity,
decoration: BoxDecoration(
color: Color.fromRGBO(230, 230, 230, 1),
borderRadius: BorderRadius.circular(25),
),
child: Center(
child: Text(
'Show More Details',
style: TextStyle(fontWeight: FontWeight.w700),
),
), ),
), ),
), ),
child: Column( SizedBox(height: 30,)
crossAxisAlignment: CrossAxisAlignment.start, ],
mainAxisSize: MainAxisSize.min, ),
children: <Widget>[
Text(
DateFormat.yMMMd().format(
DateTime.parse(
datas.createDate,
),
),
style: TextStyle(
color: Colors.red,
),
),
Divider(),
Text(
'ID: ${datas.id}',
style: TextStyle(
color: Colors.red,
fontWeight: FontWeight.w700,
),
),
SizedBox(
height: 30,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Sterilizer ID',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas.sterileId.toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Cycle Number',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas.cycleNumber.toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Date',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
DateFormat('d-M-y').format(
DateTime.parse(
datas.date,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Description',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas.description.toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 30,
),
Text(
'LABELS INCLUDED',
style: TextStyle(
color: Colors.orange,
letterSpacing: 3,
fontWeight: FontWeight.w700,
fontSize: 4.5 * _deviceBlockSize,
),
),
Container(
width: double.infinity,
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 20),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
border: Border.all(
color: Colors.grey,
),
),
child: ListView.separated(
shrinkWrap: true,
itemBuilder: (ctx, index) => RichText(
text: TextSpan(
text: 'Label ID ',
style: TextStyle(color: Colors.grey,fontFamily: 'montserrat',),
// style: DefaultTextStyle.of(context).style,
children: <TextSpan>[
TextSpan(
text: datas.labels[index],
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.orange,
),
),
],
),
),
separatorBuilder: (ctx, index) => Divider(),
itemCount: datas.labels.length,
),
),
SizedBox(height: 50,)
],
),
),
]),
); );
} }
} }
@@ -1,17 +1,21 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
class CycleFilterSelectorBox extends StatefulWidget { class CycleFilterSelectorBox extends StatefulWidget {
const CycleFilterSelectorBox({ const CycleFilterSelectorBox(
Key key, {Key key,
@required double deviceBlockSize, @required double deviceBlockSize,
@required this.hospitalCTRL, @required this.hospitalCTRL,
@required this.hospitalVals, @required this.hospitalVals,
}) : _deviceBlockSize = deviceBlockSize, @required String label})
: _deviceBlockSize = deviceBlockSize,
_label = label,
super(key: key); super(key: key);
final double _deviceBlockSize; final double _deviceBlockSize;
final TextEditingController hospitalCTRL; final TextEditingController hospitalCTRL;
final List<Map<String, String>> hospitalVals; final List<Map<String, String>> hospitalVals;
final String _label;
@override @override
_CycleFilterSelectorBoxState createState() => _CycleFilterSelectorBoxState(); _CycleFilterSelectorBoxState createState() => _CycleFilterSelectorBoxState();
@@ -47,7 +51,7 @@ class _CycleFilterSelectorBoxState extends State<CycleFilterSelectorBox> {
width: widget._deviceBlockSize, width: widget._deviceBlockSize,
), ),
Text( Text(
'Package', widget._label,
style: TextStyle( style: TextStyle(
fontSize: 3.5 * widget._deviceBlockSize, fontSize: 3.5 * widget._deviceBlockSize,
color: Colors.grey, color: Colors.grey,
@@ -72,8 +72,7 @@ class _LabelAddSelectorBoxState extends State<LabelAddSelectorBox> {
color: Colors.black, color: Colors.black,
), ),
isExpanded: true, isExpanded: true,
hint: hint: Container(
Container(
// width: 100, // width: 100,
height: 70, height: 70,
padding: const EdgeInsets.symmetric(horizontal: 0), padding: const EdgeInsets.symmetric(horizontal: 0),
@@ -84,9 +83,10 @@ class _LabelAddSelectorBoxState extends State<LabelAddSelectorBox> {
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Colors.black, color: Colors.black,
fontSize: 5 * widget._deviceBlockSize fontSize: 5 * widget._deviceBlockSize,
), ),
),), ),
),
// Container( // Container(
// // width: 100, // // width: 100,
// height: 70, // height: 70,
@@ -111,9 +111,12 @@ class _LabelAddSelectorBoxState extends State<LabelAddSelectorBox> {
child: Container( child: Container(
child: Text( child: Text(
val['name'], val['name'],
textDirection: TextDirection.rtl,
overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
// color: _mainFontColor, fontWeight: FontWeight.w700,
fontSize: 4 * widget._deviceBlockSize, color: Colors.black,
fontSize: 5 * widget._deviceBlockSize,
), ),
), ),
), ),
@@ -0,0 +1,93 @@
import 'package:cssd/config/routes.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:cssd/providers/labels.dart';
class LabelUpdateButton extends StatelessWidget {
const LabelUpdateButton({
Key key,
@required GlobalKey<FormState> form,
@required this.id,
@required this.lotNumberCTRL,
@required this.cycleNumberCTRL,
@required this.sDateCTRL,
@required this.packageValue,
@required this.eDateCTRL,
@required this.striizerIdCTRL,
@required double deviceBlockSize,
}) : _form = form,
_deviceBlockSize = deviceBlockSize,
super(key: key);
final GlobalKey<FormState> _form;
final String id;
final TextEditingController lotNumberCTRL;
final TextEditingController cycleNumberCTRL;
final TextEditingController sDateCTRL;
final List<String> packageValue;
final TextEditingController eDateCTRL;
final TextEditingController striizerIdCTRL;
final double _deviceBlockSize;
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () {
if (!_form.currentState.validate()) {
return;
}
Provider.of<LabelsProvider>(context).updateLabelResult(
id,
lotNumberCTRL.text,
cycleNumberCTRL.text,
sDateCTRL.text,
// sDateValue,
{'id': packageValue[0], 'name': packageValue[1]},
eDateCTRL.text,
// eDateValue,
striizerIdCTRL.text,
);
showDialog(
context: context,
builder: (ctx) => AlertDialog(
content: Text('Label updated.'),
actions: <Widget>[
FlatButton(
onPressed: () {
Navigator.of(ctx).pop();
},
child: Text('Ok'),
)
],
),
).then((_) {
Navigator.of(context).pushReplacementNamed(Routes.labelResultScreen);
});
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
// margin:
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue, Colors.green],
),
borderRadius: BorderRadius.circular(7),
),
child: Align(
alignment: Alignment.center,
child: Text(
'UPDATE',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
),
),
),
),
);
}
}
+275 -218
View File
@@ -1,6 +1,8 @@
import 'package:cssd/models/label_models.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../../models/label_models.dart';
class LabelDetailsDataBox extends StatelessWidget { class LabelDetailsDataBox extends StatelessWidget {
const LabelDetailsDataBox({ const LabelDetailsDataBox({
@@ -17,227 +19,282 @@ class LabelDetailsDataBox extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Padding( return Padding(
padding: EdgeInsets.all(20), padding: EdgeInsets.all(20),
child: ListView(children: <Widget>[ child: ListView(
SizedBox( children: <Widget>[
height: 10, SizedBox(
), height: 10,
Text(
'LABEL DETAILS',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
letterSpacing: 3,
), ),
), Text(
SizedBox( 'LABEL DETAILS',
height: 10, style: TextStyle(
), fontWeight: FontWeight.w700,
Container( fontSize: 5 * _deviceBlockSize,
padding: EdgeInsets.all(10), letterSpacing: 3,
decoration: BoxDecoration(
color: Color.fromRGBO(235, 235, 235, 1),
border: Border(
left: BorderSide(
color: Colors.black54,
width: 2,
),
), ),
), ),
child: Column( SizedBox(
crossAxisAlignment: CrossAxisAlignment.start, height: 10,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
DateFormat.yMMMd().format(
DateTime.parse(
datas.createDate,
),
),
style: TextStyle(
color: Colors.red,
),
),
Divider(),
Text(
'ID: ${datas.id}',
style: TextStyle(
color: Colors.red,
fontWeight: FontWeight.w700,
),
),
SizedBox(
height: 30,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Sterilizer ID',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas.sterileId.toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Cycle Number',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas.cycleNumber.toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Lot Number',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas.lotNumber.toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Sterile Date',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
DateFormat('y-M-d').format(
DateTime.parse(
datas.sterileDate,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Expire Date',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
DateFormat('y-M-d').format(
DateTime.parse(
datas.expireDate,
),
),
style: TextStyle(
fontWeight: FontWeight.w700, color: Colors.red),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Package',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas.package.toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
],
), ),
), Container(
]), padding: EdgeInsets.all(10),
decoration: BoxDecoration(
color: Color.fromRGBO(235, 235, 235, 1),
border: Border(
left: BorderSide(
color: Colors.black54,
width: 2,
),
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
DateFormat.yMMMd().format(
DateTime.parse(
datas.createDate,
),
),
style: TextStyle(
color: Colors.red,
),
),
Divider(),
Text(
'ID: ${datas.id}',
style: TextStyle(
color: Colors.red,
fontWeight: FontWeight.w700,
),
),
SizedBox(
height: 30,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Sterilizer ID',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas.sterileId.toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Cycle Number',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas.cycleNumber.toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Lot Number',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas.lotNumber.toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Sterile Date',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
DateFormat('y-M-d').format(
DateTime.parse(
datas.sterileDate,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Expire Date',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
DateFormat('y-M-d').format(
DateTime.parse(
datas.expireDate,
),
),
style: TextStyle(
fontWeight: FontWeight.w700, color: Colors.red),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Package',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas.package.toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Hospital Name',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas.hospitalName,
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
],
),
),
SizedBox(
height: 20,
),
InkWell(
onTap: () => launch(
'https://cssd-doc.com/Show/Label/${datas.id.toString()}',
// forceSafariVC: true,
// forceWebView: true,
// headers: <String, String>{'my_header_key': 'my_header_value'},
// child: Text('Show Full Details'),
),
child: Container(
padding: EdgeInsets.symmetric(vertical: 20),
width: double.infinity,
decoration: BoxDecoration(
color: Color.fromRGBO(230, 230, 230, 1),
borderRadius: BorderRadius.circular(25),
),
child: Center(
child: Text(
'Show More Details',
style: TextStyle(fontWeight: FontWeight.w700),
),
),
),
)
],
),
); );
} }
} }
+26 -3
View File
@@ -46,7 +46,7 @@ class LabelItemBox extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Container( Container(
width: 50 * _deviceBlockSize, width: 30 * _deviceBlockSize,
child: Text( child: Text(
'Package:', 'Package:',
style: TextStyle( style: TextStyle(
@@ -56,14 +56,14 @@ class LabelItemBox extends StatelessWidget {
), ),
), ),
Container( Container(
width: 50 * _deviceBlockSize, width: 40 * _deviceBlockSize,
child: Text( child: Text(
item.package, item.package,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
), ),
Container( Container(
width: 50 * _deviceBlockSize, width: 30 * _deviceBlockSize,
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Text( Text(
@@ -91,6 +91,29 @@ class LabelItemBox extends StatelessWidget {
Row( Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[ children: <Widget>[
InkWell(
customBorder: CircleBorder(),
onTap: () {
Navigator.of(context).pushReplacementNamed(
Routes.labelUpdateScreen,
arguments: item.id,
);
},
child: Container(
padding: EdgeInsets.all(7),
width: 10 * _deviceBlockSize,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.edit,
size: 6 * _deviceBlockSize,
color: Colors.white,
),
),
),
SizedBox(width: _deviceBlockSize,),
InkWell( InkWell(
customBorder: CircleBorder(), customBorder: CircleBorder(),
onTap: () { onTap: () {
+12 -7
View File
@@ -1,5 +1,5 @@
import 'package:cssd/config/routes.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
class FilterScanSaveButton extends StatelessWidget { class FilterScanSaveButton extends StatelessWidget {
const FilterScanSaveButton({ const FilterScanSaveButton({
@@ -7,7 +7,9 @@ class FilterScanSaveButton extends StatelessWidget {
@required GlobalKey<FormState> form, @required GlobalKey<FormState> form,
@required this.idCTRL, @required this.idCTRL,
@required double deviceBlockSize, @required double deviceBlockSize,
}) : _form = form, _deviceBlockSize = deviceBlockSize, super(key: key); }) : _form = form,
_deviceBlockSize = deviceBlockSize,
super(key: key);
final GlobalKey<FormState> _form; final GlobalKey<FormState> _form;
final TextEditingController idCTRL; final TextEditingController idCTRL;
@@ -17,20 +19,23 @@ class FilterScanSaveButton extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return InkWell( return InkWell(
onTap: () { onTap: () {
if (! _form.currentState.validate()) { if (!_form.currentState.validate()) {
return; return;
} }
Navigator.of(context).pushNamed( launch(
Routes.labelDetailScreen, 'https://cssd-doc.com/Show/Label/${idCTRL.text}',
arguments: idCTRL.text,
); );
// Navigator.of(context).pushNamed(
// Routes.labelDetailScreen,
// arguments: idCTRL.text,
// );
}, },
child: Container( child: Container(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize, horizontal: 5 * _deviceBlockSize,
vertical: 10, vertical: 10,
), ),
margin: EdgeInsets.symmetric(horizontal: 20), margin: EdgeInsets.only(bottom: 50,left: 20,right: 20),
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(
colors: [Colors.blue, Colors.green], colors: [Colors.blue, Colors.green],
+11 -11
View File
@@ -1,7 +1,7 @@
import 'package:barcode_scan/barcode_scan.dart'; import 'package:barcode_scan/barcode_scan.dart';
import 'package:cssd/config/routes.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:url_launcher/url_launcher.dart';
class LabelScanBox extends StatelessWidget { class LabelScanBox extends StatelessWidget {
const LabelScanBox({ const LabelScanBox({
@@ -24,9 +24,8 @@ class LabelScanBox extends StatelessWidget {
return 'null'; return 'null';
} }
} on PlatformException catch (_) { } on PlatformException catch (_) {
return 'access'; return 'access';
} } catch (_) {
catch (_){
return 'error'; return 'error';
} }
@@ -70,15 +69,16 @@ class LabelScanBox extends StatelessWidget {
print('cancel'); print('cancel');
} else if (result == 'error') { } else if (result == 'error') {
print('error'); print('error');
} } else if (result == 'access') {
else if(result == 'access'){
print('access'); print('access');
} } else {
else { launch(
Navigator.of(context).pushNamed( 'https://cssd-doc.com/Show/Label/$result',
Routes.labelDetailScreen,
arguments: result,
); );
// Navigator.of(context).pushNamed(
// Routes.labelDetailScreen,
// arguments: result,
// );
} }
}, },
); );
+4 -1
View File
@@ -7,15 +7,18 @@ class InfoInputBox extends StatelessWidget {
@required double deviceBlockSize, @required double deviceBlockSize,
@required String label, @required String label,
@required IconData icon, @required IconData icon,
@required TextInputType inputType,
}) : _deviceBlockSize = deviceBlockSize, }) : _deviceBlockSize = deviceBlockSize,
_label = label, _label = label,
_icon = icon, _icon = icon,
_inputType = inputType,
super(key: key); super(key: key);
final TextEditingController controller; final TextEditingController controller;
final double _deviceBlockSize; final double _deviceBlockSize;
final String _label; final String _label;
final IconData _icon; final IconData _icon;
final TextInputType _inputType;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -38,7 +41,7 @@ class InfoInputBox extends StatelessWidget {
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize, fontSize: 5 * _deviceBlockSize,
), ),
keyboardType: TextInputType.number, keyboardType: _inputType,
textInputAction: TextInputAction.next, textInputAction: TextInputAction.next,
); );
} }
@@ -0,0 +1,313 @@
import 'dart:async';
import 'dart:io';
import 'package:camera/camera.dart';
import 'package:cssd/providers/test_results.dart';
import 'package:flutter/material.dart';
import 'package:path_provider/path_provider.dart';
import 'package:provider/provider.dart';
class CaptureImage extends StatefulWidget {
@override
_CaptureImageState createState() {
return _CaptureImageState();
}
}
/// Returns a suitable camera icon for [direction].
IconData getCameraLensIcon(CameraLensDirection direction) {
switch (direction) {
case CameraLensDirection.back:
return Icons.camera_rear;
case CameraLensDirection.front:
return Icons.camera_front;
case CameraLensDirection.external:
return Icons.camera;
}
throw ArgumentError('Unknown lens direction');
}
void logError(String code, String message) =>
print('Error: $code\nError Message: $message');
class _CaptureImageState extends State<CaptureImage>
with WidgetsBindingObserver {
CameraController controller;
String imagePath;
// String videoPath;
VoidCallback videoPlayerListener;
bool isInit = true;
int curCamera = 0;
var cameras;
@override
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
}
@override
void didChangeDependencies() async {
if (isInit) {
cameras = await availableCameras();
onNewCameraSelected(cameras[curCamera]);
setState(() {
isInit = false;
});
}
super.didChangeDependencies();
}
@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
super.dispose();
}
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
// App state changed before we got the chance to initialize.
if (controller == null || !controller.value.isInitialized) {
return;
}
if (state == AppLifecycleState.inactive) {
controller?.dispose();
} else if (state == AppLifecycleState.resumed) {
if (controller != null) {
onNewCameraSelected(controller.description);
}
}
}
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
key: _scaffoldKey,
// appBar: AppBar(
// title: const Text('Take Picture'),
// ),
body: isInit
? Center(
child: CircularProgressIndicator(),
)
: Stack(children: <Widget>[
_cameraPreviewWidget(),
Positioned(
bottom: 100, left: 100, child: _captureControlRowWidget()),
Positioned(
bottom: 100,
right: 100,
child: InkWell(
onTap: () {
if (curCamera == 0) {
try {
onNewCameraSelected(cameras[1]);
setState(() {
curCamera = 1;
});
} catch (e) {}
} else {
onNewCameraSelected(cameras[0]);
setState(() {
curCamera = 0;
});
}
},
child: Icon(
curCamera == 0 ? Icons.camera_rear : Icons.camera_front,
size: 40,
color: Colors.white,
),
),
),
// _cameraTogglesRowWidget(cameras),
]),
),
);
}
/// Display the preview from the camera (or a message if the preview is not available).
Widget _cameraPreviewWidget() {
if (controller == null || !controller.value.isInitialized) {
return const Text(
'Tap a camera',
style: TextStyle(
color: Colors.white,
fontSize: 24.0,
fontWeight: FontWeight.w900,
),
);
} else {
return Container(
width: double.infinity,
child: CameraPreview(controller),
);
}
}
/// Toggle recording audio
/// Display the control bar with buttons to take pictures and record videos.
Widget _captureControlRowWidget() {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
IconButton(
icon: const Icon(
Icons.camera_alt,
size: 40,
color: Colors.white,
),
// color: Colors.blue,
onPressed: controller != null &&
controller.value.isInitialized &&
!controller.value.isRecordingVideo
? onTakePictureButtonPressed
: null,
),
],
);
}
getCameras() async {
return await availableCameras();
}
/// Display a row of toggle to select the camera (or a message if no camera is available).
// Widget _cameraTogglesRowWidget(var cameras) {
// final List<Widget> toggles = <Widget>[];
// if (cameras.isEmpty) {
// return const Text('No camera found');
// } else {
// for (CameraDescription cameraDescription in cameras) {
// print("${cameraDescription.name}");
// toggles.add(
// SizedBox(
// width: 90.0,
// child: RadioListTile<CameraDescription>(
// title: Icon(getCameraLensIcon(cameraDescription.lensDirection)),
// groupValue: controller?.description,
// value: cameraDescription,
// onChanged: controller != null && controller.value.isRecordingVideo
// ? null
// : onNewCameraSelected,
// ),
// ),
// );
// }
// }
// return Row(children: toggles);
// }
String timestamp() => DateTime.now().millisecondsSinceEpoch.toString();
void showInSnackBar(String message) {
_scaffoldKey.currentState.showSnackBar(SnackBar(content: Text(message)));
}
void onNewCameraSelected(CameraDescription cameraDescription) async {
print(cameraDescription.lensDirection.toString());
if (controller != null) {
await controller.dispose();
}
controller = CameraController(
cameraDescription,
ResolutionPreset.medium,
// enableAudio: enableAudio,
);
// If the controller is updated then update the UI.
controller.addListener(() {
if (mounted) setState(() {});
if (controller.value.hasError) {
showInSnackBar('Camera error ${controller.value.errorDescription}');
}
});
try {
await controller.initialize();
} on CameraException catch (e) {
_showCameraException(e);
}
if (mounted) {
setState(() {});
}
}
void onTakePictureButtonPressed() {
takePicture().then((String filePath) {
if (mounted) {
setState(() {
imagePath = filePath;
var profileProviderObject =
Provider.of<TestResultsProvider>(context, listen: false);
List<File> files = profileProviderObject.catchImages;
files.add(File(imagePath));
profileProviderObject.setCatchImages(files);
profileProviderObject.setImages();
print(imagePath);
});
if (filePath != null) {
Navigator.of(context).pop();
// showInSnackBar('Picture saved to $filePath');
}
}
});
}
Future<String> takePicture() async {
if (!controller.value.isInitialized) {
showInSnackBar('Error: select a camera first.');
return null;
}
final Directory extDir = await getApplicationDocumentsDirectory();
final String dirPath = '${extDir.path}/Pictures/flutter_test';
await Directory(dirPath).create(recursive: true);
final String filePath = '$dirPath/${timestamp()}.jpg';
if (controller.value.isTakingPicture) {
// A capture is already pending, do nothing.
return null;
}
try {
await controller.takePicture(filePath);
} on CameraException catch (e) {
_showCameraException(e);
return null;
}
return filePath;
}
void _showCameraException(CameraException e) {
logError(e.code, e.description);
showInSnackBar('Error: ${e.code}\n${e.description}');
}
}
// class CameraApp extends StatelessWidget {
// @override
// Widget build(BuildContext context) {
// return MaterialApp(
// home: CaptureImage(),
// );
// }
// }
// List<CameraDescription> cameras = [];
// Future<void> main() async {
// // Fetch the available cameras before initializing the app.
// try {
// WidgetsFlutterBinding.ensureInitialized();
// } on CameraException catch (e) {
// logError(e.code, e.description);
// }
// runApp(CameraApp());
// }
@@ -1,8 +1,16 @@
import 'dart:io';
import 'package:cssd/config/routes.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:image_picker_gallery_camera/image_picker_gallery_camera.dart';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
import 'package:multiselect_formfield/multiselect_formfield.dart'; import 'package:multiselect_formfield/multiselect_formfield.dart';
import 'package:provider/provider.dart';
import '../../../providers/test_results.dart';
class FormCreator extends StatefulWidget { class FormCreator extends StatefulWidget {
const FormCreator({ const FormCreator({
@@ -60,7 +68,82 @@ class _FormCreatorState extends State<FormCreator> {
), ),
); );
} }
if (item['type'] == 'Image') {
final testProviderObject = Provider.of<TestResultsProvider>(context);
final mediaData = MediaQuery.of(context);
final deviceWidth = mediaData.size.width;
final _deviceBlockSize = deviceWidth / 100;
listWidgets.insert(
3,
Container(
// height: 70,
child: Directionality(
textDirection: TextDirection.rtl,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Container(
margin: EdgeInsets.only(top: 20),
height: testProviderObject.catchImages.length != 0 ? 60 : 0,
child: ImageBox(
deviceBlockSize: _deviceBlockSize,
testProvider: testProviderObject,
),
),
SizedBox(
height: testProviderObject.catchImages.length != 0 ? 10 : 0,
),
InkWell(
onTap: () async {
await loadAssets(context);
},
child: Container(
width: MediaQuery.of(context).size.width - 40,
padding:
EdgeInsets.symmetric(vertical: 10, horizontal: 30),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
color: Colors.black,
),
child: Text(
'+ Add an image or file from device',
textDirection: TextDirection.ltr,
style: TextStyle(color: Colors.white),
textAlign: TextAlign.center,
),
),
),
SizedBox(
height: 10,
),
InkWell(
onTap: () async {
await Navigator.of(context).pushNamed(Routes.captureImageScreen);
// await captureImage(context);
},
child: Container(
width: MediaQuery.of(context).size.width - 40,
padding:
EdgeInsets.symmetric(vertical: 10, horizontal: 30),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
color: Colors.black,
),
child: Text(
'+ Add an image from camera',
textDirection: TextDirection.ltr,
style: TextStyle(color: Colors.white),
textAlign: TextAlign.center,
),
),
),
],
),
),
),
);
}
if (item['type'] == "Label") { if (item['type'] == "Label") {
listWidgets.add( listWidgets.add(
Container( Container(
@@ -113,26 +196,39 @@ class _FormCreatorState extends State<FormCreator> {
} }
formItems[count]['value'] = formItems[count]['value'] ?? startValue; formItems[count]['value'] = formItems[count]['value'] ?? startValue;
int divisions = (endValue - startValue).round(); // int divisions = (endValue - startValue).round();
listWidgets.add( listWidgets.add(
Padding( Padding(
padding: EdgeInsets.only(top: 35), padding: EdgeInsets.only(top: 35, left: 10, right: 10),
child: Slider( child: Column(
min: startValue, mainAxisSize: MainAxisSize.min,
max: endValue, children: <Widget>[
value: formItems[count]['value'], Row(
label: '${formItems[count]['value'].round()}', mainAxisAlignment: MainAxisAlignment.spaceBetween,
divisions: divisions, children: <Widget>[
onChanged: (double value) { Text(item['type']),
setState(() { Text(formItems[count]['value'].toString()),
formItems[count]['value'] = value; ],
}); ),
}, Slider(
semanticFormatterCallback: (double newValue) { min: startValue,
return '${newValue.round()}'; max: endValue,
}, value: formItems[count]['value'],
), // label: '${formItems[count]['value'].round()}',
), // divisions: divisions,
onChanged: (double value) {
setState(() {
formItems[count]['value'] =
double.parse(value.toStringAsFixed(2));
});
// print(formItems[count]['value']);
},
// semanticFormatterCallback: (double newValue) {
// return '${newValue.round()}';
// },
),
],
)),
); );
} }
@@ -353,9 +449,51 @@ class _FormCreatorState extends State<FormCreator> {
// ), // ),
// ); // );
} }
return listWidgets; return listWidgets;
} }
Future captureImage(BuildContext context) async {
var profileProviderObject =
Provider.of<TestResultsProvider>(context, listen: false);
List<File> files = profileProviderObject.catchImages;
try {
files.add(
await ImagePickerGC.pickImage(
context: context,
source: ImgSource.Camera,
cameraIcon: Icon(
Icons.camera_alt,
color: Colors.red,
), //cameraIcon and galleryIcon can change. If no icon provided default icon will be present
cameraText: Text(
"From Camera",
style: TextStyle(color: Colors.red),
),
),
);
} catch (e) {}
profileProviderObject.setCatchImages(files);
profileProviderObject.setImages();
}
Future<void> loadAssets(BuildContext context) async {
var profileProviderObject =
Provider.of<TestResultsProvider>(context, listen: false);
List<File> files = profileProviderObject.catchImages;
try {
files += await FilePicker.getMultiFile(
type: FileType.custom,
allowedExtensions: ['jpg', 'png', 'bmp', 'jpeg', 'pdf', 'docx', 'doc'],
);
// print(files);
} catch (_) {}
profileProviderObject.setCatchImages(files);
profileProviderObject.setImages();
// profileProviderObject.addImage();
}
_FormCreatorState(this.formItems); _FormCreatorState(this.formItems);
void _handleChanged() { void _handleChanged() {
@@ -377,3 +515,110 @@ class _FormCreatorState extends State<FormCreator> {
); );
} }
} }
class ImageBox extends StatelessWidget {
const ImageBox({
Key key,
@required double deviceBlockSize,
@required TestResultsProvider testProvider,
}) : _deviceBlockSize = deviceBlockSize,
_testProvider = testProvider,
super(key: key);
final double _deviceBlockSize;
final TestResultsProvider _testProvider;
@override
Widget build(BuildContext context) {
return ListView.separated(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemBuilder: (ctx, index) {
bool isPdf = _testProvider.catchImages[index].path.endsWith('pdf');
bool isWord = _testProvider.catchImages[index].path.endsWith('docx') ||
_testProvider.catchImages[index].path.endsWith('doc');
// print(_testProvider.catchImages[index].path.endsWith('jpg'));
// .substring(_testProvider.catchImages[index].path.length - 4));
return ClipRRect(
borderRadius: BorderRadius.circular(5),
child: Container(
width: 60,
height: 60,
child: Stack(
children: <Widget>[
Positioned(
top: 10,
left: 0,
child: GestureDetector(
onTap: () => isPdf
? print('pdf')
: isWord
? print('word')
: Navigator.of(context).push(
MaterialPageRoute(
builder: (_) => Container(
color: Colors.white,
child: Center(
child: Image.file(
_testProvider.catchImages[index],
),
),
),
),
),
child: isPdf
? Image.asset(
'assets/Images/pdf.png',
width: 60,
height: 60,
fit: BoxFit.fill,
)
: isWord
? Image.asset(
'assets/Images/word.png',
width: 60,
height: 60,
fit: BoxFit.fill,
)
: Image.file(
_testProvider.catchImages[index],
// asset: _images[index],
width: 60,
height: 60,
fit: BoxFit.fill,
),
),
),
Positioned(
top: 0,
right: 0,
child: GestureDetector(
onTap: () {
// setState(() {
_testProvider.removeImage(index);
// });
},
child: CircleAvatar(
backgroundColor: Colors.red,
radius: 10,
child: Icon(
Icons.close,
size: 12,
color: Colors.white,
),
),
),
)
],
),
),
);
},
itemCount: _testProvider.catchImages.length,
separatorBuilder: (BuildContext context, int index) => SizedBox(
width: 3 * _deviceBlockSize,
),
);
}
}
@@ -82,7 +82,7 @@ class _TestResultAddSelectorBoxState extends State<TestResultAddSelectorBox> {
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Colors.black, color: Colors.black,
fontSize: 4 * widget._deviceBlockSize, fontSize: 3 * widget._deviceBlockSize,
), ),
), ),
// TextFormField( // TextFormField(
@@ -106,9 +106,11 @@ class _TestResultAddSelectorBoxState extends State<TestResultAddSelectorBox> {
child: Container( child: Container(
child: Text( child: Text(
val, val,
overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
// color: _mainFontColor, fontWeight: FontWeight.w700,
fontSize: 4 * widget._deviceBlockSize, color: Colors.black,
fontSize: 3 * widget._deviceBlockSize,
), ),
), ),
), ),
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:url_launcher/url_launcher.dart';
class DatasBox extends StatelessWidget { class DatasBox extends StatelessWidget {
const DatasBox({ const DatasBox({
@@ -16,212 +17,240 @@ class DatasBox extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Padding( return Padding(
padding: EdgeInsets.all(20), padding: EdgeInsets.all(20),
child: Container( child: ListView(
padding: EdgeInsets.all(10), children: <Widget>[
decoration: BoxDecoration( Container(
color: Color.fromRGBO(230, 230, 230, 1), padding: EdgeInsets.all(10),
border: Border( decoration: BoxDecoration(
left: BorderSide( color: Color.fromRGBO(230, 230, 230, 1),
color: Colors.pink, border: Border(
width: 2, left: BorderSide(
), color: Colors.pink,
), width: 2,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
DateFormat.yMMMd().format(
DateTime.parse(
datas['date'],
), ),
), ),
style: TextStyle(
color: Colors.red,
),
), ),
Divider(), child: Column(
Text( crossAxisAlignment: CrossAxisAlignment.start,
datas['test_type_name'], mainAxisSize: MainAxisSize.min,
style: TextStyle(
color: Colors.red,
fontWeight: FontWeight.w700,
),
),
SizedBox(
height: 30,
),
Row(
children: <Widget>[ children: <Widget>[
Container( Text(
width: 35 * _deviceBlockSize, DateFormat.yMMMd().format(
child: Text( DateTime.parse(
'CSSD ID', datas['date'],
style: TextStyle(
color: Colors.grey,
), ),
), ),
), style: TextStyle(
Container( color: Colors.red,
width: 45 * _deviceBlockSize,
child: Text(
datas['id'].toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
), ),
), ),
], Divider(),
), Text(
Divider(), datas['test_type_name'],
SizedBox( style: TextStyle(
height: 5, color: Colors.red,
), fontWeight: FontWeight.w700,
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Autocleave ID',
style: TextStyle(
color: Colors.grey,
),
), ),
), ),
Container( SizedBox(
width: 45 * _deviceBlockSize, height: 30,
child: Text(
datas['auto_cleave_id'].toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
), ),
], Row(
), children: <Widget>[
Divider(), Container(
SizedBox( width: 35 * _deviceBlockSize,
height: 5, child: Text(
), 'Test Register ID',
Row( style: TextStyle(
children: <Widget>[ color: Colors.grey,
Container( ),
width: 35 * _deviceBlockSize,
child: Text(
'Test Code',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas['test_code'].toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Date',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
DateFormat('d-M-y').format(
DateTime.parse(
datas['date'],
), ),
), ),
style: TextStyle( Container(
fontWeight: FontWeight.w700, width: 45 * _deviceBlockSize,
child: Text(
datas['id'].toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
), ),
overflow: TextOverflow.clip, ],
),
), ),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Autoclave ID',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas['auto_cleave_id'].toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Hospital',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas['hospital'].toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Date',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
DateFormat('d-M-y').format(
DateTime.parse(
datas['date'],
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Status',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas['accepted'] == 'Accepted'
? 'Accepted'
: 'Rejected',
style: TextStyle(
fontWeight: FontWeight.w700,
color: datas['accepted'] == 'Accepted'
? Colors.green
: Colors.red,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Description',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas['description'].toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
], ],
), ),
Divider(), ),
SizedBox( SizedBox(height: 20,),
height: 5, InkWell(
onTap: () async=> await launch(
'https://cssd-doc.com/Show/TestResult/${datas['id'].toString()}',
// forceSafariVC: true,
// forceWebView: true,
// headers: <String, String>{'my_header_key': 'my_header_value'},
// child: Text('Show Full Details'),
), ),
Row( child: Container(
children: <Widget>[ padding: EdgeInsets.symmetric(vertical: 20),
Container( width: double.infinity,
width: 35 * _deviceBlockSize, decoration: BoxDecoration(
child: Text( color: Color.fromRGBO(230, 230, 230, 1),
'Status', borderRadius: BorderRadius.circular(25),
style: TextStyle( ),
color: Colors.grey, child: Center(
), child: Text(
), 'Show More Details',
style: TextStyle(fontWeight: FontWeight.w700),
), ),
Container( ),
width: 45 * _deviceBlockSize,
child: Text(
datas['verified'] == 'NotVerified'
? 'Rejected'
: 'Verified',
style: TextStyle(
fontWeight: FontWeight.w700,
color: datas['verified'] == 'NotVerified'
? Colors.red
: Colors.blueAccent,
),
overflow: TextOverflow.clip,
),
),
],
), ),
Divider(), )
SizedBox( ],
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Description',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas['description'].toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
],
),
), ),
); );
} }
@@ -1,5 +1,37 @@
import 'package:cssd/config/routes.dart'; import 'package:cssd/config/routes.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
// class TestResultFloatingButton extends StatelessWidget {
// const TestResultFloatingButton({
// Key key,
// @required double deviceBlockSize,
// }) : _deviceBlockSize = deviceBlockSize,
// super(key: key);
// final double _deviceBlockSize;
// @override
// Widget build(BuildContext context) {
// return InkWell(
// onTap: () {
// Navigator.of(context).popAndPushNamed(Routes.testResultAddScreen);
// },
// child: Container(
// padding: EdgeInsets.all(5),
// decoration: BoxDecoration(
// shape: BoxShape.circle,
// color: Color.fromRGBO(0, 190, 190, 1),
// ),
// child: Icon(
// Icons.add,
// size: 10 * _deviceBlockSize,
// color: Colors.white,
// ),
// ),
// );
// }
// }
class TestResultFloatingButton extends StatelessWidget { class TestResultFloatingButton extends StatelessWidget {
const TestResultFloatingButton({ const TestResultFloatingButton({
@@ -12,22 +44,49 @@ class TestResultFloatingButton extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return InkWell( return Row(
onTap: () { mainAxisAlignment: MainAxisAlignment.end,
Navigator.of(context).popAndPushNamed(Routes.testResultAddScreen); children: <Widget>[
}, InkWell(
child: Container( customBorder: CircleBorder(),
padding: EdgeInsets.all(5), onTap: () {
decoration: BoxDecoration( Navigator.of(context).pushNamed(Routes.testScanScreen);
shape: BoxShape.circle, },
color: Color.fromRGBO(0, 190, 190, 1), child: Container(
padding: EdgeInsets.all(2.5 * _deviceBlockSize),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
FontAwesomeIcons.barcode,
size: 7.1 * _deviceBlockSize,
color: Colors.white,
),
),
), ),
child: Icon( SizedBox(
Icons.add, width: 2 * _deviceBlockSize,
size: 10 * _deviceBlockSize,
color: Colors.white,
), ),
), InkWell(
customBorder: CircleBorder(),
onTap: () {
Navigator.of(context).pushReplacementNamed(Routes.testResultAddScreen);
},
child: Container(
padding: EdgeInsets.all(_deviceBlockSize),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color.fromRGBO(0, 190, 190, 1),
),
child: Icon(
Icons.add,
size: 10 * _deviceBlockSize,
color: Colors.white,
),
),
),
],
); );
} }
} }
+179 -32
View File
@@ -7,21 +7,21 @@ packages:
name: archive name: archive
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.11" version: "2.0.13"
args: args:
dependency: transitive dependency: transitive
description: description:
name: args name: args
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.5.2" version: "1.6.0"
async: async:
dependency: transitive dependency: transitive
description: description:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.4.0" version: "2.4.1"
barcode_scan: barcode_scan:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -35,21 +35,28 @@ packages:
name: boolean_selector name: boolean_selector
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.5" version: "2.0.0"
camera:
dependency: "direct main"
description:
name: camera
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.8+2"
charcode: charcode:
dependency: transitive dependency: transitive
description: description:
name: charcode name: charcode
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.2" version: "1.1.3"
collection: collection:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.14.11" version: "1.14.12"
connectivity: connectivity:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -84,7 +91,7 @@ packages:
name: crypto name: crypto
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.3" version: "2.1.4"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -92,6 +99,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.3" version: "0.1.3"
dio:
dependency: "direct main"
description:
name: dio
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.9"
double_back_to_close_app: double_back_to_close_app:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -99,13 +113,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
dropdown_formfield: file:
dependency: "direct main" dependency: transitive
description: description:
name: dropdown_formfield name: file
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.2" version: "5.2.1"
file_picker:
dependency: "direct main"
description:
name: file_picker
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0+1"
fixnum: fixnum:
dependency: transitive dependency: transitive
description: description:
@@ -125,6 +146,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.0" version: "0.1.0"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
name: flutter_plugin_android_lifecycle
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.8"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
@@ -142,20 +170,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "8.8.1" version: "8.8.1"
hive:
dependency: "direct main"
description:
name: hive
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.1+1"
http: http:
dependency: "direct main" dependency: "direct main"
description: description:
name: http name: http
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.0+4" version: "0.12.1"
http_parser: http_parser:
dependency: transitive dependency: transitive
description: description:
@@ -169,14 +190,28 @@ packages:
name: image name: image
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.4" version: "2.1.12"
incrementally_loading_listview: image_picker:
dependency: "direct main" dependency: transitive
description: description:
name: incrementally_loading_listview name: image_picker
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.3.0" version: "0.6.7+4"
image_picker_gallery_camera:
dependency: "direct main"
description:
name: image_picker_gallery_camera
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.6"
image_picker_platform_interface:
dependency: transitive
description:
name: image_picker_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
intl: intl:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -212,6 +247,34 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.6.4" version: "1.6.4"
path_provider:
dependency: "direct main"
description:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.11"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1+2"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.4+3"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
pedantic: pedantic:
dependency: transitive dependency: transitive
description: description:
@@ -226,6 +289,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.4.0" version: "2.4.0"
platform:
dependency: transitive
description:
name: platform
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
platform_detect:
dependency: transitive
description:
name: platform_detect
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.0"
plugin_platform_interface: plugin_platform_interface:
dependency: transitive dependency: transitive
description: description:
@@ -233,6 +310,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.2" version: "1.0.2"
process:
dependency: transitive
description:
name: process
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.13"
protobuf: protobuf:
dependency: transitive dependency: transitive
description: description:
@@ -247,20 +331,27 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.2.0" version: "3.2.0"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.4"
quiver: quiver:
dependency: transitive dependency: transitive
description: description:
name: quiver name: quiver
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.5" version: "2.1.3"
rxdart: random_string:
dependency: transitive dependency: "direct main"
description: description:
name: rxdart name: random_string
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.23.1" version: "2.1.0"
shared_preferences: shared_preferences:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -300,7 +391,7 @@ packages:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.5.5" version: "1.7.0"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
@@ -335,7 +426,7 @@ packages:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.11" version: "0.2.15"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
@@ -343,6 +434,34 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.6" version: "1.1.6"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "5.4.10"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1+7"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.7"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.1+6"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
@@ -350,13 +469,41 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.8" version: "2.0.8"
video_player:
dependency: "direct main"
description:
name: video_player
url: "https://pub.dartlang.org"
source: hosted
version: "0.10.11+2"
video_player_platform_interface:
dependency: transitive
description:
name: video_player_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
video_player_web:
dependency: transitive
description:
name: video_player_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3+2"
xdg_directories:
dependency: transitive
description:
name: xdg_directories
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0"
xml: xml:
dependency: transitive dependency: transitive
description: description:
name: xml name: xml
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.5.0" version: "3.6.1"
sdks: sdks:
dart: ">=2.6.0 <3.0.0" dart: ">=2.6.0 <3.0.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0" flutter: ">=1.12.13+hotfix.5 <2.0.0"
+17 -5
View File
@@ -11,7 +11,7 @@ description: A new Flutter project.
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at # Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.1.0+1 version: 1.4.0+1
environment: environment:
sdk: ">=2.2.2 <3.0.0" sdk: ">=2.2.2 <3.0.0"
@@ -31,11 +31,23 @@ dependencies:
font_awesome_flutter: ^8.8.1 font_awesome_flutter: ^8.8.1
intl: ^0.16.1 intl: ^0.16.1
double_back_to_close_app: ^1.2.0 double_back_to_close_app: ^1.2.0
hive: ^1.4.1+1 # hive: ^1.4.1+1
url_launcher: ^5.4.10
# multi_image_picker: ^4.6.7
# image_picker: ^0.6.7
file_picker: ^1.9.0+1
dio: ^3.0.9
# camera : any
# loadmore: ^1.0.4 # loadmore: ^1.0.4
incrementally_loading_listview: ^0.3.0 # incrementally_loading_listview: ^0.3.0
dropdown_formfield: ^0.1.2 # dropdown_formfield: ^0.1.2
path_provider: ^1.6.11
# video_player: ^0.10.11+2
image_picker_gallery_camera: ^0.1.6
random_string: ^2.0.1
camera: ^0.5.8+2
video_player: ^0.10.11+2
+24 -24
View File
@@ -1,30 +1,30 @@
// This is a basic Flutter widget test. // // This is a basic Flutter widget test.
// // //
// To perform an interaction with a widget in your test, use the WidgetTester // // To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll // // utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget // // gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct. // // tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart'; // import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; // import 'package:flutter_test/flutter_test.dart';
import 'package:cssd/main.dart'; // import 'package:cssd/main.dart';
void main() { // void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async { // testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame. // // Build our app and trigger a frame.
await tester.pumpWidget(MyApp()); // await tester.pumpWidget(MyApp());
// Verify that our counter starts at 0. // // Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget); // expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing); // expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame. // // Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add)); // await tester.tap(find.byIcon(Icons.add));
await tester.pump(); // await tester.pump();
// Verify that our counter has incremented. // // Verify that our counter has incremented.
expect(find.text('0'), findsNothing); // expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget); // expect(find.text('1'), findsOneWidget);
}); // });
} // }