Back button of other pages navigate to home

This commit is contained in:
fhkhd
2024-04-20 22:16:35 +04:30
parent 34e3f76845
commit c99cf569cf
20 changed files with 1455 additions and 1279 deletions
+248 -246
View File
@@ -75,14 +75,17 @@ class _CycleAddScreenState extends State<CycleAddScreen> {
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return Consumer<CyclesProvider>(builder: (context, cyclesProvider, _) { return Consumer<CyclesProvider>(builder: (context, cyclesProvider, _) {
return WillPopScope( return PopScope(
onWillPop: () async { canPop: false,
cyclesProvider.resetLoadingButton(); onPopInvoked: (didPop) {
Navigator.pushReplacementNamed( if (didPop) return;
context, Navigator.of(context).pushNamed(Routes.homePage);
Routes.cycleResultScreen, // cyclesProvider.resetLoadingButton();
); // Navigator.pushReplacementNamed(
return true; // context,
// Routes.cycleResultScreen,
// );
// return true;
}, },
child: SafeArea( child: SafeArea(
child: GestureDetector( child: GestureDetector(
@@ -116,254 +119,253 @@ class _CycleAddScreenState extends State<CycleAddScreen> {
builder: (ct, connection, _) { builder: (ct, connection, _) {
return connection.conStatus != 'offline' return connection.conStatus != 'offline'
? isInit ? isInit
? Center( ? Center(
child: CircularProgressIndicator( child: CircularProgressIndicator(
color: Colors.black, color: Colors.black,
), ),
) )
: 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( style: TextStyle(
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 6 * _deviceBlockSize, fontSize: 6 * _deviceBlockSize,
letterSpacing: 3, letterSpacing: 3,
), ),
),
SizedBox(
height: 20,
),
Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'Strilizer ID required!';
}
return null;
},
controller: striizerIdCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons
.sortNumericDown,
size: 7 * _deviceBlockSize,
), ),
SizedBox( labelStyle: TextStyle(
height: 20, fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
), ),
Row( isDense: true,
children: [ labelText: 'Strilizer ID',
Flexible( contentPadding:
flex: 8, EdgeInsets.symmetric(
child: TextFormField( vertical: 2,
validator: (val) { horizontal: 3,
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);
},
),
),
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);
striizerIdCTRL.text =
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,
),
),
),
),
],
), ),
SizedBox( ),
height: 20, style: TextStyle(
), fontWeight: FontWeight.w700,
TextFormField( fontSize: 5 * _deviceBlockSize,
validator: (val) { ),
if (val!.isEmpty) { keyboardType:
return 'Cycle number required!'; TextInputType.visiblePassword,
} textInputAction:
return null; TextInputAction.next,
}, onFieldSubmitted: (_) {
controller: cycleNumberCTRL, FocusScope.of(context)
decoration: InputDecoration( .requestFocus(
icon: Icon( _cycleNumberFocusNode);
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: 30,
),
CycleAddDatePicker(
dateCTRL: dateCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 20.0,
),
Container(
margin:
EdgeInsets.symmetric(vertical: 10),
child: Text(
'Labels included',
style: TextStyle(
color: kPink,
letterSpacing: 2,
fontSize: 5 * _deviceBlockSize,
),
),
),
Consumer<CyclesProvider>(
builder: (ctx, cycleProvider, _) =>
ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (ctx, index) =>
AddLabelBox(
text: 'Select Labels included',
iconColor: kPinkSub,
deviceBlockSize: _deviceBlockSize,
values:
cycleProvider.labelValues[index],
vals: cycleProvider.labelVals,
initialLabelValue:
cycleProvider.initialLabelValue,
index: index,
hasRemoveButton:
cycleProvider.labelValues.length >
1
? true
: false,
),
itemCount:
cycleProvider.labelValues.length,
),
),
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,
),
],
), ),
), ),
) 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);
striizerIdCTRL.text =
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,
),
),
),
),
],
),
SizedBox(
height: 20,
),
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: 30,
),
CycleAddDatePicker(
dateCTRL: dateCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 20.0,
),
Container(
margin:
EdgeInsets.symmetric(vertical: 10),
child: Text(
'Labels included',
style: TextStyle(
color: kPink,
letterSpacing: 2,
fontSize: 5 * _deviceBlockSize,
),
),
),
Consumer<CyclesProvider>(
builder: (ctx, cycleProvider, _) =>
ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (ctx, index) =>
AddLabelBox(
text: 'Select Labels included',
iconColor: kPinkSub,
deviceBlockSize: _deviceBlockSize,
values:
cycleProvider.labelValues[index],
vals: cycleProvider.labelVals,
initialLabelValue:
cycleProvider.initialLabelValue,
index: index,
hasRemoveButton:
cycleProvider.labelValues.length >
1
? true
: false,
),
itemCount:
cycleProvider.labelValues.length,
),
),
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,
),
],
),
),
)
: ConnectionErrorBox(); : ConnectionErrorBox();
}, },
), ),
), ),
), ),
), ),);
);
}); });
} }
} }
+19 -8
View File
@@ -29,12 +29,15 @@ class _CycleFilterScreenState extends State<CycleFilterScreen> {
TextEditingController dateCTRL = new TextEditingController(); TextEditingController dateCTRL = new TextEditingController();
DateTime? dateTimeFrom; DateTime? dateTimeFrom;
// String dateValue; // String dateValue;
List<Map<String, String>> hospitalVals = []; List<Map<String, String>> hospitalVals = [];
// String curhospitalVal; // String curhospitalVal;
bool isInit = true; bool isInit = true;
CycleFilterObject? filters; CycleFilterObject? filters;
@override @override
void initState() { void initState() {
filters = Provider.of<CyclesProvider>(context, listen: false).filters; filters = Provider.of<CyclesProvider>(context, listen: false).filters;
@@ -88,13 +91,16 @@ class _CycleFilterScreenState extends State<CycleFilterScreen> {
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return WillPopScope( return PopScope(
onWillPop: () async { canPop: false,
Navigator.pushReplacementNamed( onPopInvoked: (didPop) {
context, if (didPop) return;
Routes.cycleResultScreen, Navigator.of(context).pushNamed(Routes.homePage);
); // Navigator.pushReplacementNamed(
return true; // context,
// Routes.cycleResultScreen,
// );
// return true;
}, },
child: SafeArea( child: SafeArea(
child: GestureDetector( child: GestureDetector(
@@ -104,7 +110,12 @@ class _CycleFilterScreenState extends State<CycleFilterScreen> {
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
titleSpacing: -10, titleSpacing: -10,
title: Text('Cycles', style: TextStyle(color: Colors.white,),), title: Text(
'Cycles',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black, backgroundColor: Colors.black,
leading: IconButton( leading: IconButton(
icon: Icon( icon: Icon(
+162 -149
View File
@@ -5,6 +5,7 @@ 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 '../../config/routes.dart';
import '../../providers/connectivity.dart'; import '../../providers/connectivity.dart';
import '../../widgets/Global/internet_error.dart'; import '../../widgets/Global/internet_error.dart';
@@ -27,169 +28,181 @@ 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 SafeArea( return PopScope(
child: GestureDetector( canPop: false,
onTap: () { onPopInvoked: (didPop) {
FocusManager.instance.primaryFocus?.unfocus(); if (didPop) return;
}, Navigator.of(context).pushNamed(Routes.homePage);
child: Scaffold( },
appBar: AppBar( child: SafeArea(
titleSpacing: -10, child: GestureDetector(
title: Text('Cycles', style: TextStyle(color: Colors.white,),), onTap: () {
backgroundColor: Colors.black, FocusManager.instance.primaryFocus?.unfocus();
leading: IconButton( },
icon: Icon( child: Scaffold(
Icons.keyboard_arrow_left, appBar: AppBar(
color: Colors.white, titleSpacing: -10,
size: 35, title: Text(
'Cycles',
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(),
), ),
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 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') {
SizedBox( print('cancel');
height: 10.0, } else if (result == 'error') {
), print('error');
Form( } else if (result == 'access') {
key: _form, print('access');
child: TextFormField( } else {
validator: (val) { launch(
if (val!.isEmpty) { 'https://cssd-doc.com/Show/Cycle/$result',
return 'Id required!!'; );
} // Navigator.of(context).pushNamed(
return null; // Routes.cycleDetailScreen,
// arguments: result,
// );
}
},
);
}, },
controller: idCTRL, ),
decoration: InputDecoration( SizedBox(
icon: Icon( height: 10.0,
FontAwesomeIcons.sortNumericDown, ),
size: 6 * _deviceBlockSize, Form(
), key: _form,
labelStyle: TextStyle( child: TextFormField(
fontWeight: FontWeight.w100, validator: (val) {
fontSize: 4 * _deviceBlockSize, if (val!.isEmpty) {
), return 'Id required!!';
isDense: true, }
labelText: 'Or enter a cycle ID', return null;
contentPadding: EdgeInsets.symmetric( },
vertical: 2, controller: idCTRL,
horizontal: 3, decoration: InputDecoration(
), icon: Icon(
focusedBorder: UnderlineInputBorder( FontAwesomeIcons.sortNumericDown,
// borderRadius: BorderRadius.only(Radius.circular(4)), size: 6 * _deviceBlockSize,
borderSide: BorderSide( ),
color: Colors.grey, labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
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: 70,
),
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,
),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [kPink, kPinkSub],
), ),
borderRadius: BorderRadius.circular(7), keyboardType: TextInputType.number,
), ),
child: Align( ),
alignment: Alignment.center, SizedBox(
child: Text( height: 70,
'Search', ),
style: TextStyle( InkWell(
color: Colors.white, onTap: () {
fontSize: 5 * _deviceBlockSize, 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,
),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [kPink, kPinkSub],
),
borderRadius: BorderRadius.circular(7),
),
child: Align(
alignment: Alignment.center,
child: Text(
'Search',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
),
), ),
), ),
), ),
), ),
), ],
], )
) : ConnectionErrorBox();
: ConnectionErrorBox(); },
}, ),
), ),
), ),
), ),
+10 -7
View File
@@ -115,13 +115,16 @@ class _ItemAddScreenState extends State<ItemAddScreen> {
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
final itemProviderObject = Provider.of<ItemProvider>(context); final itemProviderObject = Provider.of<ItemProvider>(context);
return WillPopScope( return PopScope(
onWillPop: () async { canPop: false,
Navigator.pushReplacementNamed( onPopInvoked: (didPop) {
context, if (didPop) return;
Routes.itemResultScreen, Navigator.of(context).pushNamed(Routes.homePage);
); // Navigator.pushReplacementNamed(
return true; // context,
// Routes.itemResultScreen,
// );
// return true;
}, },
child: SafeArea( child: SafeArea(
child: GestureDetector( child: GestureDetector(
+17 -8
View File
@@ -32,6 +32,7 @@ class _ItemFilterScreenState extends State<ItemFilterScreen> {
List<Map<String, String>> hospitalVals = []; List<Map<String, String>> hospitalVals = [];
bool isInit = true; bool isInit = true;
ItemFilterObject? filters; ItemFilterObject? filters;
@override @override
void initState() { void initState() {
filters = Provider.of<ItemProvider>(context, listen: false).filters; filters = Provider.of<ItemProvider>(context, listen: false).filters;
@@ -83,13 +84,16 @@ class _ItemFilterScreenState extends State<ItemFilterScreen> {
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 WillPopScope( return PopScope(
onWillPop: () async { canPop: false,
Navigator.pushReplacementNamed( onPopInvoked: (didPop) {
context, if (didPop) return;
Routes.itemResultScreen, Navigator.of(context).pushNamed(Routes.homePage);
); // Navigator.pushReplacementNamed(
return true; // context,
// Routes.itemResultScreen,
// );
// return true;
}, },
child: SafeArea( child: SafeArea(
child: GestureDetector( child: GestureDetector(
@@ -99,7 +103,12 @@ class _ItemFilterScreenState extends State<ItemFilterScreen> {
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
titleSpacing: -10, titleSpacing: -10,
title: Text('Items', style: TextStyle(color: Colors.white,),), title: Text(
'Items',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black, backgroundColor: Colors.black,
leading: IconButton( leading: IconButton(
icon: Icon( icon: Icon(
+162 -149
View File
@@ -5,6 +5,7 @@ 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 '../../config/routes.dart';
import '../../providers/connectivity.dart'; import '../../providers/connectivity.dart';
import '../../widgets/Global/internet_error.dart'; import '../../widgets/Global/internet_error.dart';
@@ -25,169 +26,181 @@ class _ItemScanScreenState extends State<ItemScanScreen> {
// 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 SafeArea( return PopScope(
child: GestureDetector( canPop: false,
onTap: () { onPopInvoked: (didPop) {
FocusManager.instance.primaryFocus?.unfocus(); if (didPop) return;
}, Navigator.of(context).pushNamed(Routes.homePage);
child: Scaffold( },
appBar: AppBar( child: SafeArea(
titleSpacing: -10, child: GestureDetector(
title: Text('Items', style: TextStyle(color: Colors.white,),), onTap: () {
backgroundColor: Colors.black, FocusManager.instance.primaryFocus?.unfocus();
leading: IconButton( },
icon: Icon( child: Scaffold(
Icons.keyboard_arrow_left, appBar: AppBar(
color: Colors.white, titleSpacing: -10,
size: 35, title: Text(
'Items',
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(),
), ),
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 an Item?',
'Looking for an Item?', 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 Item 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 Item Barcode',
print('access'); style: TextStyle(
} else { color: Colors.black,
launch( fontSize: 5 * _deviceBlockSize,
'https://cssd-doc.com/Show/Item/$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') {
SizedBox( print('cancel');
height: 10.0, } else if (result == 'error') {
), print('error');
Form( } else if (result == 'access') {
key: _form, print('access');
child: TextFormField( } else {
validator: (val) { launch(
if (val!.isEmpty) { 'https://cssd-doc.com/Show/Item/$result',
return 'Id required!!'; );
} // Navigator.of(context).pushNamed(
return null; // Routes.cycleDetailScreen,
// arguments: result,
// );
}
},
);
}, },
controller: idCTRL, ),
decoration: InputDecoration( SizedBox(
icon: Icon( height: 10.0,
FontAwesomeIcons.sortNumericDown, ),
size: 6 * _deviceBlockSize, Form(
), key: _form,
labelStyle: TextStyle( child: TextFormField(
fontWeight: FontWeight.w100, validator: (val) {
fontSize: 4 * _deviceBlockSize, if (val!.isEmpty) {
), return 'Id required!!';
isDense: true, }
labelText: 'Or enter an Item ID', return null;
contentPadding: EdgeInsets.symmetric( },
vertical: 2, controller: idCTRL,
horizontal: 3, decoration: InputDecoration(
), icon: Icon(
focusedBorder: UnderlineInputBorder( FontAwesomeIcons.sortNumericDown,
// borderRadius: BorderRadius.only(Radius.circular(4)), size: 6 * _deviceBlockSize,
borderSide: BorderSide( ),
color: Colors.grey, labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Or enter an Item 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: 70,
),
InkWell(
onTap: () {
if (!_form.currentState!.validate()) {
return;
}
launch(
'https://cssd-doc.com/Show/Item/${idCTRL.text}',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: idCTRL.text,
// );
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [kBlue, kBlueSub],
), ),
borderRadius: BorderRadius.circular(7), keyboardType: TextInputType.number,
), ),
child: Align( ),
alignment: Alignment.center, SizedBox(
child: Text( height: 70,
'Search', ),
style: TextStyle( InkWell(
color: Colors.white, onTap: () {
fontSize: 5 * _deviceBlockSize, if (!_form.currentState!.validate()) {
return;
}
launch(
'https://cssd-doc.com/Show/Item/${idCTRL.text}',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: idCTRL.text,
// );
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [kBlue, kBlueSub],
),
borderRadius: BorderRadius.circular(7),
),
child: Align(
alignment: Alignment.center,
child: Text(
'Search',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
),
), ),
), ),
), ),
), ),
), ],
], )
) : ConnectionErrorBox();
: ConnectionErrorBox(); },
}, ),
), ),
), ),
), ),
+11 -8
View File
@@ -77,14 +77,17 @@ class _LabelAddScreenState extends State<LabelAddScreen> {
// String initialLabelValue; // String initialLabelValue;
return Consumer<LabelsProvider>( return Consumer<LabelsProvider>(
builder: (context, labelsProvider, _) { builder: (context, labelsProvider, _) {
return WillPopScope( return PopScope(
onWillPop: () async { canPop: false,
labelsProvider.resetLoadingButton(); onPopInvoked: (didPop) {
Navigator.pushReplacementNamed( if (didPop) return;
context, Navigator.of(context).pushNamed(Routes.homePage);
Routes.labelResultScreen, // labelsProvider.resetLoadingButton();
); // Navigator.pushReplacementNamed(
return true; // context,
// Routes.labelResultScreen,
// );
// return true;
}, },
child: SafeArea( child: SafeArea(
child: GestureDetector( child: GestureDetector(
+17 -8
View File
@@ -31,6 +31,7 @@ class _LabelFilterScreenState extends State<LabelFilterScreen> {
List<Map<String, String>> hospitalVals = []; List<Map<String, String>> hospitalVals = [];
bool isInit = true; bool isInit = true;
LabelFilterObject? filters; LabelFilterObject? filters;
@override @override
void initState() { void initState() {
filters = Provider.of<LabelsProvider>(context, listen: false).filters; filters = Provider.of<LabelsProvider>(context, listen: false).filters;
@@ -79,13 +80,16 @@ class _LabelFilterScreenState extends State<LabelFilterScreen> {
final _media = MediaQuery.of(context); final _media = MediaQuery.of(context);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return WillPopScope( return PopScope(
onWillPop: () async { canPop: false,
Navigator.pushReplacementNamed( onPopInvoked: (didPop) {
context, if (didPop) return;
Routes.labelResultScreen, Navigator.of(context).pushNamed(Routes.homePage);
); // Navigator.pushReplacementNamed(
return true; // context,
// Routes.labelResultScreen,
// );
// return true;
}, },
child: SafeArea( child: SafeArea(
child: GestureDetector( child: GestureDetector(
@@ -95,7 +99,12 @@ class _LabelFilterScreenState extends State<LabelFilterScreen> {
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
titleSpacing: -10, titleSpacing: -10,
title: Text('Labels', style: TextStyle(color: Colors.white,),), title: Text(
'Labels',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black, backgroundColor: Colors.black,
leading: IconButton( leading: IconButton(
icon: Icon( icon: Icon(
+68 -54
View File
@@ -1,11 +1,13 @@
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 '../../providers/connectivity.dart'; import '../../providers/connectivity.dart';
import '../../widgets/Global/internet_error.dart'; import '../../widgets/Global/internet_error.dart';
import '../../widgets/LabelScreens/Scan/input_box.dart'; import '../../widgets/LabelScreens/Scan/input_box.dart';
import '../../widgets/LabelScreens/Scan/save_button.dart'; import '../../widgets/LabelScreens/Scan/save_button.dart';
import '../../widgets/LabelScreens/Scan/scan_box.dart'; import '../../widgets/LabelScreens/Scan/scan_box.dart';
// import 'package:flutter/services.dart'; // import 'package:flutter/services.dart';
// import 'package:barcode_scan2/barcode_scan2.dart'; // import 'package:barcode_scan2/barcode_scan2.dart';
@@ -28,67 +30,79 @@ 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 SafeArea( return PopScope(
child: GestureDetector( canPop: false,
onTap: () { onPopInvoked: (didPop) {
FocusManager.instance.primaryFocus?.unfocus(); if (didPop) return;
}, Navigator.of(context).pushNamed(Routes.homePage);
child: Scaffold( },
appBar: AppBar( child: SafeArea(
titleSpacing: -10, child: GestureDetector(
title: Text('Labels', style: TextStyle(color: Colors.white,),), onTap: () {
backgroundColor: Colors.black, FocusManager.instance.primaryFocus?.unfocus();
leading: IconButton( },
icon: Icon( child: Scaffold(
Icons.keyboard_arrow_left, appBar: AppBar(
color: Colors.white, titleSpacing: -10,
size: 35, title: Text(
'Labels',
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(),
), ),
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(), SizedBox(
SizedBox( height: 10,
height: 10, ),
), Form(
Form( key: _form,
key: _form, child: LabelScanInputBox(
child: LabelScanInputBox( idCTRL: idCTRL,
deviceBlockSize: _deviceBlockSize,
),
),
SizedBox(
height: 70,
),
FilterScanSaveButton(
form: _form,
idCTRL: idCTRL, idCTRL: idCTRL,
deviceBlockSize: _deviceBlockSize, deviceBlockSize: _deviceBlockSize,
), ),
), ],
SizedBox( )
height: 70, : ConnectionErrorBox();
), },
FilterScanSaveButton( ),
form: _form,
idCTRL: idCTRL,
deviceBlockSize: _deviceBlockSize,
),
],
)
: ConnectionErrorBox();
},
), ),
), ),
), ),
@@ -29,6 +29,7 @@ class _MyItemsFilterScreenState extends State<MyItemsFilterScreen> {
bool isInit = true; bool isInit = true;
ItemFilterObject? filters; ItemFilterObject? filters;
@override @override
void initState() { void initState() {
filters = Provider.of<ItemProvider>(context, listen: false).filters; filters = Provider.of<ItemProvider>(context, listen: false).filters;
@@ -52,13 +53,16 @@ class _MyItemsFilterScreenState extends State<MyItemsFilterScreen> {
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 WillPopScope( return PopScope(
onWillPop: () async { canPop: false,
Navigator.pushReplacementNamed( onPopInvoked: (didPop) {
context, if (didPop) return;
Routes.myItemsResultScreen, Navigator.of(context).pushNamed(Routes.homePage);
); // Navigator.pushReplacementNamed(
return true; // context,
// Routes.myItemsResultScreen,
// );
// return true;
}, },
child: SafeArea( child: SafeArea(
child: GestureDetector( child: GestureDetector(
@@ -68,7 +72,12 @@ class _MyItemsFilterScreenState extends State<MyItemsFilterScreen> {
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
titleSpacing: -10, titleSpacing: -10,
title: Text('My Items', style: TextStyle(color: Colors.white,),), title: Text(
'My Items',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black, backgroundColor: Colors.black,
leading: IconButton( leading: IconButton(
icon: Icon( icon: Icon(
+162 -149
View File
@@ -5,6 +5,7 @@ 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 '../../config/routes.dart';
import '../../providers/connectivity.dart'; import '../../providers/connectivity.dart';
import '../../widgets/Global/internet_error.dart'; import '../../widgets/Global/internet_error.dart';
@@ -25,169 +26,181 @@ class _MyItemsScanScreenState extends State<MyItemsScanScreen> {
// 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 SafeArea( return PopScope(
child: GestureDetector( canPop: false,
onTap: () { onPopInvoked: (didPop) {
FocusManager.instance.primaryFocus?.unfocus(); if (didPop) return;
}, Navigator.of(context).pushNamed(Routes.homePage);
child: Scaffold( },
appBar: AppBar( child: SafeArea(
titleSpacing: -10, child: GestureDetector(
title: Text('My Items', style: TextStyle(color: Colors.white,),), onTap: () {
backgroundColor: Colors.black, FocusManager.instance.primaryFocus?.unfocus();
leading: IconButton( },
icon: Icon( child: Scaffold(
Icons.keyboard_arrow_left, appBar: AppBar(
color: Colors.white, titleSpacing: -10,
size: 35, title: Text(
'My Items',
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(),
), ),
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 an Item?',
'Looking for an Item?', 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 Item 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 Item Barcode',
print('access'); style: TextStyle(
} else { color: Colors.black,
launch( fontSize: 5 * _deviceBlockSize,
'https://cssd-doc.com/Show/Item/$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') {
SizedBox( print('cancel');
height: 10.0, } else if (result == 'error') {
), print('error');
Form( } else if (result == 'access') {
key: _form, print('access');
child: TextFormField( } else {
validator: (val) { launch(
if (val!.isEmpty) { 'https://cssd-doc.com/Show/Item/$result',
return 'Id required!!'; );
} // Navigator.of(context).pushNamed(
return null; // Routes.cycleDetailScreen,
// arguments: result,
// );
}
},
);
}, },
controller: idCTRL, ),
decoration: InputDecoration( SizedBox(
icon: Icon( height: 10.0,
FontAwesomeIcons.sortNumericDown, ),
size: 6 * _deviceBlockSize, Form(
), key: _form,
labelStyle: TextStyle( child: TextFormField(
fontWeight: FontWeight.w100, validator: (val) {
fontSize: 4 * _deviceBlockSize, if (val!.isEmpty) {
), return 'Id required!!';
isDense: true, }
labelText: 'Or enter an Item ID', return null;
contentPadding: EdgeInsets.symmetric( },
vertical: 2, controller: idCTRL,
horizontal: 3, decoration: InputDecoration(
), icon: Icon(
focusedBorder: UnderlineInputBorder( FontAwesomeIcons.sortNumericDown,
// borderRadius: BorderRadius.only(Radius.circular(4)), size: 6 * _deviceBlockSize,
borderSide: BorderSide( ),
color: Colors.grey, labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Or enter an Item 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: 70,
),
InkWell(
onTap: () {
if (!_form.currentState!.validate()) {
return;
}
launch(
'https://cssd-doc.com/Show/Item/${idCTRL.text}',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: idCTRL.text,
// );
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [kDarkBlue, kDarkBlueSub],
), ),
borderRadius: BorderRadius.circular(7), keyboardType: TextInputType.number,
), ),
child: Align( ),
alignment: Alignment.center, SizedBox(
child: Text( height: 70,
'Search', ),
style: TextStyle( InkWell(
color: Colors.white, onTap: () {
fontSize: 5 * _deviceBlockSize, if (!_form.currentState!.validate()) {
return;
}
launch(
'https://cssd-doc.com/Show/Item/${idCTRL.text}',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: idCTRL.text,
// );
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [kDarkBlue, kDarkBlueSub],
),
borderRadius: BorderRadius.circular(7),
),
child: Align(
alignment: Alignment.center,
child: Text(
'Search',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
),
), ),
), ),
), ),
), ),
), ],
], )
) : ConnectionErrorBox();
: ConnectionErrorBox(); },
}, ),
), ),
), ),
), ),
@@ -22,10 +22,12 @@ class _MyPackageFilterScreenState extends State<MyPackageFilterScreen> {
TextEditingController idCTRL = new TextEditingController(); TextEditingController idCTRL = new TextEditingController();
TextEditingController hospitalCTRL = new TextEditingController(); TextEditingController hospitalCTRL = new TextEditingController();
TextEditingController nameCTRL = new TextEditingController(); TextEditingController nameCTRL = new TextEditingController();
// TextEditingController udiCTRL = new TextEditingController(); // TextEditingController udiCTRL = new TextEditingController();
bool isInit = true; bool isInit = true;
PackageFilterObject? filters; PackageFilterObject? filters;
@override @override
void initState() { void initState() {
filters = Provider.of<PackageProvider>(context, listen: false).filters; filters = Provider.of<PackageProvider>(context, listen: false).filters;
@@ -49,13 +51,16 @@ class _MyPackageFilterScreenState extends State<MyPackageFilterScreen> {
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 WillPopScope( return PopScope(
onWillPop: () async { canPop: false,
Navigator.pushReplacementNamed( onPopInvoked: (didPop) {
context, if (didPop) return;
Routes.myPackagesResultScreen, Navigator.of(context).pushNamed(Routes.homePage);
); // Navigator.pushReplacementNamed(
return true; // context,
// Routes.myPackagesResultScreen,
// );
// return true;
}, },
child: SafeArea( child: SafeArea(
child: GestureDetector( child: GestureDetector(
@@ -65,7 +70,12 @@ class _MyPackageFilterScreenState extends State<MyPackageFilterScreen> {
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
titleSpacing: -10, titleSpacing: -10,
title: Text('My Packages', style: TextStyle(color: Colors.white,),), title: Text(
'My Packages',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black, backgroundColor: Colors.black,
leading: IconButton( leading: IconButton(
icon: Icon( icon: Icon(
@@ -5,6 +5,7 @@ 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 '../../config/routes.dart';
import '../../providers/connectivity.dart'; import '../../providers/connectivity.dart';
import '../../widgets/Global/internet_error.dart'; import '../../widgets/Global/internet_error.dart';
@@ -25,169 +26,181 @@ class _MyPackagesScanScreenState extends State<MyPackagesScanScreen> {
// 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 SafeArea( return PopScope(
child: GestureDetector( canPop: false,
onTap: () { onPopInvoked: (didPop) {
FocusManager.instance.primaryFocus?.unfocus(); if (didPop) return;
}, Navigator.of(context).pushNamed(Routes.homePage);
child: Scaffold( },
appBar: AppBar( child: SafeArea(
titleSpacing: -10, child: GestureDetector(
title: Text('My Packages', style: TextStyle(color: Colors.white,),), onTap: () {
backgroundColor: Colors.black, FocusManager.instance.primaryFocus?.unfocus();
leading: IconButton( },
icon: Icon( child: Scaffold(
Icons.keyboard_arrow_left, appBar: AppBar(
color: Colors.white, titleSpacing: -10,
size: 35, title: Text(
'My Packages',
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(),
), ),
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 Package?',
'Looking for a Package?', 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 Package 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 Package Barcode',
print('access'); style: TextStyle(
} else { color: Colors.black,
launch( fontSize: 5 * _deviceBlockSize,
'https://cssd-doc.com/Show/Package/$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') {
SizedBox( print('cancel');
height: 10.0, } else if (result == 'error') {
), print('error');
Form( } else if (result == 'access') {
key: _form, print('access');
child: TextFormField( } else {
validator: (val) { launch(
if (val!.isEmpty) { 'https://cssd-doc.com/Show/Package/$result',
return 'Id required!!'; );
} // Navigator.of(context).pushNamed(
return null; // Routes.cycleDetailScreen,
// arguments: result,
// );
}
},
);
}, },
controller: idCTRL, ),
decoration: InputDecoration( SizedBox(
icon: Icon( height: 10.0,
FontAwesomeIcons.sortNumericDown, ),
size: 6 * _deviceBlockSize, Form(
), key: _form,
labelStyle: TextStyle( child: TextFormField(
fontWeight: FontWeight.w100, validator: (val) {
fontSize: 4 * _deviceBlockSize, if (val!.isEmpty) {
), return 'Id required!!';
isDense: true, }
labelText: 'Or enter a Package ID', return null;
contentPadding: EdgeInsets.symmetric( },
vertical: 2, controller: idCTRL,
horizontal: 3, decoration: InputDecoration(
), icon: Icon(
focusedBorder: UnderlineInputBorder( FontAwesomeIcons.sortNumericDown,
// borderRadius: BorderRadius.only(Radius.circular(4)), size: 6 * _deviceBlockSize,
borderSide: BorderSide( ),
color: Colors.grey, labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Or enter a Package 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: 70,
),
InkWell(
onTap: () {
if (!_form.currentState!.validate()) {
return;
}
launch(
'https://cssd-doc.com/Show/Package/${idCTRL.text}',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: idCTRL.text,
// );
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [kDarkPurple, kDarkPurpleSub],
), ),
borderRadius: BorderRadius.circular(7), keyboardType: TextInputType.number,
), ),
child: Align( ),
alignment: Alignment.center, SizedBox(
child: Text( height: 70,
'Search', ),
style: TextStyle( InkWell(
color: Colors.white, onTap: () {
fontSize: 5 * _deviceBlockSize, if (!_form.currentState!.validate()) {
return;
}
launch(
'https://cssd-doc.com/Show/Package/${idCTRL.text}',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: idCTRL.text,
// );
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [kDarkPurple, kDarkPurpleSub],
),
borderRadius: BorderRadius.circular(7),
),
child: Align(
alignment: Alignment.center,
child: Text(
'Search',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
),
), ),
), ),
), ),
), ),
), ],
], )
) : ConnectionErrorBox();
: ConnectionErrorBox(); },
}, ),
), ),
), ),
), ),
+11 -8
View File
@@ -66,14 +66,17 @@ class _PackageAddScreenState extends State<PackageAddScreen> {
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return Consumer<PackageProvider>( return Consumer<PackageProvider>(
builder: (context, packageProvider, _) { builder: (context, packageProvider, _) {
return WillPopScope( return PopScope(
onWillPop: () async { canPop: false,
packageProvider.resetLoadingButton(); onPopInvoked: (didPop) {
Navigator.pushReplacementNamed( if (didPop) return;
context, Navigator.of(context).pushNamed(Routes.homePage);
Routes.packageResultScreen, // packageProvider.resetLoadingButton();
); // Navigator.pushReplacementNamed(
return true; // context,
// Routes.packageResultScreen,
// );
// return true;
}, },
child: SafeArea( child: SafeArea(
child: GestureDetector( child: GestureDetector(
@@ -22,11 +22,13 @@ class _PackageFilterScreenState extends State<PackageFilterScreen> {
TextEditingController idCTRL = new TextEditingController(); TextEditingController idCTRL = new TextEditingController();
TextEditingController hospitalCTRL = new TextEditingController(); TextEditingController hospitalCTRL = new TextEditingController();
TextEditingController nameCTRL = new TextEditingController(); TextEditingController nameCTRL = new TextEditingController();
// TextEditingController udiCTRL = new TextEditingController(); // TextEditingController udiCTRL = new TextEditingController();
List<Map<String, String>> hospitalVals = []; List<Map<String, String>> hospitalVals = [];
bool isInit = true; bool isInit = true;
PackageFilterObject? filters; PackageFilterObject? filters;
@override @override
void initState() { void initState() {
filters = Provider.of<PackageProvider>(context, listen: false).filters; filters = Provider.of<PackageProvider>(context, listen: false).filters;
@@ -76,13 +78,16 @@ class _PackageFilterScreenState extends State<PackageFilterScreen> {
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 WillPopScope( return PopScope(
onWillPop: () async { canPop: false,
Navigator.pushReplacementNamed( onPopInvoked: (didPop) {
context, if (didPop) return;
Routes.packageResultScreen, Navigator.of(context).pushNamed(Routes.homePage);
); // Navigator.pushReplacementNamed(
return true; // context,
// Routes.packageResultScreen,
// );
// return true;
}, },
child: SafeArea( child: SafeArea(
child: GestureDetector( child: GestureDetector(
@@ -92,7 +97,12 @@ class _PackageFilterScreenState extends State<PackageFilterScreen> {
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
titleSpacing: -10, titleSpacing: -10,
title: Text('Packages', style: TextStyle(color: Colors.white,),), title: Text(
'Packages',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black, backgroundColor: Colors.black,
leading: IconButton( leading: IconButton(
icon: Icon( icon: Icon(
+162 -149
View File
@@ -5,6 +5,7 @@ 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 '../../config/routes.dart';
import '../../providers/connectivity.dart'; import '../../providers/connectivity.dart';
import '../../widgets/Global/internet_error.dart'; import '../../widgets/Global/internet_error.dart';
@@ -25,169 +26,181 @@ class _PackageScanScreenState extends State<PackageScanScreen> {
// 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 SafeArea( return PopScope(
child: GestureDetector( canPop: false,
onTap: () { onPopInvoked: (didPop) {
FocusManager.instance.primaryFocus?.unfocus(); if (didPop) return;
}, Navigator.of(context).pushNamed(Routes.homePage);
child: Scaffold( },
appBar: AppBar( child: SafeArea(
titleSpacing: -10, child: GestureDetector(
title: Text('Packages', style: TextStyle(color: Colors.white,),), onTap: () {
backgroundColor: Colors.black, FocusManager.instance.primaryFocus?.unfocus();
leading: IconButton( },
icon: Icon( child: Scaffold(
Icons.keyboard_arrow_left, appBar: AppBar(
color: Colors.white, titleSpacing: -10,
size: 35, title: Text(
'Packages',
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(),
), ),
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 Package?',
'Looking for a Package?', 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 Package 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 Package Barcode',
print('access'); style: TextStyle(
} else { color: Colors.black,
launch( fontSize: 5 * _deviceBlockSize,
'https://cssd-doc.com/Show/Package/$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') {
SizedBox( print('cancel');
height: 10.0, } else if (result == 'error') {
), print('error');
Form( } else if (result == 'access') {
key: _form, print('access');
child: TextFormField( } else {
validator: (val) { launch(
if (val!.isEmpty) { 'https://cssd-doc.com/Show/Package/$result',
return 'Id required!!'; );
} // Navigator.of(context).pushNamed(
return null; // Routes.cycleDetailScreen,
// arguments: result,
// );
}
},
);
}, },
controller: idCTRL, ),
decoration: InputDecoration( SizedBox(
icon: Icon( height: 10.0,
FontAwesomeIcons.sortNumericDown, ),
size: 6 * _deviceBlockSize, Form(
), key: _form,
labelStyle: TextStyle( child: TextFormField(
fontWeight: FontWeight.w100, validator: (val) {
fontSize: 4 * _deviceBlockSize, if (val!.isEmpty) {
), return 'Id required!!';
isDense: true, }
labelText: 'Or enter a Package ID', return null;
contentPadding: EdgeInsets.symmetric( },
vertical: 2, controller: idCTRL,
horizontal: 3, decoration: InputDecoration(
), icon: Icon(
focusedBorder: UnderlineInputBorder( FontAwesomeIcons.sortNumericDown,
// borderRadius: BorderRadius.only(Radius.circular(4)), size: 6 * _deviceBlockSize,
borderSide: BorderSide( ),
color: Colors.grey, labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Or enter a Package 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: 70,
),
InkWell(
onTap: () {
if (!_form.currentState!.validate()) {
return;
}
launch(
'https://cssd-doc.com/Show/Package/${idCTRL.text}',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: idCTRL.text,
// );
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [kPurple, kPurpleSub],
), ),
borderRadius: BorderRadius.circular(7), keyboardType: TextInputType.number,
), ),
child: Align( ),
alignment: Alignment.center, SizedBox(
child: Text( height: 70,
'Search', ),
style: TextStyle( InkWell(
color: Colors.white, onTap: () {
fontSize: 5 * _deviceBlockSize, if (!_form.currentState!.validate()) {
return;
}
launch(
'https://cssd-doc.com/Show/Package/${idCTRL.text}',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: idCTRL.text,
// );
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [kPurple, kPurpleSub],
),
borderRadius: BorderRadius.circular(7),
),
child: Align(
alignment: Alignment.center,
child: Text(
'Search',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
),
), ),
), ),
), ),
), ),
), ],
], )
) : ConnectionErrorBox();
: ConnectionErrorBox(); },
}, ),
), ),
), ),
), ),
+17 -8
View File
@@ -23,6 +23,7 @@ class _TestResultAddScreenState extends State<TestResultAddScreen> {
TextEditingController testCodeCTRL = new TextEditingController(); TextEditingController testCodeCTRL = new TextEditingController();
bool isInit = true; bool isInit = true;
@override @override
void didChangeDependencies() { void didChangeDependencies() {
if (isInit) { if (isInit) {
@@ -48,19 +49,27 @@ class _TestResultAddScreenState extends State<TestResultAddScreen> {
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return WillPopScope( return PopScope(
onWillPop: () async { canPop: false,
Navigator.pushReplacementNamed( onPopInvoked: (didPop) {
context, if (didPop) return;
Routes.testResultScreen, Navigator.of(context).pushNamed(Routes.homePage);
); // Navigator.pushReplacementNamed(
return true; // context,
// Routes.testResultScreen,
// );
// return true;
}, },
child: SafeArea( child: SafeArea(
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
titleSpacing: -10, titleSpacing: -10,
title: Text('Test Results', style: TextStyle(color: Colors.white,),), title: Text(
'Test Results',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black, backgroundColor: Colors.black,
leading: IconButton( leading: IconButton(
icon: Icon( icon: Icon(
+10 -7
View File
@@ -128,13 +128,16 @@ class _TestFilterScreenState extends State<TestFilterScreen> {
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return WillPopScope( return PopScope(
onWillPop: () async { canPop: false,
Navigator.pushReplacementNamed( onPopInvoked: (didPop) {
context, if (didPop) return;
Routes.testResultScreen, Navigator.of(context).pushNamed(Routes.homePage);
); // Navigator.pushReplacementNamed(
return true; // context,
// Routes.testResultScreen,
// );
// return true;
}, },
child: SafeArea( child: SafeArea(
child: GestureDetector( child: GestureDetector(
+10 -7
View File
@@ -96,13 +96,16 @@ class _FormPageState extends State<FormPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return PopScope(
onWillPop: () async { canPop: false,
Navigator.pushReplacementNamed( onPopInvoked: (didPop) {
context, if (didPop) return;
Routes.testResultAddScreen, Navigator.of(context).pushNamed(Routes.homePage);
); // Navigator.pushReplacementNamed(
return true; // context,
// Routes.testResultAddScreen,
// );
// return true;
}, },
child: SafeArea( child: SafeArea(
child: Scaffold( child: Scaffold(
+154 -141
View File
@@ -4,6 +4,7 @@ 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 '../../config/routes.dart';
import '../../providers/connectivity.dart'; import '../../providers/connectivity.dart';
import '../../widgets/Global/internet_error.dart'; import '../../widgets/Global/internet_error.dart';
@@ -26,161 +27,173 @@ 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 SafeArea( return PopScope(
child: Scaffold( canPop: false,
appBar: AppBar( onPopInvoked: (didPop) {
titleSpacing: -10, if (didPop) return;
title: Text('Test Results', style: TextStyle(color: Colors.white,),), Navigator.of(context).pushNamed(Routes.homePage);
backgroundColor: Colors.black, },
leading: IconButton( child: SafeArea(
icon: Icon( child: Scaffold(
Icons.keyboard_arrow_left, appBar: AppBar(
color: Colors.white, titleSpacing: -10,
size: 35, 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(),
), ),
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 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') {
SizedBox( print('cancel');
height: 10.0, } else if (result == 'error') {
), print('error');
Form( } else if (result == 'access') {
key: _form, print('access');
child: TextFormField( } else {
validator: (val) { launch(
if (val!.isEmpty) { 'https://cssd-doc.com/Show/TestResult/$result',
return 'Id required!!'; );
} // Navigator.of(context).pushNamed(
return null; // Routes.cycleDetailScreen,
// arguments: result,
// );
}
},
);
}, },
controller: idCTRL, ),
decoration: InputDecoration( SizedBox(
icon: Icon( height: 10.0,
FontAwesomeIcons.sortNumericDown, ),
size: 6 * _deviceBlockSize, Form(
), key: _form,
labelStyle: TextStyle( child: TextFormField(
fontWeight: FontWeight.w100, validator: (val) {
fontSize: 4 * _deviceBlockSize, if (val!.isEmpty) {
), return 'Id required!!';
isDense: true, }
labelText: 'Or enter a Test Result ID', return null;
contentPadding: EdgeInsets.symmetric( },
vertical: 2, controller: idCTRL,
horizontal: 3, decoration: InputDecoration(
), icon: Icon(
focusedBorder: UnderlineInputBorder( FontAwesomeIcons.sortNumericDown,
// borderRadius: BorderRadius.only(Radius.circular(4)), size: 6 * _deviceBlockSize,
borderSide: BorderSide( ),
color: Colors.grey, labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Or enter a Test Result ID',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
focusedBorder: UnderlineInputBorder(
// borderRadius: BorderRadius.only(Radius.circular(4)),
borderSide: BorderSide(
color: Colors.grey,
),
), ),
), ),
), style: TextStyle(
style: TextStyle( fontWeight: FontWeight.w700,
fontWeight: FontWeight.w700, fontSize: 5 * _deviceBlockSize,
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), keyboardType: TextInputType.number,
), ),
child: Align( ),
alignment: Alignment.center, SizedBox(
child: Text( height: 70,
'Search', ),
style: TextStyle( InkWell(
color: Colors.white, onTap: () {
fontSize: 5 * _deviceBlockSize, 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(); },
}, ),
), ),
), ),
); );