changed empty job list logic
This commit is contained in:
parent
eb39cc5da1
commit
ee893ce744
2
flutter/assets/transfer.svg
Normal file
2
flutter/assets/transfer.svg
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="isolation:isolate" viewBox="298.171 98.799 32 32" width="32pt" height="32pt"><g><path d=" M 298.171 98.799 L 330.171 98.799 L 330.171 130.799 L 298.171 130.799 L 298.171 98.799 Z " fill="none"/><path d=" M 310.278 119.949 L 321.825 119.949 C 322.772 119.949 323.542 119.18 323.542 118.233 L 323.542 118.233 C 323.542 117.285 322.772 116.516 321.825 116.516 L 307.25 116.516 C 304.69 116.516 304.031 118.035 305.779 119.905 L 311.537 126.064 C 312.207 126.734 313.295 126.734 313.965 126.064 L 313.965 126.064 C 314.635 125.394 314.635 124.306 313.965 123.636 L 310.278 119.949 Z M 318.065 109.649 L 306.518 109.649 C 305.57 109.649 304.801 110.419 304.801 111.366 L 304.801 111.366 C 304.801 112.313 305.57 113.083 306.518 113.083 L 321.092 113.083 C 323.653 113.083 324.312 111.564 322.563 109.693 L 316.806 103.535 C 316.136 102.865 315.048 102.865 314.378 103.535 L 314.378 103.535 C 313.708 104.205 313.708 105.293 314.378 105.963 L 318.065 109.649 Z " fill-rule="evenodd" fill="rgb(0,0,0)"/></g></svg>
|
After Width: | Height: | Size: 1.1 KiB |
@ -153,17 +153,9 @@ class _FileManagerPageState extends State<FileManagerPage>
|
|||||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
body: Row(
|
body: Row(
|
||||||
children: [
|
children: [
|
||||||
Flexible(
|
Flexible(flex: 3, child: body(isLocal: true)),
|
||||||
flex: 3,
|
Flexible(flex: 3, child: body(isLocal: false)),
|
||||||
child: body(isLocal: true),
|
Flexible(flex: 2, child: statusList())
|
||||||
),
|
|
||||||
Flexible(
|
|
||||||
flex: 3,
|
|
||||||
child: body(isLocal: false),
|
|
||||||
),
|
|
||||||
model.jobTable.isEmpty
|
|
||||||
? SizedBox()
|
|
||||||
: Flexible(flex: 2, child: statusList())
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -550,6 +542,18 @@ class _FileManagerPageState extends State<FileManagerPage>
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget generateCard(Widget child) {
|
||||||
|
return Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).cardColor,
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(15.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/// transfer status list
|
/// transfer status list
|
||||||
/// watch transfer status
|
/// watch transfer status
|
||||||
Widget statusList() {
|
Widget statusList() {
|
||||||
@ -558,140 +562,165 @@ class _FileManagerPageState extends State<FileManagerPage>
|
|||||||
child: Container(
|
child: Container(
|
||||||
margin: const EdgeInsets.only(top: 16.0, bottom: 16.0, right: 16.0),
|
margin: const EdgeInsets.only(top: 16.0, bottom: 16.0, right: 16.0),
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Obx(
|
child: model.jobTable.isEmpty
|
||||||
() => ListView.builder(
|
? generateCard(
|
||||||
controller: ScrollController(),
|
Center(
|
||||||
itemBuilder: (BuildContext context, int index) {
|
|
||||||
final item = model.jobTable[index];
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.only(bottom: 5),
|
|
||||||
child: Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Theme.of(context).cardColor,
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(15.0),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
SvgPicture.asset(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
"assets/transfer.svg",
|
||||||
children: [
|
color: Theme.of(context).tabBarTheme.labelColor,
|
||||||
Transform.rotate(
|
height: 40,
|
||||||
angle: item.isRemote ? pi : 0,
|
).paddingOnly(bottom: 10),
|
||||||
child: SvgPicture.asset(
|
Text(
|
||||||
"assets/arrow.svg",
|
translate("No transfers in progress"),
|
||||||
color: Theme.of(context).tabBarTheme.labelColor,
|
textAlign: TextAlign.center,
|
||||||
),
|
textScaleFactor: 1.20,
|
||||||
).paddingOnly(left: 15),
|
style: TextStyle(
|
||||||
const SizedBox(
|
color: Theme.of(context).tabBarTheme.labelColor),
|
||||||
width: 16.0,
|
),
|
||||||
),
|
],
|
||||||
Expanded(
|
),
|
||||||
child: Column(
|
),
|
||||||
mainAxisSize: MainAxisSize.min,
|
)
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
: Obx(
|
||||||
|
() => ListView.builder(
|
||||||
|
controller: ScrollController(),
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
final item = model.jobTable[index];
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 5),
|
||||||
|
child: generateCard(
|
||||||
|
Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Tooltip(
|
Transform.rotate(
|
||||||
waitDuration: Duration(milliseconds: 500),
|
angle: item.isRemote ? pi : 0,
|
||||||
message: item.jobName,
|
child: SvgPicture.asset(
|
||||||
child: Text(
|
"assets/arrow.svg",
|
||||||
item.jobName,
|
color: Theme.of(context)
|
||||||
maxLines: 1,
|
.tabBarTheme
|
||||||
overflow: TextOverflow.ellipsis,
|
.labelColor,
|
||||||
).paddingSymmetric(vertical: 10),
|
),
|
||||||
|
).paddingOnly(left: 15),
|
||||||
|
const SizedBox(
|
||||||
|
width: 16.0,
|
||||||
),
|
),
|
||||||
Text(
|
Expanded(
|
||||||
'${translate("Total")} ${readableFileSize(item.totalSize.toDouble())}',
|
child: Column(
|
||||||
style: TextStyle(
|
mainAxisSize: MainAxisSize.min,
|
||||||
fontSize: 12,
|
crossAxisAlignment:
|
||||||
color: MyTheme.darkGray,
|
CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Tooltip(
|
||||||
|
waitDuration:
|
||||||
|
Duration(milliseconds: 500),
|
||||||
|
message: item.jobName,
|
||||||
|
child: Text(
|
||||||
|
item.jobName,
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
).paddingSymmetric(vertical: 10),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'${translate("Total")} ${readableFileSize(item.totalSize.toDouble())}',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: MyTheme.darkGray,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Offstage(
|
||||||
|
offstage:
|
||||||
|
item.state != JobState.inProgress,
|
||||||
|
child: Text(
|
||||||
|
'${translate("Speed")} ${readableFileSize(item.speed)}/s',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: MyTheme.darkGray,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Offstage(
|
||||||
|
offstage:
|
||||||
|
item.state == JobState.inProgress,
|
||||||
|
child: Text(
|
||||||
|
translate(
|
||||||
|
item.display(),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: MyTheme.darkGray,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Offstage(
|
||||||
|
offstage:
|
||||||
|
item.state != JobState.inProgress,
|
||||||
|
child: LinearPercentIndicator(
|
||||||
|
padding: EdgeInsets.only(right: 15),
|
||||||
|
animateFromLastPercent: true,
|
||||||
|
center: Text(
|
||||||
|
'${(item.finishedSize / item.totalSize * 100).toStringAsFixed(0)}%',
|
||||||
|
),
|
||||||
|
barRadius: Radius.circular(15),
|
||||||
|
percent: item.finishedSize /
|
||||||
|
item.totalSize,
|
||||||
|
progressColor: MyTheme.accent,
|
||||||
|
backgroundColor:
|
||||||
|
Theme.of(context).hoverColor,
|
||||||
|
lineHeight:
|
||||||
|
kDesktopFileTransferRowHeight,
|
||||||
|
).paddingSymmetric(vertical: 15),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Offstage(
|
Row(
|
||||||
offstage: item.state != JobState.inProgress,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
child: Text(
|
children: [
|
||||||
'${translate("Speed")} ${readableFileSize(item.speed)}/s',
|
Offstage(
|
||||||
style: TextStyle(
|
offstage: item.state != JobState.paused,
|
||||||
fontSize: 12,
|
child: MenuButton(
|
||||||
color: MyTheme.darkGray,
|
onPressed: () {
|
||||||
|
model.resumeJob(item.id);
|
||||||
|
},
|
||||||
|
child: SvgPicture.asset(
|
||||||
|
"assets/refresh.svg",
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
color: MyTheme.accent,
|
||||||
|
hoverColor: MyTheme.accent80,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
MenuButton(
|
||||||
),
|
padding: EdgeInsets.only(right: 15),
|
||||||
Offstage(
|
child: SvgPicture.asset(
|
||||||
offstage: item.state == JobState.inProgress,
|
"assets/close.svg",
|
||||||
child: Text(
|
color: Colors.white,
|
||||||
translate(
|
),
|
||||||
item.display(),
|
onPressed: () {
|
||||||
|
model.jobTable.removeAt(index);
|
||||||
|
model.cancelJob(item.id);
|
||||||
|
},
|
||||||
|
color: MyTheme.accent,
|
||||||
|
hoverColor: MyTheme.accent80,
|
||||||
),
|
),
|
||||||
style: TextStyle(
|
],
|
||||||
fontSize: 12,
|
|
||||||
color: MyTheme.darkGray,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Offstage(
|
|
||||||
offstage: item.state != JobState.inProgress,
|
|
||||||
child: LinearPercentIndicator(
|
|
||||||
padding: EdgeInsets.only(right: 15),
|
|
||||||
animateFromLastPercent: true,
|
|
||||||
center: Text(
|
|
||||||
'${(item.finishedSize / item.totalSize * 100).toStringAsFixed(0)}%',
|
|
||||||
),
|
|
||||||
barRadius: Radius.circular(15),
|
|
||||||
percent: item.finishedSize / item.totalSize,
|
|
||||||
progressColor: MyTheme.accent,
|
|
||||||
backgroundColor:
|
|
||||||
Theme.of(context).hoverColor,
|
|
||||||
lineHeight: kDesktopFileTransferRowHeight,
|
|
||||||
).paddingSymmetric(vertical: 15),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
Row(
|
).paddingSymmetric(vertical: 10),
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
|
||||||
children: [
|
|
||||||
Offstage(
|
|
||||||
offstage: item.state != JobState.paused,
|
|
||||||
child: MenuButton(
|
|
||||||
onPressed: () {
|
|
||||||
model.resumeJob(item.id);
|
|
||||||
},
|
|
||||||
child: SvgPicture.asset(
|
|
||||||
"assets/refresh.svg",
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
color: MyTheme.accent,
|
|
||||||
hoverColor: MyTheme.accent80,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
MenuButton(
|
|
||||||
padding: EdgeInsets.only(right: 15),
|
|
||||||
child: SvgPicture.asset(
|
|
||||||
"assets/close.svg",
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
model.jobTable.removeAt(index);
|
|
||||||
model.cancelJob(item.id);
|
|
||||||
},
|
|
||||||
color: MyTheme.accent,
|
|
||||||
hoverColor: MyTheme.button,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
],
|
);
|
||||||
).paddingSymmetric(vertical: 10),
|
},
|
||||||
|
itemCount: model.jobTable.length,
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
},
|
|
||||||
itemCount: model.jobTable.length,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user