Skip to content

Commit b698ea3

Browse files
committed
refactor: Remove CodeBlock widget and update ButtonsScreen
This commit removes the redundant `CodeBlock` widget in favor of the existing `CodeCard` and enhances the `ButtonsScreen` with more comprehensive examples of primary button variations. ### Key Changes: * **Cleanup:** * Deleted `lib/screens/widgets/code_block.dart` as its functionality is covered by `CodeCard`. * **Buttons Screen Improvements (`buttons_screen.dart`):** * Replaced the single `PrimaryButton` example with a suite of variations: Standard, Leading Icon, Trailing Icon, and Disabled states. * Updated the code preview to use `CodeCard` and included more detailed comments and property examples (leading, trailing, onPressed). * Improved the layout by grouping button examples under a descriptive heading and centering the content within a `ConstrainedBox`.
1 parent 5e0862c commit b698ea3

2 files changed

Lines changed: 64 additions & 140 deletions

File tree

lib/screens/components/buttons/buttons_screen.dart

Lines changed: 64 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import 'package:police_flutter_template/screens/widgets/code_block.dart';
21
import 'package:shadcn_flutter/shadcn_flutter.dart';
32
import '../../../extensions/text_extensions.dart';
43
import '../../widgets/code_card.dart';
@@ -25,31 +24,73 @@ class ButtonsScreen extends StatelessWidget {
2524
darkColor: Colors.blue[400],
2625
),
2726
Gap(64),
28-
Row(
29-
mainAxisAlignment: MainAxisAlignment.center,
30-
children: [
31-
ConstrainedBox(
32-
constraints: BoxConstraints(maxWidth: 300),
33-
child: PrimaryButton(
34-
onPressed: () {},
35-
child: const Text('Primärer Button'),
36-
),
37-
).withPadding(horizontal: 20),
38-
ConstrainedBox(
39-
constraints: BoxConstraints(maxWidth: 600),
40-
child: CodeBlock(
41-
lines: [
42-
CodeCommentLine("# Beispiel für Primären Button"),
43-
CodeTextLine(
44-
"PrimaryButton(",
27+
ConstrainedBox(
28+
constraints: BoxConstraints(maxWidth: 1000),
29+
child: Column(
30+
children: [
31+
Row(
32+
mainAxisAlignment: MainAxisAlignment.center,
33+
children: [
34+
Text("Primäre Buttons").x3Large.h1.setColors(
35+
lightColor: Colors.gray[800],
36+
darkColor: Colors.white,
4537
),
46-
CodeTextLine(" onPressed: () {},"),
47-
CodeTextLine(" child: const Text('Primärer Button'),"),
48-
CodeTextLine("),"),
4938
],
5039
),
51-
).withPadding(horizontal: 10),
52-
],
40+
Gap(20),
41+
Row(
42+
mainAxisAlignment: MainAxisAlignment.center,
43+
children: [
44+
SizedBox(
45+
width: 200,
46+
child: Column(
47+
children: [
48+
PrimaryButton(
49+
onPressed: () {},
50+
child: const Text('Standard'),
51+
),
52+
Gap(10),
53+
PrimaryButton(
54+
leading: const Icon(LucideIcons.download),
55+
onPressed: () {},
56+
child: const Text('Mit Icon vorne'),
57+
),
58+
Gap(10),
59+
PrimaryButton(
60+
trailing: const Icon(LucideIcons.arrowRight),
61+
onPressed: () {},
62+
child: const Text('Mit Icon hinten'),
63+
),
64+
Gap(10),
65+
PrimaryButton(
66+
child: const Text('Deaktiviert'),
67+
),
68+
Gap(10),
69+
],
70+
),
71+
).withPadding(horizontal: 20),
72+
ConstrainedBox(
73+
constraints: BoxConstraints(maxWidth: 600),
74+
child: CodeCard(
75+
lines: [
76+
CodeCommentLine("# Beispiel für Primäre Buttons"),
77+
CodeTextLine("PrimaryButton("),
78+
CodeCommentLine(" # Mit Icon vorne"),
79+
CodeTextLine(" leading: const Icon(LucideIcons.download),"),
80+
CodeCommentLine(" # Mit Icon hinten"),
81+
CodeTextLine(" trailing: const Icon(LucideIcons.arrowRight),"),
82+
CodeCommentLine(" # Für aktiven Button (bei deaktiviertem Button weglassen)"),
83+
CodeTextLine(" onPressed: () {},"),
84+
CodeCommentLine(" # Text des Buttons"),
85+
CodeTextLine(" child: const Text('Standard'),"),
86+
CodeTextLine("),"),
87+
],
88+
),
89+
).withPadding(horizontal: 10),
90+
],
91+
),
92+
],
93+
),
5394
),
5495

5596
Gap(64),

lib/screens/widgets/code_block.dart

Lines changed: 0 additions & 117 deletions
This file was deleted.

0 commit comments

Comments
 (0)