Skip to content

Commit a2f56ef

Browse files
committed
```
docs: Add personalized button example to `ButtonsScreen` This commit adds a new example section to the `ButtonsScreen` demonstrating how to create personalized buttons using the `ButtonStyle` extension methods. ### Key Changes: * **`buttons_screen.dart`**: * Added a `CodeCard` showcasing a "Personalisierte Buttons" (Personalized Buttons) example. * Demonstrates the use of `.withBackgroundColor`, `.withForegroundColor`, and `.withBorderRadius` to customize both base and hover states. * Included corresponding code snippets within the `lines` property to provide a clear implementation reference for developers.
1 parent e5d732b commit a2f56ef

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

lib/screens/components/buttons/buttons_screen.dart

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,45 @@ class ButtonsScreen extends StatelessWidget {
640640
).withPadding(horizontal: 10),
641641
],
642642
),
643+
Gap(20),
644+
Row(
645+
mainAxisAlignment: MainAxisAlignment.center,
646+
children: [
647+
ConstrainedBox(
648+
constraints: BoxConstraints(maxWidth: 900),
649+
child: CodeCard(
650+
title: 'Personalisierte Buttons',
651+
example: Row(
652+
children: [
653+
Button(
654+
style: const ButtonStyle.primary()
655+
.withBackgroundColor(color: Colors.yellow, hoverColor: Colors.purple)
656+
.withForegroundColor(color: Colors.black, hoverColor: Colors.white)
657+
.withBorderRadius(hoverBorderRadius: BorderRadius.circular(16)),
658+
onPressed: () {},
659+
leading: const Icon(LucideIcons.sun),
660+
trailing: const Icon(LucideIcons.moon),
661+
child: const Text('Personalisierter Button'),
662+
),
663+
],
664+
),
665+
lines: [
666+
CodeCommentLine("# Beispiel für Personalisierte Buttons"),
667+
CodeTextLine("Button("),
668+
CodeTextLine(" style: const ButtonStyle.primary()"),
669+
CodeTextLine(" .withBackgroundColor(color: Colors.yellow, hoverColor: Colors.purple)"),
670+
CodeTextLine(" .withForegroundColor(color: Colors.black, hoverColor: Colors.white)"),
671+
CodeTextLine(" .withBorderRadius(hoverBorderRadius: BorderRadius.circular(16)),"),
672+
CodeTextLine(" onPressed: () {},"),
673+
CodeTextLine(" leading: const Icon(LucideIcons.sun),"),
674+
CodeTextLine(" trailing: const Icon(LucideIcons.moon),"),
675+
CodeTextLine(" child: const Text('Personalisierter Button'),"),
676+
CodeTextLine("),"),
677+
],
678+
),
679+
).withPadding(horizontal: 10),
680+
],
681+
),
643682
],
644683
),
645684
),

0 commit comments

Comments
 (0)