mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-18 15:54:35 +01:00
refactors (#539)
This commit is contained in:
@@ -11,8 +11,8 @@ import 'package:server_box/core/utils/comparator.dart';
|
||||
import 'package:server_box/data/model/server/server_private_info.dart';
|
||||
import 'package:server_box/data/model/sftp/browser_status.dart';
|
||||
import 'package:server_box/data/model/sftp/worker.dart';
|
||||
import 'package:server_box/data/provider/sftp.dart';
|
||||
import 'package:server_box/data/res/misc.dart';
|
||||
import 'package:server_box/data/res/provider.dart';
|
||||
import 'package:server_box/data/res/store.dart';
|
||||
import 'package:server_box/view/widget/omit_start_text.dart';
|
||||
import 'package:server_box/view/widget/two_line_text.dart';
|
||||
@@ -21,7 +21,7 @@ import 'package:server_box/view/widget/unix_perm.dart';
|
||||
import 'package:icons_plus/icons_plus.dart';
|
||||
|
||||
class SftpPage extends StatefulWidget {
|
||||
final ServerPrivateInfo spi;
|
||||
final Spi spi;
|
||||
final String? initPath;
|
||||
final bool isSelect;
|
||||
|
||||
@@ -38,7 +38,7 @@ class SftpPage extends StatefulWidget {
|
||||
|
||||
class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
|
||||
late final _status = SftpBrowserStatus(_client);
|
||||
late final _client = widget.spi.server!.client!;
|
||||
late final _client = widget.spi.server!.value.client!;
|
||||
final _sortOption = _SortOption().vn;
|
||||
|
||||
@override
|
||||
@@ -303,7 +303,7 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
|
||||
localPath,
|
||||
SftpReqType.download,
|
||||
);
|
||||
Pros.sftp.add(req, completer: completer);
|
||||
SftpProvider.add(req, completer: completer);
|
||||
final (suc, err) = await context.showLoadingDialog(
|
||||
fn: () => completer.future,
|
||||
);
|
||||
@@ -311,7 +311,7 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
|
||||
|
||||
final result = await AppRoutes.editor(path: localPath).go<bool>(context);
|
||||
if (result != null && result) {
|
||||
Pros.sftp.add(SftpReq(
|
||||
SftpProvider.add(SftpReq(
|
||||
req.spi,
|
||||
remotePath,
|
||||
localPath,
|
||||
@@ -335,7 +335,7 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
|
||||
context.pop();
|
||||
final remotePath = _getRemotePath(name);
|
||||
|
||||
Pros.sftp.add(
|
||||
SftpProvider.add(
|
||||
SftpReq(
|
||||
widget.spi,
|
||||
remotePath,
|
||||
@@ -659,12 +659,13 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
|
||||
}
|
||||
|
||||
showSearch(
|
||||
context: context,
|
||||
delegate: SearchPage(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 7, vertical: 3),
|
||||
future: (q) => find(q).toList(),
|
||||
builder: (ctx, e) => _buildItem(e, beforeTap: () => ctx.pop()),
|
||||
));
|
||||
context: context,
|
||||
delegate: SearchPage(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 7, vertical: 3),
|
||||
future: (q) => find(q).toList(),
|
||||
builder: (ctx, e) => _buildItem(e, beforeTap: ctx.pop),
|
||||
),
|
||||
);
|
||||
},
|
||||
icon: const Icon(Icons.search),
|
||||
);
|
||||
@@ -701,7 +702,7 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
|
||||
final fileName = path.split(Platform.pathSeparator).lastOrNull;
|
||||
final remotePath = '$remoteDir/$fileName';
|
||||
Loggers.app.info('SFTP upload local: $path, remote: $remotePath');
|
||||
Pros.sftp.add(
|
||||
SftpProvider.add(
|
||||
SftpReq(widget.spi, remotePath, path, SftpReqType.upload),
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user