Fix some known issues and add some new functions
Android APK Release / Build Android APK (push) Failing after 52m53s
Android APK Release / Build Android APK (push) Failing after 52m53s
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:cloudreve4_flutter/data/models/file_model.dart';
|
||||
import 'package:cloudreve4_flutter/services/file_service.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../core/utils/app_logger.dart';
|
||||
import '../../core/utils/file_utils.dart';
|
||||
|
||||
/// 文件夹选择器
|
||||
class FolderPicker extends StatefulWidget {
|
||||
@@ -61,7 +62,7 @@ class _FolderPickerState extends State<FolderPicker> {
|
||||
|
||||
void _enterFolder(FileModel folder) {
|
||||
setState(() {
|
||||
_currentPath = folder.path;
|
||||
_currentPath = folder.relativePath;
|
||||
});
|
||||
_loadFolders();
|
||||
}
|
||||
@@ -80,7 +81,10 @@ class _FolderPickerState extends State<FolderPicker> {
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: widget.maxVisibleItems != null
|
||||
? (widget.maxVisibleItems! * 56.0 + 40.0).clamp(80.0, maxHeight)
|
||||
? (widget.maxVisibleItems! * 56.0 + 40.0).clamp(
|
||||
80.0,
|
||||
maxHeight,
|
||||
)
|
||||
: maxHeight,
|
||||
),
|
||||
child: _buildListContent(context, primaryColor),
|
||||
@@ -108,7 +112,10 @@ class _FolderPickerState extends State<FolderPicker> {
|
||||
children: [
|
||||
Icon(Icons.folder_off, size: 48, color: Colors.grey.shade400),
|
||||
const SizedBox(height: 12),
|
||||
Text('此文件夹为空', style: TextStyle(color: Colors.grey.shade600, fontSize: 14)),
|
||||
Text(
|
||||
'此文件夹为空',
|
||||
style: TextStyle(color: Colors.grey.shade600, fontSize: 14),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -146,7 +153,13 @@ class _FolderPickerState extends State<FolderPicker> {
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Text(folder.name, style: const TextStyle(fontSize: 15, fontWeight: FontWeight.w500)),
|
||||
child: Text(
|
||||
folder.name,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
Icon(Icons.chevron_right, color: Colors.grey.shade400, size: 20),
|
||||
],
|
||||
@@ -156,7 +169,7 @@ class _FolderPickerState extends State<FolderPicker> {
|
||||
}
|
||||
|
||||
Widget _buildBreadcrumb(BuildContext context, Color primaryColor) {
|
||||
final pathParts = _currentPath.split('/');
|
||||
final pathParts = FileUtils.toRelativePath(_currentPath).split('/');
|
||||
pathParts.removeWhere((part) => part.isEmpty);
|
||||
|
||||
return Column(
|
||||
@@ -180,8 +193,8 @@ class _FolderPickerState extends State<FolderPicker> {
|
||||
),
|
||||
...pathParts.asMap().entries.expand((entry) {
|
||||
final index = entry.key;
|
||||
final part = entry.value;
|
||||
final path = '/${pathParts.sublist(0, index + 1).join('/')}';
|
||||
final path =
|
||||
'/${pathParts.sublist(0, index + 1).join('/')}';
|
||||
|
||||
return [
|
||||
Padding(
|
||||
@@ -194,7 +207,7 @@ class _FolderPickerState extends State<FolderPicker> {
|
||||
),
|
||||
_buildBreadcrumbItem(
|
||||
context,
|
||||
name: part,
|
||||
name: FileUtils.decodePathSegment(entry.value),
|
||||
path: path,
|
||||
isLast: index == pathParts.length - 1,
|
||||
primaryColor: primaryColor,
|
||||
@@ -208,13 +221,14 @@ class _FolderPickerState extends State<FolderPicker> {
|
||||
const SizedBox(width: 12),
|
||||
FilledButton.tonal(
|
||||
onPressed: () {
|
||||
final relative = _currentPath.startsWith('cloudreve://my')
|
||||
? _currentPath.replaceFirst('cloudreve://my', '')
|
||||
: _currentPath;
|
||||
final relative = FileUtils.toRelativePath(_currentPath);
|
||||
widget.onFolderSelected(relative.isEmpty ? '/' : relative);
|
||||
},
|
||||
style: FilledButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 8,
|
||||
),
|
||||
),
|
||||
child: const Text('选择'),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user