sdui_dsl library
SDUI DSL — Server-Driven UI Widget Builder
Import this library in your DSL definition files to compose widget trees using Flutter-like syntax. The result can be exported to JSON via the SDUI CLI tool.
Important: Do NOT import this library in the same file as
package:flutter/material.dart. Class names (Column,Container,Text, etc.) conflict. Keep DSL definition files Flutter-free.
Quick start
import 'package:sdui_library/sdui_dsl.dart';
final _ = Column(
key: Key('home_screen'),
mainAxisAlignment: 'center',
children: [
Container(
key: Key('hero'),
height: 200,
color: 'Colors.indigo',
borderRadius: 16,
child: Text('Welcome', fontSize: 32, color: 'Colors.white'),
),
ElevatedButton(
label: 'Get Started',
backgroundColor: 'Colors.indigo',
onTap: SduiAction(type: 'navigate', payload: {'route': '/home'}),
),
],
);
Export via CLI
dart run sdui export home_screen home_screen
dart run sdui export home_screen hero
Classes
- BuildContext
- A mock BuildContext for the DSL.
- Card
- DSL node for a Card widget.
- Center
- DSL node for a Center widget.
- Column
- DSL node for a Column widget.
- Container
- DSL node for a Container widget.
- ElevatedButton
-
A filled elevated button. See
_ButtonBasefor all properties. - Icon
- DSL node for an Icon widget.
- Image
- DSL node for an Image widget (network images).
- Key
- A lightweight key class used to identify and export specific DSL nodes.
- ListView
- DSL node for a ListView widget.
- OutlinedButton
-
An outlined (bordered) button. See
_ButtonBasefor all properties. - Padding
- DSL node for a Padding widget.
- Row
- DSL node for a Row widget.
- SduiAction
- DSL representation of an SDUI action (e.g. button tap handler).
- SduiNode
- Abstract base class for all SDUI DSL nodes.
- SduiRegistry
- A global registry that maps Key values to SduiNode instances.
- Stack
- DSL node for a Stack widget.
- StatelessWidget
- A mock StatelessWidget that allows developers to define UI using familiar Flutter paradigms instead of top-level variables.
- Text
- DSL node for a Text widget.
- TextButton
-
A flat text button. See
_ButtonBasefor all properties.
Functions
-
resolveColor(
String? value) → String? - Resolves a color value string into a hex color string compatible with the SDUI library's JSON format.