Skip to content

Commit 8745fcb

Browse files
authored
opt desktop file manager status list (rustdesk#9117)
* Show delete file/dir log * Show full path rather than base file name * Show files count * Opt status card layout * Change selected color to accent Signed-off-by: 21pages <sunboeasy@gmail.com>
1 parent 2a0fd55 commit 8745fcb

3 files changed

Lines changed: 272 additions & 82 deletions

File tree

flutter/lib/desktop/pages/file_manager_page.dart

Lines changed: 46 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,25 @@ class _FileManagerPageState extends State<FileManagerPage>
173173
/// transfer status list
174174
/// watch transfer status
175175
Widget statusList() {
176+
Widget getIcon(JobProgress job) {
177+
final color = Theme.of(context).tabBarTheme.labelColor;
178+
switch (job.type) {
179+
case JobType.deleteDir:
180+
case JobType.deleteFile:
181+
return Icon(Icons.delete_outline, color: color);
182+
default:
183+
return Transform.rotate(
184+
angle: job.isRemoteToLocal ? pi : 0,
185+
child: Icon(Icons.arrow_forward_ios, color: color),
186+
);
187+
}
188+
}
189+
176190
statusListView(List<JobProgress> jobs) => ListView.builder(
177191
controller: ScrollController(),
178192
itemBuilder: (BuildContext context, int index) {
179193
final item = jobs[index];
194+
final status = item.getStatus();
180195
return Padding(
181196
padding: const EdgeInsets.only(bottom: 5),
182197
child: generateCard(
@@ -186,15 +201,8 @@ class _FileManagerPageState extends State<FileManagerPage>
186201
Row(
187202
crossAxisAlignment: CrossAxisAlignment.center,
188203
children: [
189-
Transform.rotate(
190-
angle: item.isRemoteToLocal ? pi : 0,
191-
child: SvgPicture.asset("assets/arrow.svg",
192-
colorFilter: svgColor(
193-
Theme.of(context).tabBarTheme.labelColor)),
194-
).paddingOnly(left: 15),
195-
const SizedBox(
196-
width: 16.0,
197-
),
204+
getIcon(item)
205+
.marginSymmetric(horizontal: 10, vertical: 12),
198206
Expanded(
199207
child: Column(
200208
mainAxisSize: MainAxisSize.min,
@@ -204,44 +212,24 @@ class _FileManagerPageState extends State<FileManagerPage>
204212
waitDuration: Duration(milliseconds: 500),
205213
message: item.jobName,
206214
child: Text(
207-
item.fileName,
215+
item.jobName,
208216
maxLines: 1,
209217
overflow: TextOverflow.ellipsis,
210-
).paddingSymmetric(vertical: 10),
211-
),
212-
Text(
213-
'${translate("Total")} ${readableFileSize(item.totalSize.toDouble())}',
214-
style: TextStyle(
215-
fontSize: 12,
216-
color: MyTheme.darkGray,
217-
),
218-
),
219-
Offstage(
220-
offstage: item.state != JobState.inProgress,
221-
child: Text(
222-
'${translate("Speed")} ${readableFileSize(item.speed)}/s',
223-
style: TextStyle(
224-
fontSize: 12,
225-
color: MyTheme.darkGray,
226-
),
227218
),
228219
),
229-
Offstage(
230-
offstage: item.state == JobState.inProgress,
231-
child: Text(
232-
translate(
233-
item.display(),
234-
),
235-
style: TextStyle(
236-
fontSize: 12,
237-
color: MyTheme.darkGray,
238-
),
239-
),
220+
Tooltip(
221+
waitDuration: Duration(milliseconds: 500),
222+
message: status,
223+
child: Text(status,
224+
style: TextStyle(
225+
fontSize: 12,
226+
color: MyTheme.darkGray,
227+
)).marginOnly(top: 6),
240228
),
241229
Offstage(
242-
offstage: item.state != JobState.inProgress,
230+
offstage: item.type != JobType.transfer ||
231+
item.state != JobState.inProgress,
243232
child: LinearPercentIndicator(
244-
padding: EdgeInsets.only(right: 15),
245233
animateFromLastPercent: true,
246234
center: Text(
247235
'${(item.finishedSize / item.totalSize * 100).toStringAsFixed(0)}%',
@@ -251,7 +239,7 @@ class _FileManagerPageState extends State<FileManagerPage>
251239
progressColor: MyTheme.accent,
252240
backgroundColor: Theme.of(context).hoverColor,
253241
lineHeight: kDesktopFileTransferRowHeight,
254-
).paddingSymmetric(vertical: 15),
242+
).paddingSymmetric(vertical: 8),
255243
),
256244
],
257245
),
@@ -276,7 +264,6 @@ class _FileManagerPageState extends State<FileManagerPage>
276264
),
277265
MenuButton(
278266
tooltip: translate("Delete"),
279-
padding: EdgeInsets.only(right: 15),
280267
child: SvgPicture.asset(
281268
"assets/close.svg",
282269
colorFilter: svgColor(Colors.white),
@@ -289,11 +276,11 @@ class _FileManagerPageState extends State<FileManagerPage>
289276
hoverColor: MyTheme.accent80,
290277
),
291278
],
292-
),
279+
).marginAll(12),
293280
],
294281
),
295282
],
296-
).paddingSymmetric(vertical: 10),
283+
),
297284
),
298285
);
299286
},
@@ -1007,7 +994,7 @@ class _FileManagerViewState extends State<FileManagerView> {
1007994
child: Obx(() => Container(
1008995
decoration: BoxDecoration(
1009996
color: selectedItems.items.contains(entry)
1010-
? Theme.of(context).hoverColor
997+
? MyTheme.button
1011998
: Theme.of(context).cardColor,
1012999
borderRadius: BorderRadius.all(
10131000
Radius.circular(5.0),
@@ -1050,6 +1037,11 @@ class _FileManagerViewState extends State<FileManagerView> {
10501037
),
10511038
Expanded(
10521039
child: Text(entry.name.nonBreaking,
1040+
style: TextStyle(
1041+
color: selectedItems.items
1042+
.contains(entry)
1043+
? Colors.white
1044+
: null),
10531045
overflow:
10541046
TextOverflow.ellipsis))
10551047
]),
@@ -1111,7 +1103,10 @@ class _FileManagerViewState extends State<FileManagerView> {
11111103
overflow: TextOverflow.ellipsis,
11121104
style: TextStyle(
11131105
fontSize: 12,
1114-
color: MyTheme.darkGray,
1106+
color: selectedItems.items
1107+
.contains(entry)
1108+
? Colors.white70
1109+
: MyTheme.darkGray,
11151110
),
11161111
)),
11171112
),
@@ -1131,7 +1126,11 @@ class _FileManagerViewState extends State<FileManagerView> {
11311126
sizeStr,
11321127
overflow: TextOverflow.ellipsis,
11331128
style: TextStyle(
1134-
fontSize: 10, color: MyTheme.darkGray),
1129+
fontSize: 10,
1130+
color:
1131+
selectedItems.items.contains(entry)
1132+
? Colors.white70
1133+
: MyTheme.darkGray),
11351134
),
11361135
),
11371136
),

0 commit comments

Comments
 (0)