mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-13 14:08:55 +03:30
Improve navigation back
This commit is contained in:
@@ -25,6 +25,7 @@ class _TestVerifyScreenState extends State<TestVerifyScreen> {
|
||||
ScrollController? sc;
|
||||
|
||||
bool _isInit = true;
|
||||
|
||||
// List<TestResult> _data = [];
|
||||
|
||||
@override
|
||||
@@ -90,7 +91,7 @@ class _TestVerifyScreenState extends State<TestVerifyScreen> {
|
||||
color: Colors.white,
|
||||
size: 35,
|
||||
),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
onPressed: () => Navigator.of(context).pushNamed(Routes.homePage),
|
||||
),
|
||||
),
|
||||
body: Padding(
|
||||
@@ -285,6 +286,7 @@ class TestItemBox extends StatelessWidget {
|
||||
super(key: key);
|
||||
final Map<String, dynamic> userData;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
// final String _id;
|
||||
|
||||
@override
|
||||
@@ -355,161 +357,171 @@ class TestItemBox extends StatelessWidget {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
item.verified == 'None' ?
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: Text('Verify'),
|
||||
content: Text(
|
||||
'Are you sure for verify this test?'),
|
||||
actions: <Widget>[
|
||||
Consumer<TestResultsProvider>(builder:
|
||||
(context, testResultsProvider, child) {
|
||||
return testResultsProvider.isloadingButton
|
||||
? CircularProgressIndicator(
|
||||
color: Colors.black,
|
||||
)
|
||||
: TextButton(
|
||||
onPressed: () async {
|
||||
testResultsProvider
|
||||
.setLoadingButton();
|
||||
await Provider.of<
|
||||
TestResultsProvider>(
|
||||
context,
|
||||
listen: false)
|
||||
.changeVerification(
|
||||
item.id, 'Verified')
|
||||
.then((result) {
|
||||
if (result) {
|
||||
print('true');
|
||||
}
|
||||
Navigator.of(ctx).pop();
|
||||
Navigator.of(context)
|
||||
.popAndPushNamed(Routes
|
||||
.testVerifyScreen);
|
||||
Fluttertoast.showToast(
|
||||
msg: "Test is verified.",
|
||||
toastLength:
|
||||
Toast.LENGTH_SHORT,
|
||||
gravity:
|
||||
ToastGravity.BOTTOM,
|
||||
item.verified == 'None'
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: Text('Verify'),
|
||||
content: Text(
|
||||
'Are you sure for verify this test?'),
|
||||
actions: <Widget>[
|
||||
Consumer<TestResultsProvider>(builder:
|
||||
(context, testResultsProvider,
|
||||
child) {
|
||||
return testResultsProvider
|
||||
.isloadingButton
|
||||
? CircularProgressIndicator(
|
||||
color: Colors.black,
|
||||
)
|
||||
: TextButton(
|
||||
onPressed: () async {
|
||||
testResultsProvider
|
||||
.setLoadingButton();
|
||||
await Provider.of<
|
||||
TestResultsProvider>(
|
||||
context,
|
||||
listen: false)
|
||||
.changeVerification(
|
||||
item.id,
|
||||
'Verified')
|
||||
.then((result) {
|
||||
if (result) {
|
||||
print('true');
|
||||
}
|
||||
Navigator.of(ctx).pop();
|
||||
Navigator.of(context)
|
||||
.popAndPushNamed(Routes
|
||||
.testVerifyScreen);
|
||||
Fluttertoast.showToast(
|
||||
msg:
|
||||
"Test is verified.",
|
||||
toastLength: Toast
|
||||
.LENGTH_SHORT,
|
||||
gravity: ToastGravity
|
||||
.BOTTOM,
|
||||
);
|
||||
testResultsProvider
|
||||
.resetLoadingButton();
|
||||
});
|
||||
},
|
||||
child: Text('Yes'),
|
||||
);
|
||||
testResultsProvider
|
||||
.resetLoadingButton();
|
||||
});
|
||||
},
|
||||
child: Text('Yes'),
|
||||
);
|
||||
}),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('No'),
|
||||
}),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('No'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(7),
|
||||
width: 10 * _deviceBlockSize,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: kBlue,
|
||||
),
|
||||
],
|
||||
child: Icon(
|
||||
Icons.check,
|
||||
size: 6 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(7),
|
||||
width: 10 * _deviceBlockSize,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: kBlue,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.check,
|
||||
size: 6 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 3,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: Text('Reject'),
|
||||
content: Text(
|
||||
'Are you sure for reject this test?'),
|
||||
actions: <Widget>[
|
||||
Consumer<TestResultsProvider>(
|
||||
builder:
|
||||
(context, testResultsProvider, _) {
|
||||
return testResultsProvider
|
||||
.isloadingButton
|
||||
? CircularProgressIndicator(
|
||||
color: Colors.black,
|
||||
)
|
||||
: TextButton(
|
||||
onPressed: () async {
|
||||
testResultsProvider
|
||||
.setLoadingButton();
|
||||
await Provider.of<
|
||||
TestResultsProvider>(
|
||||
context,
|
||||
listen: false)
|
||||
.changeVerification(
|
||||
item.id,
|
||||
'NotVerified')
|
||||
.then((result) {
|
||||
if (result) {
|
||||
print('true');
|
||||
}
|
||||
Navigator.of(ctx).pop();
|
||||
Navigator.of(context)
|
||||
.popAndPushNamed(Routes
|
||||
.testVerifyScreen);
|
||||
Fluttertoast.showToast(
|
||||
msg: "Test is rejected.",
|
||||
toastLength:
|
||||
Toast.LENGTH_SHORT,
|
||||
gravity:
|
||||
ToastGravity.BOTTOM,
|
||||
SizedBox(
|
||||
width: 3,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: Text('Reject'),
|
||||
content: Text(
|
||||
'Are you sure for reject this test?'),
|
||||
actions: <Widget>[
|
||||
Consumer<TestResultsProvider>(
|
||||
builder: (context,
|
||||
testResultsProvider, _) {
|
||||
return testResultsProvider
|
||||
.isloadingButton
|
||||
? CircularProgressIndicator(
|
||||
color: Colors.black,
|
||||
)
|
||||
: TextButton(
|
||||
onPressed: () async {
|
||||
testResultsProvider
|
||||
.setLoadingButton();
|
||||
await Provider.of<
|
||||
TestResultsProvider>(
|
||||
context,
|
||||
listen: false)
|
||||
.changeVerification(
|
||||
item.id,
|
||||
'NotVerified')
|
||||
.then((result) {
|
||||
if (result) {
|
||||
print('true');
|
||||
}
|
||||
Navigator.of(ctx)
|
||||
.pop();
|
||||
Navigator.of(context)
|
||||
.popAndPushNamed(
|
||||
Routes
|
||||
.testVerifyScreen);
|
||||
Fluttertoast
|
||||
.showToast(
|
||||
msg:
|
||||
"Test is rejected.",
|
||||
toastLength: Toast
|
||||
.LENGTH_SHORT,
|
||||
gravity:
|
||||
ToastGravity
|
||||
.BOTTOM,
|
||||
);
|
||||
testResultsProvider
|
||||
.resetLoadingButton();
|
||||
});
|
||||
},
|
||||
child: Text('Yes'),
|
||||
);
|
||||
testResultsProvider
|
||||
.resetLoadingButton();
|
||||
});
|
||||
},
|
||||
child: Text('Yes'),
|
||||
);
|
||||
},
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('No'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(7),
|
||||
width: 10 * _deviceBlockSize,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: kPink,
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('No'),
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
size: 6 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(7),
|
||||
width: 10 * _deviceBlockSize,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: kPink,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
size: 6 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
) : Container(),
|
||||
],
|
||||
)
|
||||
: Container(),
|
||||
SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user