caption_core
Pure widgets.dart custom desktop caption bar primitives (DesktopCaptionShell, CaptionDragRegion, CaptionWindowControls, CaptionControlColors, calculateMacOSTrafficLightY) for Flutter across Linux, macOS, and Windows, powered by native_core.
| Platform | Caption Layout | Window Controls |
|---|---|---|
| Windows | Custom client caption bar + CaptionDragRegion |
Trailing CaptionWindowControls (46px × 3 = 138px, Fitts's Law flush right + MaximizeButtonArea Snap Layouts) |
| Linux | Custom client caption bar + CaptionDragRegion |
Trailing CaptionWindowControls (46px × 3 = 138px, Fitts's Law flush right) |
| macOS | Leading traffic-light inset + calculateMacOSTrafficLightY |
Native AppKit traffic lights (red, yellow, green, collapsed in fullscreen) |
Platform Capability Matrix
| Capability | Linux (GTK3) |
macOS (AppKit) |
Windows (Win32) |
|---|---|---|---|
Non-interactive drag & double-click (CaptionDragRegion) |
✅ | ✅ | ✅ |
| Secondary-click native system menu | Not applicable (false) |
Not applicable (false) |
✅ (Triggered on onSecondaryTapUp to keep menu open) |
Trailing Fitts's Law buttons (CaptionWindowControls) |
✅ (46px × 3) |
Omitted by OS convention | ✅ (46px × 3 + Snap Layouts MaximizeButtonArea) |
| Reactive maximize / restore icon synchronization | ✅ (WindowEvent) |
Managed by AppKit | ✅ (WindowEvent) |
| Leading traffic-light inset & vertical formula | Omitted | ✅ (calculateMacOSTrafficLightY, collapsed in fullscreen) |
Omitted |
Screen-reader semantics (Minimize / Maximize / Restore / Close) |
✅ | ✅ | ✅ |
Features
DesktopCaptionShell: Ready-to-use cross-platform caption bar shell that automatically reserves leading space for macOS traffic lights, supports both decorative and interactiveleading/centerslots (leadingIsInteractive,centerIsInteractive), binds background drag/double-click/system-menu gestures, and mounts trailingCaptionWindowControlson Windows and Linux.CaptionDragRegion: Restricts OS window drag-to-move, double-click maximize/restore, and Windows secondary-click native system menu exclusively to unoccupied background areas so interactive action buttons respond in0mswithoutkDoubleTapTimeout(300ms) gesture arena delays.CaptionWindowControls: Full-height (46px × 3 = 138px) Fitts's Law window control buttons (_,[],X) rendered with crisp vectorCustomPaintericons, customizableSemanticslabels, Windows 11 Snap Layouts (MaximizeButtonArea) integration, and reactive maximize/restore state synchronization.- Zero Material & Native Plugin Dependency: Built strictly on
package:flutter/widgets.dartandpackage:native_core(0directdart:fficalls and0C++/CMake/Swift plugin wrappers).
Installation
dependencies:
caption_core: ^1.0.0
native_core: ^1.0.0
Quick Start
import 'package:caption_core/caption_core.dart';
import 'package:flutter/widgets.dart';
class WorkspaceHeader extends StatelessWidget {
const WorkspaceHeader({super.key});
@override
Widget build(BuildContext context) {
return const DesktopCaptionShell(
height: 48,
backgroundColor: Color(0xFF0F172A),
bottomBorderColor: Color(0xFF1E293B),
leading: Padding(
padding: EdgeInsets.symmetric(horizontal: 12),
child: Text(
'Workspace IDE',
style: TextStyle(color: Color(0xFFF8FAFC), fontSize: 13),
),
),
);
}
}
License
Apache License 2.0 — Copyright 2026 Infradise Inc. See LICENSE.
Libraries
- caption_core
- Pure
widgets.dartcustom desktop caption bar primitives (CaptionDragRegion,CaptionWindowControls,CaptionControlColors,DesktopCaptionShell,calculateMacOSTrafficLightY) for Flutter across Windows, Linux, and macOS, powered bynative_core.