Skip to content

Commit cac6003

Browse files
committed
feat: Add Tabs component showcase screen and routing
This commit introduces a new showcase screen for Tabs components, including the necessary routing configuration and theme overrides. ### Key Changes: * **Routing & Navigation:** * Defined `tabs` and `tabsUrl` in `RouteNames`. * Added a new `StatefulShellBranch` for the `TabsScreen` in `route_config.dart`. * Added a "Tabs" navigation item to `navigation_items.dart` using the `LucideIcons.appWindow` icon. * **UI Components:** * Created `TabsScreen` as a placeholder screen for demonstrating tab components. * Introduced `TabThemes` widget in `tab_themes.dart` to handle tab-specific theme overrides. * **Layout:** * Updated `OverrideThemeLayout` to include `TabThemes` in the widget tree, ensuring consistent theme application across the application.
1 parent 0c2734c commit cac6003

6 files changed

Lines changed: 56 additions & 3 deletions

File tree

lib/routes/route_config.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import 'package:police_flutter_template/screens/components/buttons/buttons_scree
88
import 'package:police_flutter_template/screens/components/cards/cards_screen.dart';
99
import 'package:police_flutter_template/screens/components/forms/forms_screen.dart';
1010
import 'package:police_flutter_template/screens/components/lists/lists_screen.dart';
11+
import 'package:police_flutter_template/screens/components/tabs/tabs_screen.dart';
1112
import 'package:police_flutter_template/screens/error_pages/internal_server_error_screen.dart';
1213
import 'package:police_flutter_template/screens/error_pages/not_found_screen.dart';
1314
import 'package:police_flutter_template/screens/home/home_screen.dart';
@@ -215,6 +216,15 @@ class RouteConfig {
215216
),
216217
],
217218
),
219+
StatefulShellBranch(
220+
routes: [
221+
GoRoute(
222+
name: RouteNames.tabs,
223+
path: RouteNames.tabsUrl,
224+
builder: (context, state) => TabsScreen(),
225+
),
226+
],
227+
),
218228
],
219229
),
220230
],

lib/routes/route_names.dart

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

7171
/// URL path for the forms demo route (e.g. `/forms`).
7272
static const String formsUrl = '/$forms';
73+
74+
/// Route name for the "tabs" component showcase/demo screen.
75+
static const String tabs = "tabs";
76+
77+
/// URL path for the tabs demo route (e.g. `/tabs`).
78+
static const String tabsUrl = '/$tabs';
7379
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import 'package:shadcn_flutter/shadcn_flutter.dart';
2+
3+
class TabsScreen extends StatefulWidget {
4+
const TabsScreen({super.key});
5+
6+
@override
7+
State<TabsScreen> createState() => _TabsScreenState();
8+
}
9+
10+
class _TabsScreenState extends State<TabsScreen> {
11+
@override
12+
Widget build(BuildContext context) {
13+
return const Placeholder();
14+
}
15+
}

lib/screens/widgets/layouts/override_theme_layout.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import 'package:shadcn_flutter/shadcn_flutter.dart';
44
import '../overrides/button_themes.dart';
55
import '../overrides/card_themes.dart';
66
import '../overrides/container_themes.dart';
7+
import '../overrides/tab_themes.dart';
78

89
class OverrideThemeLayout extends StatelessWidget {
910
const OverrideThemeLayout({super.key, required this.child});
@@ -12,9 +13,11 @@ class OverrideThemeLayout extends StatelessWidget {
1213

1314
@override
1415
Widget build(BuildContext context) {
15-
return FormThemes(
16-
child: ButtonThemes(
17-
child: ContainerThemes(child: CardThemes(child: child)),
16+
return TabThemes(
17+
child: FormThemes(
18+
child: ButtonThemes(
19+
child: ContainerThemes(child: CardThemes(child: child)),
20+
),
1821
),
1922
);
2023
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import 'package:shadcn_flutter/shadcn_flutter.dart';
2+
3+
4+
class TabThemes extends StatelessWidget {
5+
const TabThemes({super.key, required this.child});
6+
7+
final Widget child;
8+
9+
@override
10+
Widget build(BuildContext context) {
11+
return const Placeholder();
12+
}
13+
}

lib/settings/navigation_items.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ class NavigationItems {
9898
icon: const Icon(LucideIcons.filePenLine),
9999
onPressed: () => navigationShell.goBranch(5, initialLocation: false),
100100
),
101+
NavigationItemModel(
102+
index: 6,
103+
title: "Tabs",
104+
icon: const Icon(LucideIcons.appWindow),
105+
onPressed: () => navigationShell.goBranch(6, initialLocation: false),
106+
),
101107
NavigationItemModel(
102108
index: null,
103109
title: "404 Nicht gefunden - Standalone",

0 commit comments

Comments
 (0)