mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-10 19:58:56 +03:30
mypackage history detail ..
This commit is contained in:
@@ -39,15 +39,18 @@ 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,
|
||||
@@ -69,7 +72,9 @@ 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(
|
||||
@@ -89,81 +94,84 @@ 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],
|
||||
),
|
||||
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],
|
||||
transmitterName: !(index ==
|
||||
(packageResults.packageHistory!.length -
|
||||
1)) ? packageResults.packageHistory![index + 1].userHistoryName : null,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.0,
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
itemCount:
|
||||
packageResults.packageHistory!.length,
|
||||
shrinkWrap: true,
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
},
|
||||
),
|
||||
|
||||
@@ -3,11 +3,13 @@ import 'package:flutter/material.dart';
|
||||
|
||||
class UserPackageDataBox extends StatelessWidget {
|
||||
final PackageHistoryObject? user;
|
||||
final String? transmitterName;
|
||||
|
||||
const UserPackageDataBox({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
this.user,
|
||||
this.transmitterName
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
@@ -62,6 +64,25 @@ class UserPackageDataBox extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: 3 * _deviceBlockSize,
|
||||
),
|
||||
Row(children: [
|
||||
Text(
|
||||
"Transmitter : ",
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
transmitterName ?? "null",
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
],),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
+239
-247
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user