107 lines
2.8 KiB
Dart
107 lines
2.8 KiB
Dart
import "package:go_router/go_router.dart";
|
|
import "package:shadcn_flutter/shadcn_flutter.dart";
|
|
|
|
class ProjectDetailPage extends StatelessWidget {
|
|
const ProjectDetailPage({
|
|
super.key,
|
|
required this.projectId,
|
|
this.tab = 'overview',
|
|
});
|
|
|
|
final String projectId;
|
|
final String tab;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
headers: [
|
|
AppBar(
|
|
title: Text("Project: $projectId"),
|
|
leading: [
|
|
IconButton.ghost(
|
|
icon: const Icon(LucideIcons.arrowLeft),
|
|
onPressed: () => context.go('/'),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
child: Column(
|
|
children: [
|
|
// Tab navigation
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
|
child: Row(
|
|
children: [
|
|
_buildTabButton(context, 'overview', 'Overview'),
|
|
const Gap(8),
|
|
_buildTabButton(context, 'files', 'Files'),
|
|
const Gap(8),
|
|
_buildTabButton(context, 'settings', 'Settings'),
|
|
],
|
|
),
|
|
),
|
|
const Divider(),
|
|
Expanded(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16),
|
|
child: _buildTabContent(),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildTabButton(BuildContext context, String tabName, String label) {
|
|
final isActive = tab == tabName;
|
|
return Button(
|
|
style: isActive ? ButtonStyle.secondary() : ButtonStyle.ghost(),
|
|
onPressed: () => context.go(
|
|
ProjectDetailRoute.pathWithParams(
|
|
projectId: projectId,
|
|
tab: tabName,
|
|
),
|
|
),
|
|
child: Text(label),
|
|
);
|
|
}
|
|
|
|
Widget _buildTabContent() {
|
|
switch (tab) {
|
|
case 'files':
|
|
return const Center(child: Text("Files tab content"));
|
|
case 'settings':
|
|
return const Center(child: Text("Settings tab content"));
|
|
case 'overview':
|
|
default:
|
|
return const Center(child: Text("Project overview content"));
|
|
}
|
|
}
|
|
}
|
|
|
|
/// GoRouter routes for the project detail page
|
|
abstract class ProjectDetailRoute {
|
|
static const path = '/projects/:projectId';
|
|
static const name = 'project_detail';
|
|
|
|
static String pathWithParams({
|
|
required String projectId,
|
|
String tab = 'overview',
|
|
}) {
|
|
return '/projects/$projectId?tab=$tab';
|
|
}
|
|
|
|
static GoRoute get route => GoRoute(
|
|
path: path,
|
|
name: name,
|
|
builder: (context, state) {
|
|
final projectId = state.pathParameters['projectId']!;
|
|
final tab = state.uri.queryParameters['tab'] ?? 'overview';
|
|
|
|
return ProjectDetailPage(
|
|
projectId: projectId,
|
|
tab: tab,
|
|
);
|
|
},
|
|
);
|
|
}
|