This commit is contained in:
HooDie
2023-11-11 19:57:09 +03:30
parent b567d4dac9
commit f43f5cc54f
41 changed files with 1181 additions and 399 deletions
@@ -118,7 +118,7 @@ class _MyPackagesMineScreenState extends State<MyPackagesMineScreen> {
label: 'ID',
id: '',
name: package.filters!.name,
udi: package.filters!.udi,
// udi: package.filters!.udi,
)
: Container(),
package.filters!.name != ''
@@ -127,18 +127,18 @@ class _MyPackagesMineScreenState extends State<MyPackagesMineScreen> {
label: 'Package Name',
id: package.filters!.id,
name: '',
udi: package.filters!.udi,
)
: Container(),
package.filters!.udi != ''
? MyPackageFilterChip(
deviceBlockSize: _deviceBlockSize,
label: 'UDI',
id: package.filters!.id,
name: package.filters!.name,
udi: '',
// udi: package.filters!.udi,
)
: Container(),
// package.filters!.udi != ''
// ? MyPackageFilterChip(
// deviceBlockSize: _deviceBlockSize,
// label: 'UDI',
// id: package.filters!.id,
// name: package.filters!.name,
// udi: '',
// )
// : Container(),
],
),
);
@@ -1,4 +1,5 @@
import 'package:cssd/config/colors.dart';
import 'package:cssd/config/routes.dart';
import 'package:cssd/pages/MyPackagesPages/Result/my_packages_mine_screen.dart';
import 'package:cssd/pages/MyPackagesPages/Result/my_packages_requests_screen.dart';
import 'package:flutter/material.dart';
@@ -28,6 +29,9 @@ class _MyPackagesResultScreenState extends State<MyPackagesResultScreen>
@override
Widget build(BuildContext context) {
final _media = MediaQuery.of(context);
final double _deviceWidth = _media.size.width;
final double _deviceBlockSize = _deviceWidth / 100;
return SafeArea(
child: GestureDetector(
onTap: () {
@@ -60,6 +64,9 @@ class _MyPackagesResultScreenState extends State<MyPackagesResultScreen>
],
),
),
floatingActionButton: MyPackageResultFloatingButton(
deviceBlockSize: _deviceBlockSize,
),
body: TabBarView(
controller: _tabController,
children: [
@@ -73,3 +80,35 @@ class _MyPackagesResultScreenState extends State<MyPackagesResultScreen>
);
}
}
class MyPackageResultFloatingButton extends StatelessWidget {
const MyPackageResultFloatingButton({
Key? key,
required double deviceBlockSize,
}) : _deviceBlockSize = deviceBlockSize,
super(key: key);
final double _deviceBlockSize;
@override
Widget build(BuildContext context) {
return InkWell(
customBorder: CircleBorder(),
onTap: () {
Navigator.of(context).pushNamed(Routes.myPackagesScanScreen);
},
child: Container(
padding: EdgeInsets.all(2.5 * _deviceBlockSize),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 7.1 * _deviceBlockSize,
color: Colors.white,
),
),
);
}
}
@@ -22,7 +22,7 @@ class _MyPackageFilterScreenState extends State<MyPackageFilterScreen> {
TextEditingController idCTRL = new TextEditingController();
TextEditingController hospitalCTRL = new TextEditingController();
TextEditingController nameCTRL = new TextEditingController();
TextEditingController udiCTRL = new TextEditingController();
// TextEditingController udiCTRL = new TextEditingController();
bool isInit = true;
PackageFilterObject? filters;
@@ -32,7 +32,7 @@ class _MyPackageFilterScreenState extends State<MyPackageFilterScreen> {
idCTRL.text = filters!.id;
hospitalCTRL.text = filters!.hospital;
nameCTRL.text = filters!.name;
udiCTRL.text = filters!.udi;
// udiCTRL.text = filters!.udi;
super.initState();
}
@@ -203,82 +203,82 @@ class _MyPackageFilterScreenState extends State<MyPackageFilterScreen> {
.requestFocus(_udiFocusNode);
},
),
SizedBox(
height: 30,
),
Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
controller: udiCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'UDI',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _udiFocusNode,
keyboardType: TextInputType.text,
textInputAction: TextInputAction.next,
),
),
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;
}
},
);
},
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: 30,
// ),
// Row(
// children: [
// Flexible(
// flex: 8,
// child: TextFormField(
// controller: udiCTRL,
// decoration: InputDecoration(
// icon: Icon(
// FontAwesomeIcons.alignLeft,
// size: 6 * _deviceBlockSize,
// ),
// labelStyle: TextStyle(
// fontWeight: FontWeight.w100,
// fontSize: 4 * _deviceBlockSize,
// ),
// labelText: 'UDI',
// isDense: true,
// contentPadding: EdgeInsets.symmetric(
// vertical: 2,
// horizontal: 3,
// ),
// ),
// style: TextStyle(
// fontWeight: FontWeight.w700,
// fontSize: 5 * _deviceBlockSize,
// ),
// focusNode: _udiFocusNode,
// keyboardType: TextInputType.text,
// textInputAction: TextInputAction.next,
// ),
// ),
// 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;
// }
// },
// );
// },
// 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: 90,
),
MyPackagesFilterSaveButton(
idCTRL: idCTRL,
nameCTRL: nameCTRL,
udiCTRL: udiCTRL,
// udiCTRL: udiCTRL,
deviceBlockSize: _deviceBlockSize,
firstColor: kDarkPurple,
secondColor: kDarkPurpleSub,
@@ -0,0 +1,195 @@
import 'package:cssd/config/colors.dart';
import 'package:cssd/utils/scan.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../providers/connectivity.dart';
import '../../widgets/Global/internet_error.dart';
class MyPackagesScanScreen extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _MyPackagesScanScreenState();
}
}
class _MyPackagesScanScreenState extends State<MyPackagesScanScreen> {
TextEditingController idCTRL = new TextEditingController();
final _form = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
final _media = MediaQuery.of(context);
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _deviceWidth = _media.size.width;
final double _deviceBlockSize = _deviceWidth / 100;
return SafeArea(
child: GestureDetector(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
},
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('My Packages'),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
),
),
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? ListView(
padding: EdgeInsets.symmetric(horizontal: 20),
children: <Widget>[
Container(
padding: EdgeInsets.only(top: 30),
child: Text(
'Looking for a Package?',
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 Package 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/Package/$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(
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(
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/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();
},
),
),
),
);
}
}