mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-13 12:28:56 +03:30
Set 'There is no item to show' to all menu screens
This commit is contained in:
@@ -198,7 +198,9 @@ class _CycleResultScreenState extends State<CycleResultScreen> {
|
|||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: ListView.builder(
|
:
|
||||||
|
cycleResults.items?.length != null ?
|
||||||
|
ListView.builder(
|
||||||
controller: sc,
|
controller: sc,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
String labels = '';
|
String labels = '';
|
||||||
@@ -221,7 +223,12 @@ class _CycleResultScreenState extends State<CycleResultScreen> {
|
|||||||
},
|
},
|
||||||
itemCount: cycleResults.items?.length,
|
itemCount: cycleResults.items?.length,
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
);
|
) :
|
||||||
|
Container(
|
||||||
|
child: Center(
|
||||||
|
child: Text("There is no item to show."),
|
||||||
|
),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -251,7 +251,8 @@ class _ItemResultScreenState extends State<ItemResultScreen> {
|
|||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: ListView.builder(
|
: itemResults.items?.length != null ?
|
||||||
|
ListView.builder(
|
||||||
controller: sc,
|
controller: sc,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
// remove extra ,
|
// remove extra ,
|
||||||
@@ -262,7 +263,12 @@ class _ItemResultScreenState extends State<ItemResultScreen> {
|
|||||||
},
|
},
|
||||||
itemCount: itemResults.items?.length,
|
itemCount: itemResults.items?.length,
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
);
|
) :
|
||||||
|
Container(
|
||||||
|
child: Center(
|
||||||
|
child: Text("There is no item to show."),
|
||||||
|
),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -72,7 +72,12 @@ class _LabelResultScreenState extends State<LabelResultScreen> {
|
|||||||
),
|
),
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
titleSpacing: -10,
|
titleSpacing: -10,
|
||||||
title: Text('Home', style: TextStyle(color: Colors.white,),),
|
title: Text(
|
||||||
|
'Home',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
@@ -171,16 +176,24 @@ class _LabelResultScreenState extends State<LabelResultScreen> {
|
|||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: ListView.builder(
|
: labelResults.items?.length != null
|
||||||
controller: sc,
|
? ListView.builder(
|
||||||
itemBuilder: (context, index) =>
|
controller: sc,
|
||||||
LabelItemBox(
|
itemBuilder: (context, index) =>
|
||||||
deviceBlockSize: _deviceBlockSize,
|
LabelItemBox(
|
||||||
item: labelResults.items?[index],
|
deviceBlockSize: _deviceBlockSize,
|
||||||
),
|
item: labelResults.items?[index],
|
||||||
itemCount: labelResults.items?.length,
|
),
|
||||||
shrinkWrap: true,
|
itemCount:
|
||||||
);
|
labelResults.items?.length,
|
||||||
|
shrinkWrap: true,
|
||||||
|
)
|
||||||
|
: Container(
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
"There is no item to show."),
|
||||||
|
),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import 'package:provider/provider.dart';
|
|||||||
|
|
||||||
class MyItemsMineScreen extends StatefulWidget {
|
class MyItemsMineScreen extends StatefulWidget {
|
||||||
final bool? isAdmin;
|
final bool? isAdmin;
|
||||||
|
|
||||||
const MyItemsMineScreen({
|
const MyItemsMineScreen({
|
||||||
Key? key,
|
Key? key,
|
||||||
this.isAdmin,
|
this.isAdmin,
|
||||||
@@ -39,23 +40,23 @@ class _MyItemsMineScreenState extends State<MyItemsMineScreen> {
|
|||||||
var myItemResults = Provider.of<MyItemProvider>(context);
|
var myItemResults = Provider.of<MyItemProvider>(context);
|
||||||
myItemResults.setLoading();
|
myItemResults.setLoading();
|
||||||
myItemResults.resetPageNumber();
|
myItemResults.resetPageNumber();
|
||||||
myItemResults.getMyItems().then(
|
myItemResults.getMyItems().then(
|
||||||
(_) {
|
(_) {
|
||||||
myItemResults.resetLoading();
|
myItemResults.resetLoading();
|
||||||
sc!.addListener(
|
sc!.addListener(
|
||||||
() {
|
() {
|
||||||
if (sc!.position.pixels == sc!.position.maxScrollExtent &&
|
if (sc!.position.pixels == sc!.position.maxScrollExtent &&
|
||||||
searchCTRL.text == '') {
|
searchCTRL.text == '') {
|
||||||
var myItemResults = Provider.of<MyItemProvider>(
|
var myItemResults = Provider.of<MyItemProvider>(
|
||||||
context,
|
context,
|
||||||
listen: false,
|
listen: false,
|
||||||
);
|
);
|
||||||
myItemResults.getMyItems();
|
myItemResults.getMyItems();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
_isInit = false;
|
_isInit = false;
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
@@ -158,7 +159,7 @@ class _MyItemsMineScreenState extends State<MyItemsMineScreen> {
|
|||||||
textInputType: TextInputType.visiblePassword,
|
textInputType: TextInputType.visiblePassword,
|
||||||
deviceBlockSize: _deviceBlockSize,
|
deviceBlockSize: _deviceBlockSize,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
Provider.of<MyItemProvider>(context, listen: false)
|
Provider.of<MyItemProvider>(context, listen: false)
|
||||||
.searchMyItems(value);
|
.searchMyItems(value);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -174,27 +175,34 @@ class _MyItemsMineScreenState extends State<MyItemsMineScreen> {
|
|||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: ListView.builder(
|
: itemResults.originalMyItems?.length != null
|
||||||
controller: sc,
|
? ListView.builder(
|
||||||
itemBuilder: (context, index) {
|
controller: sc,
|
||||||
return MyItemsItemDataBox(
|
itemBuilder: (context, index) {
|
||||||
deviceBlockSize: _deviceBlockSize,
|
return MyItemsItemDataBox(
|
||||||
isAdmin:
|
deviceBlockSize: _deviceBlockSize,
|
||||||
userData['roles']?.contains('User')
|
isAdmin: userData['roles']
|
||||||
|
?.contains('User')
|
||||||
? false
|
? false
|
||||||
: true,
|
: true,
|
||||||
items: itemResults.myItems?[index],
|
items: itemResults.myItems?[index],
|
||||||
push: () {
|
push: () {
|
||||||
Navigator.pushNamed(context,
|
Navigator.pushNamed(context,
|
||||||
Routes.myItemsHistoryScreen,
|
Routes.myItemsHistoryScreen,
|
||||||
arguments:
|
arguments: itemResults
|
||||||
itemResults.myItems?[index]);
|
.myItems?[index]);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
itemCount: itemResults.myItems?.length,
|
itemCount: itemResults.myItems?.length,
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
);
|
)
|
||||||
|
: Container(
|
||||||
|
child: Center(
|
||||||
|
child:
|
||||||
|
Text("There is no item to show."),
|
||||||
|
),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
||||||
import 'package:cssd/config/routes.dart';
|
import 'package:cssd/config/routes.dart';
|
||||||
import 'package:cssd/providers/auth.dart';
|
import 'package:cssd/providers/auth.dart';
|
||||||
@@ -40,23 +39,23 @@ class _MyPackagesMineScreenState extends State<MyPackagesMineScreen> {
|
|||||||
var myPackageResults = Provider.of<MyPackageProvider>(context);
|
var myPackageResults = Provider.of<MyPackageProvider>(context);
|
||||||
myPackageResults.setLoading();
|
myPackageResults.setLoading();
|
||||||
myPackageResults.resetPageNumber();
|
myPackageResults.resetPageNumber();
|
||||||
myPackageResults.getMyPackages().then(
|
myPackageResults.getMyPackages().then(
|
||||||
(_) {
|
(_) {
|
||||||
myPackageResults.resetLoading();
|
myPackageResults.resetLoading();
|
||||||
sc!.addListener(
|
sc!.addListener(
|
||||||
() {
|
() {
|
||||||
if (sc!.position.pixels == sc!.position.maxScrollExtent &&
|
if (sc!.position.pixels == sc!.position.maxScrollExtent &&
|
||||||
searchCTRL.text == '') {
|
searchCTRL.text == '') {
|
||||||
var myPackageResults = Provider.of<MyPackageProvider>(
|
var myPackageResults = Provider.of<MyPackageProvider>(
|
||||||
context,
|
context,
|
||||||
listen: false,
|
listen: false,
|
||||||
);
|
);
|
||||||
myPackageResults.getMyPackages();
|
myPackageResults.getMyPackages();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
_isInit = false;
|
_isInit = false;
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
@@ -131,7 +130,7 @@ class _MyPackagesMineScreenState extends State<MyPackagesMineScreen> {
|
|||||||
text: 'package',
|
text: 'package',
|
||||||
deviceBlockSize: _deviceBlockSize,
|
deviceBlockSize: _deviceBlockSize,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
Provider.of<MyPackageProvider>(context, listen: false)
|
Provider.of<MyPackageProvider>(context, listen: false)
|
||||||
.searchMyPackages(value);
|
.searchMyPackages(value);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -147,28 +146,36 @@ class _MyPackagesMineScreenState extends State<MyPackagesMineScreen> {
|
|||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: ListView.builder(
|
: packageResults.originalMyPackages?.length !=
|
||||||
controller: sc,
|
null
|
||||||
itemBuilder: (context, index) {
|
? ListView.builder(
|
||||||
return MyPackagesItemDataBox(
|
controller: sc,
|
||||||
deviceBlockSize: _deviceBlockSize,
|
itemBuilder: (context, index) {
|
||||||
isAdmin:
|
return MyPackagesItemDataBox(
|
||||||
userData['roles']?.contains('User')
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
isAdmin: userData['roles']
|
||||||
|
?.contains('User')
|
||||||
? false
|
? false
|
||||||
: true,
|
: true,
|
||||||
packages:
|
packages:
|
||||||
packageResults.myPackages?[index],
|
packageResults.myPackages?[index],
|
||||||
push: () {
|
push: () {
|
||||||
Navigator.pushNamed(context,
|
Navigator.pushNamed(context,
|
||||||
Routes.myPackagesHistoryScreen,
|
Routes.myPackagesHistoryScreen,
|
||||||
arguments: packageResults
|
arguments: packageResults
|
||||||
.myPackages?[index]);
|
.myPackages?[index]);
|
||||||
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
itemCount:
|
||||||
},
|
packageResults.myPackages?.length,
|
||||||
itemCount: packageResults.myPackages?.length,
|
shrinkWrap: true,
|
||||||
shrinkWrap: true,
|
)
|
||||||
);
|
: Container(
|
||||||
|
child: Center(
|
||||||
|
child: Text("There is no item to show."),
|
||||||
|
),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -39,23 +39,25 @@ class _PackageResultScreenState extends State<PackageResultScreen> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
sc = new ScrollController();
|
sc = new ScrollController();
|
||||||
super.initState();
|
super.initState();
|
||||||
IsolateNameServer.registerPortWithName(_port.sendPort, 'downloader_send_port');
|
IsolateNameServer.registerPortWithName(
|
||||||
|
_port.sendPort, 'downloader_send_port');
|
||||||
_port.listen((dynamic data) {
|
_port.listen((dynamic data) {
|
||||||
String id = data[0];
|
String id = data[0];
|
||||||
DownloadTaskStatus status = data[1];
|
DownloadTaskStatus status = data[1];
|
||||||
int progress = data[2];
|
int progress = data[2];
|
||||||
if (status == DownloadTaskStatus.complete) {
|
if (status == DownloadTaskStatus.complete) {
|
||||||
print('Downloaded');
|
print('Downloaded');
|
||||||
}
|
}
|
||||||
setState((){ });
|
setState(() {});
|
||||||
});
|
});
|
||||||
|
|
||||||
FlutterDownloader.registerCallback(downloadCallback);
|
FlutterDownloader.registerCallback(downloadCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@pragma('vm:entry-point')
|
@pragma('vm:entry-point')
|
||||||
static void downloadCallback(String id, int status, int progress) {
|
static void downloadCallback(String id, int status, int progress) {
|
||||||
final SendPort? send = IsolateNameServer.lookupPortByName('downloader_send_port');
|
final SendPort? send =
|
||||||
|
IsolateNameServer.lookupPortByName('downloader_send_port');
|
||||||
send!.send([id, status, progress]);
|
send!.send([id, status, progress]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +109,12 @@ class _PackageResultScreenState extends State<PackageResultScreen> {
|
|||||||
),
|
),
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
titleSpacing: -10,
|
titleSpacing: -10,
|
||||||
title: Text('Home', style: TextStyle(color: Colors.white,),),
|
title: Text(
|
||||||
|
'Home',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
@@ -209,27 +216,36 @@ class _PackageResultScreenState extends State<PackageResultScreen> {
|
|||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: ListView.builder(
|
: packageResults.items?.length != null
|
||||||
controller: sc,
|
? ListView.builder(
|
||||||
itemBuilder: (context, index) {
|
controller: sc,
|
||||||
// String items = '';
|
itemBuilder: (context, index) {
|
||||||
// for (var item in packageResults
|
// String items = '';
|
||||||
// .items![index].items) {
|
// for (var item in packageResults
|
||||||
// items += item;
|
// .items![index].items) {
|
||||||
// items += ' , ';
|
// items += item;
|
||||||
// }
|
// items += ' , ';
|
||||||
// items = items.substring(
|
// }
|
||||||
// 0,
|
// items = items.substring(
|
||||||
// items.length - 3,
|
// 0,
|
||||||
// ); // remove extra ,
|
// items.length - 3,
|
||||||
return PackageItemBox(
|
// ); // remove extra ,
|
||||||
deviceBlockSize: _deviceBlockSize,
|
return PackageItemBox(
|
||||||
item: packageResults.items?[index],
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
item:
|
||||||
|
packageResults.items?[index],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
itemCount:
|
||||||
|
packageResults.items?.length,
|
||||||
|
shrinkWrap: true,
|
||||||
|
)
|
||||||
|
: Container(
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
"There is no item to show."),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
|
||||||
itemCount: packageResults.items?.length,
|
|
||||||
shrinkWrap: true,
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -261,27 +277,28 @@ class PackageResultFloatingButton extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
if (userData['roles'].contains('Supervisor') ||
|
if (userData['roles'].contains('Supervisor') ||
|
||||||
userData['roles'].contains('Admin'))
|
userData['roles'].contains('Admin'))
|
||||||
InkWell(
|
InkWell(
|
||||||
customBorder: CircleBorder(),
|
customBorder: CircleBorder(),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
var status = await Permission.storage.request();
|
var status = await Permission.storage.request();
|
||||||
if (status.isGranted) {
|
if (status.isGranted) {
|
||||||
Provider.of<PackageProvider>(context, listen: false).exportPackages();
|
Provider.of<PackageProvider>(context, listen: false)
|
||||||
}
|
.exportPackages();
|
||||||
},
|
}
|
||||||
child: Container(
|
},
|
||||||
padding: EdgeInsets.all(_deviceBlockSize),
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
padding: EdgeInsets.all(_deviceBlockSize),
|
||||||
shape: BoxShape.circle,
|
decoration: BoxDecoration(
|
||||||
color: Colors.black,
|
shape: BoxShape.circle,
|
||||||
),
|
color: Colors.black,
|
||||||
child: Icon(
|
),
|
||||||
Icons.import_export,
|
child: Icon(
|
||||||
size: 10 * _deviceBlockSize,
|
Icons.import_export,
|
||||||
color: Colors.white,
|
size: 10 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 2 * _deviceBlockSize,
|
width: 2 * _deviceBlockSize,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -278,16 +278,24 @@ class _TestResultScreenState extends State<TestResultScreen> {
|
|||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: ListView.builder(
|
: testResults.items?.length != null
|
||||||
controller: sc,
|
? ListView.builder(
|
||||||
itemBuilder: (context, index) =>
|
controller: sc,
|
||||||
TestItemBox(
|
itemBuilder: (context, index) =>
|
||||||
deviceBlockSize: _deviceBlockSize,
|
TestItemBox(
|
||||||
item: testResults.items![index],
|
deviceBlockSize: _deviceBlockSize,
|
||||||
),
|
item: testResults.items![index],
|
||||||
itemCount: testResults.items?.length,
|
),
|
||||||
shrinkWrap: true,
|
itemCount:
|
||||||
);
|
testResults.items?.length,
|
||||||
|
shrinkWrap: true,
|
||||||
|
)
|
||||||
|
: Container(
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
"There is no item to show."),
|
||||||
|
),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -230,7 +230,8 @@ class _TestVerifyScreenState extends State<TestVerifyScreen> {
|
|||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: ListView.builder(
|
: testResults.items?.length != null ?
|
||||||
|
ListView.builder(
|
||||||
controller: sc,
|
controller: sc,
|
||||||
itemBuilder: (context, index) =>
|
itemBuilder: (context, index) =>
|
||||||
(testResults.items![index].verified == 'None' &&
|
(testResults.items![index].verified == 'None' &&
|
||||||
@@ -246,7 +247,12 @@ class _TestVerifyScreenState extends State<TestVerifyScreen> {
|
|||||||
: Container(),
|
: Container(),
|
||||||
itemCount: testResults.items?.length,
|
itemCount: testResults.items?.length,
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
);
|
) :
|
||||||
|
Container(
|
||||||
|
child: Center(
|
||||||
|
child: Text("There is no item to show."),
|
||||||
|
),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class MyPackagesItemDataBox extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
if (isAdmin)
|
if (isAdmin)
|
||||||
Container(
|
Container(
|
||||||
width: 30 * _deviceBlockSize,
|
width: 50 * _deviceBlockSize,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
|
|||||||
Reference in New Issue
Block a user