Skip to content

Commit 700d3c5

Browse files
committed
feat: Add forms showcase screen and routing
This commit introduces a new "Forms" component showcase screen to the application, providing a dedicated area to demonstrate form-related UI elements. ### Key Changes: * **New Screen (`lib/screens/components/forms/forms_screen.dart`):** * Created `FormsScreen` to display form component examples. * Added a `CodeCard` demonstration for `PrimaryButton` variants (standard, with leading/trailing icons, and disabled states) including relevant code snippets. * **Routing and Navigation:** * **`lib/routes/route_names.dart`:** Added `forms` and `formsUrl` constants. * **`lib/routes/route_config.dart`:** Integrated `FormsScreen` into the GoRouter configuration as a new `StatefulShellBranch`. * **`lib/settings/navigation_items.dart`:** Added a "Forms" navigation item with the `LucideIcons.filePenLine` icon to the sidebar/navigation menu.
1 parent 0088486 commit 700d3c5

4 files changed

Lines changed: 102 additions & 0 deletions

File tree

lib/routes/route_config.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import 'package:police_flutter_template/screens/auth/auth_not_initialized_screen
66
import 'package:police_flutter_template/screens/components/alerts/alerts_screen.dart';
77
import 'package:police_flutter_template/screens/components/buttons/buttons_screen.dart';
88
import 'package:police_flutter_template/screens/components/cards/cards_screen.dart';
9+
import 'package:police_flutter_template/screens/components/forms/forms_screen.dart';
910
import 'package:police_flutter_template/screens/components/lists/lists_screen.dart';
1011
import 'package:police_flutter_template/screens/error_pages/internal_server_error_screen.dart';
1112
import 'package:police_flutter_template/screens/error_pages/not_found_screen.dart';
@@ -205,6 +206,15 @@ class RouteConfig {
205206
),
206207
],
207208
),
209+
StatefulShellBranch(
210+
routes: [
211+
GoRoute(
212+
name: RouteNames.forms,
213+
path: RouteNames.formsUrl,
214+
builder: (context, state) => FormsScreen(),
215+
),
216+
],
217+
),
208218
],
209219
),
210220
],

lib/routes/route_names.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,10 @@ class RouteNames {
6464

6565
/// URL path for the lists demo route (e.g. `/lists`).
6666
static const String listsUrl = '/$lists';
67+
68+
/// Route name for the "forms" component showcase/demo screen.
69+
static const String forms = "forms";
70+
71+
/// URL path for the forms demo route (e.g. `/forms`).
72+
static const String formsUrl = '/$forms';
6773
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import 'package:shadcn_flutter/shadcn_flutter.dart';
2+
import '../../../extensions/text_extensions.dart';
3+
import '../../widgets/code_card.dart';
4+
5+
class FormsScreen extends StatelessWidget {
6+
const FormsScreen({super.key});
7+
8+
@override
9+
Widget build(BuildContext context) {
10+
return Column(
11+
mainAxisSize: MainAxisSize.max,
12+
children: [
13+
Gap(64),
14+
Text('Formular-Elemente').h3.setColors(
15+
lightColor: Colors.gray[800],
16+
darkColor: Colors.white,
17+
),
18+
Gap(50),
19+
ConstrainedBox(
20+
constraints: BoxConstraints(maxWidth: 1000),
21+
child: Column(
22+
children: [
23+
Row(
24+
mainAxisAlignment: MainAxisAlignment.center,
25+
children: [
26+
ConstrainedBox(
27+
constraints: BoxConstraints(maxWidth: 900),
28+
child: CodeCard(
29+
title: 'Primäre Buttons',
30+
example: Row(
31+
children: [
32+
PrimaryButton(
33+
onPressed: () {},
34+
child: const Text('Standard'),
35+
),
36+
Gap(10),
37+
PrimaryButton(
38+
leading: const Icon(LucideIcons.download),
39+
onPressed: () {},
40+
child: const Text('Mit Icon vorne'),
41+
),
42+
Gap(10),
43+
PrimaryButton(
44+
trailing: const Icon(LucideIcons.arrowRight),
45+
onPressed: () {},
46+
child: const Text('Mit Icon hinten'),
47+
),
48+
Gap(10),
49+
PrimaryButton(
50+
child: const Text('Deaktiviert'),
51+
),
52+
],
53+
),
54+
lines: [
55+
CodeCommentLine("# Beispiel für Primäre Buttons"),
56+
CodeTextLine("PrimaryButton("),
57+
CodeCommentLine(" # Mit Icon vorne"),
58+
CodeTextLine(" leading: const Icon(LucideIcons.download),"),
59+
CodeCommentLine(" # Mit Icon hinten"),
60+
CodeTextLine(" trailing: const Icon(LucideIcons.arrowRight),"),
61+
CodeCommentLine(" # Für aktiven Button (bei deaktiviertem Button weglassen)"),
62+
CodeTextLine(" onPressed: () {},"),
63+
CodeCommentLine(" # Text des Buttons"),
64+
CodeTextLine(" child: const Text('Primärer Button'),"),
65+
CodeTextLine("),"),
66+
],
67+
),
68+
).withPadding(horizontal: 10),
69+
],
70+
),
71+
Gap(20),
72+
],
73+
),
74+
),
75+
76+
Gap(64),
77+
],
78+
);
79+
}
80+
}

lib/settings/navigation_items.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ class NavigationItems {
9292
icon: const Icon(LucideIcons.list),
9393
onPressed: () => navigationShell.goBranch(4, initialLocation: false),
9494
),
95+
NavigationItemModel(
96+
index: 5,
97+
title: "Forms",
98+
icon: const Icon(LucideIcons.filePenLine),
99+
onPressed: () => navigationShell.goBranch(5, initialLocation: false),
100+
),
95101
NavigationItemModel(
96102
index: null,
97103
title: "404 Nicht gefunden - Standalone",

0 commit comments

Comments
 (0)