mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-13 02:18:56 +03:30
1.7.0
This commit is contained in:
@@ -20,7 +20,6 @@ class _ForgetPassScreenState extends State<ForgetPassScreen> {
|
||||
bool _isLoading = false;
|
||||
final cellNumberController = TextEditingController();
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
cellNumberController.text = '';
|
||||
@@ -59,7 +58,7 @@ class _ForgetPassScreenState extends State<ForgetPassScreen> {
|
||||
_isLoading = true;
|
||||
});
|
||||
// try {
|
||||
await Provider.of<Auth>(context)
|
||||
await Provider.of<Auth>(context, listen: false)
|
||||
.requestCode(
|
||||
cellNumberController.text,
|
||||
)
|
||||
@@ -72,7 +71,7 @@ class _ForgetPassScreenState extends State<ForgetPassScreen> {
|
||||
_isLoading = false;
|
||||
},
|
||||
);
|
||||
} else{
|
||||
} else {
|
||||
// _showDialog('User or password incorrect!');
|
||||
Navigator.of(context).popAndPushNamed(Routes.sendCodeScreen);
|
||||
// setState(
|
||||
@@ -153,7 +152,6 @@ class _ForgetPassScreenState extends State<ForgetPassScreen> {
|
||||
),
|
||||
keyboardType: TextInputType.phone,
|
||||
textInputAction: TextInputAction.next,
|
||||
|
||||
onSaved: (value) {
|
||||
cellNumberController.text = value;
|
||||
},
|
||||
|
||||
+229
-29
@@ -1,7 +1,10 @@
|
||||
import 'package:barcode_scan/platform_wrapper.dart';
|
||||
import 'package:double_back_to_close_app/double_back_to_close_app.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_phoenix/flutter_phoenix.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import './my_info_screen.dart';
|
||||
import '../providers/auth.dart';
|
||||
@@ -19,7 +22,8 @@ class HomePage extends StatelessWidget {
|
||||
// static const route = '/HomeScreen';
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final userData = Provider.of<Auth>(context,listen: false).user;
|
||||
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||
|
||||
// print(userData['roles']);
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomPadding: false,
|
||||
@@ -53,7 +57,7 @@ class HomePage extends StatelessWidget {
|
||||
child: Text('Yes'),
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
Provider.of<Auth>(context).logout();
|
||||
Provider.of<Auth>(context, listen: false).logout();
|
||||
Phoenix.rebirth(context);
|
||||
},
|
||||
),
|
||||
@@ -106,35 +110,75 @@ class HomePage extends StatelessWidget {
|
||||
endColor: Color(0xFFFFECD2),
|
||||
firstLine: 'My INFO',
|
||||
secondLine: 'List, Details & Add a one',
|
||||
onTap: Consumer<Auth>(
|
||||
builder: (ctx, auth, _) {
|
||||
return MyInfoScreen();
|
||||
},
|
||||
onTap: () => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) {
|
||||
return Consumer<Auth>(
|
||||
builder: (ctx, auth, _) {
|
||||
return MyInfoScreen();
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
SelectionItem(
|
||||
startColor: Color(0xFFD5F5FD),
|
||||
endColor: Color(0xFFE9FFF7),
|
||||
firstLine: 'TEST RESULTS',
|
||||
secondLine: 'List, Details & Add a one',
|
||||
onTap: TestResultScreen()
|
||||
// MyTestResult(
|
||||
// isAdmin: false,
|
||||
// ),
|
||||
startColor: Color(0xFFD5F5FD),
|
||||
endColor: Color(0xFFE9FFF7),
|
||||
firstLine: 'TEST RESULTS',
|
||||
secondLine: 'List, Details & Add a one',
|
||||
onTap: () => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) {
|
||||
return Consumer<Auth>(
|
||||
builder: (ctx, auth, _) {
|
||||
return TestResultScreen();
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
// MyTestResult(
|
||||
// isAdmin: false,
|
||||
// ),
|
||||
),
|
||||
SelectionItem(
|
||||
startColor: Color(0xFFE2D2C4),
|
||||
endColor: Color(0xFFFAF7F5),
|
||||
firstLine: 'LABELS',
|
||||
secondLine: 'List, Details & Add a one',
|
||||
onTap: LabelResultScreen(),
|
||||
onTap: () => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) {
|
||||
return Consumer<Auth>(
|
||||
builder: (ctx, auth, _) {
|
||||
return LabelResultScreen();
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
SelectionItem(
|
||||
startColor: Color(0xFFA7CCE1),
|
||||
endColor: Color(0xFFECF7ED),
|
||||
firstLine: 'CYCLES',
|
||||
secondLine: 'List, Details & Add a one',
|
||||
onTap: CycleResultScreen(),
|
||||
onTap: () => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) {
|
||||
return Consumer<Auth>(
|
||||
builder: (ctx, auth, _) {
|
||||
return CycleResultScreen();
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
// SelectionItem(
|
||||
// startColor: Color(0xFFA7CCE1),
|
||||
@@ -149,9 +193,21 @@ class HomePage extends StatelessWidget {
|
||||
startColor: Color(0xFFA7CCE1),
|
||||
endColor: Color(0xFFECF7ED),
|
||||
firstLine: 'TEST TO VERIFY',
|
||||
secondLine: 'List, Details & Add a one',
|
||||
onTap: TestVerifyScreen(),
|
||||
secondLine: 'Verify and reject Test Results',
|
||||
onTap: () => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) {
|
||||
return Consumer<Auth>(
|
||||
builder: (ctx, auth, _) {
|
||||
return TestVerifyScreen();
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
BarcodeSelectionItem(),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -163,12 +219,33 @@ class HomePage extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
Future<String> scan() async {
|
||||
try {
|
||||
var barcode = await BarcodeScanner.scan();
|
||||
if (barcode.type.name == 'Cancelled') {
|
||||
return 'cancel';
|
||||
} else if (barcode.type.name == 'Failed') {
|
||||
return 'error';
|
||||
}
|
||||
try {
|
||||
var id = barcode.rawContent;
|
||||
return id;
|
||||
} catch (_) {
|
||||
return 'null';
|
||||
}
|
||||
} on PlatformException catch (_) {
|
||||
return 'access';
|
||||
} catch (_) {
|
||||
return 'error';
|
||||
}
|
||||
}
|
||||
|
||||
class SelectionItem extends StatelessWidget {
|
||||
final Color startColor;
|
||||
final Color endColor;
|
||||
final String firstLine;
|
||||
final String secondLine;
|
||||
final Widget onTap;
|
||||
final Function onTap;
|
||||
|
||||
SelectionItem(
|
||||
{this.startColor,
|
||||
@@ -196,16 +273,7 @@ class SelectionItem extends StatelessWidget {
|
||||
),
|
||||
child: InkWell(
|
||||
splashColor: Colors.red,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) {
|
||||
return onTap;
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
onTap: onTap,
|
||||
child: ListTile(
|
||||
title: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -258,3 +326,135 @@ class SelectionItem extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class BarcodeSelectionItem extends StatelessWidget {
|
||||
@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 Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 10),
|
||||
padding: EdgeInsets.symmetric(vertical: 5),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [Colors.black, Colors.black87],
|
||||
),
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(3),
|
||||
),
|
||||
),
|
||||
child: InkWell(
|
||||
splashColor: Colors.red,
|
||||
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);
|
||||
showDialog(
|
||||
context: context,
|
||||
child: AlertDialog(
|
||||
title: Text(
|
||||
'نتیجه ی اسکن',
|
||||
textDirection: TextDirection.rtl,
|
||||
textAlign: TextAlign.right,
|
||||
style: TextStyle(
|
||||
fontSize: 2.75 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
content: Text(
|
||||
result,
|
||||
textDirection: TextDirection.rtl,
|
||||
style: TextStyle(
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
onPressed: () async {
|
||||
await launch(result);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Text(
|
||||
'بازکردن در مرورگر',
|
||||
style: TextStyle(
|
||||
fontFamily: 'montserrat',
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
child: ListTile(
|
||||
title: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.qr_code_scanner,
|
||||
color: Colors.white,
|
||||
size: 8 * _deviceBlockSize,
|
||||
),
|
||||
SizedBox(
|
||||
width: 2 * _deviceBlockSize,
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'SCANNER',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
letterSpacing: 3.5,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Scan a Bar or QR code',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 3.5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
trailing: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
// Column(
|
||||
// children: <Widget>[
|
||||
// ListTile(
|
||||
// title: Text(
|
||||
// firstLine,
|
||||
// textAlign: TextAlign.start,
|
||||
// style: TextStyle(color: Colors.black),
|
||||
// ),
|
||||
// ),
|
||||
// ListTile(
|
||||
// title: Text(
|
||||
// secondLine,
|
||||
// style: TextStyle(color: Colors.black, fontSize: 20),
|
||||
// ),
|
||||
// trailing: Icon(
|
||||
// Icons.arrow_forward_ios,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
_isLoading = true;
|
||||
});
|
||||
// try {
|
||||
await Provider.of<Auth>(context)
|
||||
await Provider.of<Auth>(context, listen: false)
|
||||
.login(
|
||||
map['cellNumber'],
|
||||
map['password'],
|
||||
|
||||
@@ -37,7 +37,7 @@ class _RePassScreenState extends State<RePassScreen> {
|
||||
super.didChangeDependencies();
|
||||
}
|
||||
|
||||
Future<void> _showDialog(String message) async{
|
||||
Future<void> _showDialog(String message) async {
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
@@ -62,11 +62,12 @@ class _RePassScreenState extends State<RePassScreen> {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
await Provider.of<Auth>(context)
|
||||
await Provider.of<Auth>(context, listen: false)
|
||||
.sendRePass(passwordController.text, token)
|
||||
.then((value) async{
|
||||
.then((value) async {
|
||||
if (value == 'done') {
|
||||
await _showDialog('Password changed successfully.Now login to your account.');
|
||||
await _showDialog(
|
||||
'Password changed successfully.Now login to your account.');
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -71,7 +71,7 @@ class _FormPageState extends State<FormPage> {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
Provider.of<Inputs>(context)
|
||||
Provider.of<Inputs>(context, listen: false)
|
||||
.getInputs(
|
||||
testResultId: this.widget.testResultId ?? "",
|
||||
name: this.widget.name ?? "",
|
||||
@@ -186,6 +186,6 @@ class _FormPageState extends State<FormPage> {
|
||||
formatData(input['children']);
|
||||
}
|
||||
}
|
||||
print(values);
|
||||
// print(values);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ class _VerifyPassScreenState extends State<VerifyPassScreen> {
|
||||
bool _isLoading = false;
|
||||
final codeCTRL = TextEditingController();
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
codeCTRL.text = '';
|
||||
@@ -59,7 +58,7 @@ class _VerifyPassScreenState extends State<VerifyPassScreen> {
|
||||
_isLoading = true;
|
||||
});
|
||||
// try {
|
||||
await Provider.of<Auth>(context)
|
||||
await Provider.of<Auth>(context, listen: false)
|
||||
.sendCode(
|
||||
codeCTRL.text,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user