mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-13 11:48:56 +03:30
Set 'There is no item to show' to all menu screens
This commit is contained in:
@@ -39,23 +39,25 @@ class _PackageResultScreenState extends State<PackageResultScreen> {
|
||||
void initState() {
|
||||
sc = new ScrollController();
|
||||
super.initState();
|
||||
IsolateNameServer.registerPortWithName(_port.sendPort, 'downloader_send_port');
|
||||
IsolateNameServer.registerPortWithName(
|
||||
_port.sendPort, 'downloader_send_port');
|
||||
_port.listen((dynamic data) {
|
||||
String id = data[0];
|
||||
DownloadTaskStatus status = data[1];
|
||||
int progress = data[2];
|
||||
if (status == DownloadTaskStatus.complete) {
|
||||
print('Downloaded');
|
||||
}
|
||||
setState((){ });
|
||||
});
|
||||
String id = data[0];
|
||||
DownloadTaskStatus status = data[1];
|
||||
int progress = data[2];
|
||||
if (status == DownloadTaskStatus.complete) {
|
||||
print('Downloaded');
|
||||
}
|
||||
setState(() {});
|
||||
});
|
||||
|
||||
FlutterDownloader.registerCallback(downloadCallback);
|
||||
FlutterDownloader.registerCallback(downloadCallback);
|
||||
}
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
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]);
|
||||
}
|
||||
|
||||
@@ -107,7 +109,12 @@ class _PackageResultScreenState extends State<PackageResultScreen> {
|
||||
),
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
title: Text('Home', style: TextStyle(color: Colors.white,),),
|
||||
title: Text(
|
||||
'Home',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
backgroundColor: Colors.black,
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
@@ -209,27 +216,36 @@ class _PackageResultScreenState extends State<PackageResultScreen> {
|
||||
color: Colors.black,
|
||||
),
|
||||
)
|
||||
: ListView.builder(
|
||||
controller: sc,
|
||||
itemBuilder: (context, index) {
|
||||
// String items = '';
|
||||
// for (var item in packageResults
|
||||
// .items![index].items) {
|
||||
// items += item;
|
||||
// items += ' , ';
|
||||
// }
|
||||
// items = items.substring(
|
||||
// 0,
|
||||
// items.length - 3,
|
||||
// ); // remove extra ,
|
||||
return PackageItemBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
item: packageResults.items?[index],
|
||||
: packageResults.items?.length != null
|
||||
? ListView.builder(
|
||||
controller: sc,
|
||||
itemBuilder: (context, index) {
|
||||
// String items = '';
|
||||
// for (var item in packageResults
|
||||
// .items![index].items) {
|
||||
// items += item;
|
||||
// items += ' , ';
|
||||
// }
|
||||
// items = items.substring(
|
||||
// 0,
|
||||
// items.length - 3,
|
||||
// ); // remove extra ,
|
||||
return PackageItemBox(
|
||||
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: [
|
||||
if (userData['roles'].contains('Supervisor') ||
|
||||
userData['roles'].contains('Admin'))
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () async {
|
||||
var status = await Permission.storage.request();
|
||||
if (status.isGranted) {
|
||||
Provider.of<PackageProvider>(context, listen: false).exportPackages();
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(_deviceBlockSize),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.import_export,
|
||||
size: 10 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () async {
|
||||
var status = await Permission.storage.request();
|
||||
if (status.isGranted) {
|
||||
Provider.of<PackageProvider>(context, listen: false)
|
||||
.exportPackages();
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(_deviceBlockSize),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.import_export,
|
||||
size: 10 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 2 * _deviceBlockSize,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user