mirror of
https://codeberg.org/shroff/phylum.git
synced 2026-01-05 19:21:23 -06:00
[client] path view
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:phylum/ui/app/app_actions.dart';
|
||||
import 'package:phylum/ui/app/nav_list.dart';
|
||||
import 'package:phylum/ui/common/expandable_fab.dart';
|
||||
import 'package:phylum/ui/explorer/explorer_view.dart';
|
||||
import 'package:phylum/ui/explorer/path_view.dart';
|
||||
|
||||
class AppLayout extends StatelessWidget {
|
||||
final String folderId;
|
||||
@@ -71,7 +72,7 @@ class AppLayout extends StatelessWidget {
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// FolderHeriarchyView(),
|
||||
PathView.create(folderId),
|
||||
Expanded(child: ExplorerView.create(folderId)),
|
||||
],
|
||||
);
|
||||
|
||||
43
client/lib/ui/explorer/path_view.dart
Normal file
43
client/lib/ui/explorer/path_view.dart
Normal file
@@ -0,0 +1,43 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:phylum/libphylum/phylum_account.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class PathView extends StatelessWidget {
|
||||
final String id;
|
||||
|
||||
PathView._({required this.id}) : super(key: ValueKey(id));
|
||||
|
||||
static Widget create(String id) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 12),
|
||||
child: PathView._(id: id),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final account = context.read<PhylumAccount>();
|
||||
return StreamBuilder(
|
||||
stream: account.db.managers.resources.filter((r) => r.id.equals(id)).watchSingleOrNull(),
|
||||
builder: (context, snapshot) {
|
||||
final r = snapshot.data;
|
||||
if (r == null) {
|
||||
return const SizedBox();
|
||||
}
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (r.parent != null) PathView._(id: r.parent!),
|
||||
ElevatedButton(
|
||||
child: Text(r.parent == null ? "/" : r.name),
|
||||
onPressed: () {
|
||||
context.pushNamed('folder', pathParameters: {'id': r.id});
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user