Changed columns and window behaviour when resized
This commit is contained in:
parent
ab470d4a4c
commit
bcd1827d8a
@ -74,10 +74,6 @@ const int kDesktopDefaultDisplayHeight = 720;
|
|||||||
const int kMobileMaxDisplaySize = 1280;
|
const int kMobileMaxDisplaySize = 1280;
|
||||||
const int kDesktopMaxDisplaySize = 3840;
|
const int kDesktopMaxDisplaySize = 3840;
|
||||||
|
|
||||||
const double kDesktopFileTransferNameColWidth = 200;
|
|
||||||
const double kDesktopFileTransferModifiedColWidth = 120;
|
|
||||||
const double kDesktopFileTransferMinimumWidth = 100;
|
|
||||||
const double kDesktopFileTransferMaximumWidth = 300;
|
|
||||||
const double kDesktopFileTransferRowHeight = 30.0;
|
const double kDesktopFileTransferRowHeight = 30.0;
|
||||||
const double kDesktopFileTransferHeaderHeight = 25.0;
|
const double kDesktopFileTransferHeaderHeight = 25.0;
|
||||||
|
|
||||||
@ -142,6 +138,7 @@ const kRemoteScrollStyleBar = 'scrollbar';
|
|||||||
|
|
||||||
/// [kScrollModeDefault] Mouse or touchpad, the default scroll mode.
|
/// [kScrollModeDefault] Mouse or touchpad, the default scroll mode.
|
||||||
const kScrollModeDefault = 'default';
|
const kScrollModeDefault = 'default';
|
||||||
|
|
||||||
/// [kScrollModeReverse] Mouse or touchpad, the reverse scroll mode.
|
/// [kScrollModeReverse] Mouse or touchpad, the reverse scroll mode.
|
||||||
const kScrollModeReverse = 'reverse';
|
const kScrollModeReverse = 'reverse';
|
||||||
|
|
||||||
|
@ -364,15 +364,20 @@ class _FileManagerViewState extends State<FileManagerView> {
|
|||||||
final _breadCrumbScroller = ScrollController();
|
final _breadCrumbScroller = ScrollController();
|
||||||
final _keyboardNode = FocusNode();
|
final _keyboardNode = FocusNode();
|
||||||
final _listSearchBuffer = TimeoutStringBuffer();
|
final _listSearchBuffer = TimeoutStringBuffer();
|
||||||
final _nameColWidth = kDesktopFileTransferNameColWidth.obs;
|
final _nameColWidth = 0.0.obs;
|
||||||
final _modifiedColWidth = kDesktopFileTransferModifiedColWidth.obs;
|
final _modifiedColWidth = 0.0.obs;
|
||||||
|
final _sizeColWidth = 0.0.obs;
|
||||||
final _fileListScrollController = ScrollController();
|
final _fileListScrollController = ScrollController();
|
||||||
|
final _globalHeaderKey = GlobalKey();
|
||||||
|
|
||||||
/// [_lastClickTime], [_lastClickEntry] help to handle double click
|
/// [_lastClickTime], [_lastClickEntry] help to handle double click
|
||||||
var _lastClickTime =
|
var _lastClickTime =
|
||||||
DateTime.now().millisecondsSinceEpoch - bind.getDoubleClickTime() - 1000;
|
DateTime.now().millisecondsSinceEpoch - bind.getDoubleClickTime() - 1000;
|
||||||
Entry? _lastClickEntry;
|
Entry? _lastClickEntry;
|
||||||
|
|
||||||
|
double? _windowWidthPrev;
|
||||||
|
double _fileTransferMinimumWidth = 0.0;
|
||||||
|
|
||||||
FileController get controller => widget.controller;
|
FileController get controller => widget.controller;
|
||||||
bool get isLocal => widget.controller.isLocal;
|
bool get isLocal => widget.controller.isLocal;
|
||||||
FFI get _ffi => widget._ffi;
|
FFI get _ffi => widget._ffi;
|
||||||
@ -1145,7 +1150,27 @@ class _FileManagerViewState extends State<FileManagerView> {
|
|||||||
|
|
||||||
Widget _buildFileBrowserHeader(BuildContext context) {
|
Widget _buildFileBrowserHeader(BuildContext context) {
|
||||||
final padding = EdgeInsets.all(1.0);
|
final padding = EdgeInsets.all(1.0);
|
||||||
|
final windowWidthNow = MediaQuery.of(context).size.width;
|
||||||
|
if (_windowWidthPrev == null) {
|
||||||
|
_windowWidthPrev = windowWidthNow;
|
||||||
|
final defaultColumnWidth = windowWidthNow * 0.34 / 3;
|
||||||
|
_fileTransferMinimumWidth = defaultColumnWidth / 3;
|
||||||
|
_nameColWidth.value = defaultColumnWidth;
|
||||||
|
_modifiedColWidth.value = defaultColumnWidth;
|
||||||
|
_sizeColWidth.value = defaultColumnWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_windowWidthPrev != windowWidthNow) {
|
||||||
|
final difference = windowWidthNow / _windowWidthPrev!;
|
||||||
|
_windowWidthPrev = windowWidthNow;
|
||||||
|
_fileTransferMinimumWidth *= difference;
|
||||||
|
_nameColWidth.value *= difference;
|
||||||
|
_modifiedColWidth.value *= difference;
|
||||||
|
_sizeColWidth.value *= difference;
|
||||||
|
}
|
||||||
|
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
|
key: _globalHeaderKey,
|
||||||
height: kDesktopFileTransferHeaderHeight,
|
height: kDesktopFileTransferHeaderHeight,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
@ -1156,9 +1181,20 @@ class _FileManagerViewState extends State<FileManagerView> {
|
|||||||
DraggableDivider(
|
DraggableDivider(
|
||||||
axis: Axis.vertical,
|
axis: Axis.vertical,
|
||||||
onPointerMove: (dx) {
|
onPointerMove: (dx) {
|
||||||
|
if (_nameColWidth.value + dx <= _fileTransferMinimumWidth) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_modifiedColWidth.value - dx <= _fileTransferMinimumWidth) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_nameColWidth.value += dx;
|
_nameColWidth.value += dx;
|
||||||
_nameColWidth.value = min(kDesktopFileTransferMaximumWidth,
|
_nameColWidth.value =
|
||||||
max(kDesktopFileTransferMinimumWidth, _nameColWidth.value));
|
max(_fileTransferMinimumWidth, _nameColWidth.value);
|
||||||
|
_modifiedColWidth.value -= dx;
|
||||||
|
_modifiedColWidth.value =
|
||||||
|
max(_fileTransferMinimumWidth, _modifiedColWidth.value);
|
||||||
},
|
},
|
||||||
padding: padding,
|
padding: padding,
|
||||||
),
|
),
|
||||||
@ -1169,14 +1205,25 @@ class _FileManagerViewState extends State<FileManagerView> {
|
|||||||
DraggableDivider(
|
DraggableDivider(
|
||||||
axis: Axis.vertical,
|
axis: Axis.vertical,
|
||||||
onPointerMove: (dx) {
|
onPointerMove: (dx) {
|
||||||
|
if (_modifiedColWidth.value + dx <= _fileTransferMinimumWidth) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_sizeColWidth.value - dx <= _fileTransferMinimumWidth) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_modifiedColWidth.value += dx;
|
_modifiedColWidth.value += dx;
|
||||||
_modifiedColWidth.value = min(
|
_modifiedColWidth.value =
|
||||||
kDesktopFileTransferMaximumWidth,
|
max(_fileTransferMinimumWidth, _modifiedColWidth.value);
|
||||||
max(kDesktopFileTransferMinimumWidth,
|
_sizeColWidth.value -= dx;
|
||||||
_modifiedColWidth.value));
|
_sizeColWidth.value =
|
||||||
|
max(_fileTransferMinimumWidth, _sizeColWidth.value);
|
||||||
},
|
},
|
||||||
padding: padding),
|
padding: padding),
|
||||||
Expanded(child: headerItemFunc(null, SortBy.size, translate("Size")))
|
Expanded(
|
||||||
|
child: headerItemFunc(
|
||||||
|
_sizeColWidth.value, SortBy.size, translate("Size")))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -1201,23 +1248,20 @@ class _FileManagerViewState extends State<FileManagerView> {
|
|||||||
height: kDesktopFileTransferHeaderHeight,
|
height: kDesktopFileTransferHeaderHeight,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Flexible(
|
Expanded(
|
||||||
flex: 2,
|
|
||||||
child: Text(
|
child: Text(
|
||||||
name,
|
name,
|
||||||
style: headerTextStyle,
|
style: headerTextStyle,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
).marginSymmetric(horizontal: 4),
|
).marginOnly(left: 4),
|
||||||
),
|
),
|
||||||
Flexible(
|
ascending.value != null
|
||||||
flex: 1,
|
|
||||||
child: ascending.value != null
|
|
||||||
? Icon(
|
? Icon(
|
||||||
ascending.value!
|
ascending.value!
|
||||||
? Icons.keyboard_arrow_up_rounded
|
? Icons.keyboard_arrow_up_rounded
|
||||||
: Icons.keyboard_arrow_down_rounded,
|
: Icons.keyboard_arrow_down_rounded,
|
||||||
)
|
)
|
||||||
: const Offstage())
|
: SizedBox()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user