mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-13 22:58:56 +03:30
Set progress & toast for some other events
This commit is contained in:
@@ -273,6 +273,7 @@ class _TestVerifyScreenState extends State<TestVerifyScreen> {
|
||||
|
||||
class TestItemBox extends StatelessWidget {
|
||||
final TestResultObject item;
|
||||
|
||||
const TestItemBox({
|
||||
Key? key,
|
||||
required String id,
|
||||
@@ -354,6 +355,7 @@ class TestItemBox extends StatelessWidget {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
item.verified == 'None' ?
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
@@ -366,29 +368,44 @@ class TestItemBox extends StatelessWidget {
|
||||
content: Text(
|
||||
'Are you sure for verify this test?'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
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,
|
||||
);
|
||||
});
|
||||
},
|
||||
child: Text('Yes'),
|
||||
),
|
||||
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'),
|
||||
);
|
||||
}),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
@@ -425,28 +442,47 @@ class TestItemBox extends StatelessWidget {
|
||||
content: Text(
|
||||
'Are you sure for reject this test?'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
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,
|
||||
);
|
||||
});
|
||||
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'),
|
||||
);
|
||||
},
|
||||
child: Text('Yes'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
@@ -473,7 +509,7 @@ class TestItemBox extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
) : Container(),
|
||||
SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user