mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-13 06:18:54 +03:30
mypackage history detail ..
This commit is contained in:
@@ -39,15 +39,18 @@ class _MyPackagesHistoryScreenState extends State<MyPackagesHistoryScreen> {
|
|||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
if (_isInit) {
|
if (_isInit) {
|
||||||
packageData =
|
packageData =
|
||||||
ModalRoute.of(context)!.settings.arguments as MyPackageResultObject?;
|
ModalRoute
|
||||||
|
.of(context)!
|
||||||
|
.settings
|
||||||
|
.arguments as MyPackageResultObject?;
|
||||||
var _id = packageData!.id;
|
var _id = packageData!.id;
|
||||||
var myPackageResults = Provider.of<MyPackageProvider>(context);
|
var myPackageResults = Provider.of<MyPackageProvider>(context);
|
||||||
myPackageResults.setLoading();
|
myPackageResults.setLoading();
|
||||||
myPackageResults.getPackagesHistory(_id).then(
|
myPackageResults.getPackagesHistory(_id).then(
|
||||||
(_) {
|
(_) {
|
||||||
myPackageResults.resetLoading();
|
myPackageResults.resetLoading();
|
||||||
sc!.addListener(
|
sc!.addListener(
|
||||||
() {
|
() {
|
||||||
if (sc!.position.pixels == sc!.position.maxScrollExtent) {
|
if (sc!.position.pixels == sc!.position.maxScrollExtent) {
|
||||||
var myPackageResults = Provider.of<MyPackageProvider>(
|
var myPackageResults = Provider.of<MyPackageProvider>(
|
||||||
context,
|
context,
|
||||||
@@ -69,7 +72,9 @@ class _MyPackagesHistoryScreenState extends State<MyPackagesHistoryScreen> {
|
|||||||
final _media = MediaQuery.of(context);
|
final _media = MediaQuery.of(context);
|
||||||
final double _deviceWidth = _media.size.width;
|
final double _deviceWidth = _media.size.width;
|
||||||
final double _deviceBlockSize = _deviceWidth / 100;
|
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(
|
return SafeArea(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
@@ -89,81 +94,84 @@ class _MyPackagesHistoryScreenState extends State<MyPackagesHistoryScreen> {
|
|||||||
builder: (ct, connection, _) {
|
builder: (ct, connection, _) {
|
||||||
return connection.conStatus != 'offline'
|
return connection.conStatus != 'offline'
|
||||||
? Padding(
|
? Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
top: 20,
|
top: 20,
|
||||||
right: 20,
|
right: 20,
|
||||||
bottom: 60,
|
bottom: 60,
|
||||||
left: 20,
|
left: 20,
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
ResultBanner(
|
ResultBanner(
|
||||||
deviceBlockSize: _deviceBlockSize,
|
deviceBlockSize: _deviceBlockSize,
|
||||||
text: 'Package History',
|
text: 'Package History',
|
||||||
push: Routes.itemFilterScreen,
|
push: Routes.itemFilterScreen,
|
||||||
hasFilterObject: false,
|
hasFilterObject: false,
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20,
|
height: 20,
|
||||||
),
|
),
|
||||||
MyPackagesItemDataBox(
|
MyPackagesItemDataBox(
|
||||||
deviceBlockSize: _deviceBlockSize,
|
deviceBlockSize: _deviceBlockSize,
|
||||||
hasHistoryBtn: false,
|
hasHistoryBtn: false,
|
||||||
packages: packageData,
|
packages: packageData,
|
||||||
isAdmin: userData['roles']?.contains('User')
|
isAdmin: userData['roles']?.contains('User')
|
||||||
? false
|
? false
|
||||||
: true,
|
: true,
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20.0,
|
height: 20.0,
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Consumer<MyPackageProvider>(
|
child: Consumer<MyPackageProvider>(
|
||||||
builder: (context, packageResults, child) {
|
builder: (context, packageResults, child) {
|
||||||
return packageResults.isloading
|
return packageResults.isloading
|
||||||
? Center(
|
? Center(
|
||||||
child: CircularProgressIndicator(
|
child: CircularProgressIndicator(
|
||||||
color: Colors.black,
|
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,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
],
|
: 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();
|
: ConnectionErrorBox();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -3,11 +3,13 @@ import 'package:flutter/material.dart';
|
|||||||
|
|
||||||
class UserPackageDataBox extends StatelessWidget {
|
class UserPackageDataBox extends StatelessWidget {
|
||||||
final PackageHistoryObject? user;
|
final PackageHistoryObject? user;
|
||||||
|
final String? transmitterName;
|
||||||
|
|
||||||
const UserPackageDataBox({
|
const UserPackageDataBox({
|
||||||
Key? key,
|
Key? key,
|
||||||
required double deviceBlockSize,
|
required double deviceBlockSize,
|
||||||
this.user,
|
this.user,
|
||||||
|
this.transmitterName
|
||||||
}) : _deviceBlockSize = deviceBlockSize,
|
}) : _deviceBlockSize = deviceBlockSize,
|
||||||
super(key: key);
|
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