mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-11 20:08:55 +03:30
Fix transmitter name in package history
This commit is contained in:
@@ -39,18 +39,15 @@ class _MyPackagesHistoryScreenState extends State<MyPackagesHistoryScreen> {
|
||||
void didChangeDependencies() {
|
||||
if (_isInit) {
|
||||
packageData =
|
||||
ModalRoute
|
||||
.of(context)!
|
||||
.settings
|
||||
.arguments as MyPackageResultObject?;
|
||||
ModalRoute.of(context)!.settings.arguments as MyPackageResultObject?;
|
||||
var _id = packageData!.id;
|
||||
var myPackageResults = Provider.of<MyPackageProvider>(context);
|
||||
myPackageResults.setLoading();
|
||||
myPackageResults.getPackagesHistory(_id).then(
|
||||
(_) {
|
||||
(_) {
|
||||
myPackageResults.resetLoading();
|
||||
sc!.addListener(
|
||||
() {
|
||||
() {
|
||||
if (sc!.position.pixels == sc!.position.maxScrollExtent) {
|
||||
var myPackageResults = Provider.of<MyPackageProvider>(
|
||||
context,
|
||||
@@ -72,14 +69,17 @@ class _MyPackagesHistoryScreenState extends State<MyPackagesHistoryScreen> {
|
||||
final _media = MediaQuery.of(context);
|
||||
final double _deviceWidth = _media.size.width;
|
||||
final double _deviceBlockSize = _deviceWidth / 100;
|
||||
final userData = Provider
|
||||
.of<Auth>(context, listen: false)
|
||||
.user;
|
||||
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
title: Text('My Packages', style: TextStyle(color: Colors.white,),),
|
||||
title: Text(
|
||||
'My Packages',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
backgroundColor: Colors.black,
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
@@ -94,84 +94,81 @@ class _MyPackagesHistoryScreenState extends State<MyPackagesHistoryScreen> {
|
||||
builder: (ct, connection, _) {
|
||||
return connection.conStatus != 'offline'
|
||||
? Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 20,
|
||||
right: 20,
|
||||
bottom: 60,
|
||||
left: 20,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
ResultBanner(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
text: 'Package History',
|
||||
push: Routes.itemFilterScreen,
|
||||
hasFilterObject: false,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
MyPackagesItemDataBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
hasHistoryBtn: false,
|
||||
packages: packageData,
|
||||
isAdmin: userData['roles']?.contains('User')
|
||||
? false
|
||||
: true,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.0,
|
||||
),
|
||||
Expanded(
|
||||
child: Consumer<MyPackageProvider>(
|
||||
builder: (context, packageResults, child) {
|
||||
return packageResults.isloading
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.black,
|
||||
),
|
||||
)
|
||||
: ListView.separated(
|
||||
controller: sc,
|
||||
separatorBuilder: (context, index) {
|
||||
return Divider();
|
||||
},
|
||||
itemBuilder: (context, index) {
|
||||
return Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 20.0,
|
||||
),
|
||||
PackageHistoryDate(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
packages: packageResults
|
||||
.packageHistory![index],
|
||||
),
|
||||
UserPackageDataBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
user: packageResults
|
||||
.packageHistory![index],
|
||||
transmitterName: !(index ==
|
||||
(packageResults.packageHistory!.length -
|
||||
1)) ? packageResults.packageHistory![index + 1].userHistoryName : null,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.0,
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
itemCount:
|
||||
packageResults.packageHistory!.length,
|
||||
shrinkWrap: true,
|
||||
);
|
||||
},
|
||||
padding: EdgeInsets.only(
|
||||
top: 20,
|
||||
right: 20,
|
||||
bottom: 60,
|
||||
left: 20,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
ResultBanner(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
text: 'Package History',
|
||||
push: Routes.itemFilterScreen,
|
||||
hasFilterObject: false,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
MyPackagesItemDataBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
hasHistoryBtn: false,
|
||||
packages: packageData,
|
||||
isAdmin: userData['roles']?.contains('User')
|
||||
? false
|
||||
: true,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.0,
|
||||
),
|
||||
Expanded(
|
||||
child: Consumer<MyPackageProvider>(
|
||||
builder: (context, packageResults, child) {
|
||||
return packageResults.isloading
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.black,
|
||||
),
|
||||
)
|
||||
: ListView.separated(
|
||||
controller: sc,
|
||||
separatorBuilder: (context, index) {
|
||||
return Divider();
|
||||
},
|
||||
itemBuilder: (context, index) {
|
||||
return Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 20.0,
|
||||
),
|
||||
PackageHistoryDate(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
packages: packageResults
|
||||
.packageHistory![index],
|
||||
),
|
||||
UserPackageDataBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
user: packageResults
|
||||
.packageHistory![index],
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.0,
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
itemCount:
|
||||
packageResults.packageHistory!.length,
|
||||
shrinkWrap: true,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user