This commit is contained in:
erfan
2021-06-21 14:14:54 +04:30
parent 2c045f43f1
commit e2b8fab7d9
60 changed files with 4078 additions and 3928 deletions
+12 -4
View File
@@ -1,19 +1,27 @@
buildscript { buildscript {
ext.kotlin_version = '1.3.50' ext.kotlin_version = '1.3.61'
repositories { repositories {
google() // google()
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.5.0' classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
} }
} }
allprojects { allprojects {
repositories { repositories {
google() // google()
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter() jcenter()
} }
} }
+1 -1
View File
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
+2 -2
View File
@@ -3,7 +3,6 @@ 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 'config/routes.dart'; import 'config/routes.dart';
import 'pages/cycle_add_screen.dart'; import 'pages/cycle_add_screen.dart';
import 'pages/cycle_detail_screen.dart'; import 'pages/cycle_detail_screen.dart';
@@ -11,6 +10,7 @@ import 'pages/cycle_filter_screen.dart';
import 'pages/cycle_result_screen.dart'; import 'pages/cycle_result_screen.dart';
import 'pages/cycle_scan_screen.dart'; import 'pages/cycle_scan_screen.dart';
import 'pages/forget_pass_screen.dart'; import 'pages/forget_pass_screen.dart';
import 'pages/home_screen.dart';
import 'pages/label_add_screen.dart'; import 'pages/label_add_screen.dart';
import 'pages/label_detail_screen.dart'; import 'pages/label_detail_screen.dart';
import 'pages/label_filter_screen.dart'; import 'pages/label_filter_screen.dart';
@@ -90,7 +90,7 @@ class MyApp extends StatelessWidget {
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(
+197 -192
View File
@@ -1,17 +1,18 @@
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/Add/add_label_box.dart';
import 'package:cssd/widgets/CycleScreens/Add/date_picker.dart';
import 'package:cssd/widgets/CycleScreens/Add/save_button.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';
import 'package:intl/intl.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/Add/add_label_box.dart';
import '../widgets/CycleScreens/Add/date_picker.dart';
import '../widgets/CycleScreens/Add/save_button.dart';
import '../widgets/Global/internet_error.dart';
class CycleAddScreen extends StatefulWidget { class CycleAddScreen extends StatefulWidget {
// static const route = '/CycleAddScreen'; // static const route = '/CycleAddScreen';
@@ -84,202 +85,206 @@ class _CycleAddScreenState extends State<CycleAddScreen> {
); );
return true; return true;
}, },
child: Scaffold( child: SafeArea(
appBar: AppBar( child: Scaffold(
titleSpacing: -10, appBar: AppBar(
title: Text('Cycles'), titleSpacing: -10,
leading: IconButton( title: Text('Cycles'),
icon: Icon( leading: IconButton(
Icons.keyboard_arrow_left, icon: Icon(
size: 35, 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(); }),
}), ),
), ),
); );
} }
+33 -31
View File
@@ -1,11 +1,12 @@
import 'package:cssd/models/cycles_models.dart';
import 'package:cssd/providers/connectivity.dart';
import 'package:cssd/providers/cycles.dart';
import 'package:cssd/widgets/CycleScreens/Details/datas_box.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';
import '../models/cycles_models.dart';
import '../providers/connectivity.dart';
import '../providers/cycles.dart';
import '../widgets/CycleScreens/Details/datas_box.dart';
import '../widgets/Global/internet_error.dart';
class CycleDetailScreen extends StatefulWidget { class CycleDetailScreen extends StatefulWidget {
// static const route = '/CycleDetailScreen'; // static const route = '/CycleDetailScreen';
final String testResultId; final String testResultId;
@@ -49,35 +50,36 @@ class _CycleDetailScreenState extends State<CycleDetailScreen> {
// 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;
print(datas); return SafeArea(
return Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
titleSpacing: -10, titleSpacing: -10,
title: Text('Cycles'), title: Text('Cycles'),
leading: IconButton( leading: IconButton(
icon: Icon( icon: Icon(
Icons.keyboard_arrow_left, Icons.keyboard_arrow_left,
size: 35, size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
onPressed: () => Navigator.of(context).pop(),
), ),
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(),
)
: isEmpty
? Center(
child: Text('This Cycle doesnt exists!'),
)
: CycleDetailsDataBox(
datas: datas,
deviceBlockSize: _deviceBlockSize,
)
: ConnectionErrorBox();
}),
), ),
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(),
)
: isEmpty
? Center(
child: Text('This Cycle doesnt exists!'),
)
: CycleDetailsDataBox(
datas: datas,
deviceBlockSize: _deviceBlockSize,
)
: ConnectionErrorBox();
}),
); );
} }
} }
+200 -198
View File
@@ -1,4 +1,4 @@
import 'package:barcode_scan/barcode_scan.dart'; import 'package:barcode_scan2/barcode_scan2.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@@ -98,206 +98,208 @@ class _CycleFilterScreenState extends State<CycleFilterScreen> {
); );
return true; return true;
}, },
child: Scaffold( child: SafeArea(
appBar: AppBar( child: Scaffold(
titleSpacing: -10, appBar: AppBar(
title: Text('Cycles'), titleSpacing: -10,
leading: IconButton( title: Text('Cycles'),
icon: Icon( leading: IconButton(
Icons.keyboard_arrow_left, icon: Icon(
size: 35, 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,
),
Row(
children: [
Flexible(
flex: 8,
child: 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);
},
),
),
// Spacer(),
Flexible(
flex: 1,
child: InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
cycleIdCTRL.text = result;
// Navigator.of(context).pushNamed(
// CycleDetailScreen.route,
// arguments: result,
// );
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
FontAwesomeIcons.barcode,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
)
],
),
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,
),
Row(
children: [
Flexible(
flex: 8,
child: 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);
},
),
),
// Spacer(),
Flexible(
flex: 1,
child: InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
cycleIdCTRL.text = result;
// Navigator.of(context).pushNamed(
// CycleDetailScreen.route,
// arguments: result,
// );
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
FontAwesomeIcons.barcode,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
)
],
),
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();
}),
), ),
); );
} }
+144 -141
View File
@@ -1,11 +1,11 @@
import 'package:cssd/config/routes.dart'; import '../config/routes.dart';
import 'package:cssd/providers/connectivity.dart'; import '../providers/connectivity.dart';
import 'package:cssd/widgets/CycleScreens/Result/banner.dart'; import '../widgets/CycleScreens/Result/banner.dart';
import 'package:cssd/widgets/CycleScreens/Result/data_box.dart'; import '../widgets/CycleScreens/Result/data_box.dart';
import 'package:cssd/widgets/CycleScreens/Result/filter_objects.dart'; import '../widgets/CycleScreens/Result/filter_objects.dart';
import 'package:cssd/widgets/CycleScreens/Result/search_box.dart'; import '../widgets/CycleScreens/Result/search_box.dart';
import 'package:cssd/widgets/Global/internet_error.dart'; import '../widgets/Global/internet_error.dart';
import '../providers/cycles.dart'; import '../providers/cycles.dart';
@@ -62,142 +62,145 @@ class _CycleResultScreenState extends State<CycleResultScreen> {
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 SafeArea(
floatingActionButton: CycleResultFloatingButton( child: Scaffold(
deviceBlockSize: _deviceBlockSize, floatingActionButton: CycleResultFloatingButton(
), deviceBlockSize: _deviceBlockSize,
appBar: AppBar(
titleSpacing: -10,
title: Text('Home'),
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
), appBar: AppBar(
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) { titleSpacing: -10,
return connection.conStatus != 'offline' title: Text('Home'),
? Padding( leading: IconButton(
padding: icon: Icon(
EdgeInsets.only(top: 20, right: 20, bottom: 60, left: 20), Icons.keyboard_arrow_left,
child: Column( size: 35,
crossAxisAlignment: CrossAxisAlignment.start, ),
children: <Widget>[ onPressed: () => Navigator.of(context).pop(),
CycleResultBanner(deviceBlockSize: _deviceBlockSize), ),
SizedBox( ),
height: 10, body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
), return connection.conStatus != 'offline'
Consumer<CyclesProvider>(builder: (ctx, cycle, _) { ? Padding(
return Container( padding:
height: 50, EdgeInsets.only(top: 20, right: 20, bottom: 60, left: 20),
child: ListView( child: Column(
scrollDirection: Axis.horizontal, crossAxisAlignment: CrossAxisAlignment.start,
shrinkWrap: true, children: <Widget>[
children: <Widget>[ CycleResultBanner(deviceBlockSize: _deviceBlockSize),
CycleFilterBaner(deviceBlockSize: _deviceBlockSize), SizedBox(
cycle.filters.id != '' height: 10,
? CycleFilterChip(
deviceBlockSize: _deviceBlockSize,
label: 'ID',
id: '',
cycleNumber: cycle.filters.cycleNumber,
sterilizerId: cycle.filters.sterilizerId,
hospital: cycle.filters.hospital,
date: cycle.filters.date,
)
: Container(),
cycle.filters.cycleNumber != ''
? CycleFilterChip(
deviceBlockSize: _deviceBlockSize,
label: 'Cycle Number',
id: cycle.filters.id,
cycleNumber: '',
sterilizerId: cycle.filters.sterilizerId,
hospital: cycle.filters.hospital,
date: cycle.filters.date,
)
: Container(),
cycle.filters.sterilizerId != ''
? CycleFilterChip(
deviceBlockSize: _deviceBlockSize,
label: 'Sterilizer ID',
id: cycle.filters.id,
cycleNumber: cycle.filters.cycleNumber,
sterilizerId: '',
hospital: cycle.filters.hospital,
date: cycle.filters.date,
)
: Container(),
cycle.filters.hospital != ''
? CycleFilterChip(
deviceBlockSize: _deviceBlockSize,
label: 'Hospital',
id: cycle.filters.id,
cycleNumber: cycle.filters.cycleNumber,
sterilizerId: cycle.filters.sterilizerId,
hospital: '',
date: cycle.filters.date,
)
: Container(),
cycle.filters.date != ''
? CycleFilterChip(
deviceBlockSize: _deviceBlockSize,
label: 'Date',
id: cycle.filters.id,
cycleNumber: cycle.filters.cycleNumber,
sterilizerId: cycle.filters.sterilizerId,
hospital: cycle.filters.hospital,
date: '',
)
: Container(),
],
),
);
}),
CycleResultSearchBox(
searchCTRL: searchCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 20,
),
Expanded(
child: Consumer<CyclesProvider>(
builder: (context, cycleResults, _) {
return cycleResults.isloading
? Center(
child: CircularProgressIndicator(),
)
: ListView.builder(
controller: sc,
itemBuilder: (context, index) {
String labels = '';
for (var label
in cycleResults.items[index].label) {
labels += label;
labels += ' , ';
}
labels = labels.substring(
0, labels.length - 3); // remove extra ,
return CycleItemBox(
deviceBlockSize: _deviceBlockSize,
item: cycleResults.items[index],
labels: labels,
);
},
itemCount: cycleResults.items.length,
shrinkWrap: true,
);
},
), ),
), Consumer<CyclesProvider>(builder: (ctx, cycle, _) {
], return Container(
), height: 50,
) child: ListView(
: ConnectionErrorBox(); scrollDirection: Axis.horizontal,
}), shrinkWrap: true,
children: <Widget>[
CycleFilterBaner(
deviceBlockSize: _deviceBlockSize),
cycle.filters.id != ''
? CycleFilterChip(
deviceBlockSize: _deviceBlockSize,
label: 'ID',
id: '',
cycleNumber: cycle.filters.cycleNumber,
sterilizerId: cycle.filters.sterilizerId,
hospital: cycle.filters.hospital,
date: cycle.filters.date,
)
: Container(),
cycle.filters.cycleNumber != ''
? CycleFilterChip(
deviceBlockSize: _deviceBlockSize,
label: 'Cycle Number',
id: cycle.filters.id,
cycleNumber: '',
sterilizerId: cycle.filters.sterilizerId,
hospital: cycle.filters.hospital,
date: cycle.filters.date,
)
: Container(),
cycle.filters.sterilizerId != ''
? CycleFilterChip(
deviceBlockSize: _deviceBlockSize,
label: 'Sterilizer ID',
id: cycle.filters.id,
cycleNumber: cycle.filters.cycleNumber,
sterilizerId: '',
hospital: cycle.filters.hospital,
date: cycle.filters.date,
)
: Container(),
cycle.filters.hospital != ''
? CycleFilterChip(
deviceBlockSize: _deviceBlockSize,
label: 'Hospital',
id: cycle.filters.id,
cycleNumber: cycle.filters.cycleNumber,
sterilizerId: cycle.filters.sterilizerId,
hospital: '',
date: cycle.filters.date,
)
: Container(),
cycle.filters.date != ''
? CycleFilterChip(
deviceBlockSize: _deviceBlockSize,
label: 'Date',
id: cycle.filters.id,
cycleNumber: cycle.filters.cycleNumber,
sterilizerId: cycle.filters.sterilizerId,
hospital: cycle.filters.hospital,
date: '',
)
: Container(),
],
),
);
}),
CycleResultSearchBox(
searchCTRL: searchCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 20,
),
Expanded(
child: Consumer<CyclesProvider>(
builder: (context, cycleResults, _) {
return cycleResults.isloading
? Center(
child: CircularProgressIndicator(),
)
: ListView.builder(
controller: sc,
itemBuilder: (context, index) {
String labels = '';
for (var label
in cycleResults.items[index].label) {
labels += label;
labels += ' , ';
}
labels = labels.substring(0,
labels.length - 3); // remove extra ,
return CycleItemBox(
deviceBlockSize: _deviceBlockSize,
item: cycleResults.items[index],
labels: labels,
);
},
itemCount: cycleResults.items.length,
shrinkWrap: true,
);
},
),
),
],
),
)
: ConnectionErrorBox();
}),
),
); );
} }
} }
+154 -151
View File
@@ -1,13 +1,13 @@
import 'package:cssd/providers/connectivity.dart'; import 'package:barcode_scan2/barcode_scan2.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: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'; import 'package:url_launcher/url_launcher.dart';
import '../providers/connectivity.dart';
import '../widgets/Global/internet_error.dart';
class CycleScanScreen extends StatefulWidget { class CycleScanScreen extends StatefulWidget {
// static const route = '/cycleScanScreen'; // static const route = '/cycleScanScreen';
@override @override
@@ -27,167 +27,170 @@ class _CycleScanScreenState extends State<CycleScanScreen> {
// 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 SafeArea(
appBar: AppBar( child: Scaffold(
centerTitle: true, appBar: AppBar(
titleSpacing: -10, centerTitle: true,
title: Text('CSSD'), titleSpacing: -10,
leading: IconButton( title: Text('CSSD'),
icon: Icon( leading: IconButton(
Icons.keyboard_arrow_left, icon: Icon(
size: 35, Icons.keyboard_arrow_left,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
onPressed: () => Navigator.of(context).pop(),
), ),
), body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) { return connection.conStatus != 'offline'
return connection.conStatus != 'offline' ? ListView(
? ListView( padding: EdgeInsets.symmetric(horizontal: 20),
padding: EdgeInsets.symmetric(horizontal: 20), children: <Widget>[
children: <Widget>[ Container(
Container( padding: EdgeInsets.only(top: 30),
padding: EdgeInsets.only(top: 30), child: Text(
child: Text( 'LOOKING FOR A CYCLE?',
'LOOKING FOR A CYCLE?', textAlign: TextAlign.left,
textAlign: TextAlign.left, style: TextStyle(
style: TextStyle( color: Colors.black,
color: Colors.black, fontSize: 5.5 * _deviceBlockSize,
fontSize: 5.5 * _deviceBlockSize, fontWeight: FontWeight.w700,
fontWeight: FontWeight.w700, letterSpacing: 3,
letterSpacing: 3,
),
),
),
GestureDetector(
child: Container(
margin: EdgeInsets.symmetric(vertical: 10),
height: 200,
decoration: BoxDecoration(border: Border.all()),
child: Center(
child: Text(
'Please Scan The Cycle Barcode',
style: TextStyle(
color: Colors.black,
fontSize: 5 * _deviceBlockSize,
fontWeight: FontWeight.w100,
letterSpacing: 3,
),
textAlign: TextAlign.center,
), ),
), ),
), ),
onTap: () { GestureDetector(
scan().then( child: Container(
(String result) { margin: EdgeInsets.symmetric(vertical: 10),
if (result == 'cancel') { height: 200,
print('cancel'); decoration: BoxDecoration(border: Border.all()),
} else if (result == 'error') { child: Center(
print('error'); child: Text(
} else if (result == 'access') { 'Please Scan The Cycle Barcode',
print('access'); style: TextStyle(
} else { color: Colors.black,
launch( fontSize: 5 * _deviceBlockSize,
'https://cssd-doc.com/Show/Cycle/$result', fontWeight: FontWeight.w100,
); letterSpacing: 3,
// Navigator.of(context).pushNamed( ),
// Routes.cycleDetailScreen, textAlign: TextAlign.center,
// arguments: result, ),
// ); ),
} ),
}, onTap: () {
); scan().then(
}, (String result) {
), if (result == 'cancel') {
Form( print('cancel');
key: _form, } else if (result == 'error') {
child: TextFormField( print('error');
validator: (val) { } else if (result == 'access') {
if (val.isEmpty) { print('access');
return 'Id required!!'; } else {
} launch(
return null; 'https://cssd-doc.com/Show/Cycle/$result',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: result,
// );
}
},
);
}, },
controller: idCTRL, ),
decoration: InputDecoration( Form(
icon: Icon( key: _form,
FontAwesomeIcons.sortNumericDown, child: TextFormField(
size: 6 * _deviceBlockSize, validator: (val) {
), if (val.isEmpty) {
labelStyle: TextStyle( return 'Id required!!';
fontWeight: FontWeight.w100, }
fontSize: 4 * _deviceBlockSize, return null;
), },
isDense: true, controller: idCTRL,
labelText: 'Or enter a cycle ID', decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric( icon: Icon(
vertical: 2, FontAwesomeIcons.sortNumericDown,
horizontal: 3, size: 6 * _deviceBlockSize,
), ),
focusedBorder: UnderlineInputBorder( labelStyle: TextStyle(
// borderRadius: BorderRadius.only(Radius.circular(4)), fontWeight: FontWeight.w100,
borderSide: BorderSide( fontSize: 4 * _deviceBlockSize,
color: Colors.grey, ),
isDense: true,
labelText: 'Or enter a cycle ID',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
focusedBorder: UnderlineInputBorder(
// borderRadius: BorderRadius.only(Radius.circular(4)),
borderSide: BorderSide(
color: Colors.grey,
),
), ),
), ),
), style: TextStyle(
style: TextStyle( fontWeight: FontWeight.w700,
fontWeight: FontWeight.w700, fontSize: 5 * _deviceBlockSize,
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/Cycle/${idCTRL.text}',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: 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), keyboardType: TextInputType.number,
), ),
child: Align( ),
alignment: Alignment.center, SizedBox(
child: Text( height: 40,
'GO!', ),
style: TextStyle( Divider(
color: Colors.white, color: Colors.black,
fontSize: 5 * _deviceBlockSize, thickness: 3,
),
SizedBox(
height: 30,
),
InkWell(
onTap: () {
if (!_form.currentState.validate()) {
return;
}
launch(
'https://cssd-doc.com/Show/Cycle/${idCTRL.text}',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: 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();
: ConnectionErrorBox(); }),
}), ),
); );
} }
+101 -99
View File
@@ -38,7 +38,7 @@ class _ForgetPassScreenState extends State<ForgetPassScreen> {
title: Text('Error'), title: Text('Error'),
content: Text(message), content: Text(message),
actions: <Widget>[ actions: <Widget>[
FlatButton( TextButton(
child: Text('Ok'), child: Text('Ok'),
onPressed: () { onPressed: () {
Navigator.of(ctx).pop(); Navigator.of(ctx).pop();
@@ -90,106 +90,108 @@ class _ForgetPassScreenState extends State<ForgetPassScreen> {
// 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 SafeArea(
appBar: AppBar( child: Scaffold(
centerTitle: true, appBar: AppBar(
title: Text('CSSD'), centerTitle: true,
), title: Text('CSSD'),
body: Selector<ConnectivityProvider, String>( ),
builder: (ctx, value, _) => value != 'offline' body: Selector<ConnectivityProvider, String>(
? _isLoading builder: (ctx, value, _) => value != 'offline'
? Center( ? _isLoading
child: CircularProgressIndicator(), ? Center(
) child: CircularProgressIndicator(),
: Form( )
key: _form, : Form(
child: ListView( key: _form,
padding: EdgeInsets.symmetric(horizontal: 20), child: ListView(
children: <Widget>[ padding: EdgeInsets.symmetric(horizontal: 20),
Container( children: <Widget>[
padding: EdgeInsets.symmetric(vertical: 20), Container(
child: Text( padding: EdgeInsets.symmetric(vertical: 20),
'FORGET PASSWORD', child: Text(
textAlign: TextAlign.left, 'FORGET PASSWORD',
style: TextStyle( textAlign: TextAlign.left,
color: Colors.black, style: TextStyle(
fontSize: 5 * _deviceBlockSize, color: Colors.black,
letterSpacing: 3, fontSize: 5 * _deviceBlockSize,
fontWeight: FontWeight.w700, 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(), ),
], TextFormField(
), validator: (value) {
SizedBox(height: 10), if (value.isEmpty) {
], return 'Cell number is required.';
), }
) RegExp regExp =
: ConnectionErrorBox(), RegExp(r'^09[0,1,2,3,9]{1}[0-9]{8}$');
selector: (_, connectivity) => connectivity.conStatus, 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,
),
), ),
); );
} }
+191 -189
View File
@@ -1,4 +1,4 @@
import 'package:barcode_scan/platform_wrapper.dart'; import 'package:barcode_scan2/platform_wrapper.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/services.dart'; import 'package:flutter/services.dart';
@@ -6,13 +6,13 @@ import 'package:flutter_phoenix/flutter_phoenix.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import './my_info_screen.dart';
import '../providers/auth.dart'; import '../providers/auth.dart';
import '../providers/connectivity.dart'; import '../providers/connectivity.dart';
import '../widgets/Global/drawer.dart'; import '../widgets/Global/drawer.dart';
import '../widgets/Global/internet_error.dart'; import '../widgets/Global/internet_error.dart';
import 'cycle_result_screen.dart'; import 'cycle_result_screen.dart';
import 'label_result_screen.dart'; import 'label_result_screen.dart';
import 'my_info_screen.dart';
import 'test_result_screen.dart'; import 'test_result_screen.dart';
import 'test_verify_screen.dart'; import 'test_verify_screen.dart';
@@ -25,195 +25,197 @@ class HomePage extends StatelessWidget {
final userData = Provider.of<Auth>(context, listen: false).user; final userData = Provider.of<Auth>(context, listen: false).user;
// print(userData['roles']); // print(userData['roles']);
return Scaffold( return SafeArea(
resizeToAvoidBottomPadding: false, child: Scaffold(
drawer: Selector<ConnectivityProvider, String>( // resizeToAvoidBottomPadding: false,
builder: (ctx, value, _) => drawer: Selector<ConnectivityProvider, String>(
value != 'offline' ? AppDrawer() : Container(), builder: (ctx, value, _) =>
selector: (_, connctivity) => connctivity.conStatus, value != 'offline' ? AppDrawer() : Container(),
) selector: (_, connctivity) => connctivity.conStatus,
// Consumer<ConnectivityProvider>(builder: (ct, connection, _) { )
// return connection.conStatus != 'offline' ? AppDrawer() : Container(); // Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
// }) // return connection.conStatus != 'offline' ? AppDrawer() : Container();
, // })
appBar: AppBar( ,
centerTitle: true, appBar: AppBar(
title: Text('CSSD'), centerTitle: true,
actions: <Widget>[ title: Text('CSSD'),
Padding( actions: <Widget>[
padding: const EdgeInsets.only(right: 10.0), Padding(
child: IconButton( padding: const EdgeInsets.only(right: 10.0),
icon: Icon( child: IconButton(
Icons.power_settings_new, icon: Icon(
), Icons.power_settings_new,
onPressed: () { ),
showDialog( onPressed: () {
context: context, showDialog(
builder: (ctx) => AlertDialog( context: context,
title: Text('LogOut'), builder: (ctx) => AlertDialog(
content: Text('Are you sure for logout?'), title: Text('LogOut'),
actions: <Widget>[ content: Text('Are you sure for logout?'),
FlatButton( actions: <Widget>[
child: Text('Yes'), TextButton(
onPressed: () { child: Text('Yes'),
Navigator.of(ctx).pop(); onPressed: () {
Provider.of<Auth>(context, listen: false).logout(); Navigator.of(ctx).pop();
Phoenix.rebirth(context); Provider.of<Auth>(context, listen: false).logout();
}, Phoenix.rebirth(context);
), },
FlatButton(
child: Text('No'),
onPressed: () {
Navigator.of(ctx).pop();
},
),
],
),
);
},
),
)
],
),
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? DoubleBackToCloseApp(
snackBar: SnackBar(
duration: Duration(seconds: 2),
backgroundColor: Colors.black,
content: Text(
'Double tap for exit . . .',
style: TextStyle(color: Colors.white),
),
),
child: Container(
margin: EdgeInsets.only(
top: 0, bottom: 10, left: 20, right: 20),
child: ListView(
// crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(top: 20, bottom: 10),
child: Text(
'WELCOME HOME',
style: TextStyle(
color: Colors.black,
fontSize: 20,
letterSpacing: 3.5,
fontWeight: FontWeight.w700,
),
),
), ),
SelectionItem( TextButton(
startColor: Color(0xFFFCB8A2), child: Text('No'),
endColor: Color(0xFFFFECD2), onPressed: () {
firstLine: 'My INFO', Navigator.of(ctx).pop();
secondLine: 'List, Details & Add a one', },
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return Consumer<Auth>(
builder: (ctx, auth, _) {
return MyInfoScreen();
},
);
},
),
),
), ),
SelectionItem(
startColor: Color(0xFFD5F5FD),
endColor: Color(0xFFE9FFF7),
firstLine: 'TEST RESULTS',
secondLine: 'List, Details & Add a one',
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return Consumer<Auth>(
builder: (ctx, auth, _) {
return TestResultScreen();
},
);
},
),
),
// MyTestResult(
// isAdmin: false,
// ),
),
SelectionItem(
startColor: Color(0xFFE2D2C4),
endColor: Color(0xFFFAF7F5),
firstLine: 'LABELS',
secondLine: 'List, Details & Add a one',
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return Consumer<Auth>(
builder: (ctx, auth, _) {
return LabelResultScreen();
},
);
},
),
),
),
SelectionItem(
startColor: Color(0xFFA7CCE1),
endColor: Color(0xFFECF7ED),
firstLine: 'CYCLES',
secondLine: 'List, Details & Add a one',
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return Consumer<Auth>(
builder: (ctx, auth, _) {
return CycleResultScreen();
},
);
},
),
),
),
// SelectionItem(
// startColor: Color(0xFFA7CCE1),
// endColor: Color(0xFFECF7ED),
// firstLine: 'image',
// secondLine: 'image',
// onTap: CaptureImage(),
// ),
userData['roles'].contains('User')
? Container()
: SelectionItem(
startColor: Color(0xFFA7CCE1),
endColor: Color(0xFFECF7ED),
firstLine: 'TEST TO VERIFY',
secondLine: 'Verify and reject Test Results',
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return Consumer<Auth>(
builder: (ctx, auth, _) {
return TestVerifyScreen();
},
);
},
),
),
),
BarcodeSelectionItem(),
], ],
), ),
), );
) },
: ConnectionErrorBox(); ),
}, )
],
),
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? DoubleBackToCloseApp(
snackBar: SnackBar(
duration: Duration(seconds: 2),
backgroundColor: Colors.black,
content: Text(
'Double tap for exit . . .',
style: TextStyle(color: Colors.white),
),
),
child: Container(
margin: EdgeInsets.only(
top: 0, bottom: 10, left: 20, right: 20),
child: ListView(
// crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(top: 20, bottom: 10),
child: Text(
'WELCOME HOME',
style: TextStyle(
color: Colors.black,
fontSize: 20,
letterSpacing: 3.5,
fontWeight: FontWeight.w700,
),
),
),
SelectionItem(
startColor: Color(0xFFFCB8A2),
endColor: Color(0xFFFFECD2),
firstLine: 'My INFO',
secondLine: 'List, Details & Add a one',
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return Consumer<Auth>(
builder: (ctx, auth, _) {
return MyInfoScreen();
},
);
},
),
),
),
SelectionItem(
startColor: Color(0xFFD5F5FD),
endColor: Color(0xFFE9FFF7),
firstLine: 'TEST RESULTS',
secondLine: 'List, Details & Add a one',
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return Consumer<Auth>(
builder: (ctx, auth, _) {
return TestResultScreen();
},
);
},
),
),
// MyTestResult(
// isAdmin: false,
// ),
),
SelectionItem(
startColor: Color(0xFFE2D2C4),
endColor: Color(0xFFFAF7F5),
firstLine: 'LABELS',
secondLine: 'List, Details & Add a one',
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return Consumer<Auth>(
builder: (ctx, auth, _) {
return LabelResultScreen();
},
);
},
),
),
),
SelectionItem(
startColor: Color(0xFFA7CCE1),
endColor: Color(0xFFECF7ED),
firstLine: 'CYCLES',
secondLine: 'List, Details & Add a one',
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return Consumer<Auth>(
builder: (ctx, auth, _) {
return CycleResultScreen();
},
);
},
),
),
),
// SelectionItem(
// startColor: Color(0xFFA7CCE1),
// endColor: Color(0xFFECF7ED),
// firstLine: 'image',
// secondLine: 'image',
// onTap: CaptureImage(),
// ),
userData['roles'].contains('User')
? Container()
: SelectionItem(
startColor: Color(0xFFA7CCE1),
endColor: Color(0xFFECF7ED),
firstLine: 'TEST TO VERIFY',
secondLine: 'Verify and reject Test Results',
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return Consumer<Auth>(
builder: (ctx, auth, _) {
return TestVerifyScreen();
},
);
},
),
),
),
BarcodeSelectionItem(),
],
),
),
)
: ConnectionErrorBox();
},
),
), ),
); );
} }
@@ -359,7 +361,7 @@ class BarcodeSelectionItem extends StatelessWidget {
print(result); print(result);
showDialog( showDialog(
context: context, context: context,
child: AlertDialog( builder: (_) => AlertDialog(
title: Text( title: Text(
'نتیجه ی اسکن', 'نتیجه ی اسکن',
textDirection: TextDirection.rtl, textDirection: TextDirection.rtl,
@@ -376,7 +378,7 @@ class BarcodeSelectionItem extends StatelessWidget {
), ),
), ),
actions: <Widget>[ actions: <Widget>[
FlatButton( TextButton(
onPressed: () async { onPressed: () async {
await launch(result); await launch(result);
Navigator.of(context).pop(); Navigator.of(context).pop();
+176 -174
View File
@@ -84,195 +84,197 @@ class _LabelAddScreenState extends State<LabelAddScreen> {
); );
return true; return true;
}, },
child: Scaffold( child: SafeArea(
appBar: AppBar( child: Scaffold(
titleSpacing: -10, appBar: AppBar(
title: Text('Labels'), titleSpacing: -10,
leading: IconButton( title: Text('Labels'),
icon: Icon( leading: IconButton(
Icons.keyboard_arrow_left, icon: Icon(
size: 35, 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: 'Expire 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(); }),
}), ),
), ),
); );
} }
+32 -31
View File
@@ -1,8 +1,8 @@
import 'package:cssd/models/label_models.dart'; import '../models/label_models.dart';
import 'package:cssd/providers/connectivity.dart'; import '../providers/connectivity.dart';
import 'package:cssd/providers/labels.dart'; import '../providers/labels.dart';
import 'package:cssd/widgets/Global/internet_error.dart'; import '../widgets/Global/internet_error.dart';
import 'package:cssd/widgets/LabelScreens/Detail/datas_box.dart'; import '../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';
@@ -50,35 +50,36 @@ class _LabelDetailScreenState extends State<LabelDetailScreen> {
// 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;
print(datas); return SafeArea(
return Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
titleSpacing: -10, titleSpacing: -10,
title: Text('Labels'), title: Text('Labels'),
leading: IconButton( leading: IconButton(
icon: Icon( icon: Icon(
Icons.keyboard_arrow_left, Icons.keyboard_arrow_left,
size: 35, size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
onPressed: () => Navigator.of(context).pop(),
), ),
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(),
)
: isEmpty
? Center(
child: Text('This Lable doesnt exists!'),
)
: LabelDetailsDataBox(
datas: datas,
deviceBlockSize: _deviceBlockSize,
)
: ConnectionErrorBox();
}),
), ),
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(),
)
: isEmpty
? Center(
child: Text('This Lable doesnt exists!'),
)
: LabelDetailsDataBox(
datas: datas,
deviceBlockSize: _deviceBlockSize,
)
: ConnectionErrorBox();
}),
); );
} }
} }
+191 -187
View File
@@ -1,16 +1,17 @@
import 'package:barcode_scan/barcode_scan.dart'; import 'package:barcode_scan2/barcode_scan2.dart';
import 'package:cssd/config/routes.dart'; import 'package:flutter/cupertino.dart';
import 'package:cssd/models/label_models.dart';
import 'package:cssd/providers/connectivity.dart';
import 'package:cssd/providers/labels.dart';
import 'package:cssd/widgets/Global/internet_error.dart';
import 'package:cssd/widgets/LabelScreens/Filter/save_button.dart';
import 'package:cssd/widgets/LabelScreens/Filter/selector_box.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';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:flutter/cupertino.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/Filter/save_button.dart';
import '../widgets/LabelScreens/Filter/selector_box.dart';
class LabelFilterScreen extends StatefulWidget { class LabelFilterScreen extends StatefulWidget {
// static const route = '/LabelFilterScreen'; // static const route = '/LabelFilterScreen';
@@ -90,203 +91,206 @@ class _LabelFilterScreenState extends State<LabelFilterScreen> {
); );
return true; return true;
}, },
child: Scaffold( child: SafeArea(
appBar: AppBar( child: Scaffold(
titleSpacing: -10, appBar: AppBar(
title: Text('Labels'), titleSpacing: -10,
leading: IconButton( title: Text('Labels'),
icon: Icon( leading: IconButton(
Icons.keyboard_arrow_left, icon: Icon(
size: 35, 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,
),
Row(
children: [
Flexible(
flex: 8,
child: 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),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_cycleNumberFocusNode);
},
),
), ),
Flexible( ),
flex: 1, SizedBox(
child: InkWell( height: 20,
onTap: () { ),
scan().then( Row(
(String result) { children: [
if (result == 'cancel') { Flexible(
print('cancel'); flex: 8,
} else if (result == 'error') { child: TextFormField(
print('error'); controller: labelIdCTRl,
} else if (result == 'access') { decoration: InputDecoration(
print('access'); icon: Icon(
} else { FontAwesomeIcons.sortNumericDown,
print(result); size: 6 * _deviceBlockSize,
labelIdCTRl.text = result; ),
// Navigator.of(context).pushNamed( labelStyle: TextStyle(
// CycleDetailScreen.route, fontWeight: FontWeight.w100,
// arguments: result, fontSize: 4 * _deviceBlockSize,
// ); ),
} labelText: 'Label ID',
}, isDense: true,
); contentPadding: EdgeInsets.symmetric(
}, vertical: 2, horizontal: 3),
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
), ),
child: Icon( style: TextStyle(
FontAwesomeIcons.barcode, fontWeight: FontWeight.w700,
size: 5 * _deviceBlockSize, fontSize: 5 * _deviceBlockSize,
color: Colors.white,
), ),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context).requestFocus(
_cycleNumberFocusNode);
},
), ),
), ),
) Flexible(
], flex: 1,
), child: InkWell(
SizedBox( onTap: () {
height: 30, scan().then(
), (String result) {
TextFormField( if (result == 'cancel') {
controller: cycleNumberCTRL, print('cancel');
decoration: InputDecoration( } else if (result == 'error') {
icon: Icon( print('error');
FontAwesomeIcons.sortNumericDown, } else if (result == 'access') {
size: 6 * _deviceBlockSize, print('access');
), } else {
labelStyle: TextStyle( print(result);
fontWeight: FontWeight.w100, labelIdCTRl.text = result;
fontSize: 4 * _deviceBlockSize, // Navigator.of(context).pushNamed(
), // CycleDetailScreen.route,
labelText: 'Cycle Number', // arguments: result,
isDense: true, // );
contentPadding: EdgeInsets.symmetric( }
vertical: 2, horizontal: 3), },
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
FontAwesomeIcons.barcode,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
)
],
), ),
style: TextStyle( SizedBox(
fontWeight: FontWeight.w700, height: 30,
fontSize: 5 * _deviceBlockSize,
), ),
focusNode: _cycleNumberFocusNode, TextFormField(
keyboardType: TextInputType.visiblePassword, controller: cycleNumberCTRL,
textInputAction: TextInputAction.next, decoration: InputDecoration(
onFieldSubmitted: (_) { icon: Icon(
FocusScope.of(context) FontAwesomeIcons.sortNumericDown,
.requestFocus(_strilizerIdFocusNode); size: 6 * _deviceBlockSize,
}, ),
), labelStyle: TextStyle(
SizedBox( fontWeight: FontWeight.w100,
height: 30, fontSize: 4 * _deviceBlockSize,
), ),
TextFormField( labelText: 'Cycle Number',
controller: striizerIdCTRL, isDense: true,
decoration: InputDecoration( contentPadding: EdgeInsets.symmetric(
icon: Icon( vertical: 2, horizontal: 3),
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
), ),
labelStyle: TextStyle( style: TextStyle(
fontWeight: FontWeight.w100, fontWeight: FontWeight.w700,
fontSize: 4 * _deviceBlockSize, fontSize: 5 * _deviceBlockSize,
), ),
labelText: 'Strilizer ID', focusNode: _cycleNumberFocusNode,
isDense: true, keyboardType: TextInputType.visiblePassword,
contentPadding: EdgeInsets.symmetric( textInputAction: TextInputAction.next,
vertical: 2, horizontal: 3), onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_strilizerIdFocusNode);
},
), ),
style: TextStyle( SizedBox(
fontWeight: FontWeight.w700, height: 30,
fontSize: 5 * _deviceBlockSize, ),
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),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
textInputAction: TextInputAction.done,
keyboardType: TextInputType.visiblePassword,
focusNode: _strilizerIdFocusNode,
),
SizedBox(
height: 30,
), ),
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();
}, },
),
), ),
), ),
); );
} }
} }
Future<String> scan() async { Future<String> scan() async {
try { try {
var barcode = await BarcodeScanner.scan(); var barcode = await BarcodeScanner.scan();
+149 -143
View File
@@ -1,15 +1,16 @@
import 'package:cssd/config/routes.dart';
import 'package:cssd/providers/connectivity.dart';
import 'package:cssd/widgets/Global/page_header.dart';
import 'package:cssd/widgets/Global/internet_error.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/floating_buttons.dart';
import 'package:cssd/widgets/LabelScreens/Result/search_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:provider/provider.dart'; import 'package:provider/provider.dart';
import '../config/routes.dart';
import '../providers/connectivity.dart';
import '../providers/labels.dart'; import '../providers/labels.dart';
import '../widgets/Global/internet_error.dart';
import '../widgets/Global/page_header.dart';
import '../widgets/LabelScreens/Result/data_box.dart';
import '../widgets/LabelScreens/Result/filter_chip_box.dart';
import '../widgets/LabelScreens/Result/floating_buttons.dart';
import '../widgets/LabelScreens/Result/search_box.dart';
class LabelResultScreen extends StatefulWidget { class LabelResultScreen extends StatefulWidget {
// static const route = '/LabelResultScreen'; // static const route = '/LabelResultScreen';
@@ -61,150 +62,155 @@ class _LabelResultScreenState extends State<LabelResultScreen> {
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 SafeArea(
floatingActionButton: child: Scaffold(
LabelFloatingButtons(deviceBlockSize: _deviceBlockSize), floatingActionButton:
appBar: AppBar( LabelFloatingButtons(deviceBlockSize: _deviceBlockSize),
titleSpacing: -10, appBar: AppBar(
title: Text('Home'), titleSpacing: -10,
leading: IconButton( title: Text('Home'),
icon: Icon( leading: IconButton(
Icons.keyboard_arrow_left, icon: Icon(
size: 35, Icons.keyboard_arrow_left,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
onPressed: () => Navigator.of(context).pop(),
), ),
), body: Consumer<ConnectivityProvider>(
body: Consumer<ConnectivityProvider>( builder: (ct, connection, _) {
builder: (ct, connection, _) { return connection.conStatus != 'offline'
return connection.conStatus != 'offline' ? Padding(
? Padding( padding: EdgeInsets.only(
padding: top: 20, right: 20, bottom: 60, left: 20),
EdgeInsets.only(top: 20, right: 20, bottom: 60, left: 20), child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
children: <Widget>[ PageHeader(
PageHeader( deviceBlockSize: _deviceBlockSize,
deviceBlockSize: _deviceBlockSize, label: 'LABELS',
label: 'LABELS', route: Routes.labelFilterScreen,
route: Routes.labelFilterScreen, ),
), SizedBox(
SizedBox( height: 10,
height: 10, ),
), Consumer<LabelsProvider>(
Consumer<LabelsProvider>( builder: (context, label, _) {
builder: (context, label, _) { 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).popAndPushNamed(
Routes.labelFilterScreen,
);
},
child: Chip(
backgroundColor: Colors.black,
label: Text(
'Filters',
style: TextStyle(
color: Colors.white,
),
),
deleteIcon: Icon(
FontAwesomeIcons.filter,
color: Colors.white,
size: 4 * _deviceBlockSize,
),
onDeleted: () {
Navigator.of(context).popAndPushNamed( Navigator.of(context).popAndPushNamed(
Routes.labelFilterScreen, Routes.labelFilterScreen,
); );
}, },
), child: Chip(
), backgroundColor: Colors.black,
label.filters.id != '' label: Text(
? LabelFilterChip( 'Filters',
deviceBlockSize: _deviceBlockSize, style: TextStyle(
id: '', color: Colors.white,
cycleNumber: label.filters.cycleNumber, ),
sterilizerId: ),
label.filters.sterilizerId, deleteIcon: Icon(
hospital: label.filters.hospital, FontAwesomeIcons.filter,
label: 'ID', color: Colors.white,
) size: 4 * _deviceBlockSize,
: Container(), ),
label.filters.cycleNumber != '' onDeleted: () {
? LabelFilterChip( Navigator.of(context).popAndPushNamed(
deviceBlockSize: _deviceBlockSize, Routes.labelFilterScreen,
id: label.filters.id, );
cycleNumber: '', },
sterilizerId:
label.filters.sterilizerId,
hospital: label.filters.hospital,
label: 'Cycle Number',
)
: Container(),
label.filters.sterilizerId != ''
? LabelFilterChip(
deviceBlockSize: _deviceBlockSize,
id: label.filters.id,
cycleNumber: label.filters.cycleNumber,
sterilizerId: '',
hospital: label.filters.hospital,
label: 'Sterilizer ID',
)
: Container(),
label.filters.hospital != ''
? LabelFilterChip(
deviceBlockSize: _deviceBlockSize,
id: label.filters.id,
cycleNumber: label.filters.cycleNumber,
sterilizerId:
label.filters.sterilizerId,
hospital: '',
label: 'Hospital',
)
: Container(),
],
),
);
},
),
LabelSearchBox(
searchCTRL: searchCTRL,
deviceBlockSize: _deviceBlockSize),
SizedBox(
height: 20,
),
Expanded(
child: Consumer<LabelsProvider>(
builder: (context, labelResults, _) {
return labelResults.isloading
? Center(
child: CircularProgressIndicator(),
)
: ListView.builder(
controller: sc,
itemBuilder: (context, index) =>
LabelItemBox(
deviceBlockSize: _deviceBlockSize,
item: labelResults.items[index],
), ),
itemCount: labelResults.items.length, ),
shrinkWrap: true, label.filters.id != ''
); ? LabelFilterChip(
deviceBlockSize: _deviceBlockSize,
id: '',
cycleNumber:
label.filters.cycleNumber,
sterilizerId:
label.filters.sterilizerId,
hospital: label.filters.hospital,
label: 'ID',
)
: Container(),
label.filters.cycleNumber != ''
? LabelFilterChip(
deviceBlockSize: _deviceBlockSize,
id: label.filters.id,
cycleNumber: '',
sterilizerId:
label.filters.sterilizerId,
hospital: label.filters.hospital,
label: 'Cycle Number',
)
: Container(),
label.filters.sterilizerId != ''
? LabelFilterChip(
deviceBlockSize: _deviceBlockSize,
id: label.filters.id,
cycleNumber:
label.filters.cycleNumber,
sterilizerId: '',
hospital: label.filters.hospital,
label: 'Sterilizer ID',
)
: Container(),
label.filters.hospital != ''
? LabelFilterChip(
deviceBlockSize: _deviceBlockSize,
id: label.filters.id,
cycleNumber:
label.filters.cycleNumber,
sterilizerId:
label.filters.sterilizerId,
hospital: '',
label: 'Hospital',
)
: Container(),
],
),
);
}, },
), ),
), LabelSearchBox(
], searchCTRL: searchCTRL,
), deviceBlockSize: _deviceBlockSize),
) SizedBox(
: ConnectionErrorBox(); height: 20,
}, ),
Expanded(
child: Consumer<LabelsProvider>(
builder: (context, labelResults, _) {
return labelResults.isloading
? Center(
child: CircularProgressIndicator(),
)
: ListView.builder(
controller: sc,
itemBuilder: (context, index) =>
LabelItemBox(
deviceBlockSize: _deviceBlockSize,
item: labelResults.items[index],
),
itemCount: labelResults.items.length,
shrinkWrap: true,
);
},
),
),
],
),
)
: ConnectionErrorBox();
},
),
), ),
); );
} }
+62 -59
View File
@@ -1,12 +1,13 @@
import 'package:cssd/providers/connectivity.dart';
import 'package:cssd/widgets/Global/internet_error.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/scan_box.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../providers/connectivity.dart';
import '../widgets/Global/internet_error.dart';
import '../widgets/LabelScreens/Scan/input_box.dart';
import '../widgets/LabelScreens/Scan/save_button.dart';
import '../widgets/LabelScreens/Scan/scan_box.dart';
// import 'package:flutter/services.dart'; // import 'package:flutter/services.dart';
// import 'package:barcode_scan/barcode_scan.dart'; // import 'package:barcode_scan2/barcode_scan2.dart';
class LabelScanScreen extends StatefulWidget { class LabelScanScreen extends StatefulWidget {
// static const route = '/LabelScanScreen'; // static const route = '/LabelScanScreen';
@@ -27,63 +28,65 @@ class _LabelScanScreenState extends State<LabelScanScreen> {
// 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 SafeArea(
appBar: AppBar( child: Scaffold(
centerTitle: true, appBar: AppBar(
titleSpacing: -10, centerTitle: true,
title: Text('CSSD'), titleSpacing: -10,
leading: IconButton( title: Text('CSSD'),
icon: Icon( leading: IconButton(
Icons.keyboard_arrow_left, icon: Icon(
size: 35, Icons.keyboard_arrow_left,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
onPressed: () => Navigator.of(context).pop(),
), ),
), body: Consumer<ConnectivityProvider>(
body: Consumer<ConnectivityProvider>( builder: (ct, connection, _) {
builder: (ct, connection, _) { return connection.conStatus != 'offline'
return connection.conStatus != 'offline' ? ListView(
? ListView( padding: EdgeInsets.symmetric(horizontal: 20),
padding: EdgeInsets.symmetric(horizontal: 20), children: <Widget>[
children: <Widget>[ Container(
Container( padding: EdgeInsets.only(top: 30),
padding: EdgeInsets.only(top: 30), child: Text(
child: Text( 'LOOKING FOR A Label?',
'LOOKING FOR A Label?', textAlign: TextAlign.left,
textAlign: TextAlign.left, style: TextStyle(
style: TextStyle( color: Colors.black,
color: Colors.black, fontSize: 5.5 * _deviceBlockSize,
fontSize: 5.5 * _deviceBlockSize, fontWeight: FontWeight.w700,
fontWeight: FontWeight.w700, letterSpacing: 3,
letterSpacing: 3, ),
), ),
), ),
), LabelScanBox(),
LabelScanBox(), Form(
Form( key: _form,
key: _form, child: LabelScanInputBox(
child: LabelScanInputBox( idCTRL: idCTRL, deviceBlockSize: _deviceBlockSize),
idCTRL: idCTRL, deviceBlockSize: _deviceBlockSize), ),
), SizedBox(
SizedBox( height: 40,
height: 40, ),
), Divider(
Divider( color: Colors.black,
color: Colors.black, thickness: 3,
thickness: 3, ),
), SizedBox(
SizedBox( height: 30,
height: 30, ),
), FilterScanSaveButton(
FilterScanSaveButton( form: _form,
form: _form, idCTRL: idCTRL,
idCTRL: idCTRL, deviceBlockSize: _deviceBlockSize,
deviceBlockSize: _deviceBlockSize, ),
), ],
], )
) : ConnectionErrorBox();
: ConnectionErrorBox(); },
}, ),
), ),
); );
} }
+177 -175
View File
@@ -107,196 +107,198 @@ class _LabelUpdateScreenState extends State<LabelUpdateScreen> {
); );
return true; return true;
}, },
child: Scaffold( child: SafeArea(
appBar: AppBar( child: Scaffold(
titleSpacing: -10, appBar: AppBar(
title: Text('Labels'), titleSpacing: -10,
leading: IconButton( title: Text('Labels'),
icon: Icon( leading: IconButton(
Icons.keyboard_arrow_left, icon: Icon(
size: 35, 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( 'Update A LABEL',
'Update 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: 'Expire Date', SizedBox(
), height: 20,
SizedBox( ),
height: 70, LabelAddSelectorBox(
), deviceBlockSize: _deviceBlockSize,
LabelUpdateButton( packageCTRL: packageCTRL,
form: _form, packageVals: packageVals,
id: datas.id, packageValue: packageValue,
lotNumberCTRL: lotNumberCTRL, ),
cycleNumberCTRL: cycleNumberCTRL, SizedBox(
sDateCTRL: sDateCTRL, height: 10,
packageValue: packageValue, ),
eDateCTRL: eDateCTRL, LabelAddDatePicker(
striizerIdCTRL: striizerIdCTRL, dateCTRL: sDateCTRL,
deviceBlockSize: _deviceBlockSize, deviceBlockSize: _deviceBlockSize,
), label: 'Sterile Date',
SizedBox( ),
height: 100, 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();
: ConnectionErrorBox(); }),
}), ),
), ),
); );
} }
+176 -174
View File
@@ -1,11 +1,12 @@
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: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';
import '../config/routes.dart';
import '../providers/auth.dart';
import '../providers/connectivity.dart';
import '../widgets/Global/internet_error.dart';
class LoginScreen extends StatefulWidget { class LoginScreen extends StatefulWidget {
// static const route = '/HomeScreen'; // static const route = '/HomeScreen';
@@ -44,7 +45,7 @@ class _LoginScreenState extends State<LoginScreen> {
title: Text('Error'), title: Text('Error'),
content: Text(message), content: Text(message),
actions: <Widget>[ actions: <Widget>[
FlatButton( TextButton(
child: Text('Ok'), child: Text('Ok'),
onPressed: () { onPressed: () {
Navigator.of(ctx).pop(); Navigator.of(ctx).pop();
@@ -110,186 +111,187 @@ class _LoginScreenState extends State<LoginScreen> {
// 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 SafeArea(
appBar: AppBar( child: Scaffold(
centerTitle: true, appBar: AppBar(
title: Text('CSSD'), centerTitle: true,
), title: Text('CSSD'),
body: Selector<ConnectivityProvider, String>( ),
builder: (ctx, value, _) => value != 'offline' body: Selector<ConnectivityProvider, String>(
? _isLoading builder: (ctx, value, _) => value != 'offline'
? Center( ? _isLoading
child: CircularProgressIndicator(), ? Center(
) child: CircularProgressIndicator(),
: Form( )
key: _form, : Form(
child: ListView( key: _form,
padding: EdgeInsets.symmetric(horizontal: 20), child: ListView(
children: <Widget>[ padding: EdgeInsets.symmetric(horizontal: 20),
Container( children: <Widget>[
padding: EdgeInsets.symmetric(vertical: 20), Container(
child: Text( padding: EdgeInsets.symmetric(vertical: 20),
'LOGIN', child: Text(
textAlign: TextAlign.left, 'LOGIN',
style: TextStyle( textAlign: TextAlign.left,
color: Colors.black,
fontSize: 6 * _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( style: TextStyle(
color: Colors.black,
fontSize: 6 * _deviceBlockSize,
letterSpacing: 3,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
), ),
keyboardType: TextInputType.phone,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_passwordFocusNode);
},
onSaved: (value) {
map['cellNumber'] = value;
},
), ),
SizedBox( ),
height: 30, TextFormField(
), validator: (value) {
TextFormField( if (value.isEmpty) {
validator: (value) { return 'Cell number is required.';
if (value.isEmpty) { }
return 'Password is required.'; RegExp regExp =
} RegExp(r'^09[0,1,2,3,9]{1}[0-9]{8}$');
if (value.length < 8) { if (!regExp.hasMatch(value)) {
return 'Password at least is 8 characters.'; return 'Enter a valid cell number';
} }
return null; return null;
}, },
obscureText: _hidePass, controller: cellNumberController,
controller: passwordController, decoration: InputDecoration(
decoration: InputDecoration( icon: Icon(
icon: Icon( Icons.call,
FontAwesomeIcons.starOfLife, size: 6 * _deviceBlockSize,
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( labelStyle: TextStyle(
fontWeight: FontWeight.w700, fontWeight: FontWeight.w100,
fontSize: 5 * _deviceBlockSize, fontSize: 4 * _deviceBlockSize,
), ),
textInputAction: TextInputAction.done, labelText: 'Cell Number',
onFieldSubmitted: (_) { isDense: true,
_login(); contentPadding: EdgeInsets.symmetric(
}, vertical: 2, horizontal: 3),
keyboardType: TextInputType.visiblePassword,
focusNode: _passwordFocusNode,
onSaved: (value) {
map['password'] = value;
},
), ),
SizedBox(height: 40), style: TextStyle(
Row( fontWeight: FontWeight.w700,
children: <Widget>[ fontSize: 5 * _deviceBlockSize,
InkWell( ),
onTap: () => _login(), keyboardType: TextInputType.phone,
child: Container( textInputAction: TextInputAction.next,
width: 40 * _deviceBlockSize, onFieldSubmitted: (_) {
padding: EdgeInsets.symmetric( FocusScope.of(context)
horizontal: 5 * _deviceBlockSize, .requestFocus(_passwordFocusNode);
vertical: 10, },
onSaved: (value) {
map['cellNumber'] = value;
},
),
SizedBox(
height: 30,
),
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: (_) {
_login();
},
keyboardType: TextInputType.visiblePassword,
focusNode: _passwordFocusNode,
onSaved: (value) {
map['password'] = value;
},
),
SizedBox(height: 40),
Row(
children: <Widget>[
InkWell(
onTap: () => _login(),
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],
), ),
// margin: borderRadius: BorderRadius.circular(7),
// EdgeInsets.symmetric(horizontal: 35, vertical: 15), ),
decoration: BoxDecoration( child: Row(
gradient: LinearGradient( mainAxisSize: MainAxisSize.min,
colors: [Colors.blue, Colors.green], children: <Widget>[
Spacer(),
Icon(
Icons.exit_to_app,
color: Colors.white,
), ),
borderRadius: BorderRadius.circular(7), Text(
), 'Login',
child: Row( style: TextStyle(color: Colors.white),
mainAxisSize: MainAxisSize.min, ),
children: <Widget>[ Spacer()
Spacer(), ],
Icon( )),
Icons.exit_to_app, ),
color: Colors.white, Spacer(),
), ],
Text( ),
'Login', SizedBox(height: 10),
style: TextStyle(color: Colors.white), TextButton(
), child: Align(
Spacer() alignment: Alignment.centerLeft,
], child: Text(
)), 'Forgot Password ?',
), style: TextStyle(
Spacer(), color: Colors.black54,
], decoration: TextDecoration.underline,
),
SizedBox(height: 10),
FlatButton(
padding: EdgeInsets.all(0),
child: Align(
alignment: Alignment.centerLeft,
child: Text(
'Forgot Password ?',
style: TextStyle(
color: Colors.black54,
decoration: TextDecoration.underline,
),
), ),
), ),
onPressed: () => Navigator.of(context)
.pushNamed(Routes.forgetPassScreen),
), ),
], onPressed: () => Navigator.of(context)
), .pushNamed(Routes.forgetPassScreen),
) ),
: ConnectionErrorBox(), ],
selector: (_, connectivity) => connectivity.conStatus, ),
)); )
: ConnectionErrorBox(),
selector: (_, connectivity) => connectivity.conStatus,
)),
);
} }
} }
+132 -129
View File
@@ -40,138 +40,141 @@ class _MyInfoScreenState extends State<MyInfoScreen> {
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 SafeArea(
appBar: AppBar( child: Scaffold(
titleSpacing: -10, appBar: AppBar(
title: Text('Dashboard'), titleSpacing: -10,
leading: IconButton( title: Text('Dashboard'),
icon: Icon( leading: IconButton(
Icons.keyboard_arrow_left, icon: Icon(
size: 35, Icons.keyboard_arrow_left,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
onPressed: () => Navigator.of(context).pop(),
), ),
), 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( children: <Widget>[
children: <Widget>[ InfoHeader(
InfoHeader( deviceBlockSize: _deviceBlockSize,
deviceBlockSize: _deviceBlockSize, label: 'MY INFO',
label: 'MY INFO',
),
Container(
padding: EdgeInsets.symmetric(horizontal: 20),
child: Column(
children: <Widget>[
InfoInputBox(
controller: usernameCTRL,
deviceBlockSize: _deviceBlockSize,
label: 'Full Name',
icon: FontAwesomeIcons.sortNumericDown,
inputType: TextInputType.text,
),
SizedBox(
height: 20,
),
TextFormField(
readOnly: true,
initialValue: user['cell_number'],
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,
color: Colors.grey,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
),
SizedBox(
height: 20,
),
InfoInputBox(
controller: emailCTRL,
deviceBlockSize: _deviceBlockSize,
label: 'Email Address',
icon: FontAwesomeIcons.envelope,
inputType: TextInputType.emailAddress,
),
SizedBox(
height: 40,
),
InkWell(
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 60, vertical: 10),
margin: EdgeInsets.only(top: 50, bottom: 20),
width: double.infinity,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue, Colors.green],
),
borderRadius: BorderRadius.circular(5),
),
child: Text(
'Save',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
),
textAlign: TextAlign.center,
),
),
onTap: () async {
await Provider.of<Auth>(context, listen: false)
.setUserData(
user['id'],
usernameCTRL.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();
},
),
],
), ),
), Container(
], padding: EdgeInsets.symmetric(horizontal: 20),
) child: Column(
: ConnectionErrorBox(); children: <Widget>[
}), InfoInputBox(
controller: usernameCTRL,
deviceBlockSize: _deviceBlockSize,
label: 'Full Name',
icon: FontAwesomeIcons.sortNumericDown,
inputType: TextInputType.text,
),
SizedBox(
height: 20,
),
TextFormField(
readOnly: true,
initialValue: user['cell_number'],
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,
color: Colors.grey,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
),
SizedBox(
height: 20,
),
InfoInputBox(
controller: emailCTRL,
deviceBlockSize: _deviceBlockSize,
label: 'Email Address',
icon: FontAwesomeIcons.envelope,
inputType: TextInputType.emailAddress,
),
SizedBox(
height: 40,
),
InkWell(
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 60, vertical: 10),
margin: EdgeInsets.only(top: 50, bottom: 20),
width: double.infinity,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue, Colors.green],
),
borderRadius: BorderRadius.circular(5),
),
child: Text(
'Save',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
),
textAlign: TextAlign.center,
),
),
onTap: () async {
await Provider.of<Auth>(context,
listen: false)
.setUserData(
user['id'],
usernameCTRL.text,
emailCTRL.text,
)
.then(
(value) async => await showDialog(
context: context,
builder: (ctx) => AlertDialog(
content: Text(
'Info changed successfully.',
),
actions: <Widget>[
TextButton(
child: Text('Ok'),
onPressed: () {
Navigator.of(ctx).pop();
},
),
],
),
),
);
Navigator.of(context).pop();
},
),
],
),
),
],
)
: ConnectionErrorBox();
}),
),
); );
} }
} }
+159 -157
View File
@@ -43,7 +43,7 @@ class _RePassScreenState extends State<RePassScreen> {
builder: (ctx) => AlertDialog( builder: (ctx) => AlertDialog(
content: Text(message), content: Text(message),
actions: <Widget>[ actions: <Widget>[
FlatButton( TextButton(
child: Text('Ok'), child: Text('Ok'),
onPressed: () { onPressed: () {
Navigator.of(ctx).pop(); Navigator.of(ctx).pop();
@@ -79,163 +79,165 @@ class _RePassScreenState extends State<RePassScreen> {
// 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 SafeArea(
appBar: AppBar( child: Scaffold(
centerTitle: true, appBar: AppBar(
title: Text('CSSD'), centerTitle: true,
), title: Text('CSSD'),
body: Selector<ConnectivityProvider, String>( ),
builder: (ctx, value, _) => value != 'offline' body: Selector<ConnectivityProvider, String>(
? _isLoading builder: (ctx, value, _) => value != 'offline'
? Center( ? _isLoading
child: CircularProgressIndicator(), ? Center(
) child: CircularProgressIndicator(),
: Form( )
key: _form, : Form(
child: ListView( key: _form,
padding: EdgeInsets.symmetric(horizontal: 20), child: ListView(
children: <Widget>[ padding: EdgeInsets.symmetric(horizontal: 20),
Container( children: <Widget>[
padding: EdgeInsets.symmetric(vertical: 20), Container(
child: Text( padding: EdgeInsets.symmetric(vertical: 20),
'CHANGE PASSWORD', child: Text(
textAlign: TextAlign.left, 'CHANGE PASSWORD',
style: TextStyle( textAlign: TextAlign.left,
color: Colors.black, style: TextStyle(
fontSize: 6 * _deviceBlockSize, color: Colors.black,
letterSpacing: 3, fontSize: 6 * _deviceBlockSize,
fontWeight: FontWeight.w700, 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(), ),
], TextFormField(
), validator: (value) {
SizedBox(height: 10), if (value.isEmpty) {
], return 'Password is required.';
), }
) if (value.length < 8) {
: ConnectionErrorBox(), return 'Password at least is 8 characters.';
selector: (_, connectivity) => connectivity.conStatus, }
)); 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,
)),
);
} }
} }
+259 -257
View File
@@ -39,7 +39,7 @@ class _RegisterState extends State<Register> {
// title: Text('error occured'), // title: Text('error occured'),
// content: Text(message), // content: Text(message),
// actions: <Widget>[ // actions: <Widget>[
// FlatButton( // TextButton(
// child: Text('Ok'), // child: Text('Ok'),
// onPressed: () { // onPressed: () {
// Navigator.of(ctx).pop(); // Navigator.of(ctx).pop();
@@ -84,294 +84,296 @@ class _RegisterState extends State<Register> {
// 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 SafeArea(
appBar:AppBar( child: Scaffold(
titleSpacing: -10, appBar: AppBar(
title: Text('Login'), titleSpacing: -10,
leading: IconButton( title: Text('Login'),
icon: Icon( leading: IconButton(
Icons.keyboard_arrow_left, icon: Icon(
size: 35, Icons.keyboard_arrow_left,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
onPressed: () => Navigator.of(context).pop(),
), ),
), body: _isLoading
body: _isLoading ? Center(
? Center( child: CircularProgressIndicator(),
child: CircularProgressIndicator(), )
) : Form(
: Form( key: _form,
key: _form, child: ListView(
child: ListView( padding: EdgeInsets.symmetric(horizontal: 20),
padding: EdgeInsets.symmetric(horizontal: 20), children: <Widget>[
children: <Widget>[ Container(
Container( padding: EdgeInsets.symmetric(vertical: 20),
padding: EdgeInsets.symmetric(vertical: 20), child: Text(
child: Text( 'register',
'register', textAlign: TextAlign.left,
textAlign: TextAlign.left, style: TextStyle(
style: TextStyle( color: Colors.black,
color: Colors.black, fontSize: 7 * _deviceBlockSize,
fontSize: 7 * _deviceBlockSize, letterSpacing: 3,
letterSpacing: 3, ),
), ),
), ),
), TextFormField(
TextFormField( validator: (value) {
validator: (value) { if (value.isEmpty) {
if (value.isEmpty) { return 'Cell number is required.';
return 'Cell number is required.'; }
} RegExp regExp = RegExp(r'^09[0,1,2,3,9]{1}[0-9]{8}$');
RegExp regExp = RegExp(r'^09[0,1,2,3,9]{1}[0-9]{8}$'); if (!regExp.hasMatch(value)) {
if (!regExp.hasMatch(value)) { return 'Enter a valid cell number';
return 'Enter a valid cell number'; }
} return null;
return null; },
}, style: TextStyle(fontWeight: FontWeight.w700),
style: TextStyle(fontWeight: FontWeight.w700), keyboardType: TextInputType.phone,
keyboardType: TextInputType.phone, textInputAction: TextInputAction.next,
textInputAction: TextInputAction.next, onFieldSubmitted: (_) {
onFieldSubmitted: (_) { FocusScope.of(context).requestFocus(_passwordFocusNode);
FocusScope.of(context).requestFocus(_passwordFocusNode); },
}, controller: cellNumberController,
controller: cellNumberController, decoration: InputDecoration(
decoration: InputDecoration( isDense: true,
isDense: true, icon: Icon(
icon: Icon( Icons.call,
Icons.call, color: Colors.grey,
color: Colors.grey, ),
border: UnderlineInputBorder(),
fillColor: Colors.red,
labelText: 'Cell Number',
contentPadding: EdgeInsets.symmetric(vertical: 5),
), ),
border: UnderlineInputBorder(), onSaved: (value) {
fillColor: Colors.red, map['cellNumber'] = value;
labelText: 'Cell Number', },
contentPadding: EdgeInsets.symmetric(vertical: 5),
), ),
onSaved: (value) { SizedBox(
map['cellNumber'] = value; height: 10,
},
),
SizedBox(
height: 10,
),
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,
textInputAction: TextInputAction.done,
onFieldSubmitted: (_) {
_register();
},
style: TextStyle(fontWeight: FontWeight.w700),
decoration: InputDecoration(
isDense: true,
icon: Icon(
FontAwesomeIcons.starOfLife,
color: Colors.grey,
),
border: UnderlineInputBorder(),
fillColor: Colors.red,
labelText: 'Password',
contentPadding: EdgeInsets.symmetric(vertical: 5),
suffixIcon: InkWell(
child: Icon(FontAwesomeIcons.eye),
onTap: () {
setState(() {
_hidePass = !_hidePass;
});
},
),
), ),
focusNode: _passwordFocusNode, TextFormField(
onSaved: (value) { validator: (value) {
map['password'] = value; if (value.isEmpty) {
}, return 'Password is required.';
), }
SizedBox( if (value.length < 8) {
height: 10, return 'Password at least is 8 characters.';
), }
TextFormField( return null;
validator: (value) { },
if (value.isEmpty) { obscureText: _hidePass,
return 'Full Name is required.'; textInputAction: TextInputAction.done,
} onFieldSubmitted: (_) {
// RegExp regExp = RegExp(r'^09[0,1,2,3,9]{1}[0-9]{8}$'); _register();
// if (!regExp.hasMatch(value)) { },
// return 'Enter a valid cell number'; style: TextStyle(fontWeight: FontWeight.w700),
// } decoration: InputDecoration(
return null; isDense: true,
}, icon: Icon(
// keyboardType: TextInputType.phone, FontAwesomeIcons.starOfLife,
// textInputAction: TextInputAction.next, color: Colors.grey,
// onFieldSubmitted: (_) { ),
// FocusScope.of(context).requestFocus(_passwordFocusNode); border: UnderlineInputBorder(),
// }, fillColor: Colors.red,
// controller: cellNumberController, labelText: 'Password',
decoration: InputDecoration( contentPadding: EdgeInsets.symmetric(vertical: 5),
isDense: true, suffixIcon: InkWell(
icon: Icon( child: Icon(FontAwesomeIcons.eye),
FontAwesomeIcons.sortNumericDown, onTap: () {
color: Colors.grey,
),
border: UnderlineInputBorder(),
fillColor: Colors.red,
labelText: 'Full Name',
contentPadding: EdgeInsets.symmetric(vertical: 5),
),
style: TextStyle(fontWeight: FontWeight.w700),
// onSaved: (value) {
// map['cellNumber'] = value;
// },
),
SizedBox(
height: 20,
),
Row(
// width: double.infinity,
children: <Widget>[
Icon(
FontAwesomeIcons.alignLeft,
color: Colors.grey,
size: 5 * _deviceBlockSize,
),
SizedBox(
width: 3 * _deviceBlockSize,
),
Expanded(
// width: MediaQuery.of(context).size.width - 70,
child: DropdownButton(
focusColor: Colors.red,
icon: Icon(FontAwesomeIcons.angleDown),
isExpanded: true,
hint: Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: Text(
curhospitalVal,
style: TextStyle(
fontWeight: FontWeight.w700,
color: Colors.black,
// color: _mainFontColor,
// fontSize: 5 * _deviceBlockSize,
),
),
),
isDense: true,
items: hospitalVals.map((String value) {
return new DropdownMenuItem<String>(
value: value,
child: Container(
child: Text(
value,
style: TextStyle(
// color: _mainFontColor,
fontSize: 4 * _deviceBlockSize,
),
),
),
);
}).toList(),
onChanged: (val) {
setState(() { setState(() {
curhospitalVal = val; _hidePass = !_hidePass;
}); });
}, },
), ),
), ),
], focusNode: _passwordFocusNode,
), onSaved: (value) {
SizedBox(height: 40), map['password'] = value;
Row( },
children: <Widget>[ ),
InkWell( SizedBox(
onTap: () => _register(), height: 10,
child: Container( ),
TextFormField(
validator: (value) {
if (value.isEmpty) {
return 'Full Name 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;
},
// keyboardType: TextInputType.phone,
// textInputAction: TextInputAction.next,
// onFieldSubmitted: (_) {
// FocusScope.of(context).requestFocus(_passwordFocusNode);
// },
// controller: cellNumberController,
decoration: InputDecoration(
isDense: true,
icon: Icon(
FontAwesomeIcons.sortNumericDown,
color: Colors.grey,
),
border: UnderlineInputBorder(),
fillColor: Colors.red,
labelText: 'Full Name',
contentPadding: EdgeInsets.symmetric(vertical: 5),
),
style: TextStyle(fontWeight: FontWeight.w700),
// onSaved: (value) {
// map['cellNumber'] = value;
// },
),
SizedBox(
height: 20,
),
Row(
// width: double.infinity,
children: <Widget>[
Icon(
FontAwesomeIcons.alignLeft,
color: Colors.grey,
size: 5 * _deviceBlockSize,
),
SizedBox(
width: 3 * _deviceBlockSize,
),
Expanded(
// width: MediaQuery.of(context).size.width - 70,
child: DropdownButton(
focusColor: Colors.red,
icon: Icon(FontAwesomeIcons.angleDown),
isExpanded: true,
hint: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 4),
child: Text(
curhospitalVal,
style: TextStyle(
fontWeight: FontWeight.w700,
color: Colors.black,
// color: _mainFontColor,
// fontSize: 5 * _deviceBlockSize,
),
),
),
isDense: true,
items: hospitalVals.map((String value) {
return new DropdownMenuItem<String>(
value: value,
child: Container(
child: Text(
value,
style: TextStyle(
// color: _mainFontColor,
fontSize: 4 * _deviceBlockSize,
),
),
),
);
}).toList(),
onChanged: (val) {
setState(() {
curhospitalVal = val;
});
},
),
),
],
),
SizedBox(height: 40),
Row(
children: <Widget>[
InkWell(
onTap: () => _register(),
child: Container(
width: 40 * _deviceBlockSize,
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 5,
),
// margin:
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue, Colors.green],
),
borderRadius: BorderRadius.circular(7),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Spacer(),
Icon(
Icons.add,
color: Colors.white,
),
Text(
'register',
style: TextStyle(color: Colors.white),
),
Spacer()
],
)
// TextButton.icon(
// padding: EdgeInsets.all(0),
// onPressed: () {
// _register();
// },
// icon: Icon(Icons.exit_to_app,
// color: Colors.white, size: 17),
// label: Text('register',
// style: TextStyle(color: Colors.white)),
// ),
),
),
Spacer(),
InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: Container(
width: 40 * _deviceBlockSize, width: 40 * _deviceBlockSize,
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize, horizontal: 5 * _deviceBlockSize,
vertical: 5, vertical: 5,
), ),
// margin:
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: LinearGradient( borderRadius: BorderRadius.circular(5),
colors: [Colors.blue, Colors.green], border: Border.all(
color: Colors.black,
), ),
borderRadius: BorderRadius.circular(7),
), ),
child: Row( child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
Spacer(), Spacer(),
Icon( Icon(
Icons.add, Icons.exit_to_app,
color: Colors.white, // size: 6 * _pixelRatio,
), ),
Text( Text(
'register', 'Login',
style: TextStyle(color: Colors.white), style: TextStyle(
// fontSize: 5.5,
),
), ),
Spacer() Spacer(),
], ],
)
// FlatButton.icon(
// padding: EdgeInsets.all(0),
// onPressed: () {
// _register();
// },
// icon: Icon(Icons.exit_to_app,
// color: Colors.white, size: 17),
// label: Text('register',
// style: TextStyle(color: Colors.white)),
// ),
), ),
),
Spacer(),
InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: Container(
width: 40 * _deviceBlockSize,
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 5,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
border: Border.all(
color: Colors.black,
),
),
child: Row(
children: <Widget>[
Spacer(),
Icon(
Icons.exit_to_app,
// size: 6 * _pixelRatio,
),
Text(
'Login',
style: TextStyle(
// fontSize: 5.5,
),
),
Spacer(),
],
), ),
), ),
), ],
], ),
), ],
),
],
), ),
), ),
); );
} }
} }
+197 -195
View File
@@ -1,17 +1,18 @@
import 'package:cssd/config/routes.dart'; import 'package:barcode_scan2/barcode_scan2.dart';
import 'package:cssd/providers/connectivity.dart';
import 'package:cssd/widgets/Global/internet_error.dart';
import 'package:cssd/widgets/TestResultScreens/Add/selector_box.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:barcode_scan/barcode_scan.dart';
import 'package:cssd/providers/test_results.dart';
// import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart'; // import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart';
import 'package:cssd/pages/test_form_page.dart'; import 'package:cssd/pages/test_form_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.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 '../config/routes.dart';
import '../providers/connectivity.dart';
import '../providers/test_results.dart';
import '../widgets/Global/internet_error.dart';
import '../widgets/TestResultScreens/Add/selector_box.dart';
class TestResultAddScreen extends StatefulWidget { class TestResultAddScreen extends StatefulWidget {
// static const route = '/TestResultAddScreen'; // static const route = '/TestResultAddScreen';
@override @override
@@ -59,206 +60,207 @@ class _TestResultAddScreenState extends State<TestResultAddScreen> {
); );
return true; return true;
}, },
child: Scaffold( child: SafeArea(
appBar: AppBar( child: Scaffold(
titleSpacing: -10, appBar: AppBar(
title: Text('Test Results'), titleSpacing: -10,
leading: IconButton( title: Text('Test Results'),
icon: Icon( leading: IconButton(
Icons.keyboard_arrow_left, icon: Icon(
size: 35, 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>[
margin: EdgeInsets.only(bottom: 50), Column(
child: FlatButton( crossAxisAlignment: CrossAxisAlignment.start,
padding: EdgeInsets.all(0), children: <Widget>[
color: Color(0xFFEB4A64), Container(
shape: RoundedRectangleBorder( width: 70 * _deviceBlockSize,
child: TestResultAddSelectorBox(
deviceBlockSize: _deviceBlockSize,
dataCTRL: testTypeCTRL,
dataVals: testTypeVals,
label: 'Choose a Test Type'),
),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Text(
'OR',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 7 * _deviceBlockSize,
),
),
SizedBox(
width: 8 * _deviceBlockSize,
),
Container(
width: 50 * _deviceBlockSize,
child: TextFormField(
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,
),
),
],
)
],
),
SizedBox(
width: 5 * _deviceBlockSize,
),
Expanded(
child: Container(
height: 100,
margin: EdgeInsets.only(bottom: 50),
decoration: BoxDecoration(
color: Color(0xFFEB4A64),
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
), ),
child: Text( child: TextButton(
'GO', child: Text(
textAlign: TextAlign.center, 'GO',
style: TextStyle( textAlign: TextAlign.center,
color: Colors.white, style: TextStyle(
fontSize: 6 * _deviceBlockSize, color: Colors.white,
fontWeight: FontWeight.w700), 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);
},
), ),
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();
: ConnectionErrorBox(); }),
}), ),
), ),
); );
} }
+29 -27
View File
@@ -1,7 +1,7 @@
import 'package:cssd/providers/connectivity.dart'; import '../providers/connectivity.dart';
import 'package:cssd/providers/test_results.dart'; import '../providers/test_results.dart';
import 'package:cssd/widgets/Global/internet_error.dart'; import '../widgets/Global/internet_error.dart';
import 'package:cssd/widgets/TestResultScreens/Details/datas_box.dart'; import '../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';
@@ -42,31 +42,33 @@ class _TestDetailsScreenState extends State<TestDetailsScreen> {
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
// print(datas); // print(datas);
return Scaffold( return SafeArea(
appBar: AppBar( child: Scaffold(
titleSpacing: -10, appBar: AppBar(
title: Text('Test Result Detail'), titleSpacing: -10,
leading: IconButton( title: Text('Test Result Detail'),
icon: Icon( leading: IconButton(
Icons.keyboard_arrow_left, icon: Icon(
size: 35, Icons.keyboard_arrow_left,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
onPressed: () => Navigator.of(context).pop(),
), ),
), 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(), )
) : DatasBox(
: DatasBox( datas: datas,
datas: datas, deviceBlockSize: _deviceBlockSize,
deviceBlockSize: _deviceBlockSize, )
) : ConnectionErrorBox();
: ConnectionErrorBox(); },
}, ),
), ),
); );
} }
+251 -248
View File
@@ -1,4 +1,4 @@
import 'package:barcode_scan/barcode_scan.dart'; import 'package:barcode_scan2/barcode_scan2.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@@ -131,264 +131,267 @@ class _TestFilterScreenState extends State<TestFilterScreen> {
); );
return true; return true;
}, },
child: Scaffold( child: SafeArea(
appBar: AppBar( child: Scaffold(
titleSpacing: -10, appBar: AppBar(
title: Text('Tests'), titleSpacing: -10,
leading: IconButton( title: Text('Tests'),
icon: Icon( leading: IconButton(
Icons.keyboard_arrow_left, icon: Icon(
size: 35, Icons.keyboard_arrow_left,
), size: 35,
onPressed: () => Navigator.of(context).popAndPushNamed( ),
Routes.testResultScreen, 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,
),
Row(
children: [
Flexible(
flex: 8,
child: 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),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.text,
textInputAction: TextInputAction.next,
// onFieldSubmitted: (_) {
// FocusScope.of(context)
// .requestFocus(_cycleNumberFocusNode);
// },
),
), ),
Flexible( ),
flex: 1, SizedBox(
child: InkWell( height: 20,
onTap: () { ),
scan().then( Row(
(String result) { children: [
if (result == 'cancel') { Flexible(
print('cancel'); flex: 8,
} else if (result == 'error') { child: TextFormField(
print('error'); controller: idCTRL,
} else if (result == 'access') { decoration: InputDecoration(
print('access'); icon: Icon(
} else { FontAwesomeIcons.sortNumericDown,
print(result); size: 6 * _deviceBlockSize,
idCTRL.text = result; ),
// Navigator.of(context).pushNamed( labelStyle: TextStyle(
// CycleDetailScreen.route, fontWeight: FontWeight.w100,
// arguments: result, fontSize: 4 * _deviceBlockSize,
// ); ),
} labelText: 'ID',
}, isDense: true,
); contentPadding: EdgeInsets.symmetric(
}, vertical: 2, horizontal: 3),
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
), ),
child: Icon( style: TextStyle(
FontAwesomeIcons.barcode, fontWeight: FontWeight.w700,
size: 5 * _deviceBlockSize, fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.text,
textInputAction: TextInputAction.next,
// onFieldSubmitted: (_) {
// FocusScope.of(context)
// .requestFocus(_cycleNumberFocusNode);
// },
),
),
Flexible(
flex: 1,
child: InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
idCTRL.text = result;
// Navigator.of(context).pushNamed(
// CycleDetailScreen.route,
// arguments: result,
// );
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
FontAwesomeIcons.barcode,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
),
],
),
SizedBox(
height: 25,
),
TestResultFilterSelectorBox(
deviceBlockSize: _deviceBlockSize,
dataCTRL: labelIdCTRL,
dataVals: labelIDVals,
label: 'Label ID',
),
SizedBox(
height: 25,
),
TextFormField(
controller: usernameCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Username',
isDense: true,
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: 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(
dateCTRL: fDateCTRL,
deviceBlockSize: _deviceBlockSize,
label: 'Date From',
),
SizedBox(
height: 25,
),
TestResultFilterDatePicker(
dateCTRL: uDateCTRL,
deviceBlockSize: _deviceBlockSize,
label: 'Date Until',
),
SizedBox(
height: 70,
),
InkWell(
onTap: () {
Provider.of<TestResultsProvider>(context)
.setFilters(
idCTRL.text,
labelIdCTRL.text != ''
? labelIdCTRL.text
: '',
usernameCTRL.text,
testTypeCTRL.text != ''
? testTypes[testTypeCTRL.text]
: '',
hospitalCTRL.text != ''
? hospitals[hospitalCTRL.text]
: '',
fDateCTRL.text,
uDateCTRL.text,
);
showDialog(
context: context,
builder: (ctx) => AlertDialog(
content: Text('Filters changed.'),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.of(ctx).pop();
// Navigator.of(context).pop();
},
child: Text('Ok'),
)
],
),
).then(
(_) =>
Navigator.of(context).popAndPushNamed(
Routes.testResultScreen,
),
);
},
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(
'FILTER',
style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 5 * _deviceBlockSize,
), ),
), ),
), ),
), ),
],
),
SizedBox(
height: 25,
),
TestResultFilterSelectorBox(
deviceBlockSize: _deviceBlockSize,
dataCTRL: labelIdCTRL,
dataVals: labelIDVals,
label: 'Label ID',
),
SizedBox(
height: 25,
),
TextFormField(
controller: usernameCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Username',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
), ),
style: TextStyle( SizedBox(
fontWeight: FontWeight.w700, height: 70,
fontSize: 5 * _deviceBlockSize,
), ),
keyboardType: TextInputType.visiblePassword, // DropDownBox(values: ['Washer ID']),
textInputAction: TextInputAction.next, ],
// onFieldSubmitted: (_) { ),
// FocusScope.of(context) )
// .requestFocus(_cycleNumberFocusNode); : ConnectionErrorBox();
// }, },
), ),
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(
dateCTRL: fDateCTRL,
deviceBlockSize: _deviceBlockSize,
label: 'Date From',
),
SizedBox(
height: 25,
),
TestResultFilterDatePicker(
dateCTRL: uDateCTRL,
deviceBlockSize: _deviceBlockSize,
label: 'Date Until',
),
SizedBox(
height: 70,
),
InkWell(
onTap: () {
Provider.of<TestResultsProvider>(context)
.setFilters(
idCTRL.text,
labelIdCTRL.text != ''
? labelIdCTRL.text
: '',
usernameCTRL.text,
testTypeCTRL.text != ''
? testTypes[testTypeCTRL.text]
: '',
hospitalCTRL.text != ''
? hospitals[hospitalCTRL.text]
: '',
fDateCTRL.text,
uDateCTRL.text,
);
showDialog(
context: context,
builder: (ctx) => AlertDialog(
content: Text('Filters changed.'),
actions: <Widget>[
FlatButton(
onPressed: () {
Navigator.of(ctx).pop();
// Navigator.of(context).pop();
},
child: Text('Ok'),
)
],
),
).then(
(_) => Navigator.of(context).popAndPushNamed(
Routes.testResultScreen,
),
);
},
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(
'FILTER',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
),
),
),
),
),
SizedBox(
height: 70,
),
// DropDownBox(values: ['Washer ID']),
],
),
)
: ConnectionErrorBox();
},
), ),
), ),
); );
+71 -67
View File
@@ -1,11 +1,12 @@
import 'package:cssd/config/routes.dart';
import 'package:cssd/providers/input.dart';
import 'package:cssd/providers/test_results.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'; import 'package:random_string/random_string.dart';
import '../config/routes.dart';
import '../providers/input.dart';
import '../providers/test_results.dart';
import '../widgets/TestResultScreens/Add/form_creator.dart';
class FormPage extends StatefulWidget { class FormPage extends StatefulWidget {
final String name; final String name;
final String uniqueCode; final String uniqueCode;
@@ -50,7 +51,7 @@ class _FormPageState extends State<FormPage> {
builder: (ctx) => AlertDialog( builder: (ctx) => AlertDialog(
content: Text('Test added.'), content: Text('Test added.'),
actions: <Widget>[ actions: <Widget>[
FlatButton( TextButton(
onPressed: () { onPressed: () {
Navigator.of(ctx).pop(); Navigator.of(ctx).pop();
}, },
@@ -97,73 +98,76 @@ class _FormPageState extends State<FormPage> {
); );
return true; return true;
}, },
child: Scaffold( child: SafeArea(
appBar: AppBar( child: Scaffold(
centerTitle: true, appBar: AppBar(
title: Text('Add Test Result'), centerTitle: true,
actions: <Widget>[ title: Text('Add Test Result'),
IconButton( actions: <Widget>[
icon: Icon(Icons.save), 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
return formInputs.length != 0 ? FormCreator(
? FormCreator( form: inputs.inputItems,
form: inputs.inputItems, onChanged: (value) {
onChanged: (value) { formInputs = value;
formInputs = value; },
}, )
) : Center(
: Center( child: Text('An error happen!!!'),
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, // ),
// ), // ),
// ), // ),
// ), ],
], )),
)), ),
); );
} }
+220 -217
View File
@@ -1,6 +1,3 @@
import 'package:cssd/config/routes.dart';
import 'package:cssd/models/test_result_models.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/internet_error.dart'; import 'package:cssd/widgets/Global/internet_error.dart';
@@ -11,6 +8,10 @@ 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';
import '../config/routes.dart';
import '../models/test_result_models.dart';
import '../providers/connectivity.dart';
class TestResultScreen extends StatefulWidget { class TestResultScreen extends StatefulWidget {
// static const route = '/TestResultScreen'; // static const route = '/TestResultScreen';
final bool isAdmin; final bool isAdmin;
@@ -69,225 +70,227 @@ class _TestResultScreenState extends State<TestResultScreen> {
// 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 SafeArea(
floatingActionButton: child: Scaffold(
TestResultFloatingButton(deviceBlockSize: _deviceBlockSize), floatingActionButton:
appBar: AppBar( TestResultFloatingButton(deviceBlockSize: _deviceBlockSize),
titleSpacing: -10, appBar: AppBar(
title: Text('Home'), titleSpacing: -10,
leading: IconButton( title: Text('Home'),
icon: Icon( leading: IconButton(
Icons.keyboard_arrow_left, icon: Icon(
size: 35, Icons.keyboard_arrow_left,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
onPressed: () => Navigator.of(context).pop(),
), ),
), body: Consumer<ConnectivityProvider>(
body: Consumer<ConnectivityProvider>( builder: (ct, connection, _) {
builder: (ct, connection, _) { return connection.conStatus != 'offline'
return connection.conStatus != 'offline' ? Padding(
? Padding( padding: EdgeInsets.only(
padding: top: 20, left: 20, right: 20, bottom: 60),
EdgeInsets.only(top: 20, left: 20, right: 20, bottom: 60), child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
children: <Widget>[ Row(
Row( // crossAxisAlignment: CrossAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[
children: <Widget>[ Container(
Container( // padding: EdgeInsets.only(top: 20, bottom: 40),
// padding: EdgeInsets.only(top: 20, bottom: 40), child: Text(
child: Text( 'MY TEST RESULTS',
'MY TEST RESULTS', // textAlign: TextAlign.left,
// textAlign: TextAlign.left, style: TextStyle(
style: TextStyle( color: Colors.black,
color: Colors.black, fontSize: 6 * _deviceBlockSize,
fontSize: 6 * _deviceBlockSize, fontWeight: FontWeight.w700,
fontWeight: FontWeight.w700, letterSpacing: 2,
letterSpacing: 2,
),
),
),
Spacer(),
InkWell(
onTap: () {
Navigator.of(context)
.popAndPushNamed(Routes.testFilterScreen);
},
child: Container(
padding: EdgeInsets.all(7),
child: Icon(
FontAwesomeIcons.filter,
size: 7 * _deviceBlockSize,
),
),
),
],
),
SizedBox(
height: 20,
),
Consumer<TestResultsProvider>(
builder: (context, testResult, _) {
return Container(
height: 50,
child: ListView(
scrollDirection: Axis.horizontal,
shrinkWrap: true,
children: <Widget>[
InkWell(
onTap: () {
Navigator.of(context).popAndPushNamed(
Routes.testFilterScreen);
},
child: Chip(
backgroundColor: Colors.black,
label: Text(
'Filters',
style: TextStyle(
color: Colors.white,
),
),
deleteIcon: Icon(
FontAwesomeIcons.filter,
color: Colors.white,
size: 4 * _deviceBlockSize,
),
onDeleted: () {
Navigator.of(context).popAndPushNamed(
Routes.testFilterScreen,
);
},
),
), ),
testResult.filters.id != '' ),
? TestResultChip(
deviceBlockSize: _deviceBlockSize,
label: 'ID',
id: '',
labelID: testResult.filters.labelID,
testType: testResult.filters.testType,
hospital: testResult.filters.hospital,
username: testResult.filters.userName,
fDate: testResult.filters.fDate,
uDate: testResult.filters.uDate,
)
: Container(),
testResult.filters.labelID != ''
? TestResultChip(
deviceBlockSize: _deviceBlockSize,
label: 'Label ID',
id: testResult.filters.id,
labelID: '',
testType: testResult.filters.testType,
hospital: testResult.filters.hospital,
username: testResult.filters.userName,
fDate: testResult.filters.fDate,
uDate: testResult.filters.uDate,
)
: Container(),
testResult.filters.testType != ''
? TestResultChip(
deviceBlockSize: _deviceBlockSize,
label: 'Test Type',
id: testResult.filters.id,
labelID: testResult.filters.labelID,
testType: '',
hospital: testResult.filters.hospital,
username: testResult.filters.userName,
fDate: testResult.filters.fDate,
uDate: testResult.filters.uDate,
)
: Container(),
testResult.filters.hospital != ''
? TestResultChip(
deviceBlockSize: _deviceBlockSize,
label: 'Hospital',
id: testResult.filters.id,
labelID: testResult.filters.labelID,
testType: testResult.filters.testType,
hospital: '',
username: testResult.filters.userName,
fDate: testResult.filters.fDate,
uDate: testResult.filters.uDate,
)
: Container(),
testResult.filters.userName != ''
? TestResultChip(
deviceBlockSize: _deviceBlockSize,
label: 'Username',
id: testResult.filters.id,
labelID: testResult.filters.labelID,
testType: testResult.filters.testType,
hospital: testResult.filters.hospital,
username: '',
fDate: testResult.filters.fDate,
uDate: testResult.filters.uDate,
)
: Container(),
testResult.filters.fDate != ''
? TestResultChip(
deviceBlockSize: _deviceBlockSize,
label: 'From Date',
id: testResult.filters.id,
labelID: testResult.filters.labelID,
testType: testResult.filters.testType,
hospital: testResult.filters.hospital,
username: testResult.filters.userName,
fDate: '',
uDate: testResult.filters.uDate,
)
: Container(),
testResult.filters.uDate != ''
? TestResultChip(
deviceBlockSize: _deviceBlockSize,
label: 'Until Date',
id: testResult.filters.id,
labelID: testResult.filters.labelID,
testType: testResult.filters.testType,
hospital: testResult.filters.hospital,
username: testResult.filters.userName,
fDate: testResult.filters.fDate,
uDate: '',
)
: Container(),
],
), ),
); Spacer(),
}, InkWell(
), onTap: () {
TestResultSearchBox( Navigator.of(context)
searchCTRL: searchCTRL, .popAndPushNamed(Routes.testFilterScreen);
deviceBlockSize: _deviceBlockSize, },
), child: Container(
SizedBox( padding: EdgeInsets.all(7),
height: 20, child: Icon(
), FontAwesomeIcons.filter,
Expanded( size: 7 * _deviceBlockSize,
child: Consumer<TestResultsProvider>( ),
builder: (context, testResults, _) { ),
return testResults.isloading ),
? Center( ],
child: CircularProgressIndicator(), ),
) SizedBox(
: ListView.builder( height: 20,
controller: sc, ),
itemBuilder: (context, index) => Consumer<TestResultsProvider>(
TestItemBox( builder: (context, testResult, _) {
deviceBlockSize: _deviceBlockSize, return Container(
item: testResults.items[index], height: 50,
child: ListView(
scrollDirection: Axis.horizontal,
shrinkWrap: true,
children: <Widget>[
InkWell(
onTap: () {
Navigator.of(context).popAndPushNamed(
Routes.testFilterScreen);
},
child: Chip(
backgroundColor: Colors.black,
label: Text(
'Filters',
style: TextStyle(
color: Colors.white,
),
),
deleteIcon: Icon(
FontAwesomeIcons.filter,
color: Colors.white,
size: 4 * _deviceBlockSize,
),
onDeleted: () {
Navigator.of(context).popAndPushNamed(
Routes.testFilterScreen,
);
},
), ),
itemCount: testResults.items.length, ),
shrinkWrap: true, testResult.filters.id != ''
); ? TestResultChip(
deviceBlockSize: _deviceBlockSize,
label: 'ID',
id: '',
labelID: testResult.filters.labelID,
testType: testResult.filters.testType,
hospital: testResult.filters.hospital,
username: testResult.filters.userName,
fDate: testResult.filters.fDate,
uDate: testResult.filters.uDate,
)
: Container(),
testResult.filters.labelID != ''
? TestResultChip(
deviceBlockSize: _deviceBlockSize,
label: 'Label ID',
id: testResult.filters.id,
labelID: '',
testType: testResult.filters.testType,
hospital: testResult.filters.hospital,
username: testResult.filters.userName,
fDate: testResult.filters.fDate,
uDate: testResult.filters.uDate,
)
: Container(),
testResult.filters.testType != ''
? TestResultChip(
deviceBlockSize: _deviceBlockSize,
label: 'Test Type',
id: testResult.filters.id,
labelID: testResult.filters.labelID,
testType: '',
hospital: testResult.filters.hospital,
username: testResult.filters.userName,
fDate: testResult.filters.fDate,
uDate: testResult.filters.uDate,
)
: Container(),
testResult.filters.hospital != ''
? TestResultChip(
deviceBlockSize: _deviceBlockSize,
label: 'Hospital',
id: testResult.filters.id,
labelID: testResult.filters.labelID,
testType: testResult.filters.testType,
hospital: '',
username: testResult.filters.userName,
fDate: testResult.filters.fDate,
uDate: testResult.filters.uDate,
)
: Container(),
testResult.filters.userName != ''
? TestResultChip(
deviceBlockSize: _deviceBlockSize,
label: 'Username',
id: testResult.filters.id,
labelID: testResult.filters.labelID,
testType: testResult.filters.testType,
hospital: testResult.filters.hospital,
username: '',
fDate: testResult.filters.fDate,
uDate: testResult.filters.uDate,
)
: Container(),
testResult.filters.fDate != ''
? TestResultChip(
deviceBlockSize: _deviceBlockSize,
label: 'From Date',
id: testResult.filters.id,
labelID: testResult.filters.labelID,
testType: testResult.filters.testType,
hospital: testResult.filters.hospital,
username: testResult.filters.userName,
fDate: '',
uDate: testResult.filters.uDate,
)
: Container(),
testResult.filters.uDate != ''
? TestResultChip(
deviceBlockSize: _deviceBlockSize,
label: 'Until Date',
id: testResult.filters.id,
labelID: testResult.filters.labelID,
testType: testResult.filters.testType,
hospital: testResult.filters.hospital,
username: testResult.filters.userName,
fDate: testResult.filters.fDate,
uDate: '',
)
: Container(),
],
),
);
}, },
), ),
), TestResultSearchBox(
], searchCTRL: searchCTRL,
), deviceBlockSize: _deviceBlockSize,
) ),
: ConnectionErrorBox(); SizedBox(
}, height: 20,
),
Expanded(
child: Consumer<TestResultsProvider>(
builder: (context, testResults, _) {
return testResults.isloading
? Center(
child: CircularProgressIndicator(),
)
: ListView.builder(
controller: sc,
itemBuilder: (context, index) =>
TestItemBox(
deviceBlockSize: _deviceBlockSize,
item: testResults.items[index],
),
itemCount: testResults.items.length,
shrinkWrap: true,
);
},
),
),
],
),
)
: ConnectionErrorBox();
},
),
), ),
); );
} }
@@ -376,7 +379,7 @@ class TestItemBox extends StatelessWidget {
// content: Text( // content: Text(
// 'Are you sure for delete this test?'), // 'Are you sure for delete this test?'),
// actions: <Widget>[ // actions: <Widget>[
// FlatButton( // TextButton(
// onPressed: () { // onPressed: () {
// Provider.of<TestResultsProvider>( // Provider.of<TestResultsProvider>(
// context) // context)
@@ -388,7 +391,7 @@ class TestItemBox extends StatelessWidget {
// }, // },
// child: Text('Yes'), // child: Text('Yes'),
// ), // ),
// FlatButton( // TextButton(
// onPressed: () { // onPressed: () {
// Navigator.of(ctx).pop(); // Navigator.of(ctx).pop();
// }, // },
+150 -147
View File
@@ -1,13 +1,13 @@
import 'package:cssd/providers/connectivity.dart'; import 'package:barcode_scan2/barcode_scan2.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: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'; import 'package:url_launcher/url_launcher.dart';
import '../providers/connectivity.dart';
import '../widgets/Global/internet_error.dart';
class TestScanScreen extends StatefulWidget { class TestScanScreen extends StatefulWidget {
// static const route = '/TestScanScreen'; // static const route = '/TestScanScreen';
@override @override
@@ -27,163 +27,166 @@ class _TestScanScreenState extends State<TestScanScreen> {
// 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 SafeArea(
appBar: AppBar( child: Scaffold(
centerTitle: true, appBar: AppBar(
titleSpacing: -10, centerTitle: true,
title: Text('CSSD'), titleSpacing: -10,
leading: IconButton( title: Text('CSSD'),
icon: Icon( leading: IconButton(
Icons.keyboard_arrow_left, icon: Icon(
size: 35, Icons.keyboard_arrow_left,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
onPressed: () => Navigator.of(context).pop(),
), ),
), body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) { return connection.conStatus != 'offline'
return connection.conStatus != 'offline' ? ListView(
? ListView( padding: EdgeInsets.symmetric(horizontal: 20),
padding: EdgeInsets.symmetric(horizontal: 20), children: <Widget>[
children: <Widget>[ Container(
Container( padding: EdgeInsets.only(top: 30),
padding: EdgeInsets.only(top: 30), child: Text(
child: Text( 'LOOKING FOR A Test Result?',
'LOOKING FOR A Test Result?', textAlign: TextAlign.left,
textAlign: TextAlign.left, style: TextStyle(
style: TextStyle( color: Colors.black,
color: Colors.black, fontSize: 5.5 * _deviceBlockSize,
fontSize: 5.5 * _deviceBlockSize, fontWeight: FontWeight.w700,
fontWeight: FontWeight.w700, letterSpacing: 3,
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: () { GestureDetector(
scan().then( child: Container(
(String result) { margin: EdgeInsets.symmetric(vertical: 10),
if (result == 'cancel') { height: 200,
print('cancel'); decoration: BoxDecoration(border: Border.all()),
} else if (result == 'error') { child: Center(
print('error'); child: Text(
} else if (result == 'access') { 'Please Scan The Test Result Barcode',
print('access'); style: TextStyle(
} else { color: Colors.black,
launch( fontSize: 5 * _deviceBlockSize,
'https://cssd-doc.com/Show/TestResult/$result', fontWeight: FontWeight.w100,
); letterSpacing: 3,
// Navigator.of(context).pushNamed( ),
// Routes.cycleDetailScreen, textAlign: TextAlign.center,
// arguments: result, ),
// ); ),
} ),
}, onTap: () {
); scan().then(
}, (String result) {
), if (result == 'cancel') {
Form( print('cancel');
key: _form, } else if (result == 'error') {
child: TextFormField( print('error');
validator: (val) { } else if (result == 'access') {
if (val.isEmpty) { print('access');
return 'Id required!!'; } else {
} launch(
return null; 'https://cssd-doc.com/Show/TestResult/$result',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: result,
// );
}
},
);
}, },
controller: idCTRL, ),
decoration: InputDecoration( Form(
icon: Icon( key: _form,
FontAwesomeIcons.sortNumericDown, child: TextFormField(
size: 6 * _deviceBlockSize, validator: (val) {
), if (val.isEmpty) {
labelStyle: TextStyle( return 'Id required!!';
fontWeight: FontWeight.w100, }
fontSize: 4 * _deviceBlockSize, return null;
), },
isDense: true, controller: idCTRL,
labelText: 'Or enter a Test Result ID', decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric( icon: Icon(
vertical: 2, FontAwesomeIcons.sortNumericDown,
horizontal: 3, size: 6 * _deviceBlockSize,
), ),
focusedBorder: UnderlineInputBorder( labelStyle: TextStyle(
// borderRadius: BorderRadius.only(Radius.circular(4)), fontWeight: FontWeight.w100,
borderSide: BorderSide( fontSize: 4 * _deviceBlockSize,
color: Colors.grey, ),
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(
style: TextStyle( fontWeight: FontWeight.w700,
fontWeight: FontWeight.w700, fontSize: 5 * _deviceBlockSize,
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), keyboardType: TextInputType.number,
), ),
child: Align( ),
alignment: Alignment.center, SizedBox(
child: Text( height: 40,
'GO!', ),
style: TextStyle( Divider(
color: Colors.white, color: Colors.black,
fontSize: 5 * _deviceBlockSize, 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();
: ConnectionErrorBox(); }),
}), ),
); );
} }
+233 -231
View File
@@ -1,11 +1,11 @@
import 'package:cssd/providers/test_results.dart';
import 'package:cssd/widgets/TestResultScreens/Main/search_box.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../config/routes.dart'; import '../config/routes.dart';
import '../models/test_result_models.dart'; import '../models/test_result_models.dart';
import '../providers/auth.dart'; import '../providers/auth.dart';
import '../providers/test_results.dart';
import '../widgets/TestResultScreens/Main/search_box.dart';
class TestVerifyScreen extends StatefulWidget { class TestVerifyScreen extends StatefulWidget {
// static const route = '/TestVerifyScreen'; // static const route = '/TestVerifyScreen';
@@ -70,236 +70,238 @@ class _TestVerifyScreenState extends State<TestVerifyScreen> {
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); // final double _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 SafeArea(
appBar: AppBar( child: Scaffold(
titleSpacing: -10, appBar: AppBar(
title: Text('Home'), titleSpacing: -10,
leading: IconButton( title: Text('Home'),
icon: Icon( leading: IconButton(
Icons.keyboard_arrow_left, icon: Icon(
size: 35, Icons.keyboard_arrow_left,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
onPressed: () => Navigator.of(context).pop(),
), ),
), body: Padding(
body: Padding( padding: EdgeInsets.only(top: 20, left: 20, right: 20, bottom: 60),
padding: EdgeInsets.only(top: 20, left: 20, right: 20, bottom: 60), child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
children: <Widget>[ Row(
Row( // crossAxisAlignment: CrossAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[
children: <Widget>[ Container(
Container( // padding: EdgeInsets.only(top: 20, bottom: 40),
// padding: EdgeInsets.only(top: 20, bottom: 40), child: Text(
child: Text( 'TESTS TO VERIFY',
'TESTS TO VERIFY', // textAlign: TextAlign.left,
// textAlign: TextAlign.left, style: TextStyle(
style: TextStyle( color: Colors.black,
color: Colors.black, fontSize: 6 * _deviceBlockSize,
fontSize: 6 * _deviceBlockSize, fontWeight: FontWeight.w700,
fontWeight: FontWeight.w700, letterSpacing: 2,
letterSpacing: 2, ),
), ),
), ),
), // 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(
height: 20,
),
// Consumer<TestResultsProvider>(
// builder: (context, testResult, _) {
// return Container(
// height: 50,
// child: ListView(
// scrollDirection: Axis.horizontal,
// shrinkWrap: true,
// children: <Widget>[
// InkWell(
// onTap: () {
// Navigator.of(context)
// .popAndPushNamed(Routes.testFilterScreen);
// },
// child: Chip(
// backgroundColor: Colors.black,
// label: Text(
// 'Filters',
// style: TextStyle(
// color: Colors.white,
// ),
// ),
// deleteIcon: Icon(
// FontAwesomeIcons.filter,
// color: Colors.white,
// size: 4 * _deviceBlockSize,
// ),
// onDeleted: () {
// Navigator.of(context)
// .popAndPushNamed(Routes.testFilterScreen);
// },
// ),
// ),
// testResult.filters.id != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'ID',
// id: '',
// labelID: testResult.filters.labelID,
// testType: testResult.filters.testType,
// hospital: testResult.filters.hospital,
// username: testResult.filters.userName,
// fDate: testResult.filters.fDate,
// uDate: testResult.filters.uDate,
// )
// : Container(),
// testResult.filters.labelID != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'Label ID',
// id: testResult.filters.id,
// labelID: '',
// testType: testResult.filters.testType,
// hospital: testResult.filters.hospital,
// username: testResult.filters.userName,
// fDate: testResult.filters.fDate,
// uDate: testResult.filters.uDate,
// )
// : Container(),
// testResult.filters.testType != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'Test Type',
// id: testResult.filters.id,
// labelID: testResult.filters.labelID,
// testType: '',
// hospital: testResult.filters.hospital,
// username: testResult.filters.userName,
// fDate: testResult.filters.fDate,
// uDate: testResult.filters.uDate,
// )
// : Container(),
// testResult.filters.hospital != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'Hospital',
// id: testResult.filters.id,
// labelID: testResult.filters.labelID,
// testType: testResult.filters.testType,
// hospital: '',
// username: testResult.filters.userName,
// fDate: testResult.filters.fDate,
// uDate: testResult.filters.uDate,
// )
// : Container(),
// testResult.filters.userName != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'Username',
// id: testResult.filters.id,
// labelID: testResult.filters.labelID,
// testType: testResult.filters.testType,
// hospital: testResult.filters.hospital,
// username: '',
// fDate: testResult.filters.fDate,
// uDate: testResult.filters.uDate,
// )
// : Container(),
// testResult.filters.fDate != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'From Date',
// id: testResult.filters.id,
// labelID: testResult.filters.labelID,
// testType: testResult.filters.testType,
// hospital: testResult.filters.hospital,
// username: testResult.filters.userName,
// fDate: '',
// uDate: testResult.filters.uDate,
// )
// : Container(),
// testResult.filters.uDate != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'Until Date',
// id: testResult.filters.id,
// labelID: testResult.filters.labelID,
// testType: testResult.filters.testType,
// hospital: testResult.filters.hospital,
// username: testResult.filters.userName,
// fDate: testResult.filters.fDate,
// uDate: '',
// )
// : Container(),
// ],
// ),
// );
// },
// ),
TestResultSearchBox(
searchCTRL: searchCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 20,
),
Expanded(
child: Consumer<TestResultsProvider>(
builder: (context, testResults, _) {
return testResults.isloading
? Center(
child: CircularProgressIndicator(),
)
: ListView.builder(
controller: sc,
itemBuilder: (context, index) =>
(testResults.items[index].verified == 'None' &&
userData['roles']
.contains('Supervisor')) ||
userData['roles'].contains('Admin')
? TestItemBox(
deviceBlockSize: _deviceBlockSize,
item: testResults.items[index],
id: testResults.items[index].id,
userData: userData,
)
: Container(),
// Column(
// children: <Widget>[
// Text(testResults.items[index].name),
// Text(testResults.items[index].isVerified.toString()),
// Text(testResults.items[index].hospital),
// Text(testResults.items[index].date),
// ],
// ),
// ChangeNotifierProvider.value(
// value: testResults.items[index],
// child: ResultCard(
// isAdmin: widget.isAdmin,
// ),
// ),
itemCount: testResults.items.length,
shrinkWrap: true,
);
},
), ),
), SizedBox(
], height: 20,
),
// Consumer<TestResultsProvider>(
// builder: (context, testResult, _) {
// return Container(
// height: 50,
// child: ListView(
// scrollDirection: Axis.horizontal,
// shrinkWrap: true,
// children: <Widget>[
// InkWell(
// onTap: () {
// Navigator.of(context)
// .popAndPushNamed(Routes.testFilterScreen);
// },
// child: Chip(
// backgroundColor: Colors.black,
// label: Text(
// 'Filters',
// style: TextStyle(
// color: Colors.white,
// ),
// ),
// deleteIcon: Icon(
// FontAwesomeIcons.filter,
// color: Colors.white,
// size: 4 * _deviceBlockSize,
// ),
// onDeleted: () {
// Navigator.of(context)
// .popAndPushNamed(Routes.testFilterScreen);
// },
// ),
// ),
// testResult.filters.id != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'ID',
// id: '',
// labelID: testResult.filters.labelID,
// testType: testResult.filters.testType,
// hospital: testResult.filters.hospital,
// username: testResult.filters.userName,
// fDate: testResult.filters.fDate,
// uDate: testResult.filters.uDate,
// )
// : Container(),
// testResult.filters.labelID != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'Label ID',
// id: testResult.filters.id,
// labelID: '',
// testType: testResult.filters.testType,
// hospital: testResult.filters.hospital,
// username: testResult.filters.userName,
// fDate: testResult.filters.fDate,
// uDate: testResult.filters.uDate,
// )
// : Container(),
// testResult.filters.testType != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'Test Type',
// id: testResult.filters.id,
// labelID: testResult.filters.labelID,
// testType: '',
// hospital: testResult.filters.hospital,
// username: testResult.filters.userName,
// fDate: testResult.filters.fDate,
// uDate: testResult.filters.uDate,
// )
// : Container(),
// testResult.filters.hospital != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'Hospital',
// id: testResult.filters.id,
// labelID: testResult.filters.labelID,
// testType: testResult.filters.testType,
// hospital: '',
// username: testResult.filters.userName,
// fDate: testResult.filters.fDate,
// uDate: testResult.filters.uDate,
// )
// : Container(),
// testResult.filters.userName != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'Username',
// id: testResult.filters.id,
// labelID: testResult.filters.labelID,
// testType: testResult.filters.testType,
// hospital: testResult.filters.hospital,
// username: '',
// fDate: testResult.filters.fDate,
// uDate: testResult.filters.uDate,
// )
// : Container(),
// testResult.filters.fDate != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'From Date',
// id: testResult.filters.id,
// labelID: testResult.filters.labelID,
// testType: testResult.filters.testType,
// hospital: testResult.filters.hospital,
// username: testResult.filters.userName,
// fDate: '',
// uDate: testResult.filters.uDate,
// )
// : Container(),
// testResult.filters.uDate != ''
// ? TestResultChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'Until Date',
// id: testResult.filters.id,
// labelID: testResult.filters.labelID,
// testType: testResult.filters.testType,
// hospital: testResult.filters.hospital,
// username: testResult.filters.userName,
// fDate: testResult.filters.fDate,
// uDate: '',
// )
// : Container(),
// ],
// ),
// );
// },
// ),
TestResultSearchBox(
searchCTRL: searchCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 20,
),
Expanded(
child: Consumer<TestResultsProvider>(
builder: (context, testResults, _) {
return testResults.isloading
? Center(
child: CircularProgressIndicator(),
)
: ListView.builder(
controller: sc,
itemBuilder: (context, index) =>
(testResults.items[index].verified == 'None' &&
userData['roles']
.contains('Supervisor')) ||
userData['roles'].contains('Admin')
? TestItemBox(
deviceBlockSize: _deviceBlockSize,
item: testResults.items[index],
id: testResults.items[index].id,
userData: userData,
)
: Container(),
// Column(
// children: <Widget>[
// Text(testResults.items[index].name),
// Text(testResults.items[index].isVerified.toString()),
// Text(testResults.items[index].hospital),
// Text(testResults.items[index].date),
// ],
// ),
// ChangeNotifierProvider.value(
// value: testResults.items[index],
// child: ResultCard(
// isAdmin: widget.isAdmin,
// ),
// ),
itemCount: testResults.items.length,
shrinkWrap: true,
);
},
),
),
],
),
), ),
), ),
); );
@@ -401,7 +403,7 @@ class TestItemBox extends StatelessWidget {
content: Text( content: Text(
'Are you sure for verify this test?'), 'Are you sure for verify this test?'),
actions: <Widget>[ actions: <Widget>[
FlatButton( TextButton(
onPressed: () async { onPressed: () async {
Provider.of<TestResultsProvider>( Provider.of<TestResultsProvider>(
context) context)
@@ -418,7 +420,7 @@ class TestItemBox extends StatelessWidget {
}, },
child: Text('Yes'), child: Text('Yes'),
), ),
FlatButton( TextButton(
onPressed: () { onPressed: () {
Navigator.of(ctx).pop(); Navigator.of(ctx).pop();
}, },
@@ -454,7 +456,7 @@ class TestItemBox extends StatelessWidget {
content: Text( content: Text(
'Are you sure for reject this test?'), 'Are you sure for reject this test?'),
actions: <Widget>[ actions: <Widget>[
FlatButton( TextButton(
onPressed: () async { onPressed: () async {
await Provider.of<TestResultsProvider>( await Provider.of<TestResultsProvider>(
context) context)
@@ -471,7 +473,7 @@ class TestItemBox extends StatelessWidget {
}, },
child: Text('Yes'), child: Text('Yes'),
), ),
FlatButton( TextButton(
onPressed: () { onPressed: () {
Navigator.of(ctx).pop(); Navigator.of(ctx).pop();
}, },
+108 -105
View File
@@ -1,11 +1,12 @@
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: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';
import '../config/routes.dart';
import '../providers/auth.dart';
import '../providers/connectivity.dart';
import '../widgets/Global/internet_error.dart';
class VerifyPassScreen extends StatefulWidget { class VerifyPassScreen extends StatefulWidget {
// static const route = '/HomeScreen'; // static const route = '/HomeScreen';
@@ -38,7 +39,7 @@ class _VerifyPassScreenState extends State<VerifyPassScreen> {
title: Text('Error'), title: Text('Error'),
content: Text(message), content: Text(message),
actions: <Widget>[ actions: <Widget>[
FlatButton( TextButton(
child: Text('Ok'), child: Text('Ok'),
onPressed: () { onPressed: () {
Navigator.of(ctx).pop(); Navigator.of(ctx).pop();
@@ -85,108 +86,110 @@ class _VerifyPassScreenState extends State<VerifyPassScreen> {
// 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 SafeArea(
appBar: AppBar( child: Scaffold(
centerTitle: true, appBar: AppBar(
title: Text('CSSD'), centerTitle: true,
), title: Text('CSSD'),
body: Selector<ConnectivityProvider, String>( ),
builder: (ctx, value, _) => value != 'offline' body: Selector<ConnectivityProvider, String>(
? _isLoading builder: (ctx, value, _) => value != 'offline'
? Center( ? _isLoading
child: CircularProgressIndicator(), ? Center(
) child: CircularProgressIndicator(),
: Form( )
key: _form, : Form(
child: ListView( key: _form,
padding: EdgeInsets.symmetric(horizontal: 20), child: ListView(
children: <Widget>[ padding: EdgeInsets.symmetric(horizontal: 20),
Container( children: <Widget>[
padding: EdgeInsets.symmetric(vertical: 20), Container(
child: Text( padding: EdgeInsets.symmetric(vertical: 20),
'Send Verification Code', child: Text(
textAlign: TextAlign.left, 'Send Verification Code',
style: TextStyle( textAlign: TextAlign.left,
color: Colors.black, style: TextStyle(
fontSize: 5 * _deviceBlockSize, color: Colors.black,
letterSpacing: 3, fontSize: 5 * _deviceBlockSize,
fontWeight: FontWeight.w700, 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(), ),
], TextFormField(
), validator: (value) {
SizedBox(height: 10), if (value.isEmpty) {
], return 'Code is required.';
), }
) if (value.length != 6) {
: ConnectionErrorBox(), return 'Code most be 6 characters';
selector: (_, connectivity) => connectivity.conStatus, }
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,
),
), ),
); );
} }
+9 -8
View File
@@ -1,12 +1,13 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:cssd/config/user.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cssd/config/urls.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import '../config/urls.dart';
import '../config/user.dart';
class Auth with ChangeNotifier { class Auth with ChangeNotifier {
String _token; String _token;
DateTime _expiaryDate; DateTime _expiaryDate;
@@ -32,7 +33,7 @@ class Auth with ChangeNotifier {
Future<String> requestCode(String cellNumber) async { Future<String> requestCode(String cellNumber) async {
final response = await http.post( final response = await http.post(
Url.requestResetPass, Uri.parse(Url.requestResetPass),
body: { body: {
'cell_number': cellNumber, 'cell_number': cellNumber,
}, },
@@ -49,7 +50,7 @@ class Auth with ChangeNotifier {
Future<String> sendCode(String code) async { Future<String> sendCode(String code) async {
final response = await http.post( final response = await http.post(
Url.verifyResetPass, Uri.parse(Url.verifyResetPass),
body: { body: {
'code': code, 'code': code,
}, },
@@ -74,7 +75,7 @@ class Auth with ChangeNotifier {
print(token); print(token);
final response = await http.post( final response = await http.post(
Url.sendResetPass, Uri.parse(Url.sendResetPass),
body: { body: {
'password': password, 'password': password,
'password_confirmation': password, 'password_confirmation': password,
@@ -98,7 +99,7 @@ class Auth with ChangeNotifier {
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, Uri.parse(Url.login),
body: { body: {
'cell_number': cellNumber, 'cell_number': cellNumber,
'password': password, 'password': password,
@@ -160,7 +161,7 @@ class Auth with ChangeNotifier {
Future<Map<String, dynamic>> getUserData() async { Future<Map<String, dynamic>> getUserData() async {
final response = await http.get( final response = await http.get(
Url.getUserInfo, Uri.parse(Url.getUserInfo),
headers: {'Authorization': 'Bearer ' + token}, headers: {'Authorization': 'Bearer ' + token},
); );
// print(response.body); // print(response.body);
@@ -188,7 +189,7 @@ class Auth with ChangeNotifier {
Future<void> setUserData(id, name, email) async { Future<void> setUserData(id, name, email) async {
var response = await http.post( var response = await http.post(
'https://cssd-doc.com/api/UpdateInfo', Uri.parse('https://cssd-doc.com/api/UpdateInfo'),
headers: { headers: {
'Authorization': 'Bearer ' + token, 'Authorization': 'Bearer ' + token,
HttpHeaders.contentTypeHeader: 'application/json', HttpHeaders.contentTypeHeader: 'application/json',
+8 -8
View File
@@ -1,8 +1,8 @@
import 'dart:convert'; import 'dart:convert';
import 'package:cssd/config/urls.dart'; import '../config/urls.dart';
import 'package:cssd/config/user.dart'; import '../config/user.dart';
import 'package:cssd/models/cycles_models.dart'; import '../models/cycles_models.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;
@@ -61,7 +61,7 @@ class CyclesProvider extends ChangeNotifier {
Future<List<Map<String, String>>> getHospitalsFilters() async { Future<List<Map<String, String>>> getHospitalsFilters() async {
var response = await http.get( var response = await http.get(
Url.filterItems, Uri.parse(Url.filterItems),
headers: { headers: {
'Authorization': User.token, 'Authorization': User.token,
}, },
@@ -80,7 +80,7 @@ class CyclesProvider extends ChangeNotifier {
Future<List<String>> getLabelFilters() async { Future<List<String>> getLabelFilters() async {
var response = await http.get( var response = await http.get(
Url.labelItems, Uri.parse(Url.labelItems),
headers: { headers: {
'Authorization': User.token, 'Authorization': User.token,
}, },
@@ -107,7 +107,7 @@ class CyclesProvider extends ChangeNotifier {
labs.add({'name': '', 'id': label}); labs.add({'name': '', 'id': label});
} }
// print(labs); // print(labs);
var response = await http.post(Url.createCycleResult, var response = await http.post(Uri.parse(Url.createCycleResult),
body: json.encode( body: json.encode(
{ {
'note': note, 'note': note,
@@ -181,7 +181,7 @@ class CyclesProvider extends ChangeNotifier {
} }
// print(url); // print(url);
var response = await http.get( var response = await http.get(
url, Uri.parse(url),
headers: { headers: {
'Authorization': User.token, 'Authorization': User.token,
}, },
@@ -214,7 +214,7 @@ class CyclesProvider extends ChangeNotifier {
} }
Future<CycleDetailObject> showCycleResult(String id) async { Future<CycleDetailObject> showCycleResult(String id) async {
var response = await http.get(Url.getCycleResult(id), headers: { var response = await http.get(Uri.parse(Url.getCycleResult(id)), headers: {
'Authorization': User.token, 'Authorization': User.token,
}); });
if (response.statusCode != 200) { if (response.statusCode != 200) {
+5 -4
View File
@@ -2,8 +2,9 @@ import 'dart:convert';
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:cssd/config/urls.dart';
import 'package:cssd/config/user.dart'; import '../config/urls.dart';
import '../config/user.dart';
class Inputs with ChangeNotifier { class Inputs with ChangeNotifier {
List<Map<String, dynamic>> inputItems = []; List<Map<String, dynamic>> inputItems = [];
@@ -22,7 +23,7 @@ class Inputs with ChangeNotifier {
// }, // },
// ); // );
var response = await http.post( var response = await http.post(
Url.getInputs, Uri.parse(Url.getInputs),
body: { body: {
'test_type_id': testTypeId, 'test_type_id': testTypeId,
'test_result_id': testResultId, 'test_result_id': testResultId,
@@ -47,7 +48,7 @@ class Inputs with ChangeNotifier {
// } // }
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(Uri.parse(Url.testResultFormValues(testResultId)),
headers: {'Authorization': User.token}); headers: {'Authorization': User.token});
values = json.decode(response.body)['data']; values = json.decode(response.body)['data'];
} }
+9 -9
View File
@@ -1,8 +1,8 @@
import 'dart:convert'; import 'dart:convert';
import 'package:cssd/config/urls.dart'; import '../config/urls.dart';
import 'package:cssd/config/user.dart'; import '../config/user.dart';
import 'package:cssd/models/label_models.dart'; import '../models/label_models.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;
@@ -34,7 +34,7 @@ class LabelsProvider extends ChangeNotifier {
Future<List<Map<String, String>>> getHospitalsFilters() async { Future<List<Map<String, String>>> getHospitalsFilters() async {
var response = await http.get( var response = await http.get(
Url.filterItems, Uri.parse(Url.filterItems),
headers: { headers: {
'Authorization': User.token, 'Authorization': User.token,
}, },
@@ -53,7 +53,7 @@ class LabelsProvider extends ChangeNotifier {
Future<List<Map<String, String>>> getPackageFilters() async { Future<List<Map<String, String>>> getPackageFilters() async {
var response = await http.get( var response = await http.get(
Url.packageItems, Uri.parse(Url.packageItems),
headers: { headers: {
'Authorization': User.token, 'Authorization': User.token,
}, },
@@ -77,7 +77,7 @@ class LabelsProvider extends ChangeNotifier {
Future<void> createLabelResult(lotNumber, cycleNumber, sterileDate, package, Future<void> createLabelResult(lotNumber, cycleNumber, sterileDate, package,
expireDate, sterilizerId) async { expireDate, sterilizerId) async {
// print(labs); // print(labs);
var response = await http.post(Url.createLabelResult, var response = await http.post(Uri.parse(Url.createLabelResult),
body: json.encode( body: json.encode(
{ {
'sterile_date': sterileDate, 'sterile_date': sterileDate,
@@ -112,7 +112,7 @@ class LabelsProvider extends ChangeNotifier {
sterilizerId, sterilizerId,
) async { ) async {
// print(labs); // print(labs);
var response = await http.put(Url.updateLabelResult(id), var response = await http.put(Uri.parse(Url.updateLabelResult(id)),
body: json.encode( body: json.encode(
{ {
'sterile_date': sterileDate, 'sterile_date': sterileDate,
@@ -187,7 +187,7 @@ class LabelsProvider extends ChangeNotifier {
} }
var response = await http.get( var response = await http.get(
url, Uri.parse(url),
headers: { headers: {
'Authorization': User.token, 'Authorization': User.token,
}, },
@@ -216,7 +216,7 @@ class LabelsProvider extends ChangeNotifier {
Future<LabelDetailsObject> showLabelResult(String id) async { Future<LabelDetailsObject> showLabelResult(String id) async {
var response = await http.get( var response = await http.get(
Url.getLabelResult(id), Uri.parse(Url.getLabelResult(id)),
headers: { headers: {
'Authorization': User.token, 'Authorization': User.token,
}, },
+2 -2
View File
@@ -1,6 +1,6 @@
import 'dart:convert'; import 'dart:convert';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:cssd/config/urls.dart'; import '../config/urls.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
@@ -28,7 +28,7 @@ class MyInfoProvider extends ChangeNotifier {
final auth = json.decode(prefs.getString('auth')) as Map<String, Object>; final auth = json.decode(prefs.getString('auth')) as Map<String, Object>;
_token = auth['token']; _token = auth['token'];
final response = await http.get( final response = await http.get(
Url.getUserInfo, Uri.parse(Url.getUserInfo),
headers: { headers: {
'Authorization': 'Bearer ' + _token, 'Authorization': 'Bearer ' + _token,
}, },
+3 -3
View File
@@ -1,5 +1,5 @@
import 'package:cssd/config/urls.dart'; import '../config/urls.dart';
import 'package:cssd/config/user.dart'; import '../config/user.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;
@@ -24,7 +24,7 @@ class TestResult with ChangeNotifier{
Future<void> toggleVerify() async { Future<void> toggleVerify() async {
final response = await http.post( final response = await http.post(
Url.verifyTest(id), headers: { Uri.parse(Url.verifyTest(id)), headers: {
'Authorization': User.token 'Authorization': User.token
} }
); );
+11 -11
View File
@@ -1,5 +1,4 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io';
import 'dart:typed_data'; import 'dart:typed_data';
// import 'dart:typed_data'; // import 'dart:typed_data';
import 'package:dio/dio.dart' as di; import 'package:dio/dio.dart' as di;
@@ -7,6 +6,7 @@ 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';
import 'package:cssd/models/test_result_models.dart'; import 'package:cssd/models/test_result_models.dart';
import 'package:file_picker/file_picker.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;
@@ -14,13 +14,13 @@ import 'package:random_string/random_string.dart';
// import 'package:multi_image_picker/multi_image_picker.dart'; // import 'package:multi_image_picker/multi_image_picker.dart';
class TestResultsProvider with ChangeNotifier { class TestResultsProvider with ChangeNotifier {
List<File> catchImages = []; List<PlatformFile> catchImages = [];
List<Uint8List> images = []; List<Uint8List> images = [];
setImages() async { setImages() async {
images = []; images = [];
for (var image in catchImages) { for (var image in catchImages) {
var result = image.readAsBytesSync(); var result = image.bytes;
// final batchId = randomString(10); // final batchId = randomString(10);
// addImage(batchId, result, image.path); // addImage(batchId, result, image.path);
images.add(result.buffer images.add(result.buffer
@@ -29,7 +29,7 @@ class TestResultsProvider with ChangeNotifier {
notifyListeners(); notifyListeners();
} }
setCatchImages(List<File> images) { setCatchImages(List<PlatformFile> images) {
catchImages = images; catchImages = images;
notifyListeners(); notifyListeners();
} }
@@ -136,7 +136,7 @@ class TestResultsProvider with ChangeNotifier {
Future<List<Map<String, String>>> getFilterItems() async { Future<List<Map<String, String>>> getFilterItems() async {
var response = await http.get( var response = await http.get(
Url.filterItems, Uri.parse(Url.filterItems),
headers: { headers: {
'Authorization': User.token, 'Authorization': User.token,
}, },
@@ -187,7 +187,7 @@ class TestResultsProvider with ChangeNotifier {
} }
//'device_id=3526&testType_id=107&medicalCenter_id=2&user_name=erfan&fromPicker=2020-05-12&upToPicker=2020-05-19&device_label=Instrument%20ID&page=1' //'device_id=3526&testType_id=107&medicalCenter_id=2&user_name=erfan&fromPicker=2020-05-12&upToPicker=2020-05-19&device_label=Instrument%20ID&page=1'
var response = await http.get( var response = await http.get(
url, Uri.parse(url),
headers: { headers: {
'Authorization': User.token, 'Authorization': User.token,
// 'X-Requested-With': 'XMLHttpRequest', // 'X-Requested-With': 'XMLHttpRequest',
@@ -221,7 +221,7 @@ class TestResultsProvider with ChangeNotifier {
static Future<void> updateTestResult(String id, values) async { static Future<void> updateTestResult(String id, values) async {
var response = await http.post( var response = await http.post(
Url.updateTestResult(id), Uri.parse(Url.updateTestResult(id)),
body: json.encode(values), body: json.encode(values),
headers: { headers: {
'Authorization': User.token, 'Authorization': User.token,
@@ -262,7 +262,7 @@ class TestResultsProvider with ChangeNotifier {
final batchId = randomString(10); final batchId = randomString(10);
for (var image in catchImages) { for (var image in catchImages) {
await addImage(batchId, image.readAsBytesSync(), image.path); await addImage(batchId, image.bytes, image.path);
} }
dynamic vals = values; dynamic vals = values;
vals['file_batch_id'] = batchId; vals['file_batch_id'] = batchId;
@@ -305,7 +305,7 @@ class TestResultsProvider with ChangeNotifier {
} }
Future<Map<String, dynamic>> showTestResult(String id) async { Future<Map<String, dynamic>> showTestResult(String id) async {
var response = await http.get(Url.getTestResult(id), headers: { var response = await http.get(Uri.parse(Url.getTestResult(id)), headers: {
'Authorization': User.token, 'Authorization': User.token,
}); });
@@ -333,7 +333,7 @@ class TestResultsProvider with ChangeNotifier {
} }
Future<bool> removeTestResult(String id) async { Future<bool> removeTestResult(String id) async {
var response = await http.post(Url.removeTestResult(id), body: { var response = await http.post(Uri.parse(Url.removeTestResult(id)), body: {
'_method': 'delete' '_method': 'delete'
}, headers: { }, headers: {
'Authorization': User.token, 'Authorization': User.token,
@@ -353,7 +353,7 @@ class TestResultsProvider with ChangeNotifier {
print(id); print(id);
print(value); print(value);
var response = await http.post( var response = await http.post(
Url.testResultVerification(id, value), Uri.parse(Url.testResultVerification(id, value)),
headers: { headers: {
'Authorization': User.token, 'Authorization': User.token,
'X-Requested-With': 'XMLHttpRequest', 'X-Requested-With': 'XMLHttpRequest',
@@ -1,9 +1,10 @@
import 'package:barcode_scan/barcode_scan.dart'; import 'package:barcode_scan2/barcode_scan2.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';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:cssd/providers/cycles.dart';
import '../../../providers/cycles.dart';
class CycleAddLabelBox extends StatelessWidget { class CycleAddLabelBox extends StatelessWidget {
const CycleAddLabelBox({ const CycleAddLabelBox({
@@ -1,7 +1,8 @@
import 'package:cssd/config/routes.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:cssd/providers/cycles.dart';
import '../../../config/routes.dart';
import '../../../providers/cycles.dart';
class CycleAddSaveButton extends StatelessWidget { class CycleAddSaveButton extends StatelessWidget {
const CycleAddSaveButton({ const CycleAddSaveButton({
@@ -49,7 +50,7 @@ class CycleAddSaveButton extends StatelessWidget {
builder: (ctx) => AlertDialog( builder: (ctx) => AlertDialog(
content: Text('Cycle added.'), content: Text('Cycle added.'),
actions: <Widget>[ actions: <Widget>[
FlatButton( TextButton(
onPressed: () { onPressed: () {
Navigator.of(ctx).pop(); Navigator.of(ctx).pop();
}, },
@@ -1,7 +1,8 @@
import 'package:cssd/config/routes.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:cssd/providers/cycles.dart';
import '../../../config/routes.dart';
import '../../../providers/cycles.dart';
class CycleFilterSaveButton extends StatelessWidget { class CycleFilterSaveButton extends StatelessWidget {
const CycleFilterSaveButton({ const CycleFilterSaveButton({
@@ -48,7 +49,7 @@ class CycleFilterSaveButton extends StatelessWidget {
builder: (ctx) => AlertDialog( builder: (ctx) => AlertDialog(
content: Text('Filters changed.'), content: Text('Filters changed.'),
actions: <Widget>[ actions: <Widget>[
FlatButton( TextButton(
onPressed: () { onPressed: () {
Navigator.of(ctx).pop(); Navigator.of(ctx).pop();
}, },
+2 -1
View File
@@ -1,7 +1,8 @@
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'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import '../../../config/routes.dart';
class CycleResultBanner extends StatelessWidget { class CycleResultBanner extends StatelessWidget {
const CycleResultBanner({ const CycleResultBanner({
Key key, Key key,
@@ -1,9 +1,10 @@
import 'package:cssd/config/routes.dart';
import 'package:cssd/models/cycles_models.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:intl/intl.dart';
import '../../../config/routes.dart';
import '../../../models/cycles_models.dart';
class CycleItemBox extends StatelessWidget { class CycleItemBox extends StatelessWidget {
final CycleResultObject item; final CycleResultObject item;
final String labels; final String labels;
@@ -1,8 +1,9 @@
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'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:cssd/providers/cycles.dart';
import '../../../config/routes.dart';
import '../../../providers/cycles.dart';
class CycleFilterBaner extends StatelessWidget { class CycleFilterBaner extends StatelessWidget {
const CycleFilterBaner({ const CycleFilterBaner({
@@ -1,7 +1,8 @@
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';
import 'package:cssd/providers/cycles.dart';
import '../../../providers/cycles.dart';
class CycleResultSearchBox extends StatelessWidget { class CycleResultSearchBox extends StatelessWidget {
const CycleResultSearchBox({ const CycleResultSearchBox({
Key key, Key key,
+2 -1
View File
@@ -1,8 +1,9 @@
import 'package:cssd/config/routes.dart';
// import 'package:cssd/pages/test_result_screen.dart'; // import 'package:cssd/pages/test_result_screen.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 '../../config/routes.dart';
class AppDrawer extends StatelessWidget { class AppDrawer extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -1,7 +1,8 @@
import 'package:cssd/config/routes.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:cssd/providers/labels.dart';
import '../../../config/routes.dart';
import '../../../providers/labels.dart';
class LabelAddSaveButton extends StatelessWidget { class LabelAddSaveButton extends StatelessWidget {
const LabelAddSaveButton({ const LabelAddSaveButton({
@@ -49,7 +50,7 @@ class LabelAddSaveButton extends StatelessWidget {
builder: (ctx) => AlertDialog( builder: (ctx) => AlertDialog(
content: Text('Label added.'), content: Text('Label added.'),
actions: <Widget>[ actions: <Widget>[
FlatButton( TextButton(
onPressed: () { onPressed: () {
Navigator.of(ctx).pop(); Navigator.of(ctx).pop();
}, },
@@ -1,7 +1,7 @@
import 'package:cssd/config/routes.dart'; import '../../../config/routes.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:cssd/providers/labels.dart'; import '../../../providers/labels.dart';
class LabelUpdateButton extends StatelessWidget { class LabelUpdateButton extends StatelessWidget {
const LabelUpdateButton({ const LabelUpdateButton({
@@ -52,7 +52,7 @@ class LabelUpdateButton extends StatelessWidget {
builder: (ctx) => AlertDialog( builder: (ctx) => AlertDialog(
content: Text('Label updated.'), content: Text('Label updated.'),
actions: <Widget>[ actions: <Widget>[
FlatButton( TextButton(
onPressed: () { onPressed: () {
Navigator.of(ctx).pop(); Navigator.of(ctx).pop();
}, },
@@ -1,7 +1,8 @@
import 'package:cssd/config/routes.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:cssd/providers/labels.dart';
import '../../../config/routes.dart';
import '../../../providers/labels.dart';
class LabelFilterSaveButton extends StatelessWidget { class LabelFilterSaveButton extends StatelessWidget {
const LabelFilterSaveButton({ const LabelFilterSaveButton({
@@ -45,7 +46,7 @@ class LabelFilterSaveButton extends StatelessWidget {
builder: (ctx) => AlertDialog( builder: (ctx) => AlertDialog(
content: Text('Filters changed.'), content: Text('Filters changed.'),
actions: <Widget>[ actions: <Widget>[
FlatButton( TextButton(
onPressed: () { onPressed: () {
Navigator.of(ctx).pop(); Navigator.of(ctx).pop();
}, },
@@ -1,8 +1,9 @@
import 'package:cssd/config/routes.dart';
import 'package:cssd/models/label_models.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 '../../../config/routes.dart';
import '../../../models/label_models.dart';
class LabelItemBox extends StatelessWidget { class LabelItemBox extends StatelessWidget {
final LabelResultObject item; final LabelResultObject item;
const LabelItemBox({ const LabelItemBox({
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../../providers/labels.dart'; import '../../../providers/labels.dart';
class LabelFilterChip extends StatelessWidget { class LabelFilterChip extends StatelessWidget {
const LabelFilterChip({ const LabelFilterChip({
@@ -1,7 +1,8 @@
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'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import '../../../config/routes.dart';
class LabelFloatingButtons extends StatelessWidget { class LabelFloatingButtons extends StatelessWidget {
const LabelFloatingButtons({ const LabelFloatingButtons({
Key key, Key key,
@@ -1,6 +1,7 @@
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';
import '../../../providers/labels.dart'; import '../../../providers/labels.dart';
class LabelSearchBox extends StatelessWidget { class LabelSearchBox extends StatelessWidget {
+1 -1
View File
@@ -1,4 +1,4 @@
import 'package:barcode_scan/barcode_scan.dart'; import 'package:barcode_scan2/barcode_scan2.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'; import 'package:url_launcher/url_launcher.dart';
@@ -2,11 +2,13 @@ import 'dart:async';
import 'dart:io'; import 'dart:io';
import 'package:camera/camera.dart'; import 'package:camera/camera.dart';
import 'package:cssd/providers/test_results.dart'; import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../../providers/test_results.dart';
class CaptureImage extends StatefulWidget { class CaptureImage extends StatefulWidget {
@override @override
_CaptureImageState createState() { _CaptureImageState createState() {
@@ -201,7 +203,7 @@ class _CaptureImageState extends State<CaptureImage>
// } // }
// } // }
// return Row(children: toggles); // return Row(children: toggles);
// } // }
String timestamp() => DateTime.now().millisecondsSinceEpoch.toString(); String timestamp() => DateTime.now().millisecondsSinceEpoch.toString();
@@ -247,8 +249,13 @@ class _CaptureImageState extends State<CaptureImage>
imagePath = filePath; imagePath = filePath;
var profileProviderObject = var profileProviderObject =
Provider.of<TestResultsProvider>(context, listen: false); Provider.of<TestResultsProvider>(context, listen: false);
List<File> files = profileProviderObject.catchImages; List<PlatformFile> files = profileProviderObject.catchImages;
files.add(File(imagePath)); print(imagePath);
files.add(PlatformFile(
name: 'test',
size: 0,
path: imagePath,
bytes: File(imagePath).readAsBytesSync()));
profileProviderObject.setCatchImages(files); profileProviderObject.setCatchImages(files);
profileProviderObject.setImages(); profileProviderObject.setImages();
print(imagePath); print(imagePath);
@@ -1,7 +1,4 @@
import 'dart:io'; import 'package:barcode_scan2/barcode_scan2.dart';
import 'package:barcode_scan/barcode_scan.dart';
import 'package:cssd/config/routes.dart';
import 'package:file_picker/file_picker.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';
@@ -12,6 +9,7 @@ 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 'package:provider/provider.dart';
import '../../../config/routes.dart';
import '../../../providers/test_results.dart'; import '../../../providers/test_results.dart';
class FormCreator extends StatefulWidget { class FormCreator extends StatefulWidget {
@@ -528,7 +526,7 @@ class _FormCreatorState extends State<FormCreator> {
Future captureImage(BuildContext context) async { Future captureImage(BuildContext context) async {
var profileProviderObject = var profileProviderObject =
Provider.of<TestResultsProvider>(context, listen: false); Provider.of<TestResultsProvider>(context, listen: false);
List<File> files = profileProviderObject.catchImages; List<PlatformFile> files = profileProviderObject.catchImages;
try { try {
files.add( files.add(
await ImagePickerGC.pickImage( await ImagePickerGC.pickImage(
@@ -552,12 +550,17 @@ class _FormCreatorState extends State<FormCreator> {
Future<void> loadAssets(BuildContext context) async { Future<void> loadAssets(BuildContext context) async {
var profileProviderObject = var profileProviderObject =
Provider.of<TestResultsProvider>(context, listen: false); Provider.of<TestResultsProvider>(context, listen: false);
List<File> files = profileProviderObject.catchImages; List<PlatformFile> files = profileProviderObject.catchImages;
try { try {
files += await FilePicker.getMultiFile( var datas = await FilePicker.platform.pickFiles(
type: FileType.custom, type: FileType.custom,
allowedExtensions: ['jpg', 'png', 'bmp', 'jpeg', 'pdf', 'docx', 'doc'], allowedExtensions: ['jpg', 'png', 'bmp', 'jpeg', 'pdf', 'docx', 'doc'],
withData: true,
withReadStream: true,
); );
files += datas.files;
// files +=
// print(files); // print(files);
} catch (_) {} } catch (_) {}
@@ -632,8 +635,9 @@ class ImageBox extends StatelessWidget {
builder: (_) => Container( builder: (_) => Container(
color: Colors.white, color: Colors.white,
child: Center( child: Center(
child: Image.file( child: Image.memory(
_testProvider.catchImages[index], _testProvider.catchImages[index].bytes,
fit: BoxFit.contain,
), ),
), ),
), ),
@@ -653,12 +657,12 @@ class ImageBox extends StatelessWidget {
height: 60, height: 60,
fit: BoxFit.fill, fit: BoxFit.fill,
) )
: Image.file( : Image.memory(
_testProvider.catchImages[index], _testProvider.catchImages[index].bytes,
// asset: _images[index], // asset: _images[index],
width: 60, width: 60,
height: 60, height: 60,
fit: BoxFit.fill, fit: BoxFit.contain,
), ),
), ),
), ),
@@ -1,6 +1,7 @@
import 'package:cssd/config/routes.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../../config/routes.dart';
class TestResultAddSaveButton extends StatelessWidget { class TestResultAddSaveButton extends StatelessWidget {
const TestResultAddSaveButton({ const TestResultAddSaveButton({
Key key, Key key,
@@ -1,6 +1,7 @@
import 'package:cssd/config/routes.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../../config/routes.dart';
class TestResultAddButton extends StatelessWidget { class TestResultAddButton extends StatelessWidget {
const TestResultAddButton({ const TestResultAddButton({
Key key, Key key,
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../../providers/test_results.dart'; import '../../../providers/test_results.dart';
class TestResultChip extends StatelessWidget { class TestResultChip extends StatelessWidget {
@@ -1,7 +1,8 @@
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'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import '../../../config/routes.dart';
// class TestResultFloatingButton extends StatelessWidget { // class TestResultFloatingButton extends StatelessWidget {
// const TestResultFloatingButton({ // const TestResultFloatingButton({
// Key key, // Key key,
@@ -1,6 +1,7 @@
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';
import '../../../providers/test_results.dart'; import '../../../providers/test_results.dart';
class TestResultSearchBox extends StatelessWidget { class TestResultSearchBox extends StatelessWidget {
+131 -89
View File
@@ -21,21 +21,21 @@ packages:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.5.0-nullsafety.1" version: "2.6.1"
barcode_scan: barcode_scan2:
dependency: "direct main" dependency: "direct main"
description: description:
name: barcode_scan name: barcode_scan2
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.0" version: "4.1.3"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
name: boolean_selector name: boolean_selector
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0-nullsafety.1" version: "2.1.0"
camera: camera:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -49,49 +49,56 @@ packages:
name: characters name: characters
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0-nullsafety.3" version: "1.1.0"
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.2.0-nullsafety.1" version: "1.2.0"
clock: clock:
dependency: transitive dependency: transitive
description: description:
name: clock name: clock
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0-nullsafety.1" version: "1.1.0"
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.15.0-nullsafety.3" version: "1.15.0"
connectivity: connectivity:
dependency: "direct main" dependency: "direct main"
description: description:
name: connectivity name: connectivity
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.8+5" version: "3.0.6"
connectivity_for_web:
dependency: transitive
description:
name: connectivity_for_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.0"
connectivity_macos: connectivity_macos:
dependency: transitive dependency: transitive
description: description:
name: connectivity_macos name: connectivity_macos
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.0+3" version: "0.2.0"
connectivity_platform_interface: connectivity_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: connectivity_platform_interface name: connectivity_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.5" version: "2.0.1"
convert: convert:
dependency: transitive dependency: transitive
description: description:
@@ -112,49 +119,56 @@ packages:
name: cupertino_icons name: cupertino_icons
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.3" version: "1.0.3"
dio: dio:
dependency: "direct main" dependency: "direct main"
description: description:
name: dio name: dio
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.9" version: "4.0.0"
double_back_to_close_app: double_back_to_close_app:
dependency: "direct main" dependency: "direct main"
description: description:
name: double_back_to_close_app name: double_back_to_close_app
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "2.0.1"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
name: fake_async name: fake_async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0-nullsafety.1" version: "1.2.0"
ffi:
dependency: transitive
description:
name: ffi
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
file: file:
dependency: transitive dependency: transitive
description: description:
name: file name: file
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "5.2.1" version: "6.1.2"
file_picker: file_picker:
dependency: "direct main" dependency: "direct main"
description: description:
name: file_picker name: file_picker
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.9.0+1" version: "3.0.2+2"
fixnum: fixnum:
dependency: transitive dependency: transitive
description: description:
name: fixnum name: fixnum
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.10.11" version: "1.0.0"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@@ -173,14 +187,14 @@ packages:
name: flutter_phoenix name: flutter_phoenix
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.0" version: "1.0.0"
flutter_plugin_android_lifecycle: flutter_plugin_android_lifecycle:
dependency: transitive dependency: transitive
description: description:
name: flutter_plugin_android_lifecycle name: flutter_plugin_android_lifecycle
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.8" version: "2.0.2"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
@@ -204,14 +218,14 @@ packages:
name: http name: http
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.1" version: "0.13.3"
http_parser: http_parser:
dependency: transitive dependency: transitive
description: description:
name: http_parser name: http_parser
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.1.4" version: "4.0.0"
image: image:
dependency: transitive dependency: transitive
description: description:
@@ -225,21 +239,28 @@ packages:
name: image_picker name: image_picker
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.6.7+4" version: "0.7.5+4"
image_picker_for_web:
dependency: transitive
description:
name: image_picker_for_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
image_picker_gallery_camera: image_picker_gallery_camera:
dependency: "direct main" dependency: "direct main"
description: description:
name: image_picker_gallery_camera name: image_picker_gallery_camera
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.6" version: "0.2.2"
image_picker_platform_interface: image_picker_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: image_picker_platform_interface name: image_picker_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "2.1.0"
intl: intl:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -247,20 +268,27 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.16.1" version: "0.16.1"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
name: matcher name: matcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.10-nullsafety.1" version: "0.12.10"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0-nullsafety.3" version: "1.3.0"
multiselect_formfield: multiselect_formfield:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -268,48 +296,62 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.2" version: "0.1.2"
nested:
dependency: transitive
description:
name: nested
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
path: path:
dependency: transitive dependency: transitive
description: description:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0-nullsafety.1" version: "1.8.0"
path_provider: path_provider:
dependency: "direct main" dependency: "direct main"
description: description:
name: path_provider name: path_provider
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.6.11" version: "2.0.2"
path_provider_linux: path_provider_linux:
dependency: transitive dependency: transitive
description: description:
name: path_provider_linux name: path_provider_linux
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.0.1+2" version: "2.0.0"
path_provider_macos: path_provider_macos:
dependency: transitive dependency: transitive
description: description:
name: path_provider_macos name: path_provider_macos
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.0.4+3" version: "2.0.0"
path_provider_platform_interface: path_provider_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: path_provider_platform_interface name: path_provider_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.2" version: "2.0.1"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
pedantic: pedantic:
dependency: transitive dependency: transitive
description: description:
name: pedantic name: pedantic
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0+1" version: "1.11.1"
petitparser: petitparser:
dependency: transitive dependency: transitive
description: description:
@@ -323,49 +365,35 @@ packages:
name: platform name: platform
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.2.1" version: "3.0.0"
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:
name: plugin_platform_interface name: plugin_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.2" version: "2.0.0"
process: process:
dependency: transitive dependency: transitive
description: description:
name: process name: process
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.13" version: "4.2.1"
protobuf: protobuf:
dependency: transitive dependency: transitive
description: description:
name: protobuf name: protobuf
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.1" version: "2.0.0"
provider: provider:
dependency: "direct main" dependency: "direct main"
description: description:
name: provider name: provider
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.2.0" version: "5.0.0"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.4"
random_string: random_string:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -379,28 +407,42 @@ packages:
name: shared_preferences name: shared_preferences
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.5.7" version: "2.0.6"
shared_preferences_linux:
dependency: transitive
description:
name: shared_preferences_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
shared_preferences_macos: shared_preferences_macos:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_macos name: shared_preferences_macos
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.0.1+7" version: "2.0.0"
shared_preferences_platform_interface: shared_preferences_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_platform_interface name: shared_preferences_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.3" version: "2.0.0"
shared_preferences_web: shared_preferences_web:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_web name: shared_preferences_web
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.2+4" version: "2.0.0"
shared_preferences_windows:
dependency: transitive
description:
name: shared_preferences_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@@ -412,112 +454,112 @@ packages:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0-nullsafety.2" version: "1.8.1"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
name: stack_trace name: stack_trace
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.10.0-nullsafety.1" version: "1.10.0"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
name: stream_channel name: stream_channel
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0-nullsafety.1" version: "2.1.0"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
name: string_scanner name: string_scanner
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0-nullsafety.1" version: "1.1.0"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
name: term_glyph name: term_glyph
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0-nullsafety.1" version: "1.2.0"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.19-nullsafety.2" version: "0.3.0"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
name: typed_data name: typed_data
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0-nullsafety.3" version: "1.3.0"
url_launcher: url_launcher:
dependency: "direct main" dependency: "direct main"
description: description:
name: url_launcher name: url_launcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "5.4.10" version: "6.0.6"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
url_launcher_macos: url_launcher_macos:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_macos name: url_launcher_macos
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.0.1+7" version: "2.0.0"
url_launcher_platform_interface: url_launcher_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_platform_interface name: url_launcher_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.7" version: "2.0.3"
url_launcher_web: url_launcher_web:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_web name: url_launcher_web
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.1+6" version: "2.0.1"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0-nullsafety.3" version: "2.1.0"
video_player: win32:
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 dependency: transitive
description: description:
name: video_player_platform_interface name: win32
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.2" version: "2.2.1"
video_player_web:
dependency: transitive
description:
name: video_player_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3+2"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:
name: xdg_directories name: xdg_directories
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.0" version: "0.2.0"
xml: xml:
dependency: transitive dependency: transitive
description: description:
@@ -533,5 +575,5 @@ packages:
source: hosted source: hosted
version: "2.2.1" version: "2.2.1"
sdks: sdks:
dart: ">=2.10.0-110 <2.11.0" dart: ">=2.13.0 <3.0.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0" flutter: ">=2.0.0"
+16 -16
View File
@@ -11,33 +11,33 @@ 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.7.0+6 version: 1.7.1+7
environment: environment:
sdk: ">=2.2.2 <3.0.0" sdk: ">=2.7.0 <3.0.0"
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
barcode_scan: ^3.0.0 barcode_scan2: ^4.1.3
camera: ^0.5.8+2 camera: ^0.5.8+2
connectivity: ^0.4.8+5 connectivity: ^3.0.6
cupertino_icons: ^0.1.2 cupertino_icons: ^1.0.3
dio: ^3.0.9 dio: ^4.0.0
double_back_to_close_app: ^1.2.0 double_back_to_close_app: ^2.0.1
file_picker: ^1.9.0+1 file_picker: ^3.0.2+2
flutter_phoenix: ^0.1.0 flutter_phoenix: ^1.0.0
font_awesome_flutter: ^8.8.1 font_awesome_flutter: ^8.8.1
http: ^0.12.0+3 http: ^0.13.3
image_picker_gallery_camera: ^0.1.6 image_picker_gallery_camera: ^0.2.2
intl: ^0.16.1 intl: ^0.16.1
multiselect_formfield: ^0.1.2 multiselect_formfield: ^0.1.2
path_provider: ^1.6.11 path_provider: ^2.0.2
provider: ^3.2.0 provider: ^5.0.0
random_string: ^2.0.1 random_string: ^2.0.1
shared_preferences: ^0.5.6 shared_preferences: ^2.0.6
url_launcher: ^5.4.10 url_launcher: ^6.0.6
video_player: ^0.10.11+2 # video_player: ^0.10.11+2
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: