Improve back button function in all screens

This commit is contained in:
hanie.khodkari
2025-03-19 18:38:40 +03:30
parent d99ecb2783
commit 58cd3d9f3f
35 changed files with 4715 additions and 5007 deletions
+204 -219
View File
@@ -49,244 +49,229 @@ class _TestResultAddScreenState extends State<TestResultAddScreen> {
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100;
return PopScope(
canPop: false,
onPopInvoked: (didPop) {
if (didPop) return;
Navigator.of(context).pushNamed(Routes.homePage);
// Navigator.pushReplacementNamed(
// context,
// Routes.testResultScreen,
// );
// return true;
},
child: SafeArea(
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Test Results',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
// padding: EdgeInsets.all(0),
onPressed: () => Navigator.of(context)
.popAndPushNamed(Routes.testResultScreen),
return SafeArea(
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Test Results',
style: TextStyle(
color: Colors.white,
),
),
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: ListView(
padding: EdgeInsets.symmetric(
horizontal: 20, vertical: 20),
children: <Widget>[
Container(
padding: EdgeInsets.only(
top: 10,
),
child: Text(
'Add a Test Result',
style: TextStyle(
color: Colors.black,
fontSize: 5 * _deviceBlockSize,
letterSpacing: 3,
fontWeight: FontWeight.w700,
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
// padding: EdgeInsets.all(0),
onPressed: () =>
Navigator.of(context).popAndPushNamed(Routes.testResultScreen),
),
),
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: ListView(
padding:
EdgeInsets.symmetric(horizontal: 20, vertical: 20),
children: <Widget>[
Container(
padding: EdgeInsets.only(
top: 10,
),
child: Text(
'Add a Test Result',
style: TextStyle(
color: Colors.black,
fontSize: 5 * _deviceBlockSize,
letterSpacing: 3,
fontWeight: FontWeight.w700,
),
),
GestureDetector(
child: Container(
margin: EdgeInsets.only(top: 5, bottom: 30),
padding: EdgeInsets.all(10),
height: 200,
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,
),
),
GestureDetector(
child: Container(
margin: EdgeInsets.only(top: 5, bottom: 30),
padding: EdgeInsets.all(10),
height: 200,
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: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
Provider.of<TestResultsProvider>(
context,
listen: false,
).testCode = result;
Navigator.pushNamed(
context,
Routes.formTestResultScreen,
arguments: result,
);
}
},
);
},
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
width: 70 * _deviceBlockSize,
child: TestResultAddSelectorBox(
deviceBlockSize: _deviceBlockSize,
dataCTRL: testTypeCTRL,
dataVals: testTypeVals,
label: 'Choose a Test Type',
),
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
Provider.of<TestResultsProvider>(
context,
listen: false,
).testCode = result;
Navigator.pushNamed(
context,
Routes.formTestResultScreen,
arguments: result,
);
}
},
);
},
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.center,
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>[
Text(
'OR',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 7 * _deviceBlockSize,
),
),
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: testCodeCTRL,
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.visiblePassword,
),
),
],
),
SizedBox(
height: 40.0,
),
Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
width: 50 * _deviceBlockSize,
decoration: BoxDecoration(
color: Colors.black,
borderRadius: BorderRadius.circular(7),
SizedBox(
width: 8 * _deviceBlockSize,
),
child: Align(
alignment: Alignment.center,
child: TextButton(
child: Text(
'Select',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
),
),
onPressed: () {
if (testCodeCTRL.text != '') {
Provider.of<TestResultsProvider>(
context,
listen: false,
).testCode = testCodeCTRL.text;
Navigator.pushNamed(
context,
Routes.formTestResultScreen,
arguments: testCodeCTRL.text,
Container(
width: 50 * _deviceBlockSize,
child: TextFormField(
onChanged: (val) {
if (val != '') {
setState(
() {
testTypeCTRL.text = '';
},
);
} else if (testTypeCTRL.text !=
'') {
Provider.of<TestResultsProvider>(
context,
listen: false,
).testType = testTypeCTRL.text;
Navigator.pushReplacementNamed(
context,
Routes.formTestResultScreen,
arguments: testTypeCTRL.text,
} else {
setState(
() {
testTypeCTRL.text =
testTypeVals[0];
},
);
}
// print(testCode);
},
controller: testCodeCTRL,
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.visiblePassword,
),
),
],
),
SizedBox(
height: 40.0,
),
Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
],
),
SizedBox(
width: 5 * _deviceBlockSize,
),
],
),
],
)
: ConnectionErrorBox();
},
),
width: 50 * _deviceBlockSize,
decoration: BoxDecoration(
color: Colors.black,
borderRadius: BorderRadius.circular(7),
),
child: Align(
alignment: Alignment.center,
child: TextButton(
child: Text(
'Select',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
),
),
onPressed: () {
if (testCodeCTRL.text != '') {
Provider.of<TestResultsProvider>(
context,
listen: false,
).testCode = testCodeCTRL.text;
Navigator.pushNamed(
context,
Routes.formTestResultScreen,
arguments: testCodeCTRL.text,
);
} else if (testTypeCTRL.text != '') {
Provider.of<TestResultsProvider>(
context,
listen: false,
).testType = testTypeCTRL.text;
Navigator.pushReplacementNamed(
context,
Routes.formTestResultScreen,
arguments: testTypeCTRL.text,
);
}
// print(testCode);
},
),
),
),
],
),
SizedBox(
width: 5 * _deviceBlockSize,
),
],
),
],
)
: ConnectionErrorBox();
},
),
),
);
+32 -39
View File
@@ -44,49 +44,42 @@ class _TestDetailsScreenState extends State<TestDetailsScreen> {
final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100;
// print(datas);
return PopScope(
canPop: false,
onPopInvoked: (didPop) {
if (didPop) return;
Navigator.of(context).pushNamed(Routes.homePage);
},
child: SafeArea(
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Test Results',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
return SafeArea(
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Test Results',
style: TextStyle(
color: Colors.white,
),
),
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: DatasBox(
datas: datas!,
deviceBlockSize: _deviceBlockSize,
)
: ConnectionErrorBox();
},
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
),
),
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: DatasBox(
datas: datas!,
deviceBlockSize: _deviceBlockSize,
)
: ConnectionErrorBox();
},
),
),
);
}
+266 -278
View File
@@ -128,299 +128,287 @@ class _TestFilterScreenState extends State<TestFilterScreen> {
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100;
return PopScope(
canPop: false,
onPopInvoked: (didPop) {
if (didPop) return;
Navigator.of(context).pushNamed(Routes.homePage);
// Navigator.pushReplacementNamed(
// context,
// Routes.testResultScreen,
// );
// return true;
},
child: SafeArea(
child: GestureDetector(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
},
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Test Results',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).popAndPushNamed(
Routes.testResultScreen,
),
return SafeArea(
child: GestureDetector(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
},
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Test Results',
style: TextStyle(
color: Colors.white,
),
),
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: Padding(
padding: EdgeInsets.all(20),
child: ListView(
children: <Widget>[
Text(
'Filter Test Results',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).popAndPushNamed(
Routes.testResultScreen,
),
),
),
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: Padding(
padding: EdgeInsets.all(20),
child: ListView(
children: <Widget>[
Text(
'Filter Test Results',
style: TextStyle(
fontWeight: FontWeight.w700,
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),
),
SizedBox(
height: 20,
),
Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
controller: idCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
keyboardType: TextInputType.text,
textInputAction: TextInputAction.next,
// onFieldSubmitted: (_) {
// FocusScope.of(context)
// .requestFocus(_cycleNumberFocusNode);
// },
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,
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(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
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,
),
),
),
],
),
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,
),
userData['roles']?.contains('User') ?? false
? Container()
: Column(
children: [
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,
listen: false)
.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,
// ),
// );
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.black, Colors.black87],
),
borderRadius: BorderRadius.circular(7),
),
child: Align(
alignment: Alignment.center,
child: Text(
'Filter',
style: TextStyle(
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
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),
),
SizedBox(
height: 70,
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
// DropDownBox(values: ['Washer ID']),
],
),
)
: ConnectionErrorBox();
},
),
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,
),
userData['roles']?.contains('User') ?? false
? Container()
: Column(
children: [
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,
listen: false)
.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,
// ),
// );
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.black, Colors.black87],
),
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();
},
),
),
),
+84 -96
View File
@@ -96,105 +96,93 @@ class _FormPageState extends State<FormPage> {
@override
Widget build(BuildContext context) {
return PopScope(
canPop: false,
onPopInvoked: (didPop) {
if (didPop) return;
Navigator.of(context).pushNamed(Routes.homePage);
// Navigator.pushReplacementNamed(
// context,
// Routes.testResultAddScreen,
// );
// return true;
},
child: SafeArea(
child: Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text(
'Add Test Result',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
actions: <Widget>[
_isLoadingButton
? Center(
child: CircularProgressIndicator(
color: Colors.white,
),
)
: IconButton(
icon: Icon(
Icons.save,
color: Colors.white,
),
onPressed: () {
_saveForm();
},
)
],
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () {
Navigator.of(context).popAndPushNamed(Routes.testResultScreen);
},
return SafeArea(
child: Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text(
'Add Test Result',
style: TextStyle(
color: Colors.white,
),
),
body: SingleChildScrollView(
child: Column(
children: <Widget>[
_isLoading
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: Form(
key: _form,
child: Consumer<Inputs>(
builder: (context, inputs, _) {
formInputs = inputs.inputItems;
print(formInputs);
return formInputs.length != 0
? FormCreator(
form: formInputs,
onChanged: (value) {
formInputs = value;
},
)
: Center(
child: Text('Something went wrong!!!'),
);
},
),
),
// https://www.cssd-doc.com/api/GetInfo
// InkWell(
// onTap: () {
// _saveForm();
// },
// child: Container(
// padding: EdgeInsets.symmetric(horizontal: 60, vertical: 15),
// margin: EdgeInsets.symmetric(vertical: 20, horizontal: 50),
// decoration: BoxDecoration(
// gradient: LinearGradient(colors: [Colors.blue, Colors.green]),
// borderRadius: BorderRadius.circular(10),
// ),
// child: Text(
// 'Save',
// style: TextStyle(color: Colors.white, fontSize: 17),
// textAlign: TextAlign.center,
// ),
// ),
// ),
],
backgroundColor: Colors.black,
actions: <Widget>[
_isLoadingButton
? Center(
child: CircularProgressIndicator(
color: Colors.white,
),
)
: IconButton(
icon: Icon(
Icons.save,
color: Colors.white,
),
onPressed: () {
_saveForm();
},
)
],
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () {
Navigator.of(context).popAndPushNamed(Routes.testResultScreen);
},
),
),
body: SingleChildScrollView(
child: Column(
children: <Widget>[
_isLoading
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: Form(
key: _form,
child: Consumer<Inputs>(
builder: (context, inputs, _) {
formInputs = inputs.inputItems;
print(formInputs);
return formInputs.length != 0
? FormCreator(
form: formInputs,
onChanged: (value) {
formInputs = value;
},
)
: Center(
child: Text('Something went wrong!!!'),
);
},
),
),
// https://www.cssd-doc.com/api/GetInfo
// InkWell(
// onTap: () {
// _saveForm();
// },
// child: Container(
// padding: EdgeInsets.symmetric(horizontal: 60, vertical: 15),
// margin: EdgeInsets.symmetric(vertical: 20, horizontal: 50),
// decoration: BoxDecoration(
// gradient: LinearGradient(colors: [Colors.blue, Colors.green]),
// borderRadius: BorderRadius.circular(10),
// ),
// child: Text(
// 'Save',
// style: TextStyle(color: Colors.white, fontSize: 17),
// textAlign: TextAlign.center,
// ),
// ),
// ),
],
),
),
),
+1 -1
View File
@@ -128,7 +128,7 @@ class _TestResultScreenState extends State<TestResultScreen> {
InkWell(
onTap: () {
Navigator.of(context)
.popAndPushNamed(Routes.testFilterScreen);
.pushNamed(Routes.testFilterScreen);
},
child: Container(
padding: EdgeInsets.all(7),
+142 -149
View File
@@ -27,173 +27,166 @@ class _TestScanScreenState extends State<TestScanScreen> {
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100;
return PopScope(
canPop: false,
onPopInvoked: (didPop) {
if (didPop) return;
Navigator.of(context).pushNamed(Routes.homePage);
},
child: SafeArea(
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Test Results',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
return SafeArea(
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Test Results',
style: TextStyle(
color: Colors.white,
),
),
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? ListView(
padding: EdgeInsets.symmetric(horizontal: 20),
children: <Widget>[
Container(
padding: EdgeInsets.only(top: 30),
child: Text(
'Looking for a Test Result?',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black,
fontSize: 5.5 * _deviceBlockSize,
fontWeight: FontWeight.w700,
letterSpacing: 3,
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
),
),
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? ListView(
padding: EdgeInsets.symmetric(horizontal: 20),
children: <Widget>[
Container(
padding: EdgeInsets.only(top: 30),
child: Text(
'Looking for a Test Result?',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black,
fontSize: 5.5 * _deviceBlockSize,
fontWeight: FontWeight.w700,
letterSpacing: 3,
),
),
GestureDetector(
child: Container(
margin: EdgeInsets.symmetric(vertical: 10),
height: 200,
decoration: BoxDecoration(border: Border.all()),
child: Center(
child: Text(
'Please Scan The Test Result Barcode',
style: TextStyle(
color: Colors.black,
fontSize: 5 * _deviceBlockSize,
fontWeight: FontWeight.w100,
letterSpacing: 3,
),
textAlign: TextAlign.center,
),
),
),
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
launch(
'https://cssd-doc.com/Show/TestResult/$result',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: result,
// );
}
},
);
},
),
SizedBox(
height: 10.0,
),
Form(
key: _form,
child: TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'Id required!!';
}
return null;
},
controller: idCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
),
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,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Or enter a Test Result ID',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
focusedBorder: UnderlineInputBorder(
// borderRadius: BorderRadius.only(Radius.circular(4)),
borderSide: BorderSide(
color: Colors.grey,
),
letterSpacing: 3,
),
textAlign: TextAlign.center,
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
),
),
SizedBox(
height: 70,
),
InkWell(
onTap: () {
if (!_form.currentState!.validate()) {
return;
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
launch(
'https://cssd-doc.com/Show/TestResult/$result',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: result,
// );
}
},
);
},
),
SizedBox(
height: 10.0,
),
Form(
key: _form,
child: TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'Id required!!';
}
launch(
'https://cssd-doc.com/Show/TestResult/${idCTRL.text}',
);
return null;
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
controller: idCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.black, Colors.black87],
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Or enter a Test Result ID',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
focusedBorder: UnderlineInputBorder(
// borderRadius: BorderRadius.only(Radius.circular(4)),
borderSide: BorderSide(
color: Colors.grey,
),
borderRadius: BorderRadius.circular(7),
),
child: Align(
alignment: Alignment.center,
child: Text(
'Search',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
),
),
SizedBox(
height: 70,
),
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,
),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.black, Colors.black87],
),
borderRadius: BorderRadius.circular(7),
),
child: Align(
alignment: Alignment.center,
child: Text(
'Search',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
),
),
),
),
],
)
: ConnectionErrorBox();
},
),
),
],
)
: ConnectionErrorBox();
},
),
),
);