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.
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'
),
),
],
),
],
)
More like this
-
Flutter File Permission Card with rwx Grid and Octal Mode Readout
A Flutter file permission card for DevOps dashboards, hosting panels and learning apps: a terminal-style grid of owner, group and other against read, write and execute, bits worth 4, 2 and 1 summing to the octal digits of mode 755, plus the chmod command and the -rwxr-xr-x listing. Built with wind_kit.
-
Flutter Contrast Checker Card with WCAG AA and AAA Pass Badges
A WCAG 2.2 colour contrast card for design system and accessibility apps: text and background swatches, a live preview of body and large text, the 3.74:1 ratio on a threshold scale, AA and AAA pass or fail tiles for normal and large text, and a one-tap fix to the nearest passing shade.
-
Flutter Subnet Calculator Card with 32 Bit Network and Host Grid
A Flutter subnet calculator card for network and developer tools: an IPv4 address with its CIDR prefix, all 32 bits by octet with network and host bits in two colours, plus network, mask, first and last host, broadcast and usable hosts. A correct /21 worked example built with wind_kit.