mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-13 13:58:57 +03:30
Set progress & toast for some other events
This commit is contained in:
@@ -5,11 +5,13 @@ class PackageResultObject extends Equatable {
|
|||||||
final String id;
|
final String id;
|
||||||
final String createdAt;
|
final String createdAt;
|
||||||
final String name;
|
final String name;
|
||||||
|
final String status;
|
||||||
|
|
||||||
PackageResultObject({
|
PackageResultObject({
|
||||||
required this.id,
|
required this.id,
|
||||||
required this.createdAt,
|
required this.createdAt,
|
||||||
required this.name,
|
required this.name,
|
||||||
|
required this.status
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -273,6 +273,7 @@ class _TestVerifyScreenState extends State<TestVerifyScreen> {
|
|||||||
|
|
||||||
class TestItemBox extends StatelessWidget {
|
class TestItemBox extends StatelessWidget {
|
||||||
final TestResultObject item;
|
final TestResultObject item;
|
||||||
|
|
||||||
const TestItemBox({
|
const TestItemBox({
|
||||||
Key? key,
|
Key? key,
|
||||||
required String id,
|
required String id,
|
||||||
@@ -354,6 +355,7 @@ class TestItemBox extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
item.verified == 'None' ?
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@@ -366,9 +368,18 @@ class TestItemBox extends StatelessWidget {
|
|||||||
content: Text(
|
content: Text(
|
||||||
'Are you sure for verify this test?'),
|
'Are you sure for verify this test?'),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
TextButton(
|
Consumer<TestResultsProvider>(builder:
|
||||||
|
(context, testResultsProvider, child) {
|
||||||
|
return testResultsProvider.isloadingButton
|
||||||
|
? CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
)
|
||||||
|
: TextButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
Provider.of<TestResultsProvider>(
|
testResultsProvider
|
||||||
|
.setLoadingButton();
|
||||||
|
await Provider.of<
|
||||||
|
TestResultsProvider>(
|
||||||
context,
|
context,
|
||||||
listen: false)
|
listen: false)
|
||||||
.changeVerification(
|
.changeVerification(
|
||||||
@@ -378,17 +389,23 @@ class TestItemBox extends StatelessWidget {
|
|||||||
print('true');
|
print('true');
|
||||||
}
|
}
|
||||||
Navigator.of(ctx).pop();
|
Navigator.of(ctx).pop();
|
||||||
Navigator.of(context).popAndPushNamed(
|
Navigator.of(context)
|
||||||
Routes.testVerifyScreen);
|
.popAndPushNamed(Routes
|
||||||
|
.testVerifyScreen);
|
||||||
Fluttertoast.showToast(
|
Fluttertoast.showToast(
|
||||||
msg: "Test is verified.",
|
msg: "Test is verified.",
|
||||||
toastLength: Toast.LENGTH_SHORT,
|
toastLength:
|
||||||
gravity: ToastGravity.BOTTOM,
|
Toast.LENGTH_SHORT,
|
||||||
|
gravity:
|
||||||
|
ToastGravity.BOTTOM,
|
||||||
);
|
);
|
||||||
|
testResultsProvider
|
||||||
|
.resetLoadingButton();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Text('Yes'),
|
child: Text('Yes'),
|
||||||
),
|
);
|
||||||
|
}),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(ctx).pop();
|
Navigator.of(ctx).pop();
|
||||||
@@ -425,28 +442,47 @@ class TestItemBox extends StatelessWidget {
|
|||||||
content: Text(
|
content: Text(
|
||||||
'Are you sure for reject this test?'),
|
'Are you sure for reject this test?'),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
TextButton(
|
Consumer<TestResultsProvider>(
|
||||||
|
builder:
|
||||||
|
(context, testResultsProvider, _) {
|
||||||
|
return testResultsProvider
|
||||||
|
.isloadingButton
|
||||||
|
? CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
)
|
||||||
|
: TextButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await Provider.of<TestResultsProvider>(
|
testResultsProvider
|
||||||
|
.setLoadingButton();
|
||||||
|
await Provider.of<
|
||||||
|
TestResultsProvider>(
|
||||||
context,
|
context,
|
||||||
listen: false)
|
listen: false)
|
||||||
.changeVerification(
|
.changeVerification(
|
||||||
item.id, 'NotVerified')
|
item.id,
|
||||||
|
'NotVerified')
|
||||||
.then((result) {
|
.then((result) {
|
||||||
if (result) {
|
if (result) {
|
||||||
print('true');
|
print('true');
|
||||||
}
|
}
|
||||||
Navigator.of(ctx).pop();
|
Navigator.of(ctx).pop();
|
||||||
Navigator.of(context).popAndPushNamed(
|
Navigator.of(context)
|
||||||
Routes.testVerifyScreen);
|
.popAndPushNamed(Routes
|
||||||
|
.testVerifyScreen);
|
||||||
Fluttertoast.showToast(
|
Fluttertoast.showToast(
|
||||||
msg: "Test is rejected.",
|
msg: "Test is rejected.",
|
||||||
toastLength: Toast.LENGTH_SHORT,
|
toastLength:
|
||||||
gravity: ToastGravity.BOTTOM,
|
Toast.LENGTH_SHORT,
|
||||||
|
gravity:
|
||||||
|
ToastGravity.BOTTOM,
|
||||||
);
|
);
|
||||||
|
testResultsProvider
|
||||||
|
.resetLoadingButton();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Text('Yes'),
|
child: Text('Yes'),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
@@ -473,7 +509,7 @@ class TestItemBox extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
) : Container(),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: _deviceBlockSize,
|
width: _deviceBlockSize,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -346,6 +346,7 @@ class PackageProvider extends ChangeNotifier {
|
|||||||
createdAt: item['created_at'],
|
createdAt: item['created_at'],
|
||||||
id: item['id'].toString(),
|
id: item['id'].toString(),
|
||||||
name: item['name'],
|
name: item['name'],
|
||||||
|
status: item['status']
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ class ItemDetailsDataBox extends StatelessWidget {
|
|||||||
Key? key,
|
Key? key,
|
||||||
required this.datas,
|
required this.datas,
|
||||||
required double deviceBlockSize,
|
required double deviceBlockSize,
|
||||||
}) : _deviceBlockSize = deviceBlockSize,
|
})
|
||||||
|
: _deviceBlockSize = deviceBlockSize,
|
||||||
super(key: key);
|
super(key: key);
|
||||||
|
|
||||||
final ItemDetailObject datas;
|
final ItemDetailObject datas;
|
||||||
@@ -336,10 +337,14 @@ class ItemDetailsDataBox extends StatelessWidget {
|
|||||||
Container(
|
Container(
|
||||||
width: 45 * _deviceBlockSize,
|
width: 45 * _deviceBlockSize,
|
||||||
child: Text(
|
child: Text(
|
||||||
datas.status == 'approved' ? 'Confirmed' : 'Rejected',
|
datas.status == 'approved' ? 'Confirmed' :
|
||||||
|
datas
|
||||||
|
.status == 'rejected' ? 'Rejected' : 'Pending..',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
color: datas.status == 'approved' ? kBlue : kPink,
|
color: datas.status == 'approved' ? kBlue :
|
||||||
|
datas
|
||||||
|
.status == 'rejected' ? kPink : Colors.grey,
|
||||||
),
|
),
|
||||||
overflow: TextOverflow.clip,
|
overflow: TextOverflow.clip,
|
||||||
),
|
),
|
||||||
@@ -365,8 +370,10 @@ class ItemDetailsDataBox extends StatelessWidget {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) => PinchZoom(
|
builder: (BuildContext context) =>
|
||||||
child: Image.network(datas.filePath![index])
|
PinchZoom(
|
||||||
|
child: Image.network(
|
||||||
|
datas.filePath![index])
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -375,7 +382,7 @@ class ItemDetailsDataBox extends StatelessWidget {
|
|||||||
itemCount: datas.filePath!.length,
|
itemCount: datas.filePath!.length,
|
||||||
options: CarouselOptions(
|
options: CarouselOptions(
|
||||||
enlargeCenterPage: true,
|
enlargeCenterPage: true,
|
||||||
aspectRatio: 16/8,
|
aspectRatio: 16 / 8,
|
||||||
viewportFraction: datas.filePath?.length == 1 ? 1 : 0.6,
|
viewportFraction: datas.filePath?.length == 1 ? 1 : 0.6,
|
||||||
padEnds: false,
|
padEnds: false,
|
||||||
pauseAutoPlayOnTouch: true,
|
pauseAutoPlayOnTouch: true,
|
||||||
@@ -394,7 +401,8 @@ class ItemDetailsDataBox extends StatelessWidget {
|
|||||||
height: 20,
|
height: 20,
|
||||||
),
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () async => await launch(
|
onTap: () async =>
|
||||||
|
await launch(
|
||||||
'https://cssd-doc.com/Show/Item/${datas.id.toString()}',
|
'https://cssd-doc.com/Show/Item/${datas.id.toString()}',
|
||||||
),
|
),
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'package:cssd/models/item_model.dart';
|
|||||||
import 'package:cssd/providers/auth.dart';
|
import 'package:cssd/providers/auth.dart';
|
||||||
import 'package:cssd/providers/items.dart';
|
import 'package:cssd/providers/items.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:fluttertoast/fluttertoast.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
@@ -51,7 +52,9 @@ class ItemItemBox extends StatelessWidget {
|
|||||||
// width: 3 * _deviceBlockSize,
|
// width: 3 * _deviceBlockSize,
|
||||||
// ),
|
// ),
|
||||||
// Spacer(),
|
// Spacer(),
|
||||||
SizedBox(width: 4,),
|
SizedBox(
|
||||||
|
width: 4,
|
||||||
|
),
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@@ -219,9 +222,10 @@ class ItemItemBox extends StatelessWidget {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
width: 5.0,
|
width: 5.0,
|
||||||
),
|
),
|
||||||
userData['roles']?.contains('User') ?? false
|
(userData['roles']?.contains('User') ?? false)
|
||||||
? Container()
|
? Container()
|
||||||
: Row(
|
: item?.status == "suspended"
|
||||||
|
? Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
InkWell(
|
InkWell(
|
||||||
@@ -232,27 +236,62 @@ class ItemItemBox extends StatelessWidget {
|
|||||||
builder: (context) {
|
builder: (context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: Text(
|
title: Text(
|
||||||
'Are you Reject this item?'
|
'Are you Reject this item?'),
|
||||||
),
|
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
TextButton(
|
Consumer<ItemProvider>(
|
||||||
onPressed: () {
|
builder: (context,
|
||||||
Provider.of<ItemProvider>(context,
|
itemProvider, _) {
|
||||||
listen: false)
|
return itemProvider
|
||||||
.changeStatus(item!.id, "rejected")
|
.isloadingButton
|
||||||
|
? CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
)
|
||||||
|
: TextButton(
|
||||||
|
onPressed:
|
||||||
|
() async {
|
||||||
|
itemProvider
|
||||||
|
.setLoadingButton();
|
||||||
|
await Provider.of<
|
||||||
|
ItemProvider>(
|
||||||
|
context,
|
||||||
|
listen:
|
||||||
|
false)
|
||||||
|
.changeStatus(
|
||||||
|
item!.id,
|
||||||
|
"rejected")
|
||||||
.then(
|
.then(
|
||||||
(value) {
|
(value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
print('true');
|
print(
|
||||||
|
'true');
|
||||||
}
|
}
|
||||||
Navigator.of(context).pop();
|
Navigator.of(
|
||||||
// Navigator.of(context)
|
context)
|
||||||
// .popAndPushNamed(Routes
|
.pop();
|
||||||
// .itemResultScreen);
|
Navigator.of(
|
||||||
|
context)
|
||||||
|
.popAndPushNamed(
|
||||||
|
Routes
|
||||||
|
.itemResultScreen);
|
||||||
|
Fluttertoast
|
||||||
|
.showToast(
|
||||||
|
msg:
|
||||||
|
"Item is rejected.",
|
||||||
|
toastLength:
|
||||||
|
Toast
|
||||||
|
.LENGTH_SHORT,
|
||||||
|
gravity:
|
||||||
|
ToastGravity
|
||||||
|
.BOTTOM,
|
||||||
|
);
|
||||||
|
itemProvider
|
||||||
|
.resetLoadingButton();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Text('Yes'),
|
child: Text('Yes'),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
@@ -270,10 +309,9 @@ class ItemItemBox extends StatelessWidget {
|
|||||||
width: 8 * _deviceBlockSize,
|
width: 8 * _deviceBlockSize,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: kPink
|
color: kPink),
|
||||||
),
|
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.close ,
|
Icons.close,
|
||||||
size: 4 * _deviceBlockSize,
|
size: 4 * _deviceBlockSize,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
@@ -293,25 +331,56 @@ class ItemItemBox extends StatelessWidget {
|
|||||||
'Are you Confirm this item?',
|
'Are you Confirm this item?',
|
||||||
),
|
),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
TextButton(
|
Consumer<ItemProvider>(builder:
|
||||||
onPressed: () {
|
(context, itemProvider, _) {
|
||||||
Provider.of<ItemProvider>(context,
|
return itemProvider
|
||||||
listen: false)
|
.isloadingButton
|
||||||
.changeStatus(item!.id, "approved")
|
? CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
)
|
||||||
|
: TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
itemProvider
|
||||||
|
.setLoadingButton();
|
||||||
|
await Provider.of<
|
||||||
|
ItemProvider>(
|
||||||
|
context,
|
||||||
|
listen:
|
||||||
|
false)
|
||||||
|
.changeStatus(
|
||||||
|
item!.id,
|
||||||
|
"approved")
|
||||||
.then(
|
.then(
|
||||||
(value) {
|
(value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
print('true');
|
print('true');
|
||||||
}
|
}
|
||||||
Navigator.of(context).pop();
|
Navigator.of(
|
||||||
// Navigator.of(context)
|
context)
|
||||||
// .popAndPushNamed(Routes
|
.pop();
|
||||||
// .itemResultScreen);
|
Navigator.of(
|
||||||
|
context)
|
||||||
|
.popAndPushNamed(
|
||||||
|
Routes
|
||||||
|
.itemResultScreen);
|
||||||
|
Fluttertoast
|
||||||
|
.showToast(
|
||||||
|
msg:
|
||||||
|
"Item is Confirmed.",
|
||||||
|
toastLength: Toast
|
||||||
|
.LENGTH_SHORT,
|
||||||
|
gravity:
|
||||||
|
ToastGravity
|
||||||
|
.BOTTOM,
|
||||||
|
);
|
||||||
|
itemProvider
|
||||||
|
.resetLoadingButton();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Text('Yes'),
|
child: Text('Yes'),
|
||||||
),
|
);
|
||||||
|
}),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
@@ -338,7 +407,8 @@ class ItemItemBox extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
)
|
||||||
|
: Container(),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 5.0,
|
width: 5.0,
|
||||||
),
|
),
|
||||||
@@ -368,7 +438,9 @@ class ItemItemBox extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(width: 4,)
|
SizedBox(
|
||||||
|
width: 4,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'package:cssd/models/package_model.dart';
|
|||||||
import 'package:cssd/providers/auth.dart';
|
import 'package:cssd/providers/auth.dart';
|
||||||
import 'package:cssd/providers/packages.dart';
|
import 'package:cssd/providers/packages.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:fluttertoast/fluttertoast.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
@@ -152,7 +153,8 @@ class PackageItemBox extends StatelessWidget {
|
|||||||
Provider.of<PackageProvider>(
|
Provider.of<PackageProvider>(
|
||||||
context,
|
context,
|
||||||
listen: false)
|
listen: false)
|
||||||
.removePackages(item!.id);
|
.removePackages(
|
||||||
|
item!.id);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
@@ -172,6 +174,9 @@ class PackageItemBox extends StatelessWidget {
|
|||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
item?.status == "suspended"
|
||||||
|
? Row(
|
||||||
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 5.0,
|
width: 5.0,
|
||||||
),
|
),
|
||||||
@@ -183,12 +188,25 @@ class PackageItemBox extends StatelessWidget {
|
|||||||
builder: (context) {
|
builder: (context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: Text(
|
title: Text(
|
||||||
'Are you Reject this item?'
|
'Are you Reject this item?'),
|
||||||
),
|
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
TextButton(
|
Consumer<
|
||||||
onPressed: () {
|
PackageProvider>(
|
||||||
Provider.of<PackageProvider>(context,
|
builder: (context,
|
||||||
|
packageProvider,
|
||||||
|
_) {
|
||||||
|
return packageProvider
|
||||||
|
.isloadingButton
|
||||||
|
? CircularProgressIndicator(
|
||||||
|
color: Colors
|
||||||
|
.black,
|
||||||
|
)
|
||||||
|
: TextButton(
|
||||||
|
onPressed:
|
||||||
|
() async {
|
||||||
|
packageProvider
|
||||||
|
.setLoadingButton();
|
||||||
|
await Provider.of<PackageProvider>(context,
|
||||||
listen: false)
|
listen: false)
|
||||||
.changeStatus(item!.id, "rejected")
|
.changeStatus(item!.id, "rejected")
|
||||||
.then(
|
.then(
|
||||||
@@ -197,17 +215,26 @@ class PackageItemBox extends StatelessWidget {
|
|||||||
print('true');
|
print('true');
|
||||||
}
|
}
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
// Navigator.of(context)
|
Navigator.of(context).popAndPushNamed(Routes.packageResultScreen);
|
||||||
// .popAndPushNamed(Routes
|
Fluttertoast.showToast(
|
||||||
// .packageResultScreen);
|
msg: "Package is Rejected.",
|
||||||
|
toastLength: Toast.LENGTH_SHORT,
|
||||||
|
gravity: ToastGravity.BOTTOM,
|
||||||
|
);
|
||||||
|
packageProvider.resetLoadingButton();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Text('Yes'),
|
child: Text(
|
||||||
|
'Yes'),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(
|
||||||
|
context)
|
||||||
|
.pop();
|
||||||
},
|
},
|
||||||
child: Text('No'),
|
child: Text('No'),
|
||||||
),
|
),
|
||||||
@@ -221,10 +248,9 @@ class PackageItemBox extends StatelessWidget {
|
|||||||
width: 8 * _deviceBlockSize,
|
width: 8 * _deviceBlockSize,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: kPink
|
color: kPink),
|
||||||
),
|
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.close ,
|
Icons.close,
|
||||||
size: 4 * _deviceBlockSize,
|
size: 4 * _deviceBlockSize,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
@@ -244,9 +270,23 @@ class PackageItemBox extends StatelessWidget {
|
|||||||
'Are you Confirm this item?',
|
'Are you Confirm this item?',
|
||||||
),
|
),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
TextButton(
|
Consumer<
|
||||||
onPressed: () {
|
PackageProvider>(
|
||||||
Provider.of<PackageProvider>(context,
|
builder: (context,
|
||||||
|
packageProvider,
|
||||||
|
_) {
|
||||||
|
return packageProvider
|
||||||
|
.isloadingButton
|
||||||
|
? CircularProgressIndicator(
|
||||||
|
color: Colors
|
||||||
|
.black,
|
||||||
|
)
|
||||||
|
: TextButton(
|
||||||
|
onPressed:
|
||||||
|
() async {
|
||||||
|
packageProvider
|
||||||
|
.setLoadingButton();
|
||||||
|
await Provider.of<PackageProvider>(context,
|
||||||
listen: false)
|
listen: false)
|
||||||
.changeStatus(item!.id, "approved")
|
.changeStatus(item!.id, "approved")
|
||||||
.then(
|
.then(
|
||||||
@@ -255,17 +295,26 @@ class PackageItemBox extends StatelessWidget {
|
|||||||
print('true');
|
print('true');
|
||||||
}
|
}
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
// Navigator.of(context)
|
Navigator.of(context).popAndPushNamed(Routes.packageResultScreen);
|
||||||
// .popAndPushNamed(Routes
|
Fluttertoast.showToast(
|
||||||
// .packageResultScreen);
|
msg: "Package is Confirmed.",
|
||||||
|
toastLength: Toast.LENGTH_SHORT,
|
||||||
|
gravity: ToastGravity.BOTTOM,
|
||||||
|
);
|
||||||
|
packageProvider.resetLoadingButton();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Text('Yes'),
|
child: Text(
|
||||||
|
'Yes'),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(
|
||||||
|
context)
|
||||||
|
.pop();
|
||||||
},
|
},
|
||||||
child: Text('No'),
|
child: Text('No'),
|
||||||
),
|
),
|
||||||
@@ -288,6 +337,9 @@ class PackageItemBox extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 5,
|
width: 5,
|
||||||
),
|
),
|
||||||
@@ -315,9 +367,6 @@ class PackageItemBox extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user