implemented shrinking transfers

This commit is contained in:
NicKoehler 2023-02-25 09:44:23 +01:00
parent ab9acc76fc
commit abeb2058ee
No known key found for this signature in database
GPG Key ID: BAE01394EB51AC58

View File

@ -153,9 +153,17 @@ class _FileManagerPageState extends State<FileManagerPage>
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: Theme.of(context).scaffoldBackgroundColor,
body: Row( body: Row(
children: [ children: [
Flexible(flex: 3, child: body(isLocal: true)), Flexible(
Flexible(flex: 3, child: body(isLocal: false)), flex: 3,
Flexible(flex: 2, child: statusList()) child: body(isLocal: true),
),
Flexible(
flex: 3,
child: body(isLocal: false),
),
model.jobTable.isEmpty
? SizedBox()
: Flexible(flex: 2, child: statusList())
], ],
), ),
); );
@ -546,157 +554,146 @@ class _FileManagerPageState extends State<FileManagerPage>
/// watch transfer status /// watch transfer status
Widget statusList() { Widget statusList() {
return PreferredSize( return PreferredSize(
preferredSize: const Size(200, double.infinity), preferredSize: const Size(200, double.infinity),
child: model.jobTable.isEmpty child: Container(
? Center(child: Text(translate("Empty"))) margin: const EdgeInsets.only(top: 16.0, bottom: 16.0, right: 16.0),
: Container( padding: const EdgeInsets.all(8.0),
margin: child: Obx(
const EdgeInsets.only(top: 16.0, bottom: 16.0, right: 16.0), () => ListView.builder(
padding: const EdgeInsets.all(8.0), controller: ScrollController(),
child: Obx( itemBuilder: (BuildContext context, int index) {
() => ListView.builder( final item = model.jobTable[index];
controller: ScrollController(), return Padding(
itemBuilder: (BuildContext context, int index) { padding: const EdgeInsets.only(bottom: 5),
final item = model.jobTable[index]; child: Container(
return Padding( decoration: BoxDecoration(
padding: const EdgeInsets.only(bottom: 5), color: Theme.of(context).cardColor,
child: Container( borderRadius: BorderRadius.all(
decoration: BoxDecoration( Radius.circular(15.0),
color: Theme.of(context).cardColor, ),
borderRadius: BorderRadius.all( ),
Radius.circular(15.0), child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Transform.rotate(
angle: item.isRemote ? pi : 0,
child: SvgPicture.asset(
"assets/arrow.svg",
color: Theme.of(context).tabBarTheme.labelColor,
),
).paddingOnly(left: 15),
const SizedBox(
width: 16.0,
),
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: 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),
),
],
), ),
), ),
child: Column( Row(
mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
Row( Offstage(
crossAxisAlignment: CrossAxisAlignment.center, offstage: item.state != JobState.paused,
children: [ child: MenuButton(
Transform.rotate( onPressed: () {
angle: item.isRemote ? pi : 0, model.resumeJob(item.id);
child: SvgPicture.asset( },
"assets/arrow.svg", child: SvgPicture.asset(
color: Theme.of(context) "assets/refresh.svg",
.tabBarTheme color: Colors.white,
.labelColor,
),
).paddingOnly(left: 15),
const SizedBox(
width: 16.0,
), ),
Expanded( color: MyTheme.accent,
child: Column( hoverColor: MyTheme.accent80,
mainAxisSize: MainAxisSize.min, ),
crossAxisAlignment: ),
CrossAxisAlignment.start, MenuButton(
children: [ padding: EdgeInsets.only(right: 15),
Tooltip( child: SvgPicture.asset(
waitDuration: "assets/close.svg",
Duration(milliseconds: 500), color: Colors.white,
message: item.jobName, ),
child: Text( onPressed: () {
item.jobName, model.jobTable.removeAt(index);
maxLines: 1, model.cancelJob(item.id);
overflow: TextOverflow.ellipsis, },
).paddingSymmetric(vertical: 10), color: MyTheme.accent,
), hoverColor: MyTheme.accent80,
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),
),
],
),
),
Row(
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.accent80,
),
],
),
],
), ),
], ],
).paddingSymmetric(vertical: 10), ),
), ],
); ),
}, ],
itemCount: model.jobTable.length, ).paddingSymmetric(vertical: 10),
),
), ),
)); );
},
itemCount: model.jobTable.length,
),
),
),
);
} }
Widget headTools(bool isLocal) { Widget headTools(bool isLocal) {