Flutter Code Snippet Card with Syntax Colors and Copy

A syntax highlighted code snippet card with a window title bar, a language tag, and a copy button, composed from Wind utility classes. The sample is Wind itself: a className string over a nested widget tree.

Anılcan Çakır by Anılcan Çakır 79 views 0 stars 3 weeks ago Rev 1
Flutter Code Snippet Card with Syntax Colors and Copy preview
main.dart
WDiv(
  className: 'max-w-sm w-full mx-auto rounded-3xl bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 shadow-xl overflow-hidden',
  children: [
    WDiv(
      className: 'flex flex-row items-center justify-between w-full px-5 py-3 border-b border-gray-100 dark:border-gray-800',
      children: [
        WDiv(
          className: 'flex flex-row items-center',
          children: [
            WDiv(
              className: 'w-3 h-3 rounded-full bg-rose-400 dark:bg-rose-400 mr-2',
              children: []
            ),
            WDiv(
              className: 'w-3 h-3 rounded-full bg-amber-400 dark:bg-amber-400 mr-2',
              children: []
            ),
            WDiv(
              className: 'w-3 h-3 rounded-full bg-emerald-400 dark:bg-emerald-400 mr-3',
              children: []
            ),
            WText(
              'main.dart',
              className: 'text-gray-500 dark:text-gray-400 text-xs font-semibold'
            ),
          ],
        ),
        WDiv(
          className: 'px-2 py-1 rounded-md bg-sky-50 dark:bg-sky-950',
          child: WText(
            'Dart',
            className: 'text-sky-600 dark:text-sky-300 text-xs font-semibold'
          ),
        ),
      ],
    ),
    WDiv(
      className: 'flex flex-col gap-2 w-full p-5 bg-gray-950 dark:bg-gray-950',
      children: [
        WDiv(
          className: 'flex flex-row items-center',
          children: [
            WText(
              'WDiv',
              className: 'text-sky-400 dark:text-sky-400 text-sm font-medium'
            ),
            WText(
              '(',
              className: 'text-gray-500 dark:text-gray-500 text-sm'
            ),
          ],
        ),
        WDiv(
          className: 'flex flex-row items-center pl-4',
          children: [
            WText(
              'className',
              className: 'text-violet-400 dark:text-violet-400 text-sm'
            ),
            WText(
              ': ',
              className: 'text-gray-500 dark:text-gray-500 text-sm'
            ),
            WText(
              "'flex flex-col gap-4 p-6'",
              className: 'text-emerald-400 dark:text-emerald-400 text-sm'
            ),
            WText(
              ',',
              className: 'text-gray-500 dark:text-gray-500 text-sm'
            ),
          ],
        ),
        WDiv(
          className: 'flex flex-row items-center pl-4',
          children: [
            WText(
              'child',
              className: 'text-violet-400 dark:text-violet-400 text-sm'
            ),
            WText(
              ': ',
              className: 'text-gray-500 dark:text-gray-500 text-sm'
            ),
            WText(
              'WText',
              className: 'text-sky-400 dark:text-sky-400 text-sm font-medium'
            ),
            WText(
              '(',
              className: 'text-gray-500 dark:text-gray-500 text-sm'
            ),
            WText(
              "'Ship Your Vision'",
              className: 'text-emerald-400 dark:text-emerald-400 text-sm'
            ),
            WText(
              '),',
              className: 'text-gray-500 dark:text-gray-500 text-sm'
            ),
          ],
        ),
        WDiv(
          className: 'flex flex-row items-center',
          children: [
            WText(
              ')',
              className: 'text-gray-500 dark:text-gray-500 text-sm'
            ),
          ],
        ),
      ],
    ),
    WDiv(
      className: 'flex flex-row items-center justify-between w-full px-5 py-4',
      children: [
        WText(
          'Utility-first, no widget tree to nest',
          className: 'text-gray-400 dark:text-gray-500 text-xs'
        ),
        WButton(
          className: 'px-4 py-2 rounded-xl bg-indigo-600 dark:bg-indigo-500',
          child: WText(
            'Copy',
            className: 'text-white text-xs font-semibold'
          ),
        ),
      ],
    ),
  ],
)
Stats
Views
79
Stars
0
Revisions
1
Size
4,006 chars
Created
Jun 30, 2026