opt.: use new routes
This commit is contained in:
@@ -8,7 +8,6 @@ import 'package:toolbox/data/provider/server.dart';
|
||||
import 'package:toolbox/data/provider/sftp.dart';
|
||||
import 'package:toolbox/data/res/misc.dart';
|
||||
import 'package:toolbox/locator.dart';
|
||||
import 'package:toolbox/view/page/editor.dart';
|
||||
import 'package:toolbox/view/widget/input_field.dart';
|
||||
import 'package:toolbox/view/widget/picker.dart';
|
||||
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||
@@ -23,13 +22,15 @@ import '../../../data/res/path.dart';
|
||||
import '../../../data/res/ui.dart';
|
||||
import '../../widget/custom_appbar.dart';
|
||||
import '../../widget/fade_in.dart';
|
||||
import 'sftp_mission.dart';
|
||||
|
||||
class LocalStoragePage extends StatefulWidget {
|
||||
final bool isPickFile;
|
||||
final String? initDir;
|
||||
const LocalStoragePage({Key? key, this.isPickFile = false, this.initDir})
|
||||
: super(key: key);
|
||||
const LocalStoragePage({
|
||||
Key? key,
|
||||
required this.isPickFile,
|
||||
this.initDir,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<LocalStoragePage> createState() => _LocalStoragePageState();
|
||||
@@ -78,10 +79,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.downloading),
|
||||
onPressed: () => AppRoute(
|
||||
const SftpMissionPage(),
|
||||
'sftp downloading',
|
||||
).go(context),
|
||||
onPressed: () => AppRoute.sftpMission().go(context),
|
||||
)
|
||||
],
|
||||
),
|
||||
@@ -256,11 +254,8 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
);
|
||||
return;
|
||||
}
|
||||
final result = await AppRoute(
|
||||
EditorPage(
|
||||
path: file.absolute.path,
|
||||
),
|
||||
'sftp dled editor',
|
||||
final result = await AppRoute.editor(
|
||||
path: file.absolute.path,
|
||||
).go<String>(context);
|
||||
final f = File(file.absolute.path);
|
||||
if (result != null) {
|
||||
|
||||
@@ -9,8 +9,6 @@ import 'package:toolbox/core/extension/navigator.dart';
|
||||
import 'package:toolbox/core/extension/sftpfile.dart';
|
||||
import 'package:toolbox/data/res/misc.dart';
|
||||
import 'package:toolbox/data/store/history.dart';
|
||||
import 'package:toolbox/view/page/editor.dart';
|
||||
import 'package:toolbox/view/page/storage/local.dart';
|
||||
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||
|
||||
import '../../../core/extension/numx.dart';
|
||||
@@ -31,7 +29,6 @@ import '../../widget/custom_appbar.dart';
|
||||
import '../../widget/fade_in.dart';
|
||||
import '../../widget/input_field.dart';
|
||||
import '../../widget/two_line_text.dart';
|
||||
import 'sftp_mission.dart';
|
||||
|
||||
class SftpPage extends StatefulWidget {
|
||||
final ServerPrivateInfo spi;
|
||||
@@ -92,10 +89,7 @@ class _SftpPageState extends State<SftpPage> {
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.downloading),
|
||||
onPressed: () => AppRoute(
|
||||
const SftpMissionPage(),
|
||||
'sftp downloading',
|
||||
).go(context),
|
||||
onPressed: () => AppRoute.sftpMission().go(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -176,11 +170,7 @@ class _SftpPageState extends State<SftpPage> {
|
||||
final path = await () async {
|
||||
switch (idx) {
|
||||
case 0:
|
||||
return await AppRoute(
|
||||
const LocalStoragePage(
|
||||
isPickFile: true,
|
||||
),
|
||||
'sftp dled pick')
|
||||
return await AppRoute.localStorage(isPickFile: true)
|
||||
.go<String>(context);
|
||||
case 1:
|
||||
return await pickOneFile();
|
||||
@@ -390,10 +380,7 @@ class _SftpPageState extends State<SftpPage> {
|
||||
await completer.future;
|
||||
context.pop();
|
||||
|
||||
final result = await AppRoute(
|
||||
EditorPage(path: localPath),
|
||||
'SFTP edit',
|
||||
).go<String>(context);
|
||||
final result = await AppRoute.editor(path: localPath).go<String>(context);
|
||||
if (result != null) {
|
||||
_sftp.add(SftpReq(req.spi, remotePath, localPath, SftpReqType.upload));
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import 'package:toolbox/core/extension/datetime.dart';
|
||||
import 'package:toolbox/core/extension/navigator.dart';
|
||||
import 'package:toolbox/core/route.dart';
|
||||
import 'package:toolbox/locator.dart';
|
||||
import 'package:toolbox/view/page/storage/local.dart';
|
||||
|
||||
import '../../../core/extension/numx.dart';
|
||||
import '../../../core/utils/misc.dart';
|
||||
@@ -77,10 +76,7 @@ class _SftpMissionPageState extends State<SftpMissionPage> {
|
||||
onPressed: () {
|
||||
final idx = status.req.localPath.lastIndexOf('/');
|
||||
final dir = status.req.localPath.substring(0, idx);
|
||||
AppRoute(
|
||||
LocalStoragePage(initDir: dir),
|
||||
'sftp local',
|
||||
).go(context);
|
||||
AppRoute.localStorage(initDir: dir).go(context);
|
||||
},
|
||||
icon: const Icon(Icons.file_open)),
|
||||
IconButton(
|
||||
|
||||
Reference in New Issue
Block a user