flutter_dapp 0.0.28
A runtime application plugin for flutter.
flutter_dapp
A runtime application plugin for flutter. Using js_script for logic script, and xml_layout for UI template.
Usage
DApp(
// Load main.js and main.xml as the entry widget
entry: '/main',
fileSystems: [
// A file wrap for reading script and template
fileSystem,
],
)
XML Tags
scaffold
- Attribute
- appBar
PreferredSizeWidget - body
Widget - floatingActionButton
Widget - drawer
Widget - endDrawer
Widget - bottomNavigationBar
Widget - bottomSheet
Widget - background
Color - resizeToAvoidBottomInset
bool
- appBar
- Child Same as the
bodyattribute.
row
- Attributes:
- mainAxisAlignment
MainAxisAlignmentdefault: MainAxisAlignment.start - mainAxisSize
MainAxisSizedefault: MainAxisSize.max - crossAxisAlignment
CrossAxisAlignmentdefault: CrossAxisAlignment.center - verticalDirection
VerticalDirectionVerticalDirection.down - textDirection
TextDirection - textBaseline
TextBaseline
- mainAxisAlignment
- Children
Widget
column
- Attributes:
- mainAxisAlignment
MainAxisAlignmentdefault: MainAxisAlignment.start - mainAxisSize
MainAxisSizedefault: MainAxisSize.max - crossAxisAlignment
CrossAxisAlignmentdefault: CrossAxisAlignment.center - verticalDirection
VerticalDirectionVerticalDirection.down - textDirection
TextDirection - textBaseline
TextBaseline
- mainAxisAlignment
- Children
Widget
center
- Attributes:
- widthFactor
double - heightFactor
double
- widthFactor
- Child
Widget
button
- Attributes:
- onPressed
Void Function - onLongPress
Void Function - type
DButtonTypedefault: DButtonType.elevated - minimumSize
Size - tapTargetSize
MaterialTapTargetSize - padding
EdgeInsets - color
Color
- onPressed
- Child
Widget
widget
- Description:
- Load another dapp widget.
- Attibutes:
- src
String - data
any. Pass to theloadfunction as the first argument.
- src
appbar
- Attributes:
- leading
Widget - actions
List<Widget> - bottom
PreferredSizeWidget - brightness
Brightness - background
Color - color
Color - height
doubledefault:56
- leading
- Child
Widget
list-view
- Attributes:
- builder
Widget Function(context, index) - itemCount
intdefault:0
- builder
- Children
Widgetavailable when builder is null.
list-item
- Description:
- Almost same as
ListTilein dart, could be used in list-view.
- Almost same as
- Attributes:
- leading
Widget - title
Widget - subtitle
Widget - trailing
Widget - onTap
Void Function - dense
bool - padding
EdgeInsets - color
Color
- leading
img
- Description:
imagetag is same asimgtag
- Attributes:
- src
String - width
double - height
double - fit
BoxFitdefault: BoxFit.contain - headers
Map- http headers, available when
srcis net image.
- http headers, available when
- gaplessPlayback
booldefault: false
- src
callback
- Description:
- Generate a
Void Function, and pass custom arguments
- Generate a
- Attributes:
- function
Stringthe function name in script. - args
Listthe arguments.
- function
refresh
- Descrition:
- Drag down to refresh and load more widget.
- Attributes:
- loading
bool - onRefresh
Void Function - onLoadMore
Void Function - refreshInset
doubledefault: 36
- loading
- Child
Widgetthe scrollable widget.
tabs
- Descrition:
- Wrap of
DefaultTabController
- Wrap of
- Attributes:
- scrollable
booldefault: false - elevation
doubledefault: 0 - background
Color
- scrollable
- Children
TabItem
tab
- Descrition:
- Generate a
TabItem
- Generate a
- Attributes:
- title
String - icon
Widget
- title
- Child
Widget
input
- Attributes:
- placeholder
String - text
String - autofocus
booldefault: false - onChange
Void Function(String newText) - onSubmit
Void Function(String text) - onFocus
Void Function - onBlur
Void Function - style
TextStyle
- placeholder
icon
- Attributes:
- size
double - color
Color
- size
- Child
IconData
textstyle
- Description:
- Generate a
TextStyle
- Generate a
- Attributes:
- color
Color - background
Color - size
double
- color
stack
- Attributes:
- alignment
Alignmentdefault: Alignment.topLeft - textDirection
TextDirection - fit
StackFitdefault: StackFit.loose - clip
Clipdefault: Clip.hardEdge
- alignment
- Children
Widget
view
- Description:
- Generate a
Container
- Generate a
- Attributes:
- width
double - height
double - color
Color - animate
booldefault: false - duration
Durationavaiable whenanimateis true - clip
Clipdefault: Clip.none - border
Border - radius
BorderRadius - gradient
Gradient - padding
EdgeInsets - alignment
Alignment - margin
EdgeInsets
- width
Border
- Attributes:
- top
BorderSidedefault: BorderSide.none - right
BorderSidedefault: BorderSide.none - bottom
BorderSidedefault: BorderSide.none - left
BorderSidedefault: BorderSide.none
- top
Border.all
- Attributes:
- color
Colordefault: Colors.black - width
doubledefault: 1.0 - style
BorderStyledefault: BorderStyle.none
- color
Border.symmetric
- Attributes:
- vertical
BorderSidedefault: BorderSide.none - horizontal
BorderSidedefault: BorderSide.none
- vertical
LinearGradient
- Attributes:
- begin
Alignmentdefault: Alignment.centerRight - end
Alignmentdefault: Alignment.centerRight - colors
List<Color> - stops
List<double> - mode
TileModedefault: TileMode.clamp
- begin
RadialGradient
- Attributes:
- center
Alignmentdefault: Alignment.center - radius
doubledefault: 0.5 - colors
List<Color> - stops
List<double> - mode
TileModedefault: TileMode.clamp - focal
Alignment - focalRadius
doubledefault: 0
- center
slivers
- Description:
- Wrap of
CustomScrollView
- Wrap of
- Attributes:
- direction
Axisdefault: Axis.vertical - reverse
booldefault: false
- direction
- Children
Widget
sliver-list-view
- Attrbutes:
- builder
Widget Function(context, index) - itemCount
intdefault: 0
- builder
- Children
Widgetavailable when builder is null.
sliver-appbar
- Attrbutes:
- leading
Widget - actions
List<Widget> - bottom
PreferredSizeWidget - brightness
Brightness - background
Color - color
Color - floating
booldefault: false - expandedHeight
double
- leading
- Child
Widgetas the title of AppBar
FlexibleSpaceBar
- Attributes:
- padding
EdgeInsets - background
Widget - center
bool - mode
CollapseModedefault: CollapseMode.parallax
- padding
- Child
Widgetas the title
sliver-container
- Child
Widget
text
- Attributes:
- lines
int - overflow
TextOverflow
- lines
- Children
InlineSpanor text
span
- Description:
- Generate a
TextSpanwhen child is text orList<TextSpan>, Generate aWidgetSpanwhen child is Widget.
- Generate a
Expanded
- Attributes:
- flex
intdefault: 1
- flex
Divider
- Attributes:
- type
Stringoptions:vertical,horizontal - width
doubleavailable when type isvertical - height
doubleavailable when type ishorizontal - thickness
double - indent
double - endIndent
double
- type
menu-button
- Description:
- A wrap of
PopupMenuButtonin flutter
- A wrap of
- Attributes:
- onSelected
PopupMenuItemSelected - onCanceled
PopupMenuCanceled - items
List<PopupMenuEntry> - padding
EdgeInsetsdefault: EdgeInsets.all(8.0) - tooltip
String - elevation
double - icon
Widget - iconSize
double - offset
Offsetdefault: Offset.zero - enabled
booldefault: true - color
Color
- onSelected
- Child
Widget
menu-item
- Description:
- A wrap of
PopupMenuItemin flutter
- A wrap of
- Attributes:
- value
any - enabled
booldefault: true - height
doubledefault: kMinInteractiveDimension - padding
EdgeInsets - style
TextStyle - color
Color - size
double
- value
- Child
Widget
menu-divider
- Description:
- A wrap of
PopupMenuDividerin flutter
- A wrap of
- Attributes:
- height
doubledefault: 16
- height
switch
- Description:
- A wrap of
AnimatedSwitcherin flutter
- A wrap of
- Attributes:
- duration
Durationdefault: Duration(milliseconds: 300) - axis
Axisdefault: Axis.vertical
- duration
- Child
Widget
grid-view
- Description:
- A wrap of
GridViewin flutter
- A wrap of
- Attributes:
- builder
IndexedWidgetBuilder - itemCount
intdefault: 0 Available whenbuilderis not null - padding
EdgeInsetsdefault: EdgeInsets.zero - crossAxisCount
intdefault: 4 - childAspectRatio
doubledefault: 1
- builder
- Children
WidgetAvailable whenbuilderis null
sliver-grid-view
- Description:
- A wrap of
SliverGridViewin flutter
- A wrap of
- Attributes:
- builder
IndexedWidgetBuilder - itemCount
intdefault: 0 Available whenbuilderis not null - crossAxisCount
intdefault: 4 - childAspectRatio
doubledefault: 1
- builder
- Children
WidgetAvailable whenbuilderis null
Extended inline method
js(method, arguments...)
<if candidate="js(isFavorate)">
<view color="red"/>
</if>
- Description:
- Call method define in the js script.
array(arguments...)
<callback function="getItem" array="array(arg1, arg2)"/>
- Description:
- Convert arguments to a
List.
- Convert arguments to a
length(list)
- Description:
- Get length of list.
isNull(obj)
isNotNull(obj)
switch(test, a, b)
- Description:
- return
aiftestequal true, otherwise returnb.
- return