|
1 | 1 | import 'package:files/backend/folder_provider.dart'; |
2 | 2 | import 'package:files/backend/workspace.dart'; |
3 | 3 | import 'package:files/widgets/context_menu.dart'; |
| 4 | +import 'package:files/widgets/drive_list.dart'; |
4 | 5 | import 'package:flutter/material.dart'; |
5 | 6 |
|
6 | 7 | typedef NewTabCallback = void Function(String); |
@@ -53,40 +54,53 @@ class _SidePaneState extends State<SidePane> { |
53 | 54 | width: 304, |
54 | 55 | child: Material( |
55 | 56 | color: Theme.of(context).colorScheme.surface, |
56 | | - child: ListView.builder( |
| 57 | + child: ListView.separated( |
57 | 58 | padding: const EdgeInsets.only(top: 56), |
58 | | - itemCount: widget.destinations.length, |
59 | | - itemBuilder: (context, index) => ContextMenu( |
60 | | - entries: [ |
61 | | - ContextMenuItem( |
62 | | - child: const Text("Open"), |
| 59 | + itemCount: widget.destinations.length + 1, |
| 60 | + separatorBuilder: (context, index) { |
| 61 | + if (index == widget.destinations.length - 1) { |
| 62 | + return const Divider(); |
| 63 | + } |
| 64 | + |
| 65 | + return const SizedBox(); |
| 66 | + }, |
| 67 | + itemBuilder: (context, index) { |
| 68 | + if (index == widget.destinations.length) { |
| 69 | + return DriveList(onDriveTap: widget.workspace.changeCurrentDir); |
| 70 | + } |
| 71 | + |
| 72 | + return ContextMenu( |
| 73 | + entries: [ |
| 74 | + ContextMenuItem( |
| 75 | + child: const Text("Open"), |
| 76 | + onTap: () => widget.workspace |
| 77 | + .changeCurrentDir(widget.destinations[index].path), |
| 78 | + ), |
| 79 | + ContextMenuItem( |
| 80 | + child: const Text("Open in new tab"), |
| 81 | + onTap: () => widget.onNewTab(widget.destinations[index].path), |
| 82 | + ), |
| 83 | + ContextMenuItem( |
| 84 | + child: const Text("Open in new window"), |
| 85 | + onTap: () {}, |
| 86 | + enabled: false, |
| 87 | + ), |
| 88 | + ], |
| 89 | + child: ListTile( |
| 90 | + dense: true, |
| 91 | + leading: Icon(widget.destinations[index].icon), |
| 92 | + selected: widget.workspace.currentDir == |
| 93 | + widget.destinations[index].path, |
| 94 | + selectedTileColor: |
| 95 | + Theme.of(context).colorScheme.primary.withOpacity(0.1), |
| 96 | + title: Text( |
| 97 | + widget.destinations[index].label, |
| 98 | + ), |
63 | 99 | onTap: () => widget.workspace |
64 | 100 | .changeCurrentDir(widget.destinations[index].path), |
65 | 101 | ), |
66 | | - ContextMenuItem( |
67 | | - child: const Text("Open in new tab"), |
68 | | - onTap: () => widget.onNewTab(widget.destinations[index].path), |
69 | | - ), |
70 | | - ContextMenuItem( |
71 | | - child: const Text("Open in new window"), |
72 | | - onTap: () {}, |
73 | | - enabled: false, |
74 | | - ), |
75 | | - ], |
76 | | - child: ListTile( |
77 | | - dense: true, |
78 | | - leading: Icon(widget.destinations[index].icon), |
79 | | - selected: widget.workspace.currentDir == |
80 | | - widget.destinations[index].path, |
81 | | - selectedTileColor: |
82 | | - Theme.of(context).colorScheme.primary.withOpacity(0.1), |
83 | | - title: Text( |
84 | | - widget.destinations[index].label, |
85 | | - ), |
86 | | - onTap: () => widget.workspace |
87 | | - .changeCurrentDir(widget.destinations[index].path), |
88 | | - ), |
89 | | - ), |
| 102 | + ); |
| 103 | + }, |
90 | 104 | ), |
91 | 105 | ), |
92 | 106 | ); |
|
0 commit comments