A modern C# .NET 9.0 implementation of Flet - Build interactive multi-platform applications with Flutter UI and C# backend
FlutterSharp is a comprehensive C# .NET 9.0 SDK that brings the power of Flet to the .NET ecosystem. It enables developers to build beautiful, interactive applications for web, desktop, and mobile using Flutter's rich UI framework while writing business logic in C#.
- Modern C# 12 / .NET 9.0 - Leverages latest language features and runtime capabilities
- Type-Safe - Full IntelliSense support with strongly-typed controls and properties
- High Performance - MessagePack binary serialization for efficient communication
- Cross-Platform - Build for web, Windows, macOS, Linux, iOS, and Android
- Rich UI Controls - 100+ Material Design and Cupertino controls
- Async/Await Throughout - Modern async patterns for responsive applications
- Hot Reload Support - Fast development iteration
C# Application Code (.NET 9.0)
↓
FlutterSharp SDK (MessagePack Protocol)
↓ (WebSocket/TCP)
Flutter Client (Dart)
↓
Native Platform UI
- Solution structure with .NET 9.0 projects
- MessagePack serialization with custom formatters
- Protocol message classes (RegisterClient, PatchControl, ControlEvent, etc.)
- WebSocket transport layer with connection management
- Base control framework (BaseControl, Control)
- Session management with WeakReference-based control indexing
- Object patching system (JSON Patch RFC 6902)
- Page class with routing and event handling
Layout (7):
- Column - Vertical layout
- Row - Horizontal layout
- Container - Box model with padding, margin, border
- Stack - Overlapping layout
- ListView - Scrollable list with dividers
- GridView - Scrollable 2D grid layout
- ResponsiveRow - Responsive grid with virtual columns
Display (9):
- Text - Text display with rich styling
- Icon - Icon display
- Page - Root page container
- Image - Image display (JPEG, PNG, SVG, GIF, WebP, etc.)
- Divider - Material Design horizontal divider
- VerticalDivider - Material Design vertical divider
- ProgressBar - Material Design linear progress indicator
- ProgressRing - Material Design circular progress indicator
- CircleAvatar - User avatar with image or initials
Input (23):
- TextField - Material Design text input
- ElevatedButton - Material Design elevated button
- FilledButton - Material Design filled button
- FilledTonalButton - Material Design filled tonal button
- OutlinedButton - Material Design outlined button
- TextButton - Material Design text button
- IconButton - Material Design icon button
- FloatingActionButton - Floating action button for primary actions
- Checkbox - Material Design checkbox
- Radio - Material Design radio button
- RadioGroup - Radio button group with selection state
- Switch - Material Design switch
- Slider - Material Design slider
- RangeSlider - Range slider with two thumbs
- Dropdown - Material Design dropdown
- SearchBar - Search input with suggestion view
- SegmentedButton - Multi-option segmented selection
- Segment - Individual segment for SegmentedButton
- PopupMenuButton - Popup menu button
- PopupMenuItem - Individual menu item
- AutoComplete - Auto-complete text input with suggestions
- ContextMenu - Context menu for mouse interactions
Navigation (12):
- AppBar - Material Design app bar
- NavigationBar - Material Design bottom navigation
- NavigationBarDestination - Navigation bar destination item
- NavigationRail - Material Design side navigation rail
- NavigationRailDestination - Navigation rail destination item
- NavigationDrawer - Material Design navigation drawer
- NavigationDrawerDestination - Navigation drawer destination item
- BottomAppBar - Bottom app bar with optional notch for FAB
- Tabs - Tab-based navigation container
- TabBar - Tab bar with multiple tabs
- Tab - Individual tab control
Data Display (13):
- Card - Material Design card container
- ListTile - Material Design list item
- Chip - Material Design compact element for tags/selections
- Badge - Notification badges for counts and status
- ExpansionPanel - Collapsible panel with header and content
- ExpansionPanelList - List of expansion panels
- ExpansionTile - Single-line ListTile with expansion arrow
- DataTable - Data grid with sorting and selection support
- DataColumn - Column configuration for DataTable
- DataRow - Row configuration for DataTable
- DataCell - Cell data for DataTable
- SelectionArea - Text selection wrapper
- ReorderableListView - Drag-and-drop reorderable list
Dialog & Overlay (5):
- AlertDialog - Modal dialogs for user prompts
- BottomSheet - Modal bottom sheet dialog
- SnackBar - Brief messages at bottom of screen
- Banner - Persistent message banner
- Tooltip - Contextual help tooltips
Pickers & Menus (6):
- DatePicker - Material date picker dialog
- TimePicker - Material time picker dialog
- DateRangePicker - Material date range picker dialog
- MenuBar - Menu bar with cascading child menus
- MenuItemButton - Menu item button for MenuBar
- SubmenuButton - Submenu button with cascading menu
Core Interaction (11):
- GestureDetector - Detects gestures (tap, drag, pan, scale, etc.)
- Draggable - Makes controls draggable
- DragTarget - Receives draggable controls
- Dismissible - Swipe-to-dismiss pattern with background controls
- SafeArea - Respects system UI insets (notches, status bars)
- Markdown - Markdown rendering with syntax highlighting
- AnimatedSwitcher - Animated transitions between children (fade, rotation, scale)
- WindowDragArea - Draggable area for moving windows (desktop apps)
- Placeholder - Placeholder widget for development
- TextSpan - Rich text with multiple styles and click handlers
- InteractiveViewer - Pan, zoom, and rotate content
Advanced (1):
- ReactiveControl - Base class for auto-updating controls
Cupertino (8):
- CupertinoButton - iOS-style button with opacity on press
- CupertinoActivityIndicator - iOS-style circular activity indicator
- CupertinoAlertDialog - iOS-style alert dialog
- CupertinoSwitch - iOS-style toggle switch
- CupertinoSlider - iOS-style slider for value selection
- CupertinoTextField - iOS-style text input field
- CupertinoNavigationBar - iOS-style bottom navigation tab bar
- CupertinoAppBar - iOS-style top app bar with navigation
Supporting Classes (7):
- DropdownOption - Dropdown menu option
- TextChangedEventArgs - Text field change events
- CheckboxChangedEventArgs - Checkbox change events
- RadioChangedEventArgs - Radio button change events
- SwitchChangedEventArgs - Switch change events
- EventHandler - Generic event handler delegate
- ControlAttribute - Control metadata for Flutter widget mapping
- 20 unit tests passing
- Protocol serialization tests
- Control lifecycle tests
- Patching system tests
- App class with Run/RunAsync methods
- SessionManager for multi-client support
- Control property change tracking
- Event system integration
- ReactiveControl for automatic patch generation
- Hello World sample application
- WebApp sample with ASP.NET Core integration
- All layout controls (Column, Row, Container, Stack, ListView, GridView)
- All display controls (Text, Icon, Page, Image, Divider, ProgressBar)
- 11/12 input controls completed
- All Material button variants (Elevated, Filled, Outlined, Text, Icon)
- AppBar navigation control
- Data display controls (Card, ListTile)
- ⏳ Remaining: Advanced input controls, Dialogs, Navigation components
- FlutterSharp.Web package created
- WebSocket middleware implementation
- Session management for multi-client support
- Service extensions for dependency injection
- Application builder extensions for middleware pipeline
- Static file serving for Flutter assets
- Hot reload support
- Development server
See IMPLEMENTATION_PLAN.md for the complete roadmap.
FlutterSharp/
├── src/
│ └── FlutterSharp.Core/ # Core SDK
│ ├── Protocol/ # MessagePack protocol & messages
│ ├── Transport/ # WebSocket/TCP connections
│ ├── Controls/ # Control base classes
│ │ ├── Core/ # Core controls (Column, Row, Text)
│ │ ├── Material/ # Material Design controls
│ │ └── Cupertino/ # iOS-style controls
│ ├── Session/ # Session management (planned)
│ ├── Patching/ # Object patching (planned)
│ ├── Routing/ # Navigation (planned)
│ └── Services/ # Platform services (planned)
├── tests/
│ └── FlutterSharp.Core.Tests/ # Unit tests
├── samples/ # Sample applications (planned)
├── docs/ # Documentation
├── extern/
│ └── flet/ # Flet reference (git submodule)
├── IMPLEMENTATION_PLAN.md # Detailed implementation roadmap
└── README.md # This file
using FlutterSharp.Core.Controls;
using FlutterSharp.Core.Controls.Core;
using FlutterSharp.Core.Controls.Material;
using FlutterSharp.Web.Extensions;
var builder = WebApplication.CreateBuilder(args);
// Add FlutterSharp services
builder.Services.AddFlutterSharp(page =>
{
page.Title = "FlutterSharp Counter";
page.Theme = "light";
var column = new Column
{
HorizontalAlignment = "center",
VerticalAlignment = "center"
};
var counter = new Text("0") { Size = 48, Color = "blue" };
int count = 0;
var button = new ElevatedButton("Increment");
button.Click += (sender, e) =>
{
count++;
counter.Value = count.ToString();
};
column.AddChild(new Text("FlutterSharp Counter") { Size = 32, Weight = "bold" });
column.AddChild(counter);
column.AddChild(button);
page.AddChild(column);
});
var app = builder.Build();
// Enable FlutterSharp WebSocket middleware
app.UseFlutterSharp();
app.Run();using FlutterSharp.Core.Controls.Core;
using FlutterSharp.Core.Controls.Material;
// Create a simple UI
var page = new Page
{
Title = "Hello FlutterSharp"
};
var column = new Column
{
HorizontalAlignment = "center",
VerticalAlignment = "center"
};
var text = new Text("Welcome to FlutterSharp!")
{
Size = 24,
Weight = "bold"
};
var button = new ElevatedButton("Click Me!");
button.Click += (sender, e) =>
{
text.Value = "Button clicked!";
};
column.AddChild(text);
column.AddChild(button);
page.AddChild(column);
// Run the application
await App.RunAsync(page);- .NET 9.0 SDK (RC or later)
- Git
# Clone the repository
git clone https://github.com/wieslawsoltes/FlutterSharp.git
cd FlutterSharp
# Initialize submodules (Flet reference)
git submodule update --init --recursive
# Build the solution
dotnet build
# Run tests
dotnet test- C# 12 - Latest language features
- .NET 9.0 - Modern runtime
- MessagePack-CSharp - Fast binary serialization
- System.Net.WebSockets - Network transport
- Microsoft.Extensions.* - Logging, DI abstractions
- xUnit - Testing framework
- Type Safety - Leverage C#'s strong type system
- Performance - Efficient serialization and minimal overhead
- Developer Experience - IntelliSense, clear APIs, good error messages
- Compatibility - Protocol-compatible with Flet Flutter client
- Modern .NET - Use latest C# features and patterns
This project is in early development. Contributions are welcome!
Areas where help is needed:
- Session management implementation
- Object patching system
- Additional controls
- Documentation
- Sample applications
- Testing
| Feature | Python Flet | FlutterSharp |
|---|---|---|
| Language | Python 3.7+ | C# 12 / .NET 9.0 |
| Type Safety | Dynamic typing | Static typing with generics |
| Performance | Good | Excellent (compiled, async) |
| IDE Support | PyCharm, VS Code | Visual Studio, Rider, VS Code |
| Hot Reload | Yes | Planned |
| Controls | 100+ | In progress |
| Platform | All | All (planned) |
- Week 1-2 ✅ Foundation & Protocol (Complete)
- Week 3-4 🚧 Session & Control Framework (In Progress)
- Week 5-6 📋 Essential Controls
- Week 7-8 📋 Material Design Controls
- Week 9-10 📋 Advanced Features
- Week 11-12 📋 Web & Desktop Runtimes
See IMPLEMENTATION_PLAN.md for detailed timeline.
This project is licensed under the MIT License - see the LICENSE file for details.
- Flet - The original Python implementation that inspired this project
- Flutter - The UI framework powering the client
- MessagePack - Efficient serialization format
This project is in active development and not yet ready for production use.
Current version: 1.1.0-alpha
- ✅ Foundation Complete - Protocol, transport, serialization
- ✅ Core Framework Complete - Controls, sessions, patching
- ✅ App & Runtime Complete - App class, SessionManager
- ✅ Reactive Updates - Auto-patch generation on property changes
- ✅ 100 Controls Implemented - Layout, display, input, navigation, dialogs, pickers, menus, data display, core interaction, Cupertino
- ✅ ~8,200 Lines of Code - 80 C# files, 68 control files
- ✅ All Essential Controls - Complete set of core Flutter controls
- ✅ All Material Buttons - Complete button variant set (7 variants: Elevated, Filled, FilledTonal, Outlined, Text, Icon, FAB)
- ✅ All Progress Indicators - ProgressBar (linear) and ProgressRing (circular)
- ✅ All Dividers - Divider (horizontal) and VerticalDivider (vertical)
- ✅ Complete Dialog System - AlertDialog, BottomSheet, SnackBar, Banner, Tooltip
- ✅ Advanced Input Controls - SearchBar, SegmentedButton, PopupMenuButton, RadioGroup, RangeSlider, AutoComplete, ContextMenu
- ✅ Pickers & Menus - DatePicker, TimePicker, MenuBar with MenuItemButton and SubmenuButton
- ✅ Data Display - Card, ListTile, Chip, Badge, ExpansionPanel, ExpansionTile, DataTable with sorting/selection, SelectionArea, ReorderableListView
- ✅ Navigation Components - AppBar, NavigationBar, NavigationRail, NavigationDrawer, BottomAppBar, Tabs/TabBar for multi-view apps
- ✅ User Avatars - CircleAvatar with image/initials support
- ✅ Collapsible Content - ExpansionPanel, ExpansionPanelList, ExpansionTile
- ✅ Responsive Layouts - GridView, ResponsiveRow for adaptive UIs
- ✅ Core Interaction - GestureDetector for gestures, Draggable/DragTarget for drag-and-drop, Dismissible for swipe-to-dismiss, SafeArea for system insets, Markdown rendering, AnimatedSwitcher for transitions, WindowDragArea for custom title bars, Placeholder for development, TextSpan for rich text, InteractiveViewer for pan/zoom
- ✅ Cupertino Controls - Complete iOS design language with CupertinoButton, CupertinoSwitch, CupertinoSlider, CupertinoTextField, CupertinoActivityIndicator, CupertinoAlertDialog, CupertinoNavigationBar, CupertinoAppBar (8 iOS-style controls)
- ✅ ASP.NET Core Integration - FlutterSharp.Web package with WebSocket middleware, session management, and DI extensions
- ✅ 20 Tests Passing - Solid test coverage
- ✅ Sample Applications - Hello World demo + ASP.NET Core WebApp with counter demo
- ✅ 100 Controls Milestone - Comprehensive control library complete!
- ✅ Web Server Foundation - ASP.NET Core integration started (Phase 6)
- 📋 Optional Extensions - Additional specialized Cupertino controls (DatePicker, ActionSheet, etc.)
Built with ❤️ using .NET 9.0