adding packages

This commit is contained in:
2026-01-15 14:38:46 -08:00
parent ef86e3ab6a
commit 6869cf47e5
5253 changed files with 726695 additions and 34 deletions
@@ -0,0 +1,73 @@
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../enums.dart';
import '../library.dart';
import '../theme/icon_theme_data.dart';
import '../theme/text_theme.dart';
part 'appbar.g.dart';
@WidgetClass('AppBar', preferredHeight: kToolbarHeight)
class AppBarBase extends _$AppBarBase {
AppBarBase(this.widgetData, this.widgetContext, this.widgetRender);
List<Widget> actions;
Color backgroundColor;
Widget bottom;
@enumBrightness
Brightness brightness;
bool centerTitle;
double elevation;
Widget flexibleSpace;
Key key;
Color shadowColor;
ShapeBorder shape;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@SupportedKey()
IconThemeDataBase actionsIconTheme;
@SupportedKey()
IconThemeDataBase iconTheme;
@WidgetKey.widget()
Widget leading;
@SupportedKey()
TextThemeBase textTheme;
@WidgetKey.widget(acceptWidth: 100)
Widget title;
@PropertyKey(defaultValue: 'true')
bool automaticallyImplyLeading;
@PropertyKey(defaultValue: 'true')
bool primary;
@PropertyKey(defaultValue: '16.0')
double titleSpacing;
@PropertyKey(defaultValue: '1.0')
double toolbarOpacity;
@PropertyKey(defaultValue: '1.0')
double bottomOpacity;
@PropertyKey(defaultValue: 'false')
bool excludeHeaderSemantics;
}
@@ -0,0 +1,530 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'appbar.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$AppBarBase extends WidgetPreferredSizedBase {
String actionsKey = 'actions';
String backgroundColorKey = 'backgroundColor';
String bottomKey = 'bottom';
String brightnessKey = 'brightness';
String centerTitleKey = 'centerTitle';
String elevationKey = 'elevation';
String flexibleSpaceKey = 'flexibleSpace';
String keyKey = 'key';
String shadowColorKey = 'shadowColor';
String actionsIconThemeKey = 'actionsIconTheme';
String iconThemeKey = 'iconTheme';
String leadingKey = 'leading';
String textThemeKey = 'textTheme';
String titleKey = 'title';
String automaticallyImplyLeadingKey = 'automaticallyImplyLeading';
String primaryKey = 'primary';
String titleSpacingKey = 'titleSpacing';
String toolbarOpacityKey = 'toolbarOpacity';
String bottomOpacityKey = 'bottomOpacity';
String excludeHeaderSemanticsKey = 'excludeHeaderSemantics';
@override
Size get preferredSize => Size.fromHeight(56.0);
@override
Map<String, String> get properties => {
'actions': 'List<Widget>',
'backgroundColor': 'Color',
'bottom': 'Widget',
'brightness': 'Brightness',
'centerTitle': 'bool',
'elevation': 'double',
'flexibleSpace': 'Widget',
'key': 'Key',
'shadowColor': 'Color',
'actionsIconTheme': 'IconThemeDataBase',
'iconTheme': 'IconThemeDataBase',
'leading': 'Widget',
'textTheme': 'TextThemeBase',
'title': 'Widget',
'automaticallyImplyLeading': 'bool',
'primary': 'bool',
'titleSpacing': 'double',
'toolbarOpacity': 'double',
'bottomOpacity': 'double',
'excludeHeaderSemantics': 'bool',
};
final _actionsListen = ValueNotifier<bool>(false);
List<WidgetBase> get actionsVal {
if (params[actionsKey] != null) {
final _children = <WidgetBase>[];
final _list = List.from(params[actionsKey]);
for (final item in _list) {
if (item is Map<String, dynamic>) {
_children.add(widgetRender(widgetContext, item));
}
}
return _children;
}
return null;
}
void actionsValUpdate(Map<String, dynamic> val) {
if (params[actionsKey] == null) {
params[actionsKey] = [];
}
params[actionsKey].add(val);
widgetContext.onUpdate(id, widgetData);
}
Color get backgroundColorVal {
if (params[backgroundColorKey] != null) {
int _value = null;
String description = params[backgroundColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[backgroundColorKey] is Map) {
if (params[backgroundColorKey]['name'] == 'Color' &&
params[backgroundColorKey]['params'] != null &&
params[backgroundColorKey]['params']['0'] != null) {
_value = int.tryParse(params[backgroundColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set backgroundColorVal(Color val) {
params[backgroundColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
WidgetBase get bottomVal {
if (params[bottomKey] != null) {
return widgetRender(widgetContext, params[bottomKey]);
}
return null;
}
void bottomValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'ItU1xQCIz8o';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'DeY68MS4BC5';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'g6eoOkme9M8';
}
params[bottomKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
List<Brightness> get brightnessValues => [
Brightness.light,
Brightness.dark,
];
Brightness get brightnessVal {
if (params[brightnessKey] != null) {
final _value = params[brightnessKey].toString().replaceAll('#', '');
return brightnessValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set brightnessVal(Brightness val) {
params[brightnessKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
bool get centerTitleVal {
if (params[centerTitleKey] != null) {
return params[centerTitleKey] as bool;
}
return null;
}
set centerTitleVal(bool val) {
params[centerTitleKey] = val;
widgetContext.onUpdate(id, widgetData);
}
double get elevationVal {
if (params[elevationKey] != null) {
return params[elevationKey] as double;
}
return null;
}
set elevationVal(double val) {
params[elevationKey] = val;
widgetContext.onUpdate(id, widgetData);
}
WidgetBase get flexibleSpaceVal {
if (params[flexibleSpaceKey] != null) {
return widgetRender(widgetContext, params[flexibleSpaceKey]);
}
return null;
}
void flexibleSpaceValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'Ra7aIA-iJBE';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'rQunSaedU1k';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'Wp24GRsdnAh';
}
params[flexibleSpaceKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
Color get shadowColorVal {
if (params[shadowColorKey] != null) {
int _value = null;
String description = params[shadowColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[shadowColorKey] is Map) {
if (params[shadowColorKey]['name'] == 'Color' &&
params[shadowColorKey]['params'] != null &&
params[shadowColorKey]['params']['0'] != null) {
_value = int.tryParse(params[shadowColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set shadowColorVal(Color val) {
params[shadowColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
IconThemeDataBase get actionsIconThemeVal {
if (params[actionsIconThemeKey] != null) {
return IconThemeDataBase(
params[actionsIconThemeKey], widgetContext, widgetRender);
}
return null;
}
set actionsIconThemeVal(IconThemeDataBase val) {
params[actionsIconThemeKey] = val;
widgetContext.onUpdate(id, widgetData);
}
IconThemeDataBase get iconThemeVal {
if (params[iconThemeKey] != null) {
return IconThemeDataBase(
params[iconThemeKey], widgetContext, widgetRender);
}
return null;
}
set iconThemeVal(IconThemeDataBase val) {
params[iconThemeKey] = val;
widgetContext.onUpdate(id, widgetData);
}
final _leadingListen = ValueNotifier<bool>(false);
WidgetBase get leadingVal {
if (params[leadingKey] != null) {
return widgetRender(widgetContext, params[leadingKey]);
}
return null;
}
void leadingValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'J5ByDf7gp-I';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'pECVZ76SiUN';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'hqN_qjzEohG';
}
params[leadingKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
TextThemeBase get textThemeVal {
if (params[textThemeKey] != null) {
return TextThemeBase(params[textThemeKey], widgetContext, widgetRender);
}
return null;
}
set textThemeVal(TextThemeBase val) {
params[textThemeKey] = val;
widgetContext.onUpdate(id, widgetData);
}
final _titleListen = ValueNotifier<bool>(false);
WidgetBase get titleVal {
if (params[titleKey] != null) {
return widgetRender(widgetContext, params[titleKey]);
}
return null;
}
void titleValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = '-rzvtkdjuvP';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = '-fp7eX8rfaE';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'TunbKegzcsA';
}
params[titleKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
bool get automaticallyImplyLeadingVal {
if (params[automaticallyImplyLeadingKey] != null) {
return params[automaticallyImplyLeadingKey] as bool;
}
return true;
}
set automaticallyImplyLeadingVal(bool val) {
params[automaticallyImplyLeadingKey] = val;
widgetContext.onUpdate(id, widgetData);
}
bool get primaryVal {
if (params[primaryKey] != null) {
return params[primaryKey] as bool;
}
return true;
}
set primaryVal(bool val) {
params[primaryKey] = val;
widgetContext.onUpdate(id, widgetData);
}
double get titleSpacingVal {
if (params[titleSpacingKey] != null) {
return params[titleSpacingKey] as double;
}
return 16.0;
}
set titleSpacingVal(double val) {
params[titleSpacingKey] = val;
widgetContext.onUpdate(id, widgetData);
}
double get toolbarOpacityVal {
if (params[toolbarOpacityKey] != null) {
return params[toolbarOpacityKey] as double;
}
return 1.0;
}
set toolbarOpacityVal(double val) {
params[toolbarOpacityKey] = val;
widgetContext.onUpdate(id, widgetData);
}
double get bottomOpacityVal {
if (params[bottomOpacityKey] != null) {
return params[bottomOpacityKey] as double;
}
return 1.0;
}
set bottomOpacityVal(double val) {
params[bottomOpacityKey] = val;
widgetContext.onUpdate(id, widgetData);
}
bool get excludeHeaderSemanticsVal {
if (params[excludeHeaderSemanticsKey] != null) {
return params[excludeHeaderSemanticsKey] as bool;
}
return false;
}
set excludeHeaderSemanticsVal(bool val) {
params[excludeHeaderSemanticsKey] = val;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return PreferredSize(
preferredSize: preferredSize,
child: GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: AppBar(
actions: actionsVal == null && !widgetContext.isDragging
? []
: [
if (actionsVal != null)
for (final item in actionsVal) item.build(context),
if (widgetContext.isDragging)
DragTarget<WidgetBaseData>(
onAccept: (val) {
_actionsListen.value = false;
if (val != null) {
actionsValUpdate(val?.data);
}
},
onLeave: (val) {
_actionsListen.value = false;
},
onWillAccept: (val) {
_actionsListen.value = true;
return _actionsListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _actionsListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(30, 30),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
],
actionsIconTheme: actionsIconThemeVal?.build(context),
automaticallyImplyLeading: automaticallyImplyLeadingVal,
backgroundColor: backgroundColorVal,
bottom: bottomVal?.build(context),
bottomOpacity: bottomOpacityVal,
brightness: brightnessVal,
centerTitle: centerTitleVal,
elevation: elevationVal,
excludeHeaderSemantics: excludeHeaderSemanticsVal,
flexibleSpace: flexibleSpaceVal?.build(context),
iconTheme: iconThemeVal?.build(context),
key: keyVal,
leading: !widgetContext.isDragging ||
(widgetContext.isDragging &&
leadingVal?.build(context) != null)
? (leadingVal?.build(context))
: PreferredSize(
preferredSize: Size(30.0, 30.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_leadingListen.value = false;
if (val != null) {
leadingValUpdate(val?.data);
}
},
onLeave: (val) {
_leadingListen.value = false;
},
onWillAccept: (val) {
_leadingListen.value = true;
return _leadingListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _leadingListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(30.0, 30.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
primary: primaryVal,
shadowColor: shadowColorVal,
textTheme: textThemeVal?.build(context),
title: !widgetContext.isDragging ||
(widgetContext.isDragging && titleVal?.build(context) != null)
? (titleVal?.build(context))
: PreferredSize(
preferredSize: Size(100.0, 30.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_titleListen.value = false;
if (val != null) {
titleValUpdate(val?.data);
}
},
onLeave: (val) {
_titleListen.value = false;
},
onWillAccept: (val) {
_titleListen.value = true;
return _titleListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _titleListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 30.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
titleSpacing: titleSpacingVal,
toolbarOpacity: toolbarOpacityVal,
),
),
);
}
}
@@ -0,0 +1,46 @@
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../enums.dart';
import '../library.dart';
part 'column.g.dart';
@WidgetClass('Column')
class ColumnBase extends _$ColumnBase {
ColumnBase(this.widgetData, this.widgetContext, this.widgetRender);
List<Widget> children;
Key key;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@enumMainAxisSize
MainAxisSize mainAxisSize;
@enumTextBaseline
TextBaseline textBaseline;
@enumTextDirection
TextDirection textDirection;
@enumMainAxisAlignment
MainAxisAlignment mainAxisAlignment;
@enumCrossAxisAlignment
CrossAxisAlignment crossAxisAlignment;
@enumVerticalDirection
VerticalDirection verticalDirection;
}
@@ -0,0 +1,268 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'column.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$ColumnBase extends WidgetBase {
String childrenKey = 'children';
String keyKey = 'key';
String mainAxisSizeKey = 'mainAxisSize';
String textBaselineKey = 'textBaseline';
String textDirectionKey = 'textDirection';
String mainAxisAlignmentKey = 'mainAxisAlignment';
String crossAxisAlignmentKey = 'crossAxisAlignment';
String verticalDirectionKey = 'verticalDirection';
@override
Map<String, String> get properties => {
'children': 'List<Widget>',
'key': 'Key',
'mainAxisSize': 'MainAxisSize',
'textBaseline': 'TextBaseline',
'textDirection': 'TextDirection',
'mainAxisAlignment': 'MainAxisAlignment',
'crossAxisAlignment': 'CrossAxisAlignment',
'verticalDirection': 'VerticalDirection',
};
final _childrenListen = ValueNotifier<bool>(false);
List<WidgetBase> get childrenVal {
if (params[childrenKey] != null) {
final _children = <WidgetBase>[];
final _list = List.from(params[childrenKey]);
for (final item in _list) {
if (item is Map<String, dynamic>) {
_children.add(widgetRender(widgetContext, item));
}
}
return _children;
}
return null;
}
void childrenValUpdate(Map<String, dynamic> val) {
if (params[childrenKey] == null) {
params[childrenKey] = [];
}
params[childrenKey].add(val);
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
List<MainAxisSize> get mainAxisSizeValues => [
MainAxisSize.max,
MainAxisSize.min,
];
MainAxisSize get mainAxisSizeVal {
if (params[mainAxisSizeKey] != null) {
final _value = params[mainAxisSizeKey].toString().replaceAll('#', '');
return mainAxisSizeValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => MainAxisSize.max,
);
}
return MainAxisSize.max;
}
set mainAxisSizeVal(MainAxisSize val) {
params[mainAxisSizeKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<TextBaseline> get textBaselineValues => [
TextBaseline.alphabetic,
TextBaseline.ideographic,
];
TextBaseline get textBaselineVal {
if (params[textBaselineKey] != null) {
final _value = params[textBaselineKey].toString().replaceAll('#', '');
return textBaselineValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set textBaselineVal(TextBaseline val) {
params[textBaselineKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<TextDirection> get textDirectionValues => [
TextDirection.ltr,
TextDirection.rtl,
];
TextDirection get textDirectionVal {
if (params[textDirectionKey] != null) {
final _value = params[textDirectionKey].toString().replaceAll('#', '');
return textDirectionValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set textDirectionVal(TextDirection val) {
params[textDirectionKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<MainAxisAlignment> get mainAxisAlignmentValues => [
MainAxisAlignment.center,
MainAxisAlignment.end,
MainAxisAlignment.spaceAround,
MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceEvenly,
MainAxisAlignment.start,
];
MainAxisAlignment get mainAxisAlignmentVal {
if (params[mainAxisAlignmentKey] != null) {
final _value =
params[mainAxisAlignmentKey].toString().replaceAll('#', '');
return mainAxisAlignmentValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => MainAxisAlignment.start,
);
}
return MainAxisAlignment.start;
}
set mainAxisAlignmentVal(MainAxisAlignment val) {
params[mainAxisAlignmentKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<CrossAxisAlignment> get crossAxisAlignmentValues => [
CrossAxisAlignment.baseline,
CrossAxisAlignment.center,
CrossAxisAlignment.end,
CrossAxisAlignment.start,
CrossAxisAlignment.stretch,
];
CrossAxisAlignment get crossAxisAlignmentVal {
if (params[crossAxisAlignmentKey] != null) {
final _value =
params[crossAxisAlignmentKey].toString().replaceAll('#', '');
return crossAxisAlignmentValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => CrossAxisAlignment.center,
);
}
return CrossAxisAlignment.center;
}
set crossAxisAlignmentVal(CrossAxisAlignment val) {
params[crossAxisAlignmentKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<VerticalDirection> get verticalDirectionValues => [
VerticalDirection.up,
VerticalDirection.down,
];
VerticalDirection get verticalDirectionVal {
if (params[verticalDirectionKey] != null) {
final _value =
params[verticalDirectionKey].toString().replaceAll('#', '');
return verticalDirectionValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => VerticalDirection.down,
);
}
return VerticalDirection.down;
}
set verticalDirectionVal(VerticalDirection val) {
params[verticalDirectionKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: Column(
children: childrenVal == null && !widgetContext.isDragging
? []
: [
if (childrenVal != null)
for (final item in childrenVal) item.build(context),
if (widgetContext.isDragging)
DragTarget<WidgetBaseData>(
onAccept: (val) {
_childrenListen.value = false;
if (val != null) {
childrenValUpdate(val?.data);
}
},
onLeave: (val) {
_childrenListen.value = false;
},
onWillAccept: (val) {
_childrenListen.value = true;
return _childrenListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childrenListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(30, 30),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
],
crossAxisAlignment: crossAxisAlignmentVal,
key: keyVal,
mainAxisAlignment: mainAxisAlignmentVal,
mainAxisSize: mainAxisSizeVal,
textBaseline: textBaselineVal,
textDirection: textDirectionVal,
verticalDirection: verticalDirectionVal,
),
);
}
}
@@ -0,0 +1,35 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../library.dart';
part 'expanded.g.dart';
@WidgetClass('Expanded', allowTap: false)
class ExpandedBase extends _$ExpandedBase {
ExpandedBase(this.widgetData, this.widgetContext, this.widgetRender);
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
defaultValue: 'Placeholder',
)
Widget child;
int flex;
Key key;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
}
@@ -0,0 +1,130 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'expanded.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$ExpandedBase extends WidgetBase {
String childKey = 'child';
String flexKey = 'flex';
String keyKey = 'key';
@override
Map<String, String> get properties => {
'child': 'Widget',
'flex': 'int',
'key': 'Key',
};
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = '1VgSbjXHAqF';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'uUu3uCJOGwv';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = '-QlJw2cN-lL';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
int get flexVal {
if (params[flexKey] != null) {
return params[flexKey] as int;
}
return null;
}
set flexVal(int val) {
params[flexKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return Expanded(
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': 'qgk5Bwzee3F',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
flex: flexVal,
key: keyVal,
);
}
}
@@ -0,0 +1,71 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../enums.dart';
import '../library.dart';
part 'flat_button.g.dart';
@WidgetClass('FlatButton')
class FlatButtonBase extends _$FlatButtonBase {
FlatButtonBase(this.widgetData, this.widgetContext, this.widgetRender);
Duration animationDuration;
@enumClip
Clip clipBehavior;
Color color;
@enumBrightness
Brightness colorBrightness;
Color disabledColor;
Color disabledTextColor;
Color focusColor;
FocusNode focusNode;
Color highlightColor;
Color hoverColor;
Key key;
MaterialTapTargetSize materialTapTargetSize;
@enumMouseCursor
MouseCursor mouseCursor;
Function onLongPress;
Function onPressed;
EdgeInsets padding;
ShapeBorder shape;
Color splashColor;
Color textColor;
@enumButtonTextTheme
ButtonTextTheme textTheme;
@enumVisualDensity
VisualDensity visualDensity;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@PropertyKey(defaultValue: 'false')
bool autofocus;
@WidgetKey.widget(
acceptWidth: 35,
acceptHeight: 35,
defaultValue: 'Placeholder',
)
Widget child;
void Function(bool) onHighlightChanged;
}
@@ -0,0 +1,559 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'flat_button.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$FlatButtonBase extends WidgetBase {
String clipBehaviorKey = 'clipBehavior';
String colorKey = 'color';
String colorBrightnessKey = 'colorBrightness';
String disabledColorKey = 'disabledColor';
String disabledTextColorKey = 'disabledTextColor';
String focusColorKey = 'focusColor';
String highlightColorKey = 'highlightColor';
String hoverColorKey = 'hoverColor';
String keyKey = 'key';
String mouseCursorKey = 'mouseCursor';
String onLongPressKey = 'onLongPress';
String onPressedKey = 'onPressed';
String paddingKey = 'padding';
String splashColorKey = 'splashColor';
String textColorKey = 'textColor';
String textThemeKey = 'textTheme';
String visualDensityKey = 'visualDensity';
String autofocusKey = 'autofocus';
String childKey = 'child';
@override
Map<String, String> get properties => {
'clipBehavior': 'Clip',
'color': 'Color',
'colorBrightness': 'Brightness',
'disabledColor': 'Color',
'disabledTextColor': 'Color',
'focusColor': 'Color',
'highlightColor': 'Color',
'hoverColor': 'Color',
'key': 'Key',
'mouseCursor': 'MouseCursor',
'onLongPress': 'Function',
'onPressed': 'Function',
'padding': 'EdgeInsets',
'splashColor': 'Color',
'textColor': 'Color',
'textTheme': 'ButtonTextTheme',
'visualDensity': 'VisualDensity',
'autofocus': 'bool',
'child': 'Widget',
};
List<Clip> get clipBehaviorValues => [
Clip.none,
Clip.antiAlias,
Clip.antiAliasWithSaveLayer,
Clip.hardEdge,
];
Clip get clipBehaviorVal {
if (params[clipBehaviorKey] != null) {
final _value = params[clipBehaviorKey].toString().replaceAll('#', '');
return clipBehaviorValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => Clip.none,
);
}
return Clip.none;
}
set clipBehaviorVal(Clip val) {
params[clipBehaviorKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
Color get colorVal {
if (params[colorKey] != null) {
int _value = null;
String description = params[colorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[colorKey] is Map) {
if (params[colorKey]['name'] == 'Color' &&
params[colorKey]['params'] != null &&
params[colorKey]['params']['0'] != null) {
_value = int.tryParse(params[colorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set colorVal(Color val) {
params[colorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
List<Brightness> get colorBrightnessValues => [
Brightness.light,
Brightness.dark,
];
Brightness get colorBrightnessVal {
if (params[colorBrightnessKey] != null) {
final _value = params[colorBrightnessKey].toString().replaceAll('#', '');
return colorBrightnessValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set colorBrightnessVal(Brightness val) {
params[colorBrightnessKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
Color get disabledColorVal {
if (params[disabledColorKey] != null) {
int _value = null;
String description = params[disabledColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[disabledColorKey] is Map) {
if (params[disabledColorKey]['name'] == 'Color' &&
params[disabledColorKey]['params'] != null &&
params[disabledColorKey]['params']['0'] != null) {
_value = int.tryParse(params[disabledColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set disabledColorVal(Color val) {
params[disabledColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Color get disabledTextColorVal {
if (params[disabledTextColorKey] != null) {
int _value = null;
String description = params[disabledTextColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[disabledTextColorKey] is Map) {
if (params[disabledTextColorKey]['name'] == 'Color' &&
params[disabledTextColorKey]['params'] != null &&
params[disabledTextColorKey]['params']['0'] != null) {
_value = int.tryParse(params[disabledTextColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set disabledTextColorVal(Color val) {
params[disabledTextColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Color get focusColorVal {
if (params[focusColorKey] != null) {
int _value = null;
String description = params[focusColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[focusColorKey] is Map) {
if (params[focusColorKey]['name'] == 'Color' &&
params[focusColorKey]['params'] != null &&
params[focusColorKey]['params']['0'] != null) {
_value = int.tryParse(params[focusColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set focusColorVal(Color val) {
params[focusColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Color get highlightColorVal {
if (params[highlightColorKey] != null) {
int _value = null;
String description = params[highlightColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[highlightColorKey] is Map) {
if (params[highlightColorKey]['name'] == 'Color' &&
params[highlightColorKey]['params'] != null &&
params[highlightColorKey]['params']['0'] != null) {
_value = int.tryParse(params[highlightColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set highlightColorVal(Color val) {
params[highlightColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Color get hoverColorVal {
if (params[hoverColorKey] != null) {
int _value = null;
String description = params[hoverColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[hoverColorKey] is Map) {
if (params[hoverColorKey]['name'] == 'Color' &&
params[hoverColorKey]['params'] != null &&
params[hoverColorKey]['params']['0'] != null) {
_value = int.tryParse(params[hoverColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set hoverColorVal(Color val) {
params[hoverColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
List<MouseCursor> get mouseCursorValues => [
SystemMouseCursors.click,
SystemMouseCursors.basic,
SystemMouseCursors.forbidden,
SystemMouseCursors.grab,
SystemMouseCursors.grabbing,
SystemMouseCursors.text,
SystemMouseCursors.none,
];
MouseCursor get mouseCursorVal {
if (params[mouseCursorKey] != null) {
final _value = params[mouseCursorKey].toString().replaceAll('#', '');
return mouseCursorValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => SystemMouseCursors.click,
);
}
return SystemMouseCursors.click;
}
set mouseCursorVal(MouseCursor val) {
params[mouseCursorKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
String get onLongPressVal {
if (params[onLongPressKey] != null) {
return params[onLongPressKey] as String;
}
return null;
}
set onLongPressVal(String val) {
params[onLongPressKey] = val;
widgetContext.onUpdate(id, widgetData);
}
String get onPressedVal {
if (params[onPressedKey] != null) {
return params[onPressedKey] as String;
}
return null;
}
set onPressedVal(String val) {
params[onPressedKey] = val;
widgetContext.onUpdate(id, widgetData);
}
EdgeInsets get paddingVal {
EdgeInsets _spacing = EdgeInsets.all(0.0);
if (params[paddingKey] != null) {
double top = 0;
double bottom = 0;
double left = 0;
double right = 0;
Map<String, dynamic> _spacingParams = params[paddingKey]['params'];
top = _spacingParams['top'] ?? 0;
bottom = _spacingParams['bottom'] ?? 0;
left = _spacingParams['left'] ?? 0;
right = _spacingParams['right'] ?? 0;
_spacing = EdgeInsets.fromLTRB(left, top, right, bottom);
}
return _spacing;
}
set paddingVal(EdgeInsets val) {
params[paddingKey] = {
"name": "EdgeInsets.only",
"id": "paddingKeyEdgeInsets",
"params": {
"top": val.top,
"bottom": val.bottom,
"left": val.left,
"right": val.right,
}
};
widgetContext.onUpdate(id, widgetData);
}
Color get splashColorVal {
if (params[splashColorKey] != null) {
int _value = null;
String description = params[splashColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[splashColorKey] is Map) {
if (params[splashColorKey]['name'] == 'Color' &&
params[splashColorKey]['params'] != null &&
params[splashColorKey]['params']['0'] != null) {
_value = int.tryParse(params[splashColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set splashColorVal(Color val) {
params[splashColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Color get textColorVal {
if (params[textColorKey] != null) {
int _value = null;
String description = params[textColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[textColorKey] is Map) {
if (params[textColorKey]['name'] == 'Color' &&
params[textColorKey]['params'] != null &&
params[textColorKey]['params']['0'] != null) {
_value = int.tryParse(params[textColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set textColorVal(Color val) {
params[textColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
List<ButtonTextTheme> get textThemeValues => [
ButtonTextTheme.normal,
ButtonTextTheme.accent,
ButtonTextTheme.primary,
];
ButtonTextTheme get textThemeVal {
if (params[textThemeKey] != null) {
final _value = params[textThemeKey].toString().replaceAll('#', '');
return textThemeValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set textThemeVal(ButtonTextTheme val) {
params[textThemeKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<VisualDensity> get visualDensityValues => [
VisualDensity.adaptivePlatformDensity,
VisualDensity.comfortable,
VisualDensity.compact,
VisualDensity.standard,
];
VisualDensity get visualDensityVal {
if (params[visualDensityKey] != null) {
final _value = params[visualDensityKey].toString().replaceAll('#', '');
return visualDensityValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set visualDensityVal(VisualDensity val) {
params[visualDensityKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
bool get autofocusVal {
if (params[autofocusKey] != null) {
return params[autofocusKey] as bool;
}
return false;
}
set autofocusVal(bool val) {
params[autofocusKey] = val;
widgetContext.onUpdate(id, widgetData);
}
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'GuGquUUpdUD';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'MTDvwC2COPh';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'TB27AON9tWV';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: FlatButton(
autofocus: autofocusVal,
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': 'GS8VeS6U2al',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(35.0, 35.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(35.0, 35.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
clipBehavior: clipBehaviorVal,
color: colorVal,
colorBrightness: colorBrightnessVal,
disabledColor: disabledColorVal,
disabledTextColor: disabledTextColorVal,
focusColor: focusColorVal,
highlightColor: highlightColorVal,
hoverColor: hoverColorVal,
key: keyVal,
mouseCursor: mouseCursorVal,
onLongPress: () => onAction(context, onLongPressVal),
onPressed: () => onAction(context, onPressedVal),
padding: paddingVal,
splashColor: splashColorVal,
textColor: textColorVal,
textTheme: textThemeVal,
visualDensity: visualDensityVal,
),
);
}
}
@@ -0,0 +1,75 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../enums.dart';
import '../library.dart';
part 'flat_button_icon.g.dart';
@WidgetClass('FlatButton.icon')
class FlatButtonIconBase extends _$FlatButtonIconBase {
FlatButtonIconBase(this.widgetData, this.widgetContext, this.widgetRender);
Duration animationDuration;
@enumClip
Clip clipBehavior;
Color color;
@enumBrightness
Brightness colorBrightness;
Color disabledColor;
Color disabledTextColor;
Color focusColor;
FocusNode focusNode;
Color highlightColor;
Color hoverColor;
Key key;
MaterialTapTargetSize materialTapTargetSize;
@enumMouseCursor
MouseCursor mouseCursor;
Function onLongPress;
Function onPressed;
EdgeInsets padding;
ShapeBorder shape;
Color splashColor;
Color textColor;
@enumButtonTextTheme
ButtonTextTheme textTheme;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@PropertyKey(defaultValue: 'false')
bool autofocus;
@WidgetKey.widget(
acceptWidth: 50,
acceptHeight: 35,
defaultValue: 'Placeholder',
)
Widget icon;
@WidgetKey.widget(
acceptWidth: 35,
acceptHeight: 35,
defaultValue: 'Placeholder',
)
Widget label;
void Function(bool) onHighlightChanged;
}
@@ -0,0 +1,597 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'flat_button_icon.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$FlatButtonIconBase extends WidgetBase {
String clipBehaviorKey = 'clipBehavior';
String colorKey = 'color';
String colorBrightnessKey = 'colorBrightness';
String disabledColorKey = 'disabledColor';
String disabledTextColorKey = 'disabledTextColor';
String focusColorKey = 'focusColor';
String highlightColorKey = 'highlightColor';
String hoverColorKey = 'hoverColor';
String keyKey = 'key';
String mouseCursorKey = 'mouseCursor';
String onLongPressKey = 'onLongPress';
String onPressedKey = 'onPressed';
String paddingKey = 'padding';
String splashColorKey = 'splashColor';
String textColorKey = 'textColor';
String textThemeKey = 'textTheme';
String autofocusKey = 'autofocus';
String iconKey = 'icon';
String labelKey = 'label';
@override
Map<String, String> get properties => {
'clipBehavior': 'Clip',
'color': 'Color',
'colorBrightness': 'Brightness',
'disabledColor': 'Color',
'disabledTextColor': 'Color',
'focusColor': 'Color',
'highlightColor': 'Color',
'hoverColor': 'Color',
'key': 'Key',
'mouseCursor': 'MouseCursor',
'onLongPress': 'Function',
'onPressed': 'Function',
'padding': 'EdgeInsets',
'splashColor': 'Color',
'textColor': 'Color',
'textTheme': 'ButtonTextTheme',
'autofocus': 'bool',
'icon': 'Widget',
'label': 'Widget',
};
List<Clip> get clipBehaviorValues => [
Clip.none,
Clip.antiAlias,
Clip.antiAliasWithSaveLayer,
Clip.hardEdge,
];
Clip get clipBehaviorVal {
if (params[clipBehaviorKey] != null) {
final _value = params[clipBehaviorKey].toString().replaceAll('#', '');
return clipBehaviorValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => Clip.none,
);
}
return Clip.none;
}
set clipBehaviorVal(Clip val) {
params[clipBehaviorKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
Color get colorVal {
if (params[colorKey] != null) {
int _value = null;
String description = params[colorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[colorKey] is Map) {
if (params[colorKey]['name'] == 'Color' &&
params[colorKey]['params'] != null &&
params[colorKey]['params']['0'] != null) {
_value = int.tryParse(params[colorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set colorVal(Color val) {
params[colorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
List<Brightness> get colorBrightnessValues => [
Brightness.light,
Brightness.dark,
];
Brightness get colorBrightnessVal {
if (params[colorBrightnessKey] != null) {
final _value = params[colorBrightnessKey].toString().replaceAll('#', '');
return colorBrightnessValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set colorBrightnessVal(Brightness val) {
params[colorBrightnessKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
Color get disabledColorVal {
if (params[disabledColorKey] != null) {
int _value = null;
String description = params[disabledColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[disabledColorKey] is Map) {
if (params[disabledColorKey]['name'] == 'Color' &&
params[disabledColorKey]['params'] != null &&
params[disabledColorKey]['params']['0'] != null) {
_value = int.tryParse(params[disabledColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set disabledColorVal(Color val) {
params[disabledColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Color get disabledTextColorVal {
if (params[disabledTextColorKey] != null) {
int _value = null;
String description = params[disabledTextColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[disabledTextColorKey] is Map) {
if (params[disabledTextColorKey]['name'] == 'Color' &&
params[disabledTextColorKey]['params'] != null &&
params[disabledTextColorKey]['params']['0'] != null) {
_value = int.tryParse(params[disabledTextColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set disabledTextColorVal(Color val) {
params[disabledTextColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Color get focusColorVal {
if (params[focusColorKey] != null) {
int _value = null;
String description = params[focusColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[focusColorKey] is Map) {
if (params[focusColorKey]['name'] == 'Color' &&
params[focusColorKey]['params'] != null &&
params[focusColorKey]['params']['0'] != null) {
_value = int.tryParse(params[focusColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set focusColorVal(Color val) {
params[focusColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Color get highlightColorVal {
if (params[highlightColorKey] != null) {
int _value = null;
String description = params[highlightColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[highlightColorKey] is Map) {
if (params[highlightColorKey]['name'] == 'Color' &&
params[highlightColorKey]['params'] != null &&
params[highlightColorKey]['params']['0'] != null) {
_value = int.tryParse(params[highlightColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set highlightColorVal(Color val) {
params[highlightColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Color get hoverColorVal {
if (params[hoverColorKey] != null) {
int _value = null;
String description = params[hoverColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[hoverColorKey] is Map) {
if (params[hoverColorKey]['name'] == 'Color' &&
params[hoverColorKey]['params'] != null &&
params[hoverColorKey]['params']['0'] != null) {
_value = int.tryParse(params[hoverColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set hoverColorVal(Color val) {
params[hoverColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
List<MouseCursor> get mouseCursorValues => [
SystemMouseCursors.click,
SystemMouseCursors.basic,
SystemMouseCursors.forbidden,
SystemMouseCursors.grab,
SystemMouseCursors.grabbing,
SystemMouseCursors.text,
SystemMouseCursors.none,
];
MouseCursor get mouseCursorVal {
if (params[mouseCursorKey] != null) {
final _value = params[mouseCursorKey].toString().replaceAll('#', '');
return mouseCursorValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => SystemMouseCursors.click,
);
}
return SystemMouseCursors.click;
}
set mouseCursorVal(MouseCursor val) {
params[mouseCursorKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
String get onLongPressVal {
if (params[onLongPressKey] != null) {
return params[onLongPressKey] as String;
}
return null;
}
set onLongPressVal(String val) {
params[onLongPressKey] = val;
widgetContext.onUpdate(id, widgetData);
}
String get onPressedVal {
if (params[onPressedKey] != null) {
return params[onPressedKey] as String;
}
return null;
}
set onPressedVal(String val) {
params[onPressedKey] = val;
widgetContext.onUpdate(id, widgetData);
}
EdgeInsets get paddingVal {
EdgeInsets _spacing = EdgeInsets.all(0.0);
if (params[paddingKey] != null) {
double top = 0;
double bottom = 0;
double left = 0;
double right = 0;
Map<String, dynamic> _spacingParams = params[paddingKey]['params'];
top = _spacingParams['top'] ?? 0;
bottom = _spacingParams['bottom'] ?? 0;
left = _spacingParams['left'] ?? 0;
right = _spacingParams['right'] ?? 0;
_spacing = EdgeInsets.fromLTRB(left, top, right, bottom);
}
return _spacing;
}
set paddingVal(EdgeInsets val) {
params[paddingKey] = {
"name": "EdgeInsets.only",
"id": "paddingKeyEdgeInsets",
"params": {
"top": val.top,
"bottom": val.bottom,
"left": val.left,
"right": val.right,
}
};
widgetContext.onUpdate(id, widgetData);
}
Color get splashColorVal {
if (params[splashColorKey] != null) {
int _value = null;
String description = params[splashColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[splashColorKey] is Map) {
if (params[splashColorKey]['name'] == 'Color' &&
params[splashColorKey]['params'] != null &&
params[splashColorKey]['params']['0'] != null) {
_value = int.tryParse(params[splashColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set splashColorVal(Color val) {
params[splashColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Color get textColorVal {
if (params[textColorKey] != null) {
int _value = null;
String description = params[textColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[textColorKey] is Map) {
if (params[textColorKey]['name'] == 'Color' &&
params[textColorKey]['params'] != null &&
params[textColorKey]['params']['0'] != null) {
_value = int.tryParse(params[textColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set textColorVal(Color val) {
params[textColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
List<ButtonTextTheme> get textThemeValues => [
ButtonTextTheme.normal,
ButtonTextTheme.accent,
ButtonTextTheme.primary,
];
ButtonTextTheme get textThemeVal {
if (params[textThemeKey] != null) {
final _value = params[textThemeKey].toString().replaceAll('#', '');
return textThemeValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set textThemeVal(ButtonTextTheme val) {
params[textThemeKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
bool get autofocusVal {
if (params[autofocusKey] != null) {
return params[autofocusKey] as bool;
}
return false;
}
set autofocusVal(bool val) {
params[autofocusKey] = val;
widgetContext.onUpdate(id, widgetData);
}
final _iconListen = ValueNotifier<bool>(false);
WidgetBase get iconVal {
if (params[iconKey] != null) {
return widgetRender(widgetContext, params[iconKey]);
}
return null;
}
void iconValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'gooWUMSie4s';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'eL56wz9FyU4';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'XCJsagNdJ3G';
}
params[iconKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
final _labelListen = ValueNotifier<bool>(false);
WidgetBase get labelVal {
if (params[labelKey] != null) {
return widgetRender(widgetContext, params[labelKey]);
}
return null;
}
void labelValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'qbw8IAf2R4z';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = '2MhaKgFDfrI';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'mnlHpNd3PXH';
}
params[labelKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: FlatButton.icon(
autofocus: autofocusVal,
clipBehavior: clipBehaviorVal,
color: colorVal,
colorBrightness: colorBrightnessVal,
disabledColor: disabledColorVal,
disabledTextColor: disabledTextColorVal,
focusColor: focusColorVal,
highlightColor: highlightColorVal,
hoverColor: hoverColorVal,
icon: !widgetContext.isDragging ||
(widgetContext.isDragging && iconVal?.build(context) != null)
? (iconVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': 'f7QTJZr16DZ',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(50.0, 35.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_iconListen.value = false;
if (val != null) {
iconValUpdate(val?.data);
}
},
onLeave: (val) {
_iconListen.value = false;
},
onWillAccept: (val) {
_iconListen.value = true;
return _iconListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _iconListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(50.0, 35.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
key: keyVal,
label: !widgetContext.isDragging ||
(widgetContext.isDragging && labelVal?.build(context) != null)
? (labelVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': 'cRHqnvsD-G1',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(35.0, 35.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_labelListen.value = false;
if (val != null) {
labelValUpdate(val?.data);
}
},
onLeave: (val) {
_labelListen.value = false;
},
onWillAccept: (val) {
_labelListen.value = true;
return _labelListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _labelListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(35.0, 35.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
mouseCursor: mouseCursorVal,
onLongPress: () => onAction(context, onLongPressVal),
onPressed: () => onAction(context, onPressedVal),
padding: paddingVal,
splashColor: splashColorVal,
textColor: textColorVal,
textTheme: textThemeVal,
),
);
}
}
@@ -0,0 +1,49 @@
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../enums.dart';
import '../library.dart';
part 'flex.g.dart';
@WidgetClass('Flex')
class FlexBase extends _$FlexBase {
FlexBase(this.widgetData, this.widgetContext, this.widgetRender);
List<Widget> children;
Key key;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@enumMainAxisSize
MainAxisSize mainAxisSize;
@enumAxis
Axis direction;
@enumTextBaseline
TextBaseline textBaseline;
@enumTextDirection
TextDirection textDirection;
@enumMainAxisAlignment
MainAxisAlignment mainAxisAlignment;
@enumCrossAxisAlignment
CrossAxisAlignment crossAxisAlignment;
@enumVerticalDirection
VerticalDirection verticalDirection;
}
@@ -0,0 +1,292 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'flex.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$FlexBase extends WidgetBase {
String childrenKey = 'children';
String keyKey = 'key';
String mainAxisSizeKey = 'mainAxisSize';
String directionKey = 'direction';
String textBaselineKey = 'textBaseline';
String textDirectionKey = 'textDirection';
String mainAxisAlignmentKey = 'mainAxisAlignment';
String crossAxisAlignmentKey = 'crossAxisAlignment';
String verticalDirectionKey = 'verticalDirection';
@override
Map<String, String> get properties => {
'children': 'List<Widget>',
'key': 'Key',
'mainAxisSize': 'MainAxisSize',
'direction': 'Axis',
'textBaseline': 'TextBaseline',
'textDirection': 'TextDirection',
'mainAxisAlignment': 'MainAxisAlignment',
'crossAxisAlignment': 'CrossAxisAlignment',
'verticalDirection': 'VerticalDirection',
};
final _childrenListen = ValueNotifier<bool>(false);
List<WidgetBase> get childrenVal {
if (params[childrenKey] != null) {
final _children = <WidgetBase>[];
final _list = List.from(params[childrenKey]);
for (final item in _list) {
if (item is Map<String, dynamic>) {
_children.add(widgetRender(widgetContext, item));
}
}
return _children;
}
return null;
}
void childrenValUpdate(Map<String, dynamic> val) {
if (params[childrenKey] == null) {
params[childrenKey] = [];
}
params[childrenKey].add(val);
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
List<MainAxisSize> get mainAxisSizeValues => [
MainAxisSize.max,
MainAxisSize.min,
];
MainAxisSize get mainAxisSizeVal {
if (params[mainAxisSizeKey] != null) {
final _value = params[mainAxisSizeKey].toString().replaceAll('#', '');
return mainAxisSizeValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => MainAxisSize.max,
);
}
return MainAxisSize.max;
}
set mainAxisSizeVal(MainAxisSize val) {
params[mainAxisSizeKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<Axis> get directionValues => [
Axis.horizontal,
Axis.vertical,
];
Axis get directionVal {
if (params[directionKey] != null) {
final _value = params[directionKey].toString().replaceAll('#', '');
return directionValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => Axis.vertical,
);
}
return Axis.vertical;
}
set directionVal(Axis val) {
params[directionKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<TextBaseline> get textBaselineValues => [
TextBaseline.alphabetic,
TextBaseline.ideographic,
];
TextBaseline get textBaselineVal {
if (params[textBaselineKey] != null) {
final _value = params[textBaselineKey].toString().replaceAll('#', '');
return textBaselineValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set textBaselineVal(TextBaseline val) {
params[textBaselineKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<TextDirection> get textDirectionValues => [
TextDirection.ltr,
TextDirection.rtl,
];
TextDirection get textDirectionVal {
if (params[textDirectionKey] != null) {
final _value = params[textDirectionKey].toString().replaceAll('#', '');
return textDirectionValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set textDirectionVal(TextDirection val) {
params[textDirectionKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<MainAxisAlignment> get mainAxisAlignmentValues => [
MainAxisAlignment.center,
MainAxisAlignment.end,
MainAxisAlignment.spaceAround,
MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceEvenly,
MainAxisAlignment.start,
];
MainAxisAlignment get mainAxisAlignmentVal {
if (params[mainAxisAlignmentKey] != null) {
final _value =
params[mainAxisAlignmentKey].toString().replaceAll('#', '');
return mainAxisAlignmentValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => MainAxisAlignment.start,
);
}
return MainAxisAlignment.start;
}
set mainAxisAlignmentVal(MainAxisAlignment val) {
params[mainAxisAlignmentKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<CrossAxisAlignment> get crossAxisAlignmentValues => [
CrossAxisAlignment.baseline,
CrossAxisAlignment.center,
CrossAxisAlignment.end,
CrossAxisAlignment.start,
CrossAxisAlignment.stretch,
];
CrossAxisAlignment get crossAxisAlignmentVal {
if (params[crossAxisAlignmentKey] != null) {
final _value =
params[crossAxisAlignmentKey].toString().replaceAll('#', '');
return crossAxisAlignmentValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => CrossAxisAlignment.center,
);
}
return CrossAxisAlignment.center;
}
set crossAxisAlignmentVal(CrossAxisAlignment val) {
params[crossAxisAlignmentKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<VerticalDirection> get verticalDirectionValues => [
VerticalDirection.up,
VerticalDirection.down,
];
VerticalDirection get verticalDirectionVal {
if (params[verticalDirectionKey] != null) {
final _value =
params[verticalDirectionKey].toString().replaceAll('#', '');
return verticalDirectionValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => VerticalDirection.down,
);
}
return VerticalDirection.down;
}
set verticalDirectionVal(VerticalDirection val) {
params[verticalDirectionKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: Flex(
children: childrenVal == null && !widgetContext.isDragging
? []
: [
if (childrenVal != null)
for (final item in childrenVal) item.build(context),
if (widgetContext.isDragging)
DragTarget<WidgetBaseData>(
onAccept: (val) {
_childrenListen.value = false;
if (val != null) {
childrenValUpdate(val?.data);
}
},
onLeave: (val) {
_childrenListen.value = false;
},
onWillAccept: (val) {
_childrenListen.value = true;
return _childrenListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childrenListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(30, 30),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
],
crossAxisAlignment: crossAxisAlignmentVal,
direction: directionVal,
key: keyVal,
mainAxisAlignment: mainAxisAlignmentVal,
mainAxisSize: mainAxisSizeVal,
textBaseline: textBaselineVal,
textDirection: textDirectionVal,
verticalDirection: verticalDirectionVal,
),
);
}
}
@@ -0,0 +1,35 @@
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../enums.dart';
import '../library.dart';
part 'flexible.g.dart';
@WidgetClass('Flexible', allowTap: false)
class FlexibleBase extends _$FlexibleBase {
FlexibleBase(this.widgetData, this.widgetContext, this.widgetRender);
@WidgetKey(
defaultValue: 'Placeholder',
)
Widget child;
int flex;
Key key;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@enumFlexFit
FlexFit fit;
}
@@ -0,0 +1,113 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'flexible.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$FlexibleBase extends WidgetBase {
String childKey = 'child';
String flexKey = 'flex';
String keyKey = 'key';
String fitKey = 'fit';
@override
Map<String, String> get properties => {
'child': 'Widget',
'flex': 'int',
'key': 'Key',
'fit': 'FlexFit',
};
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'FEoeNSNIm8N';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = '96slpzT9tHi';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'rS47ucn248m';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
int get flexVal {
if (params[flexKey] != null) {
return params[flexKey] as int;
}
return null;
}
set flexVal(int val) {
params[flexKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
List<FlexFit> get fitValues => [
FlexFit.loose,
FlexFit.tight,
];
FlexFit get fitVal {
if (params[fitKey] != null) {
final _value = params[fitKey].toString().replaceAll('#', '');
return fitValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => FlexFit.loose,
);
}
return FlexFit.loose;
}
set fitVal(FlexFit val) {
params[fitKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return Flexible(
child: childVal?.build(context),
fit: fitVal,
flex: flexVal,
key: keyVal,
);
}
}
@@ -0,0 +1,65 @@
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../enums.dart';
import '../library.dart';
part 'floating_action_button.g.dart';
@WidgetClass('FloatingActionButton')
class FloatingActionButtonBase extends _$FloatingActionButtonBase {
FloatingActionButtonBase(
this.widgetData, this.widgetContext, this.widgetRender);
Color backgroundColor;
double disabledElevation;
Color focusColor;
double focusElevation;
FocusNode focusNode;
Color foregroundColor;
Color hoverColor;
double hoverElevation;
Key key;
Function onPressed;
ShapeBorder shape;
Color splashColor;
String tooltip;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@WidgetKey.widget()
Widget child;
@PropertyKey(defaultValue: 'UniqueKey()')
Object heroTag;
@PropertyKey(defaultValue: 'false')
bool autofocus;
@PropertyKey(defaultValue: 'false')
bool mini;
@PropertyKey(defaultValue: 'false')
bool isExtended;
@enumMaterialTapTargetSize
MaterialTapTargetSize materialTapTargetSize;
@enumClip
Clip clipBehavior;
@enumMouseCursor
MouseCursor mouseCursor;
}
@@ -0,0 +1,471 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'floating_action_button.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$FloatingActionButtonBase extends WidgetBase {
String backgroundColorKey = 'backgroundColor';
String disabledElevationKey = 'disabledElevation';
String focusColorKey = 'focusColor';
String focusElevationKey = 'focusElevation';
String foregroundColorKey = 'foregroundColor';
String hoverColorKey = 'hoverColor';
String hoverElevationKey = 'hoverElevation';
String keyKey = 'key';
String onPressedKey = 'onPressed';
String splashColorKey = 'splashColor';
String tooltipKey = 'tooltip';
String childKey = 'child';
String heroTagKey = 'heroTag';
String autofocusKey = 'autofocus';
String miniKey = 'mini';
String isExtendedKey = 'isExtended';
String materialTapTargetSizeKey = 'materialTapTargetSize';
String clipBehaviorKey = 'clipBehavior';
String mouseCursorKey = 'mouseCursor';
@override
Map<String, String> get properties => {
'backgroundColor': 'Color',
'disabledElevation': 'double',
'focusColor': 'Color',
'focusElevation': 'double',
'foregroundColor': 'Color',
'hoverColor': 'Color',
'hoverElevation': 'double',
'key': 'Key',
'onPressed': 'Function',
'splashColor': 'Color',
'tooltip': 'String',
'child': 'Widget',
'heroTag': 'Object',
'autofocus': 'bool',
'mini': 'bool',
'isExtended': 'bool',
'materialTapTargetSize': 'MaterialTapTargetSize',
'clipBehavior': 'Clip',
'mouseCursor': 'MouseCursor',
};
Color get backgroundColorVal {
if (params[backgroundColorKey] != null) {
int _value = null;
String description = params[backgroundColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[backgroundColorKey] is Map) {
if (params[backgroundColorKey]['name'] == 'Color' &&
params[backgroundColorKey]['params'] != null &&
params[backgroundColorKey]['params']['0'] != null) {
_value = int.tryParse(params[backgroundColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set backgroundColorVal(Color val) {
params[backgroundColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
double get disabledElevationVal {
if (params[disabledElevationKey] != null) {
return params[disabledElevationKey] as double;
}
return null;
}
set disabledElevationVal(double val) {
params[disabledElevationKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Color get focusColorVal {
if (params[focusColorKey] != null) {
int _value = null;
String description = params[focusColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[focusColorKey] is Map) {
if (params[focusColorKey]['name'] == 'Color' &&
params[focusColorKey]['params'] != null &&
params[focusColorKey]['params']['0'] != null) {
_value = int.tryParse(params[focusColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set focusColorVal(Color val) {
params[focusColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
double get focusElevationVal {
if (params[focusElevationKey] != null) {
return params[focusElevationKey] as double;
}
return null;
}
set focusElevationVal(double val) {
params[focusElevationKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Color get foregroundColorVal {
if (params[foregroundColorKey] != null) {
int _value = null;
String description = params[foregroundColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[foregroundColorKey] is Map) {
if (params[foregroundColorKey]['name'] == 'Color' &&
params[foregroundColorKey]['params'] != null &&
params[foregroundColorKey]['params']['0'] != null) {
_value = int.tryParse(params[foregroundColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set foregroundColorVal(Color val) {
params[foregroundColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Color get hoverColorVal {
if (params[hoverColorKey] != null) {
int _value = null;
String description = params[hoverColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[hoverColorKey] is Map) {
if (params[hoverColorKey]['name'] == 'Color' &&
params[hoverColorKey]['params'] != null &&
params[hoverColorKey]['params']['0'] != null) {
_value = int.tryParse(params[hoverColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set hoverColorVal(Color val) {
params[hoverColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
double get hoverElevationVal {
if (params[hoverElevationKey] != null) {
return params[hoverElevationKey] as double;
}
return null;
}
set hoverElevationVal(double val) {
params[hoverElevationKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
String get onPressedVal {
if (params[onPressedKey] != null) {
return params[onPressedKey] as String;
}
return null;
}
set onPressedVal(String val) {
params[onPressedKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Color get splashColorVal {
if (params[splashColorKey] != null) {
int _value = null;
String description = params[splashColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[splashColorKey] is Map) {
if (params[splashColorKey]['name'] == 'Color' &&
params[splashColorKey]['params'] != null &&
params[splashColorKey]['params']['0'] != null) {
_value = int.tryParse(params[splashColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set splashColorVal(Color val) {
params[splashColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
String get tooltipVal {
if (params[tooltipKey] != null) {
return params[tooltipKey] as String;
}
return null;
}
set tooltipVal(String val) {
params[tooltipKey] = val;
widgetContext.onUpdate(id, widgetData);
}
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'kJ2w_O1MFU';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'YfVd7j3uGi';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'MsEsXrT6n1';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
Object get heroTagVal {
if (params[heroTagKey] != null) {
return params[heroTagKey] as Object;
}
return UniqueKey();
}
set heroTagVal(Object val) {
params[heroTagKey] = val;
widgetContext.onUpdate(id, widgetData);
}
bool get autofocusVal {
if (params[autofocusKey] != null) {
return params[autofocusKey] as bool;
}
return false;
}
set autofocusVal(bool val) {
params[autofocusKey] = val;
widgetContext.onUpdate(id, widgetData);
}
bool get miniVal {
if (params[miniKey] != null) {
return params[miniKey] as bool;
}
return false;
}
set miniVal(bool val) {
params[miniKey] = val;
widgetContext.onUpdate(id, widgetData);
}
bool get isExtendedVal {
if (params[isExtendedKey] != null) {
return params[isExtendedKey] as bool;
}
return false;
}
set isExtendedVal(bool val) {
params[isExtendedKey] = val;
widgetContext.onUpdate(id, widgetData);
}
List<MaterialTapTargetSize> get materialTapTargetSizeValues => [
MaterialTapTargetSize.shrinkWrap,
MaterialTapTargetSize.padded,
];
MaterialTapTargetSize get materialTapTargetSizeVal {
if (params[materialTapTargetSizeKey] != null) {
final _value =
params[materialTapTargetSizeKey].toString().replaceAll('#', '');
return materialTapTargetSizeValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set materialTapTargetSizeVal(MaterialTapTargetSize val) {
params[materialTapTargetSizeKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<Clip> get clipBehaviorValues => [
Clip.none,
Clip.antiAlias,
Clip.antiAliasWithSaveLayer,
Clip.hardEdge,
];
Clip get clipBehaviorVal {
if (params[clipBehaviorKey] != null) {
final _value = params[clipBehaviorKey].toString().replaceAll('#', '');
return clipBehaviorValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => Clip.none,
);
}
return Clip.none;
}
set clipBehaviorVal(Clip val) {
params[clipBehaviorKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<MouseCursor> get mouseCursorValues => [
SystemMouseCursors.click,
SystemMouseCursors.basic,
SystemMouseCursors.forbidden,
SystemMouseCursors.grab,
SystemMouseCursors.grabbing,
SystemMouseCursors.text,
SystemMouseCursors.none,
];
MouseCursor get mouseCursorVal {
if (params[mouseCursorKey] != null) {
final _value = params[mouseCursorKey].toString().replaceAll('#', '');
return mouseCursorValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => SystemMouseCursors.click,
);
}
return SystemMouseCursors.click;
}
set mouseCursorVal(MouseCursor val) {
params[mouseCursorKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: FloatingActionButton(
autofocus: autofocusVal,
backgroundColor: backgroundColorVal,
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context))
: PreferredSize(
preferredSize: Size(30.0, 30.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(30.0, 30.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
clipBehavior: clipBehaviorVal,
disabledElevation: disabledElevationVal,
focusColor: focusColorVal,
focusElevation: focusElevationVal,
foregroundColor: foregroundColorVal,
heroTag: heroTagVal,
hoverColor: hoverColorVal,
hoverElevation: hoverElevationVal,
isExtended: isExtendedVal,
key: keyVal,
materialTapTargetSize: materialTapTargetSizeVal,
mini: miniVal,
mouseCursor: mouseCursorVal,
onPressed: () => onAction(context, onPressedVal),
splashColor: splashColorVal,
tooltip: tooltipVal,
),
);
}
}
@@ -0,0 +1,48 @@
import 'package:flutter/material.dart';
import 'package:flutter_dynamic_widget/src/material/enums.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../library.dart';
part 'flutter_logo.g.dart';
@WidgetClass('FlutterLogo')
class FlutterLogoBase extends _$FlutterLogoBase {
FlutterLogoBase(this.widgetData, this.widgetContext, this.widgetRender);
@enumFlutterLogoStyle
FlutterLogoStyle style = FlutterLogoStyle.markOnly;
// @EnumKey(
// defaultValue: 'Curves.fastOutSlowIn',
// values: [
// 'Curves.fastOutSlowIn',
// ],
// )
// Curve curve = Curves.fastOutSlowIn;
MaterialColor colors;
// Duration duration = const Duration(milliseconds: 750);
Key key;
double size;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@ColorKey(defaultValue: 0xFF616161)
Color textColor;
}
@@ -0,0 +1,123 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'flutter_logo.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$FlutterLogoBase extends WidgetBase {
String styleKey = 'style';
String keyKey = 'key';
String sizeKey = 'size';
String textColorKey = 'textColor';
@override
Map<String, String> get properties => {
'style': 'FlutterLogoStyle',
'key': 'Key',
'size': 'double',
'textColor': 'Color',
};
List<FlutterLogoStyle> get styleValues => [
FlutterLogoStyle.horizontal,
FlutterLogoStyle.markOnly,
FlutterLogoStyle.stacked,
];
FlutterLogoStyle get styleVal {
if (params[styleKey] != null) {
final _value = params[styleKey].toString().replaceAll('#', '');
return styleValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => FlutterLogoStyle.markOnly,
);
}
return FlutterLogoStyle.markOnly;
}
set styleVal(FlutterLogoStyle val) {
params[styleKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
double get sizeVal {
if (params[sizeKey] != null) {
return params[sizeKey] as double;
}
return null;
}
set sizeVal(double val) {
params[sizeKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Color get textColorVal {
if (params[textColorKey] != null) {
int _value = 4284572001;
String description = params[textColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[textColorKey] is Map) {
if (params[textColorKey]['name'] == 'Color' &&
params[textColorKey]['params'] != null &&
params[textColorKey]['params']['0'] != null) {
_value = int.tryParse(params[textColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return Color(4284572001);
}
set textColorVal(Color val) {
params[textColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: FlutterLogo(
key: keyVal,
size: sizeVal,
style: styleVal,
textColor: textColorVal,
),
);
}
}
@@ -0,0 +1,42 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../library.dart';
part 'form.g.dart';
@WidgetClass('Form')
class FormBase extends _$FormBase {
FormBase(this.widgetData, this.widgetContext, this.widgetRender);
Key key;
Function onChanged;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
defaultValue: 'Placeholder',
)
Widget child;
@PropertyKey(defaultValue: 'false')
bool autovalidate;
Future<bool> Function() onWillPop;
}
@@ -0,0 +1,148 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'form.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$FormBase extends WidgetBase {
String keyKey = 'key';
String onChangedKey = 'onChanged';
String childKey = 'child';
String autovalidateKey = 'autovalidate';
@override
Map<String, String> get properties => {
'key': 'Key',
'onChanged': 'Function',
'child': 'Widget',
'autovalidate': 'bool',
};
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
String get onChangedVal {
if (params[onChangedKey] != null) {
return params[onChangedKey] as String;
}
return null;
}
set onChangedVal(String val) {
params[onChangedKey] = val;
widgetContext.onUpdate(id, widgetData);
}
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'Xl9Lr-Nyk';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'o7ALfHFtsu';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = '4KznWSs-Ni';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
bool get autovalidateVal {
if (params[autovalidateKey] != null) {
return params[autovalidateKey] as bool;
}
return false;
}
set autovalidateVal(bool val) {
params[autovalidateKey] = val;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: Form(
autovalidate: autovalidateVal,
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': 'Rnl3iCAkZU',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
key: keyVal,
onChanged: () => onAction(context, onChangedVal),
),
);
}
}
@@ -0,0 +1,38 @@
import 'package:flutter/material.dart';
import 'package:flutter_dynamic_widget/src/material/enums.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../library.dart';
part 'fractionally_sized_box.g.dart';
@WidgetClass('FractionallySizedBox')
class FractionallySizedBoxBase extends _$FractionallySizedBoxBase {
FractionallySizedBoxBase(this.widgetData, this.widgetContext, this.widgetRender);
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
)
Widget child;
double widthFactor;
Key key;
double heightFactor;
@enumAlignment
Alignment alignment;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@override
final GenerateWidget widgetRender;
}
@@ -0,0 +1,172 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'fractionally_sized_box.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$FractionallySizedBoxBase extends WidgetBase {
String childKey = 'child';
String widthFactorKey = 'widthFactor';
String keyKey = 'key';
String heightFactorKey = 'heightFactor';
String alignmentKey = 'alignment';
@override
Map<String, String> get properties => {
'child': 'Widget',
'widthFactor': 'double',
'key': 'Key',
'heightFactor': 'double',
'alignment': 'Alignment',
};
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'G_D8L2MAgn-';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'Mi44I6m4pXe';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'wdk4tE7_CL7';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
double get widthFactorVal {
if (params[widthFactorKey] != null) {
return params[widthFactorKey] as double;
}
return null;
}
set widthFactorVal(double val) {
params[widthFactorKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
double get heightFactorVal {
if (params[heightFactorKey] != null) {
return params[heightFactorKey] as double;
}
return null;
}
set heightFactorVal(double val) {
params[heightFactorKey] = val;
widgetContext.onUpdate(id, widgetData);
}
List<Alignment> get alignmentValues => [
Alignment.bottomCenter,
Alignment.bottomLeft,
Alignment.bottomRight,
Alignment.center,
Alignment.centerLeft,
Alignment.centerRight,
Alignment.topCenter,
Alignment.topLeft,
Alignment.topRight,
];
Alignment get alignmentVal {
if (params[alignmentKey] != null) {
final _value = params[alignmentKey].toString().replaceAll('#', '');
return alignmentValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => Alignment.center,
);
}
return Alignment.center;
}
set alignmentVal(Alignment val) {
params[alignmentKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: FractionallySizedBox(
alignment: alignmentVal,
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
heightFactor: heightFactorVal,
key: keyVal,
widthFactor: widthFactorVal,
),
);
}
}
@@ -0,0 +1,37 @@
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../enums.dart';
import '../library.dart';
import '../properties/icon_data.dart';
part 'icon.g.dart';
@WidgetClass('Icon')
class IconBase extends _$IconBase {
IconBase(this.widgetData, this.widgetContext, this.widgetRender);
Color color;
String semanticLabel;
double size;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@SupportedKey(key: '0')
IconDataBase iconData;
@enumTextDirection
TextDirection textDirection;
}
@@ -0,0 +1,123 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'icon.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$IconBase extends WidgetBase {
String colorKey = 'color';
String semanticLabelKey = 'semanticLabel';
String sizeKey = 'size';
String iconDataKey = '0';
String textDirectionKey = 'textDirection';
@override
Map<String, String> get properties => {
'color': 'Color',
'semanticLabel': 'String',
'size': 'double',
'0': 'IconDataBase',
'textDirection': 'TextDirection',
};
Color get colorVal {
if (params[colorKey] != null) {
int _value = null;
String description = params[colorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[colorKey] is Map) {
if (params[colorKey]['name'] == 'Color' &&
params[colorKey]['params'] != null &&
params[colorKey]['params']['0'] != null) {
_value = int.tryParse(params[colorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set colorVal(Color val) {
params[colorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
String get semanticLabelVal {
if (params[semanticLabelKey] != null) {
return params[semanticLabelKey] as String;
}
return null;
}
set semanticLabelVal(String val) {
params[semanticLabelKey] = val;
widgetContext.onUpdate(id, widgetData);
}
double get sizeVal {
if (params[sizeKey] != null) {
return params[sizeKey] as double;
}
return null;
}
set sizeVal(double val) {
params[sizeKey] = val;
widgetContext.onUpdate(id, widgetData);
}
IconDataBase get iconDataVal {
if (params[iconDataKey] != null) {
return IconDataBase(params[iconDataKey], widgetContext, widgetRender);
}
return null;
}
set iconDataVal(IconDataBase val) {
params[iconDataKey] = val;
widgetContext.onUpdate(id, widgetData);
}
List<TextDirection> get textDirectionValues => [
TextDirection.ltr,
TextDirection.rtl,
];
TextDirection get textDirectionVal {
if (params[textDirectionKey] != null) {
final _value = params[textDirectionKey].toString().replaceAll('#', '');
return textDirectionValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set textDirectionVal(TextDirection val) {
params[textDirectionKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: Icon(
iconDataVal?.build(context),
color: colorVal,
semanticLabel: semanticLabelVal,
size: sizeVal,
textDirection: textDirectionVal,
),
);
}
}
@@ -0,0 +1,75 @@
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_dynamic_widget/src/material/enums.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../library.dart';
import '../properties/box_constraints.dart';
part 'icon_button.g.dart';
@WidgetClass('IconButton')
class IconButtonBase extends _$IconButtonBase {
IconButtonBase(this.widgetData, this.widgetContext, this.widgetRender);
Color color;
BoxConstraintsBase constraints;
Color disabledColor;
Color focusColor;
FocusNode focusNode;
Color highlightColor;
Color hoverColor;
Key key;
Function onPressed;
Color splashColor;
double splashRadius;
String tooltip;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@enumMouseCursor
MouseCursor mouseCursor;
@EnumKey(
values: [
'VisualDensity.adaptivePlatformDensity',
'VisualDensity.comfortable',
'VisualDensity.compact',
'VisualDensity.standard',
],
)
VisualDensity visualDensity;
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
)
Widget icon;
@PropertyKey(defaultValue: '24.0')
double iconSize;
@EdgeInsetsKey(defaultValue: 8)
EdgeInsets padding;
@enumAlignment
Alignment alignment;
@PropertyKey(defaultValue: 'false')
bool autofocus;
@PropertyKey(defaultValue: 'true')
bool enableFeedback;
}
@@ -0,0 +1,495 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'icon_button.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$IconButtonBase extends WidgetBase {
String colorKey = 'color';
String disabledColorKey = 'disabledColor';
String focusColorKey = 'focusColor';
String highlightColorKey = 'highlightColor';
String hoverColorKey = 'hoverColor';
String keyKey = 'key';
String onPressedKey = 'onPressed';
String splashColorKey = 'splashColor';
String splashRadiusKey = 'splashRadius';
String tooltipKey = 'tooltip';
String mouseCursorKey = 'mouseCursor';
String visualDensityKey = 'visualDensity';
String iconKey = 'icon';
String iconSizeKey = 'iconSize';
String paddingKey = 'padding';
String alignmentKey = 'alignment';
String autofocusKey = 'autofocus';
String enableFeedbackKey = 'enableFeedback';
@override
Map<String, String> get properties => {
'color': 'Color',
'disabledColor': 'Color',
'focusColor': 'Color',
'highlightColor': 'Color',
'hoverColor': 'Color',
'key': 'Key',
'onPressed': 'Function',
'splashColor': 'Color',
'splashRadius': 'double',
'tooltip': 'String',
'mouseCursor': 'MouseCursor',
'visualDensity': 'VisualDensity',
'icon': 'Widget',
'iconSize': 'double',
'padding': 'EdgeInsets',
'alignment': 'Alignment',
'autofocus': 'bool',
'enableFeedback': 'bool',
};
Color get colorVal {
if (params[colorKey] != null) {
int _value = null;
String description = params[colorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[colorKey] is Map) {
if (params[colorKey]['name'] == 'Color' &&
params[colorKey]['params'] != null &&
params[colorKey]['params']['0'] != null) {
_value = int.tryParse(params[colorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set colorVal(Color val) {
params[colorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Color get disabledColorVal {
if (params[disabledColorKey] != null) {
int _value = null;
String description = params[disabledColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[disabledColorKey] is Map) {
if (params[disabledColorKey]['name'] == 'Color' &&
params[disabledColorKey]['params'] != null &&
params[disabledColorKey]['params']['0'] != null) {
_value = int.tryParse(params[disabledColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set disabledColorVal(Color val) {
params[disabledColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Color get focusColorVal {
if (params[focusColorKey] != null) {
int _value = null;
String description = params[focusColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[focusColorKey] is Map) {
if (params[focusColorKey]['name'] == 'Color' &&
params[focusColorKey]['params'] != null &&
params[focusColorKey]['params']['0'] != null) {
_value = int.tryParse(params[focusColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set focusColorVal(Color val) {
params[focusColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Color get highlightColorVal {
if (params[highlightColorKey] != null) {
int _value = null;
String description = params[highlightColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[highlightColorKey] is Map) {
if (params[highlightColorKey]['name'] == 'Color' &&
params[highlightColorKey]['params'] != null &&
params[highlightColorKey]['params']['0'] != null) {
_value = int.tryParse(params[highlightColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set highlightColorVal(Color val) {
params[highlightColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Color get hoverColorVal {
if (params[hoverColorKey] != null) {
int _value = null;
String description = params[hoverColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[hoverColorKey] is Map) {
if (params[hoverColorKey]['name'] == 'Color' &&
params[hoverColorKey]['params'] != null &&
params[hoverColorKey]['params']['0'] != null) {
_value = int.tryParse(params[hoverColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set hoverColorVal(Color val) {
params[hoverColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
String get onPressedVal {
if (params[onPressedKey] != null) {
return params[onPressedKey] as String;
}
return null;
}
set onPressedVal(String val) {
params[onPressedKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Color get splashColorVal {
if (params[splashColorKey] != null) {
int _value = null;
String description = params[splashColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[splashColorKey] is Map) {
if (params[splashColorKey]['name'] == 'Color' &&
params[splashColorKey]['params'] != null &&
params[splashColorKey]['params']['0'] != null) {
_value = int.tryParse(params[splashColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set splashColorVal(Color val) {
params[splashColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
double get splashRadiusVal {
if (params[splashRadiusKey] != null) {
return params[splashRadiusKey] as double;
}
return null;
}
set splashRadiusVal(double val) {
params[splashRadiusKey] = val;
widgetContext.onUpdate(id, widgetData);
}
String get tooltipVal {
if (params[tooltipKey] != null) {
return params[tooltipKey] as String;
}
return null;
}
set tooltipVal(String val) {
params[tooltipKey] = val;
widgetContext.onUpdate(id, widgetData);
}
List<MouseCursor> get mouseCursorValues => [
SystemMouseCursors.click,
SystemMouseCursors.basic,
SystemMouseCursors.forbidden,
SystemMouseCursors.grab,
SystemMouseCursors.grabbing,
SystemMouseCursors.text,
SystemMouseCursors.none,
];
MouseCursor get mouseCursorVal {
if (params[mouseCursorKey] != null) {
final _value = params[mouseCursorKey].toString().replaceAll('#', '');
return mouseCursorValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => SystemMouseCursors.click,
);
}
return SystemMouseCursors.click;
}
set mouseCursorVal(MouseCursor val) {
params[mouseCursorKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<VisualDensity> get visualDensityValues => [
VisualDensity.adaptivePlatformDensity,
VisualDensity.comfortable,
VisualDensity.compact,
VisualDensity.standard,
];
VisualDensity get visualDensityVal {
if (params[visualDensityKey] != null) {
final _value = params[visualDensityKey].toString().replaceAll('#', '');
return visualDensityValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set visualDensityVal(VisualDensity val) {
params[visualDensityKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
final _iconListen = ValueNotifier<bool>(false);
WidgetBase get iconVal {
if (params[iconKey] != null) {
return widgetRender(widgetContext, params[iconKey]);
}
return null;
}
void iconValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = '7rFqcTnDOYE';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'Ngf8TXCYHuG';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = '5hEqFN7lRFK';
}
params[iconKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
double get iconSizeVal {
if (params[iconSizeKey] != null) {
return params[iconSizeKey] as double;
}
return 24.0;
}
set iconSizeVal(double val) {
params[iconSizeKey] = val;
widgetContext.onUpdate(id, widgetData);
}
EdgeInsets get paddingVal {
EdgeInsets _spacing = EdgeInsets.all(0.0);
if (params[paddingKey] != null) {
double top = 0;
double bottom = 0;
double left = 0;
double right = 0;
Map<String, dynamic> _spacingParams = params[paddingKey]['params'];
top = _spacingParams['top'] ?? 0;
bottom = _spacingParams['bottom'] ?? 0;
left = _spacingParams['left'] ?? 0;
right = _spacingParams['right'] ?? 0;
_spacing = EdgeInsets.fromLTRB(left, top, right, bottom);
}
return _spacing;
}
set paddingVal(EdgeInsets val) {
params[paddingKey] = {
"name": "EdgeInsets.only",
"id": "paddingKeyEdgeInsets",
"params": {
"top": val.top,
"bottom": val.bottom,
"left": val.left,
"right": val.right,
}
};
widgetContext.onUpdate(id, widgetData);
}
List<Alignment> get alignmentValues => [
Alignment.bottomCenter,
Alignment.bottomLeft,
Alignment.bottomRight,
Alignment.center,
Alignment.centerLeft,
Alignment.centerRight,
Alignment.topCenter,
Alignment.topLeft,
Alignment.topRight,
];
Alignment get alignmentVal {
if (params[alignmentKey] != null) {
final _value = params[alignmentKey].toString().replaceAll('#', '');
return alignmentValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => Alignment.center,
);
}
return Alignment.center;
}
set alignmentVal(Alignment val) {
params[alignmentKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
bool get autofocusVal {
if (params[autofocusKey] != null) {
return params[autofocusKey] as bool;
}
return false;
}
set autofocusVal(bool val) {
params[autofocusKey] = val;
widgetContext.onUpdate(id, widgetData);
}
bool get enableFeedbackVal {
if (params[enableFeedbackKey] != null) {
return params[enableFeedbackKey] as bool;
}
return true;
}
set enableFeedbackVal(bool val) {
params[enableFeedbackKey] = val;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: IconButton(
alignment: alignmentVal,
autofocus: autofocusVal,
color: colorVal,
disabledColor: disabledColorVal,
enableFeedback: enableFeedbackVal,
focusColor: focusColorVal,
highlightColor: highlightColorVal,
hoverColor: hoverColorVal,
icon: !widgetContext.isDragging ||
(widgetContext.isDragging && iconVal?.build(context) != null)
? (iconVal?.build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_iconListen.value = false;
if (val != null) {
iconValUpdate(val?.data);
}
},
onLeave: (val) {
_iconListen.value = false;
},
onWillAccept: (val) {
_iconListen.value = true;
return _iconListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _iconListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
iconSize: iconSizeVal,
key: keyVal,
mouseCursor: mouseCursorVal,
onPressed: () => onAction(context, onPressedVal),
padding: paddingVal,
splashColor: splashColorVal,
splashRadius: splashRadiusVal,
tooltip: tooltipVal,
visualDensity: visualDensityVal,
),
);
}
}
@@ -0,0 +1,73 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_dynamic_widget/src/material/enums.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../library.dart';
part 'image_network.g.dart';
@WidgetClass('Image.network')
class ImageNetworkBase extends _$ImageNetworkBase {
ImageNetworkBase(this.widgetData, this.widgetContext, this.widgetRender);
int cacheHeight;
int cacheWidth;
Rect centerSlice;
Color color;
BlendMode colorBlendMode;
BoxFit fit;
Map<String, String> headers;
double height;
Key key;
String semanticLabel;
double width;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@PropertyKey(key: '0', defaultValue: 'https://placeholder.com/')
String src;
@PropertyKey(defaultValue: '1.0')
double scale;
Widget Function(BuildContext, Widget, int, bool) frameBuilder;
Widget Function(BuildContext, Widget, ImageChunkEvent) loadingBuilder;
Widget Function(BuildContext, Object, StackTrace) errorBuilder;
@PropertyKey(defaultValue: 'false')
bool excludeFromSemantics;
@enumAlignment
Alignment alignment;
@enumImageRepeat
ImageRepeat repeat;
@PropertyKey(defaultValue: 'false')
bool matchTextDirection;
@PropertyKey(defaultValue: 'false')
bool gaplessPlayback;
@enumFilterQuality
FilterQuality filterQuality;
@PropertyKey(defaultValue: 'false')
bool isAntiAlias;
}
@@ -0,0 +1,331 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'image_network.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$ImageNetworkBase extends WidgetBase {
String cacheHeightKey = 'cacheHeight';
String cacheWidthKey = 'cacheWidth';
String colorKey = 'color';
String heightKey = 'height';
String keyKey = 'key';
String semanticLabelKey = 'semanticLabel';
String widthKey = 'width';
String srcKey = '0';
String scaleKey = 'scale';
String excludeFromSemanticsKey = 'excludeFromSemantics';
String alignmentKey = 'alignment';
String repeatKey = 'repeat';
String matchTextDirectionKey = 'matchTextDirection';
String gaplessPlaybackKey = 'gaplessPlayback';
String filterQualityKey = 'filterQuality';
String isAntiAliasKey = 'isAntiAlias';
@override
Map<String, String> get properties => {
'cacheHeight': 'int',
'cacheWidth': 'int',
'color': 'Color',
'height': 'double',
'key': 'Key',
'semanticLabel': 'String',
'width': 'double',
'0': 'String',
'scale': 'double',
'excludeFromSemantics': 'bool',
'alignment': 'Alignment',
'repeat': 'ImageRepeat',
'matchTextDirection': 'bool',
'gaplessPlayback': 'bool',
'filterQuality': 'FilterQuality',
'isAntiAlias': 'bool',
};
int get cacheHeightVal {
if (params[cacheHeightKey] != null) {
return params[cacheHeightKey] as int;
}
return null;
}
set cacheHeightVal(int val) {
params[cacheHeightKey] = val;
widgetContext.onUpdate(id, widgetData);
}
int get cacheWidthVal {
if (params[cacheWidthKey] != null) {
return params[cacheWidthKey] as int;
}
return null;
}
set cacheWidthVal(int val) {
params[cacheWidthKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Color get colorVal {
if (params[colorKey] != null) {
int _value = null;
String description = params[colorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[colorKey] is Map) {
if (params[colorKey]['name'] == 'Color' &&
params[colorKey]['params'] != null &&
params[colorKey]['params']['0'] != null) {
_value = int.tryParse(params[colorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set colorVal(Color val) {
params[colorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
double get heightVal {
if (params[heightKey] != null) {
return params[heightKey] as double;
}
return null;
}
set heightVal(double val) {
params[heightKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
String get semanticLabelVal {
if (params[semanticLabelKey] != null) {
return params[semanticLabelKey] as String;
}
return null;
}
set semanticLabelVal(String val) {
params[semanticLabelKey] = val;
widgetContext.onUpdate(id, widgetData);
}
double get widthVal {
if (params[widthKey] != null) {
return params[widthKey] as double;
}
return null;
}
set widthVal(double val) {
params[widthKey] = val;
widgetContext.onUpdate(id, widgetData);
}
String get srcVal {
if (params[srcKey] != null) {
return params[srcKey] as String;
}
return 'https://placeholder.com/';
}
set srcVal(String val) {
params[srcKey] = val;
widgetContext.onUpdate(id, widgetData);
}
double get scaleVal {
if (params[scaleKey] != null) {
return params[scaleKey] as double;
}
return 1.0;
}
set scaleVal(double val) {
params[scaleKey] = val;
widgetContext.onUpdate(id, widgetData);
}
bool get excludeFromSemanticsVal {
if (params[excludeFromSemanticsKey] != null) {
return params[excludeFromSemanticsKey] as bool;
}
return false;
}
set excludeFromSemanticsVal(bool val) {
params[excludeFromSemanticsKey] = val;
widgetContext.onUpdate(id, widgetData);
}
List<Alignment> get alignmentValues => [
Alignment.bottomCenter,
Alignment.bottomLeft,
Alignment.bottomRight,
Alignment.center,
Alignment.centerLeft,
Alignment.centerRight,
Alignment.topCenter,
Alignment.topLeft,
Alignment.topRight,
];
Alignment get alignmentVal {
if (params[alignmentKey] != null) {
final _value = params[alignmentKey].toString().replaceAll('#', '');
return alignmentValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => Alignment.center,
);
}
return Alignment.center;
}
set alignmentVal(Alignment val) {
params[alignmentKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<ImageRepeat> get repeatValues => [
ImageRepeat.noRepeat,
ImageRepeat.repeat,
ImageRepeat.repeatX,
ImageRepeat.repeatY,
];
ImageRepeat get repeatVal {
if (params[repeatKey] != null) {
final _value = params[repeatKey].toString().replaceAll('#', '');
return repeatValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => ImageRepeat.noRepeat,
);
}
return ImageRepeat.noRepeat;
}
set repeatVal(ImageRepeat val) {
params[repeatKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
bool get matchTextDirectionVal {
if (params[matchTextDirectionKey] != null) {
return params[matchTextDirectionKey] as bool;
}
return false;
}
set matchTextDirectionVal(bool val) {
params[matchTextDirectionKey] = val;
widgetContext.onUpdate(id, widgetData);
}
bool get gaplessPlaybackVal {
if (params[gaplessPlaybackKey] != null) {
return params[gaplessPlaybackKey] as bool;
}
return false;
}
set gaplessPlaybackVal(bool val) {
params[gaplessPlaybackKey] = val;
widgetContext.onUpdate(id, widgetData);
}
List<FilterQuality> get filterQualityValues => [
FilterQuality.high,
FilterQuality.low,
FilterQuality.medium,
FilterQuality.none,
];
FilterQuality get filterQualityVal {
if (params[filterQualityKey] != null) {
final _value = params[filterQualityKey].toString().replaceAll('#', '');
return filterQualityValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => FilterQuality.low,
);
}
return FilterQuality.low;
}
set filterQualityVal(FilterQuality val) {
params[filterQualityKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
bool get isAntiAliasVal {
if (params[isAntiAliasKey] != null) {
return params[isAntiAliasKey] as bool;
}
return false;
}
set isAntiAliasVal(bool val) {
params[isAntiAliasKey] = val;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: Image.network(
srcVal,
alignment: alignmentVal,
cacheHeight: cacheHeightVal,
cacheWidth: cacheWidthVal,
color: colorVal,
excludeFromSemantics: excludeFromSemanticsVal,
filterQuality: filterQualityVal,
gaplessPlayback: gaplessPlaybackVal,
height: heightVal,
isAntiAlias: isAntiAliasVal,
key: keyVal,
matchTextDirection: matchTextDirectionVal,
repeat: repeatVal,
scale: scaleVal,
semanticLabel: semanticLabelVal,
width: widthVal,
),
);
}
}
@@ -0,0 +1,95 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../enums.dart';
import '../library.dart';
import '../theme/theme_data.dart';
part 'material_app.g.dart';
@WidgetClass('MaterialApp', allowTap: false)
class MaterialAppBase extends _$MaterialAppBase {
MaterialAppBase(this.widgetData, this.widgetContext, this.widgetRender);
@ListWidgetKey(acceptType: '')
List<NavigatorObserver> navigatorObservers = const <NavigatorObserver>[];
Map<Type, Action<Intent>> actions;
Color color;
Map<String, Widget Function(BuildContext)> routes =
const <String, WidgetBuilder>{};
String initialRoute;
Key key;
Locale locale;
Iterable<LocalizationsDelegate<dynamic>> localizationsDelegates;
GlobalKey<NavigatorState> navigatorKey;
Map<LogicalKeySet, Intent> shortcuts;
Iterable<Locale> supportedLocales = const <Locale>[Locale('en', 'US')];
@enumThemeMode
ThemeMode themeMode = ThemeMode.system;
String title = '';
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@PropertyKey(defaultValue: 'false')
bool checkerboardOffscreenLayers;
@PropertyKey(defaultValue: 'false')
bool checkerboardRasterCacheImages;
@SupportedKey()
ThemeDataBase darkTheme;
@PropertyKey(defaultValue: 'true')
bool debugShowCheckedModeBanner;
@PropertyKey(defaultValue: 'false')
bool debugShowMaterialGrid;
@PropertyKey(defaultValue: 'false')
bool showPerformanceOverlay;
@PropertyKey(defaultValue: 'false')
bool showSemanticsDebugger;
@SupportedKey()
ThemeDataBase theme;
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
defaultValue: 'Placeholder',
)
Widget home;
// Route<dynamic> Function(RouteSettings) onGenerateRoute;
// List<Route<dynamic>> Function(String) onGenerateInitialRoutes;
// Route<dynamic> Function(RouteSettings) onUnknownRoute;
// Widget Function(BuildContext, Widget) builder;
// String Function(BuildContext) onGenerateTitle;
// Locale Function(List<Locale>, Iterable<Locale>) localeListResolutionCallback;
// Locale Function(Locale, Iterable<Locale>) localeResolutionCallback;
}
@@ -0,0 +1,351 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'material_app.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$MaterialAppBase extends WidgetBase {
String navigatorObserversKey = 'navigatorObservers';
String colorKey = 'color';
String initialRouteKey = 'initialRoute';
String keyKey = 'key';
String themeModeKey = 'themeMode';
String titleKey = 'title';
String checkerboardOffscreenLayersKey = 'checkerboardOffscreenLayers';
String checkerboardRasterCacheImagesKey = 'checkerboardRasterCacheImages';
String darkThemeKey = 'darkTheme';
String debugShowCheckedModeBannerKey = 'debugShowCheckedModeBanner';
String debugShowMaterialGridKey = 'debugShowMaterialGrid';
String showPerformanceOverlayKey = 'showPerformanceOverlay';
String showSemanticsDebuggerKey = 'showSemanticsDebugger';
String themeKey = 'theme';
String homeKey = 'home';
@override
Map<String, String> get properties => {
'navigatorObservers': 'List<NavigatorObserver>',
'color': 'Color',
'initialRoute': 'String',
'key': 'Key',
'themeMode': 'ThemeMode',
'title': 'String',
'checkerboardOffscreenLayers': 'bool',
'checkerboardRasterCacheImages': 'bool',
'darkTheme': 'ThemeDataBase',
'debugShowCheckedModeBanner': 'bool',
'debugShowMaterialGrid': 'bool',
'showPerformanceOverlay': 'bool',
'showSemanticsDebugger': 'bool',
'theme': 'ThemeDataBase',
'home': 'Widget',
};
final _navigatorObserversListen = ValueNotifier<bool>(false);
List<WidgetBase> get navigatorObserversVal {
if (params[navigatorObserversKey] != null) {
final _children = <WidgetBase>[];
final _list = List.from(params[navigatorObserversKey]);
for (final item in _list) {
if (item is Map<String, dynamic>) {
_children.add(widgetRender(widgetContext, item));
}
}
return _children;
}
return null;
}
void navigatorObserversValUpdate(Map<String, dynamic> val) {
if (params[navigatorObserversKey] == null) {
params[navigatorObserversKey] = [];
}
params[navigatorObserversKey].add(val);
widgetContext.onUpdate(id, widgetData);
}
Color get colorVal {
if (params[colorKey] != null) {
int _value = null;
String description = params[colorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[colorKey] is Map) {
if (params[colorKey]['name'] == 'Color' &&
params[colorKey]['params'] != null &&
params[colorKey]['params']['0'] != null) {
_value = int.tryParse(params[colorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set colorVal(Color val) {
params[colorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
String get initialRouteVal {
if (params[initialRouteKey] != null) {
return params[initialRouteKey] as String;
}
return null;
}
set initialRouteVal(String val) {
params[initialRouteKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
List<ThemeMode> get themeModeValues => [
ThemeMode.dark,
ThemeMode.light,
ThemeMode.system,
];
ThemeMode get themeModeVal {
if (params[themeModeKey] != null) {
final _value = params[themeModeKey].toString().replaceAll('#', '');
return themeModeValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => ThemeMode.system,
);
}
return ThemeMode.system;
}
set themeModeVal(ThemeMode val) {
params[themeModeKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
String get titleVal {
if (params[titleKey] != null) {
return params[titleKey] as String;
}
return null;
}
set titleVal(String val) {
params[titleKey] = val;
widgetContext.onUpdate(id, widgetData);
}
bool get checkerboardOffscreenLayersVal {
if (params[checkerboardOffscreenLayersKey] != null) {
return params[checkerboardOffscreenLayersKey] as bool;
}
return false;
}
set checkerboardOffscreenLayersVal(bool val) {
params[checkerboardOffscreenLayersKey] = val;
widgetContext.onUpdate(id, widgetData);
}
bool get checkerboardRasterCacheImagesVal {
if (params[checkerboardRasterCacheImagesKey] != null) {
return params[checkerboardRasterCacheImagesKey] as bool;
}
return false;
}
set checkerboardRasterCacheImagesVal(bool val) {
params[checkerboardRasterCacheImagesKey] = val;
widgetContext.onUpdate(id, widgetData);
}
ThemeDataBase get darkThemeVal {
if (params[darkThemeKey] != null) {
return ThemeDataBase(params[darkThemeKey], widgetContext, widgetRender);
}
return null;
}
set darkThemeVal(ThemeDataBase val) {
params[darkThemeKey] = val;
widgetContext.onUpdate(id, widgetData);
}
bool get debugShowCheckedModeBannerVal {
if (params[debugShowCheckedModeBannerKey] != null) {
return params[debugShowCheckedModeBannerKey] as bool;
}
return true;
}
set debugShowCheckedModeBannerVal(bool val) {
params[debugShowCheckedModeBannerKey] = val;
widgetContext.onUpdate(id, widgetData);
}
bool get debugShowMaterialGridVal {
if (params[debugShowMaterialGridKey] != null) {
return params[debugShowMaterialGridKey] as bool;
}
return false;
}
set debugShowMaterialGridVal(bool val) {
params[debugShowMaterialGridKey] = val;
widgetContext.onUpdate(id, widgetData);
}
bool get showPerformanceOverlayVal {
if (params[showPerformanceOverlayKey] != null) {
return params[showPerformanceOverlayKey] as bool;
}
return false;
}
set showPerformanceOverlayVal(bool val) {
params[showPerformanceOverlayKey] = val;
widgetContext.onUpdate(id, widgetData);
}
bool get showSemanticsDebuggerVal {
if (params[showSemanticsDebuggerKey] != null) {
return params[showSemanticsDebuggerKey] as bool;
}
return false;
}
set showSemanticsDebuggerVal(bool val) {
params[showSemanticsDebuggerKey] = val;
widgetContext.onUpdate(id, widgetData);
}
ThemeDataBase get themeVal {
if (params[themeKey] != null) {
return ThemeDataBase(params[themeKey], widgetContext, widgetRender);
}
return null;
}
set themeVal(ThemeDataBase val) {
params[themeKey] = val;
widgetContext.onUpdate(id, widgetData);
}
final _homeListen = ValueNotifier<bool>(false);
WidgetBase get homeVal {
if (params[homeKey] != null) {
return widgetRender(widgetContext, params[homeKey]);
}
return null;
}
void homeValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = '9V3IqT6TK1';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'sf8UJ12qpK';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'Ac48EL2qmL';
}
params[homeKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return MaterialApp(
checkerboardOffscreenLayers: checkerboardOffscreenLayersVal,
checkerboardRasterCacheImages: checkerboardRasterCacheImagesVal,
color: colorVal,
darkTheme: darkThemeVal?.build(context),
debugShowCheckedModeBanner: debugShowCheckedModeBannerVal,
debugShowMaterialGrid: debugShowMaterialGridVal,
home: !widgetContext.isDragging ||
(widgetContext.isDragging && homeVal?.build(context) != null)
? (homeVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': 'fuNm-hOvgu',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_homeListen.value = false;
if (val != null) {
homeValUpdate(val?.data);
}
},
onLeave: (val) {
_homeListen.value = false;
},
onWillAccept: (val) {
_homeListen.value = true;
return _homeListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _homeListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
initialRoute: initialRouteVal,
key: keyVal,
navigatorObservers: navigatorObserversVal == null &&
!widgetContext.isDragging
? []
: [
if (navigatorObserversVal != null)
for (final item in navigatorObserversVal) item.build(context),
],
showPerformanceOverlay: showPerformanceOverlayVal,
showSemanticsDebugger: showSemanticsDebuggerVal,
theme: themeVal?.build(context),
themeMode: themeModeVal,
title: titleVal,
);
}
}
@@ -0,0 +1,68 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../enums.dart';
import '../library.dart';
part 'outline_button.g.dart';
@WidgetClass('OutlineButton')
class OutlineButtonBase extends _$OutlineButtonBase {
OutlineButtonBase(this.widgetData, this.widgetContext, this.widgetRender);
BorderSide borderSide;
@enumClip
Clip clipBehavior;
Color color;
Color disabledBorderColor;
Color disabledTextColor;
Color focusColor;
FocusNode focusNode;
Color highlightColor;
Color highlightedBorderColor;
double highlightElevation;
Color hoverColor;
Key key;
@enumMouseCursor
MouseCursor mouseCursor;
Function onLongPress;
Function onPressed;
EdgeInsets padding;
ShapeBorder shape;
Color splashColor;
Color textColor;
@enumButtonTextTheme
ButtonTextTheme textTheme;
@enumVisualDensity
VisualDensity visualDensity;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@PropertyKey(defaultValue: 'false')
bool autofocus;
@WidgetKey.widget(
acceptWidth: 35,
acceptHeight: 35,
defaultValue: 'Placeholder',
)
Widget child;
}
@@ -0,0 +1,580 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'outline_button.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$OutlineButtonBase extends WidgetBase {
String clipBehaviorKey = 'clipBehavior';
String colorKey = 'color';
String disabledBorderColorKey = 'disabledBorderColor';
String disabledTextColorKey = 'disabledTextColor';
String focusColorKey = 'focusColor';
String highlightColorKey = 'highlightColor';
String highlightedBorderColorKey = 'highlightedBorderColor';
String highlightElevationKey = 'highlightElevation';
String hoverColorKey = 'hoverColor';
String keyKey = 'key';
String mouseCursorKey = 'mouseCursor';
String onLongPressKey = 'onLongPress';
String onPressedKey = 'onPressed';
String paddingKey = 'padding';
String splashColorKey = 'splashColor';
String textColorKey = 'textColor';
String textThemeKey = 'textTheme';
String visualDensityKey = 'visualDensity';
String autofocusKey = 'autofocus';
String childKey = 'child';
@override
Map<String, String> get properties => {
'clipBehavior': 'Clip',
'color': 'Color',
'disabledBorderColor': 'Color',
'disabledTextColor': 'Color',
'focusColor': 'Color',
'highlightColor': 'Color',
'highlightedBorderColor': 'Color',
'highlightElevation': 'double',
'hoverColor': 'Color',
'key': 'Key',
'mouseCursor': 'MouseCursor',
'onLongPress': 'Function',
'onPressed': 'Function',
'padding': 'EdgeInsets',
'splashColor': 'Color',
'textColor': 'Color',
'textTheme': 'ButtonTextTheme',
'visualDensity': 'VisualDensity',
'autofocus': 'bool',
'child': 'Widget',
};
List<Clip> get clipBehaviorValues => [
Clip.none,
Clip.antiAlias,
Clip.antiAliasWithSaveLayer,
Clip.hardEdge,
];
Clip get clipBehaviorVal {
if (params[clipBehaviorKey] != null) {
final _value = params[clipBehaviorKey].toString().replaceAll('#', '');
return clipBehaviorValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => Clip.none,
);
}
return Clip.none;
}
set clipBehaviorVal(Clip val) {
params[clipBehaviorKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
Color get colorVal {
if (params[colorKey] != null) {
int _value = null;
String description = params[colorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[colorKey] is Map) {
if (params[colorKey]['name'] == 'Color' &&
params[colorKey]['params'] != null &&
params[colorKey]['params']['0'] != null) {
_value = int.tryParse(params[colorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set colorVal(Color val) {
params[colorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Color get disabledBorderColorVal {
if (params[disabledBorderColorKey] != null) {
int _value = null;
String description = params[disabledBorderColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[disabledBorderColorKey] is Map) {
if (params[disabledBorderColorKey]['name'] == 'Color' &&
params[disabledBorderColorKey]['params'] != null &&
params[disabledBorderColorKey]['params']['0'] != null) {
_value = int.tryParse(params[disabledBorderColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set disabledBorderColorVal(Color val) {
params[disabledBorderColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Color get disabledTextColorVal {
if (params[disabledTextColorKey] != null) {
int _value = null;
String description = params[disabledTextColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[disabledTextColorKey] is Map) {
if (params[disabledTextColorKey]['name'] == 'Color' &&
params[disabledTextColorKey]['params'] != null &&
params[disabledTextColorKey]['params']['0'] != null) {
_value = int.tryParse(params[disabledTextColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set disabledTextColorVal(Color val) {
params[disabledTextColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Color get focusColorVal {
if (params[focusColorKey] != null) {
int _value = null;
String description = params[focusColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[focusColorKey] is Map) {
if (params[focusColorKey]['name'] == 'Color' &&
params[focusColorKey]['params'] != null &&
params[focusColorKey]['params']['0'] != null) {
_value = int.tryParse(params[focusColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set focusColorVal(Color val) {
params[focusColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Color get highlightColorVal {
if (params[highlightColorKey] != null) {
int _value = null;
String description = params[highlightColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[highlightColorKey] is Map) {
if (params[highlightColorKey]['name'] == 'Color' &&
params[highlightColorKey]['params'] != null &&
params[highlightColorKey]['params']['0'] != null) {
_value = int.tryParse(params[highlightColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set highlightColorVal(Color val) {
params[highlightColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Color get highlightedBorderColorVal {
if (params[highlightedBorderColorKey] != null) {
int _value = null;
String description = params[highlightedBorderColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[highlightedBorderColorKey] is Map) {
if (params[highlightedBorderColorKey]['name'] == 'Color' &&
params[highlightedBorderColorKey]['params'] != null &&
params[highlightedBorderColorKey]['params']['0'] != null) {
_value =
int.tryParse(params[highlightedBorderColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set highlightedBorderColorVal(Color val) {
params[highlightedBorderColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
double get highlightElevationVal {
if (params[highlightElevationKey] != null) {
return params[highlightElevationKey] as double;
}
return null;
}
set highlightElevationVal(double val) {
params[highlightElevationKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Color get hoverColorVal {
if (params[hoverColorKey] != null) {
int _value = null;
String description = params[hoverColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[hoverColorKey] is Map) {
if (params[hoverColorKey]['name'] == 'Color' &&
params[hoverColorKey]['params'] != null &&
params[hoverColorKey]['params']['0'] != null) {
_value = int.tryParse(params[hoverColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set hoverColorVal(Color val) {
params[hoverColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
List<MouseCursor> get mouseCursorValues => [
SystemMouseCursors.click,
SystemMouseCursors.basic,
SystemMouseCursors.forbidden,
SystemMouseCursors.grab,
SystemMouseCursors.grabbing,
SystemMouseCursors.text,
SystemMouseCursors.none,
];
MouseCursor get mouseCursorVal {
if (params[mouseCursorKey] != null) {
final _value = params[mouseCursorKey].toString().replaceAll('#', '');
return mouseCursorValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => SystemMouseCursors.click,
);
}
return SystemMouseCursors.click;
}
set mouseCursorVal(MouseCursor val) {
params[mouseCursorKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
String get onLongPressVal {
if (params[onLongPressKey] != null) {
return params[onLongPressKey] as String;
}
return null;
}
set onLongPressVal(String val) {
params[onLongPressKey] = val;
widgetContext.onUpdate(id, widgetData);
}
String get onPressedVal {
if (params[onPressedKey] != null) {
return params[onPressedKey] as String;
}
return null;
}
set onPressedVal(String val) {
params[onPressedKey] = val;
widgetContext.onUpdate(id, widgetData);
}
EdgeInsets get paddingVal {
EdgeInsets _spacing = EdgeInsets.all(0.0);
if (params[paddingKey] != null) {
double top = 0;
double bottom = 0;
double left = 0;
double right = 0;
Map<String, dynamic> _spacingParams = params[paddingKey]['params'];
top = _spacingParams['top'] ?? 0;
bottom = _spacingParams['bottom'] ?? 0;
left = _spacingParams['left'] ?? 0;
right = _spacingParams['right'] ?? 0;
_spacing = EdgeInsets.fromLTRB(left, top, right, bottom);
}
return _spacing;
}
set paddingVal(EdgeInsets val) {
params[paddingKey] = {
"name": "EdgeInsets.only",
"id": "paddingKeyEdgeInsets",
"params": {
"top": val.top,
"bottom": val.bottom,
"left": val.left,
"right": val.right,
}
};
widgetContext.onUpdate(id, widgetData);
}
Color get splashColorVal {
if (params[splashColorKey] != null) {
int _value = null;
String description = params[splashColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[splashColorKey] is Map) {
if (params[splashColorKey]['name'] == 'Color' &&
params[splashColorKey]['params'] != null &&
params[splashColorKey]['params']['0'] != null) {
_value = int.tryParse(params[splashColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set splashColorVal(Color val) {
params[splashColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Color get textColorVal {
if (params[textColorKey] != null) {
int _value = null;
String description = params[textColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[textColorKey] is Map) {
if (params[textColorKey]['name'] == 'Color' &&
params[textColorKey]['params'] != null &&
params[textColorKey]['params']['0'] != null) {
_value = int.tryParse(params[textColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set textColorVal(Color val) {
params[textColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
List<ButtonTextTheme> get textThemeValues => [
ButtonTextTheme.normal,
ButtonTextTheme.accent,
ButtonTextTheme.primary,
];
ButtonTextTheme get textThemeVal {
if (params[textThemeKey] != null) {
final _value = params[textThemeKey].toString().replaceAll('#', '');
return textThemeValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set textThemeVal(ButtonTextTheme val) {
params[textThemeKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<VisualDensity> get visualDensityValues => [
VisualDensity.adaptivePlatformDensity,
VisualDensity.comfortable,
VisualDensity.compact,
VisualDensity.standard,
];
VisualDensity get visualDensityVal {
if (params[visualDensityKey] != null) {
final _value = params[visualDensityKey].toString().replaceAll('#', '');
return visualDensityValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set visualDensityVal(VisualDensity val) {
params[visualDensityKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
bool get autofocusVal {
if (params[autofocusKey] != null) {
return params[autofocusKey] as bool;
}
return false;
}
set autofocusVal(bool val) {
params[autofocusKey] = val;
widgetContext.onUpdate(id, widgetData);
}
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'Ur1cNE-xbDu';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'oQ7fSuVe2Ke';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'OxrpPRQ8YdC';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: OutlineButton(
autofocus: autofocusVal,
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': '2tpQQMRY_j7',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(35.0, 35.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(35.0, 35.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
clipBehavior: clipBehaviorVal,
color: colorVal,
disabledBorderColor: disabledBorderColorVal,
disabledTextColor: disabledTextColorVal,
focusColor: focusColorVal,
highlightColor: highlightColorVal,
highlightElevation: highlightElevationVal,
highlightedBorderColor: highlightedBorderColorVal,
hoverColor: hoverColorVal,
key: keyVal,
mouseCursor: mouseCursorVal,
onLongPress: () => onAction(context, onLongPressVal),
onPressed: () => onAction(context, onPressedVal),
padding: paddingVal,
splashColor: splashColorVal,
textColor: textColorVal,
textTheme: textThemeVal,
visualDensity: visualDensityVal,
),
);
}
}
@@ -0,0 +1,39 @@
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../library.dart';
part 'placeholder.g.dart';
@WidgetClass('Placeholder')
class PlaceholderBase extends _$PlaceholderBase {
PlaceholderBase(this.widgetData, this.widgetContext, this.widgetRender);
Key key;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@ColorKey(defaultValue: 0xFF455A64)
Color color;
@PropertyKey(defaultValue: '2.0')
double strokeWidth;
@PropertyKey(defaultValue: '400.0')
double fallbackWidth;
@PropertyKey(defaultValue: '400.0')
double fallbackHeight;
}
@@ -0,0 +1,128 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'placeholder.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$PlaceholderBase extends WidgetBase {
String keyKey = 'key';
String colorKey = 'color';
String strokeWidthKey = 'strokeWidth';
String fallbackWidthKey = 'fallbackWidth';
String fallbackHeightKey = 'fallbackHeight';
@override
Map<String, String> get properties => {
'key': 'Key',
'color': 'Color',
'strokeWidth': 'double',
'fallbackWidth': 'double',
'fallbackHeight': 'double',
};
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
Color get colorVal {
if (params[colorKey] != null) {
int _value = 4282735204;
String description = params[colorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[colorKey] is Map) {
if (params[colorKey]['name'] == 'Color' &&
params[colorKey]['params'] != null &&
params[colorKey]['params']['0'] != null) {
_value = int.tryParse(params[colorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return Color(4282735204);
}
set colorVal(Color val) {
params[colorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
double get strokeWidthVal {
if (params[strokeWidthKey] != null) {
return params[strokeWidthKey] as double;
}
return 2.0;
}
set strokeWidthVal(double val) {
params[strokeWidthKey] = val;
widgetContext.onUpdate(id, widgetData);
}
double get fallbackWidthVal {
if (params[fallbackWidthKey] != null) {
return params[fallbackWidthKey] as double;
}
return 400.0;
}
set fallbackWidthVal(double val) {
params[fallbackWidthKey] = val;
widgetContext.onUpdate(id, widgetData);
}
double get fallbackHeightVal {
if (params[fallbackHeightKey] != null) {
return params[fallbackHeightKey] as double;
}
return 400.0;
}
set fallbackHeightVal(double val) {
params[fallbackHeightKey] = val;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: Placeholder(
color: colorVal,
fallbackHeight: fallbackHeightVal,
fallbackWidth: fallbackWidthVal,
key: keyVal,
strokeWidth: strokeWidthVal,
),
);
}
}
@@ -0,0 +1,37 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../library.dart';
part 'positioned.g.dart';
@WidgetClass('Positioned', allowTap: false)
class PositionedBase extends _$PositionedBase {
PositionedBase(this.widgetData, this.widgetContext, this.widgetRender);
Key key;
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
defaultValue: 'Placeholder',
)
Widget child;
double width, height;
double top, bottom, left, right;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@override
final GenerateWidget widgetRender;
}
@@ -0,0 +1,205 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'positioned.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$PositionedBase extends WidgetBase {
String keyKey = 'key';
String childKey = 'child';
String widthKey = 'width';
String heightKey = 'height';
String topKey = 'top';
String bottomKey = 'bottom';
String leftKey = 'left';
String rightKey = 'right';
@override
Map<String, String> get properties => {
'key': 'Key',
'child': 'Widget',
'width': 'double',
'height': 'double',
'top': 'double',
'bottom': 'double',
'left': 'double',
'right': 'double',
};
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'kuaQfJppp9B';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'iWCgvx7fkOI';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'OYDSFcsYLM6';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
double get widthVal {
if (params[widthKey] != null) {
return params[widthKey] as double;
}
return null;
}
set widthVal(double val) {
params[widthKey] = val;
widgetContext.onUpdate(id, widgetData);
}
double get heightVal {
if (params[heightKey] != null) {
return params[heightKey] as double;
}
return null;
}
set heightVal(double val) {
params[heightKey] = val;
widgetContext.onUpdate(id, widgetData);
}
double get topVal {
if (params[topKey] != null) {
return params[topKey] as double;
}
return null;
}
set topVal(double val) {
params[topKey] = val;
widgetContext.onUpdate(id, widgetData);
}
double get bottomVal {
if (params[bottomKey] != null) {
return params[bottomKey] as double;
}
return null;
}
set bottomVal(double val) {
params[bottomKey] = val;
widgetContext.onUpdate(id, widgetData);
}
double get leftVal {
if (params[leftKey] != null) {
return params[leftKey] as double;
}
return null;
}
set leftVal(double val) {
params[leftKey] = val;
widgetContext.onUpdate(id, widgetData);
}
double get rightVal {
if (params[rightKey] != null) {
return params[rightKey] as double;
}
return null;
}
set rightVal(double val) {
params[rightKey] = val;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return Positioned(
bottom: bottomVal,
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': 'pcBQMomtDHL',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
height: heightVal,
key: keyVal,
left: leftVal,
right: rightVal,
top: topVal,
width: widthVal,
);
}
}
@@ -0,0 +1,77 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../enums.dart';
import '../library.dart';
part 'raised_button.g.dart';
@WidgetClass('RaisedButton')
class RaisedButtonBase extends _$RaisedButtonBase {
RaisedButtonBase(this.widgetData, this.widgetContext, this.widgetRender);
Duration animationDuration;
@enumClip
Clip clipBehavior;
Color color;
@enumBrightness
Brightness colorBrightness;
Color disabledColor;
double disabledElevation;
Color disabledTextColor;
double elevation;
Color focusColor;
double focusElevation;
FocusNode focusNode;
Color highlightColor;
double highlightElevation;
Color hoverColor;
double hoverElevation;
Key key;
MaterialTapTargetSize materialTapTargetSize;
@enumMouseCursor
MouseCursor mouseCursor;
Function onLongPress;
Function onPressed;
EdgeInsets padding;
ShapeBorder shape;
Color splashColor;
Color textColor;
@enumButtonTextTheme
ButtonTextTheme textTheme;
@enumVisualDensity
VisualDensity visualDensity;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@PropertyKey(defaultValue: 'false')
bool autofocus;
@WidgetKey.widget(
acceptWidth: 35,
acceptHeight: 35,
defaultValue: 'Placeholder',
)
Widget child;
void Function(bool) onHighlightChanged;
}
@@ -0,0 +1,634 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'raised_button.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$RaisedButtonBase extends WidgetBase {
String clipBehaviorKey = 'clipBehavior';
String colorKey = 'color';
String colorBrightnessKey = 'colorBrightness';
String disabledColorKey = 'disabledColor';
String disabledElevationKey = 'disabledElevation';
String disabledTextColorKey = 'disabledTextColor';
String elevationKey = 'elevation';
String focusColorKey = 'focusColor';
String focusElevationKey = 'focusElevation';
String highlightColorKey = 'highlightColor';
String highlightElevationKey = 'highlightElevation';
String hoverColorKey = 'hoverColor';
String hoverElevationKey = 'hoverElevation';
String keyKey = 'key';
String mouseCursorKey = 'mouseCursor';
String onLongPressKey = 'onLongPress';
String onPressedKey = 'onPressed';
String paddingKey = 'padding';
String splashColorKey = 'splashColor';
String textColorKey = 'textColor';
String textThemeKey = 'textTheme';
String visualDensityKey = 'visualDensity';
String autofocusKey = 'autofocus';
String childKey = 'child';
@override
Map<String, String> get properties => {
'clipBehavior': 'Clip',
'color': 'Color',
'colorBrightness': 'Brightness',
'disabledColor': 'Color',
'disabledElevation': 'double',
'disabledTextColor': 'Color',
'elevation': 'double',
'focusColor': 'Color',
'focusElevation': 'double',
'highlightColor': 'Color',
'highlightElevation': 'double',
'hoverColor': 'Color',
'hoverElevation': 'double',
'key': 'Key',
'mouseCursor': 'MouseCursor',
'onLongPress': 'Function',
'onPressed': 'Function',
'padding': 'EdgeInsets',
'splashColor': 'Color',
'textColor': 'Color',
'textTheme': 'ButtonTextTheme',
'visualDensity': 'VisualDensity',
'autofocus': 'bool',
'child': 'Widget',
};
List<Clip> get clipBehaviorValues => [
Clip.none,
Clip.antiAlias,
Clip.antiAliasWithSaveLayer,
Clip.hardEdge,
];
Clip get clipBehaviorVal {
if (params[clipBehaviorKey] != null) {
final _value = params[clipBehaviorKey].toString().replaceAll('#', '');
return clipBehaviorValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => Clip.none,
);
}
return Clip.none;
}
set clipBehaviorVal(Clip val) {
params[clipBehaviorKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
Color get colorVal {
if (params[colorKey] != null) {
int _value = null;
String description = params[colorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[colorKey] is Map) {
if (params[colorKey]['name'] == 'Color' &&
params[colorKey]['params'] != null &&
params[colorKey]['params']['0'] != null) {
_value = int.tryParse(params[colorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set colorVal(Color val) {
params[colorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
List<Brightness> get colorBrightnessValues => [
Brightness.light,
Brightness.dark,
];
Brightness get colorBrightnessVal {
if (params[colorBrightnessKey] != null) {
final _value = params[colorBrightnessKey].toString().replaceAll('#', '');
return colorBrightnessValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set colorBrightnessVal(Brightness val) {
params[colorBrightnessKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
Color get disabledColorVal {
if (params[disabledColorKey] != null) {
int _value = null;
String description = params[disabledColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[disabledColorKey] is Map) {
if (params[disabledColorKey]['name'] == 'Color' &&
params[disabledColorKey]['params'] != null &&
params[disabledColorKey]['params']['0'] != null) {
_value = int.tryParse(params[disabledColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set disabledColorVal(Color val) {
params[disabledColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
double get disabledElevationVal {
if (params[disabledElevationKey] != null) {
return params[disabledElevationKey] as double;
}
return null;
}
set disabledElevationVal(double val) {
params[disabledElevationKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Color get disabledTextColorVal {
if (params[disabledTextColorKey] != null) {
int _value = null;
String description = params[disabledTextColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[disabledTextColorKey] is Map) {
if (params[disabledTextColorKey]['name'] == 'Color' &&
params[disabledTextColorKey]['params'] != null &&
params[disabledTextColorKey]['params']['0'] != null) {
_value = int.tryParse(params[disabledTextColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set disabledTextColorVal(Color val) {
params[disabledTextColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
double get elevationVal {
if (params[elevationKey] != null) {
return params[elevationKey] as double;
}
return null;
}
set elevationVal(double val) {
params[elevationKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Color get focusColorVal {
if (params[focusColorKey] != null) {
int _value = null;
String description = params[focusColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[focusColorKey] is Map) {
if (params[focusColorKey]['name'] == 'Color' &&
params[focusColorKey]['params'] != null &&
params[focusColorKey]['params']['0'] != null) {
_value = int.tryParse(params[focusColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set focusColorVal(Color val) {
params[focusColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
double get focusElevationVal {
if (params[focusElevationKey] != null) {
return params[focusElevationKey] as double;
}
return null;
}
set focusElevationVal(double val) {
params[focusElevationKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Color get highlightColorVal {
if (params[highlightColorKey] != null) {
int _value = null;
String description = params[highlightColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[highlightColorKey] is Map) {
if (params[highlightColorKey]['name'] == 'Color' &&
params[highlightColorKey]['params'] != null &&
params[highlightColorKey]['params']['0'] != null) {
_value = int.tryParse(params[highlightColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set highlightColorVal(Color val) {
params[highlightColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
double get highlightElevationVal {
if (params[highlightElevationKey] != null) {
return params[highlightElevationKey] as double;
}
return null;
}
set highlightElevationVal(double val) {
params[highlightElevationKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Color get hoverColorVal {
if (params[hoverColorKey] != null) {
int _value = null;
String description = params[hoverColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[hoverColorKey] is Map) {
if (params[hoverColorKey]['name'] == 'Color' &&
params[hoverColorKey]['params'] != null &&
params[hoverColorKey]['params']['0'] != null) {
_value = int.tryParse(params[hoverColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set hoverColorVal(Color val) {
params[hoverColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
double get hoverElevationVal {
if (params[hoverElevationKey] != null) {
return params[hoverElevationKey] as double;
}
return null;
}
set hoverElevationVal(double val) {
params[hoverElevationKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
List<MouseCursor> get mouseCursorValues => [
SystemMouseCursors.click,
SystemMouseCursors.basic,
SystemMouseCursors.forbidden,
SystemMouseCursors.grab,
SystemMouseCursors.grabbing,
SystemMouseCursors.text,
SystemMouseCursors.none,
];
MouseCursor get mouseCursorVal {
if (params[mouseCursorKey] != null) {
final _value = params[mouseCursorKey].toString().replaceAll('#', '');
return mouseCursorValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => SystemMouseCursors.click,
);
}
return SystemMouseCursors.click;
}
set mouseCursorVal(MouseCursor val) {
params[mouseCursorKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
String get onLongPressVal {
if (params[onLongPressKey] != null) {
return params[onLongPressKey] as String;
}
return null;
}
set onLongPressVal(String val) {
params[onLongPressKey] = val;
widgetContext.onUpdate(id, widgetData);
}
String get onPressedVal {
if (params[onPressedKey] != null) {
return params[onPressedKey] as String;
}
return null;
}
set onPressedVal(String val) {
params[onPressedKey] = val;
widgetContext.onUpdate(id, widgetData);
}
EdgeInsets get paddingVal {
EdgeInsets _spacing = EdgeInsets.all(0.0);
if (params[paddingKey] != null) {
double top = 0;
double bottom = 0;
double left = 0;
double right = 0;
Map<String, dynamic> _spacingParams = params[paddingKey]['params'];
top = _spacingParams['top'] ?? 0;
bottom = _spacingParams['bottom'] ?? 0;
left = _spacingParams['left'] ?? 0;
right = _spacingParams['right'] ?? 0;
_spacing = EdgeInsets.fromLTRB(left, top, right, bottom);
}
return _spacing;
}
set paddingVal(EdgeInsets val) {
params[paddingKey] = {
"name": "EdgeInsets.only",
"id": "paddingKeyEdgeInsets",
"params": {
"top": val.top,
"bottom": val.bottom,
"left": val.left,
"right": val.right,
}
};
widgetContext.onUpdate(id, widgetData);
}
Color get splashColorVal {
if (params[splashColorKey] != null) {
int _value = null;
String description = params[splashColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[splashColorKey] is Map) {
if (params[splashColorKey]['name'] == 'Color' &&
params[splashColorKey]['params'] != null &&
params[splashColorKey]['params']['0'] != null) {
_value = int.tryParse(params[splashColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set splashColorVal(Color val) {
params[splashColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Color get textColorVal {
if (params[textColorKey] != null) {
int _value = null;
String description = params[textColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[textColorKey] is Map) {
if (params[textColorKey]['name'] == 'Color' &&
params[textColorKey]['params'] != null &&
params[textColorKey]['params']['0'] != null) {
_value = int.tryParse(params[textColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set textColorVal(Color val) {
params[textColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
List<ButtonTextTheme> get textThemeValues => [
ButtonTextTheme.normal,
ButtonTextTheme.accent,
ButtonTextTheme.primary,
];
ButtonTextTheme get textThemeVal {
if (params[textThemeKey] != null) {
final _value = params[textThemeKey].toString().replaceAll('#', '');
return textThemeValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set textThemeVal(ButtonTextTheme val) {
params[textThemeKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<VisualDensity> get visualDensityValues => [
VisualDensity.adaptivePlatformDensity,
VisualDensity.comfortable,
VisualDensity.compact,
VisualDensity.standard,
];
VisualDensity get visualDensityVal {
if (params[visualDensityKey] != null) {
final _value = params[visualDensityKey].toString().replaceAll('#', '');
return visualDensityValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set visualDensityVal(VisualDensity val) {
params[visualDensityKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
bool get autofocusVal {
if (params[autofocusKey] != null) {
return params[autofocusKey] as bool;
}
return false;
}
set autofocusVal(bool val) {
params[autofocusKey] = val;
widgetContext.onUpdate(id, widgetData);
}
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'oIMCSuAOhw';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'ig6df8bG5w';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'GBAxGjraXD';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: RaisedButton(
autofocus: autofocusVal,
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': '7zVCuMb5rk',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(35.0, 35.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(35.0, 35.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
clipBehavior: clipBehaviorVal,
color: colorVal,
colorBrightness: colorBrightnessVal,
disabledColor: disabledColorVal,
disabledElevation: disabledElevationVal,
disabledTextColor: disabledTextColorVal,
elevation: elevationVal,
focusColor: focusColorVal,
focusElevation: focusElevationVal,
highlightColor: highlightColorVal,
highlightElevation: highlightElevationVal,
hoverColor: hoverColorVal,
hoverElevation: hoverElevationVal,
key: keyVal,
mouseCursor: mouseCursorVal,
onLongPress: () => onAction(context, onLongPressVal),
onPressed: () => onAction(context, onPressedVal),
padding: paddingVal,
splashColor: splashColorVal,
textColor: textColorVal,
textTheme: textThemeVal,
visualDensity: visualDensityVal,
),
);
}
}
@@ -0,0 +1,79 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../enums.dart';
import '../library.dart';
part 'raised_button_icon.g.dart';
@WidgetClass('RaisedButton.icon')
class RaisedButtonIconBase extends _$RaisedButtonIconBase {
RaisedButtonIconBase(this.widgetData, this.widgetContext, this.widgetRender);
Duration animationDuration;
@enumClip
Clip clipBehavior;
Color color;
@enumBrightness
Brightness colorBrightness;
Color disabledColor;
double disabledElevation;
Color disabledTextColor;
double elevation;
Color focusColor;
FocusNode focusNode;
Color highlightColor;
double highlightElevation;
Color hoverColor;
Key key;
MaterialTapTargetSize materialTapTargetSize;
@enumMouseCursor
MouseCursor mouseCursor;
Function onLongPress;
Function onPressed;
EdgeInsets padding;
ShapeBorder shape;
Color splashColor;
Color textColor;
@enumButtonTextTheme
ButtonTextTheme textTheme;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@PropertyKey(defaultValue: 'false')
bool autofocus;
@WidgetKey.widget(
acceptWidth: 50,
acceptHeight: 35,
defaultValue: 'Placeholder',
)
Widget icon;
@WidgetKey.widget(
acceptWidth: 35,
acceptHeight: 35,
defaultValue: 'Placeholder',
)
Widget label;
void Function(bool) onHighlightChanged;
}
@@ -0,0 +1,642 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'raised_button_icon.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$RaisedButtonIconBase extends WidgetBase {
String clipBehaviorKey = 'clipBehavior';
String colorKey = 'color';
String colorBrightnessKey = 'colorBrightness';
String disabledColorKey = 'disabledColor';
String disabledElevationKey = 'disabledElevation';
String disabledTextColorKey = 'disabledTextColor';
String elevationKey = 'elevation';
String focusColorKey = 'focusColor';
String highlightColorKey = 'highlightColor';
String highlightElevationKey = 'highlightElevation';
String hoverColorKey = 'hoverColor';
String keyKey = 'key';
String mouseCursorKey = 'mouseCursor';
String onLongPressKey = 'onLongPress';
String onPressedKey = 'onPressed';
String paddingKey = 'padding';
String splashColorKey = 'splashColor';
String textColorKey = 'textColor';
String textThemeKey = 'textTheme';
String autofocusKey = 'autofocus';
String iconKey = 'icon';
String labelKey = 'label';
@override
Map<String, String> get properties => {
'clipBehavior': 'Clip',
'color': 'Color',
'colorBrightness': 'Brightness',
'disabledColor': 'Color',
'disabledElevation': 'double',
'disabledTextColor': 'Color',
'elevation': 'double',
'focusColor': 'Color',
'highlightColor': 'Color',
'highlightElevation': 'double',
'hoverColor': 'Color',
'key': 'Key',
'mouseCursor': 'MouseCursor',
'onLongPress': 'Function',
'onPressed': 'Function',
'padding': 'EdgeInsets',
'splashColor': 'Color',
'textColor': 'Color',
'textTheme': 'ButtonTextTheme',
'autofocus': 'bool',
'icon': 'Widget',
'label': 'Widget',
};
List<Clip> get clipBehaviorValues => [
Clip.none,
Clip.antiAlias,
Clip.antiAliasWithSaveLayer,
Clip.hardEdge,
];
Clip get clipBehaviorVal {
if (params[clipBehaviorKey] != null) {
final _value = params[clipBehaviorKey].toString().replaceAll('#', '');
return clipBehaviorValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => Clip.none,
);
}
return Clip.none;
}
set clipBehaviorVal(Clip val) {
params[clipBehaviorKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
Color get colorVal {
if (params[colorKey] != null) {
int _value = null;
String description = params[colorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[colorKey] is Map) {
if (params[colorKey]['name'] == 'Color' &&
params[colorKey]['params'] != null &&
params[colorKey]['params']['0'] != null) {
_value = int.tryParse(params[colorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set colorVal(Color val) {
params[colorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
List<Brightness> get colorBrightnessValues => [
Brightness.light,
Brightness.dark,
];
Brightness get colorBrightnessVal {
if (params[colorBrightnessKey] != null) {
final _value = params[colorBrightnessKey].toString().replaceAll('#', '');
return colorBrightnessValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set colorBrightnessVal(Brightness val) {
params[colorBrightnessKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
Color get disabledColorVal {
if (params[disabledColorKey] != null) {
int _value = null;
String description = params[disabledColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[disabledColorKey] is Map) {
if (params[disabledColorKey]['name'] == 'Color' &&
params[disabledColorKey]['params'] != null &&
params[disabledColorKey]['params']['0'] != null) {
_value = int.tryParse(params[disabledColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set disabledColorVal(Color val) {
params[disabledColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
double get disabledElevationVal {
if (params[disabledElevationKey] != null) {
return params[disabledElevationKey] as double;
}
return null;
}
set disabledElevationVal(double val) {
params[disabledElevationKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Color get disabledTextColorVal {
if (params[disabledTextColorKey] != null) {
int _value = null;
String description = params[disabledTextColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[disabledTextColorKey] is Map) {
if (params[disabledTextColorKey]['name'] == 'Color' &&
params[disabledTextColorKey]['params'] != null &&
params[disabledTextColorKey]['params']['0'] != null) {
_value = int.tryParse(params[disabledTextColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set disabledTextColorVal(Color val) {
params[disabledTextColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
double get elevationVal {
if (params[elevationKey] != null) {
return params[elevationKey] as double;
}
return null;
}
set elevationVal(double val) {
params[elevationKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Color get focusColorVal {
if (params[focusColorKey] != null) {
int _value = null;
String description = params[focusColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[focusColorKey] is Map) {
if (params[focusColorKey]['name'] == 'Color' &&
params[focusColorKey]['params'] != null &&
params[focusColorKey]['params']['0'] != null) {
_value = int.tryParse(params[focusColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set focusColorVal(Color val) {
params[focusColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Color get highlightColorVal {
if (params[highlightColorKey] != null) {
int _value = null;
String description = params[highlightColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[highlightColorKey] is Map) {
if (params[highlightColorKey]['name'] == 'Color' &&
params[highlightColorKey]['params'] != null &&
params[highlightColorKey]['params']['0'] != null) {
_value = int.tryParse(params[highlightColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set highlightColorVal(Color val) {
params[highlightColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
double get highlightElevationVal {
if (params[highlightElevationKey] != null) {
return params[highlightElevationKey] as double;
}
return null;
}
set highlightElevationVal(double val) {
params[highlightElevationKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Color get hoverColorVal {
if (params[hoverColorKey] != null) {
int _value = null;
String description = params[hoverColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[hoverColorKey] is Map) {
if (params[hoverColorKey]['name'] == 'Color' &&
params[hoverColorKey]['params'] != null &&
params[hoverColorKey]['params']['0'] != null) {
_value = int.tryParse(params[hoverColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set hoverColorVal(Color val) {
params[hoverColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
List<MouseCursor> get mouseCursorValues => [
SystemMouseCursors.click,
SystemMouseCursors.basic,
SystemMouseCursors.forbidden,
SystemMouseCursors.grab,
SystemMouseCursors.grabbing,
SystemMouseCursors.text,
SystemMouseCursors.none,
];
MouseCursor get mouseCursorVal {
if (params[mouseCursorKey] != null) {
final _value = params[mouseCursorKey].toString().replaceAll('#', '');
return mouseCursorValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => SystemMouseCursors.click,
);
}
return SystemMouseCursors.click;
}
set mouseCursorVal(MouseCursor val) {
params[mouseCursorKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
String get onLongPressVal {
if (params[onLongPressKey] != null) {
return params[onLongPressKey] as String;
}
return null;
}
set onLongPressVal(String val) {
params[onLongPressKey] = val;
widgetContext.onUpdate(id, widgetData);
}
String get onPressedVal {
if (params[onPressedKey] != null) {
return params[onPressedKey] as String;
}
return null;
}
set onPressedVal(String val) {
params[onPressedKey] = val;
widgetContext.onUpdate(id, widgetData);
}
EdgeInsets get paddingVal {
EdgeInsets _spacing = EdgeInsets.all(0.0);
if (params[paddingKey] != null) {
double top = 0;
double bottom = 0;
double left = 0;
double right = 0;
Map<String, dynamic> _spacingParams = params[paddingKey]['params'];
top = _spacingParams['top'] ?? 0;
bottom = _spacingParams['bottom'] ?? 0;
left = _spacingParams['left'] ?? 0;
right = _spacingParams['right'] ?? 0;
_spacing = EdgeInsets.fromLTRB(left, top, right, bottom);
}
return _spacing;
}
set paddingVal(EdgeInsets val) {
params[paddingKey] = {
"name": "EdgeInsets.only",
"id": "paddingKeyEdgeInsets",
"params": {
"top": val.top,
"bottom": val.bottom,
"left": val.left,
"right": val.right,
}
};
widgetContext.onUpdate(id, widgetData);
}
Color get splashColorVal {
if (params[splashColorKey] != null) {
int _value = null;
String description = params[splashColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[splashColorKey] is Map) {
if (params[splashColorKey]['name'] == 'Color' &&
params[splashColorKey]['params'] != null &&
params[splashColorKey]['params']['0'] != null) {
_value = int.tryParse(params[splashColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set splashColorVal(Color val) {
params[splashColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
Color get textColorVal {
if (params[textColorKey] != null) {
int _value = null;
String description = params[textColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[textColorKey] is Map) {
if (params[textColorKey]['name'] == 'Color' &&
params[textColorKey]['params'] != null &&
params[textColorKey]['params']['0'] != null) {
_value = int.tryParse(params[textColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set textColorVal(Color val) {
params[textColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
List<ButtonTextTheme> get textThemeValues => [
ButtonTextTheme.normal,
ButtonTextTheme.accent,
ButtonTextTheme.primary,
];
ButtonTextTheme get textThemeVal {
if (params[textThemeKey] != null) {
final _value = params[textThemeKey].toString().replaceAll('#', '');
return textThemeValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set textThemeVal(ButtonTextTheme val) {
params[textThemeKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
bool get autofocusVal {
if (params[autofocusKey] != null) {
return params[autofocusKey] as bool;
}
return false;
}
set autofocusVal(bool val) {
params[autofocusKey] = val;
widgetContext.onUpdate(id, widgetData);
}
final _iconListen = ValueNotifier<bool>(false);
WidgetBase get iconVal {
if (params[iconKey] != null) {
return widgetRender(widgetContext, params[iconKey]);
}
return null;
}
void iconValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'nX_tBrFEEVD';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'bOBe_D2O1zB';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'jWOH4zqbAhp';
}
params[iconKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
final _labelListen = ValueNotifier<bool>(false);
WidgetBase get labelVal {
if (params[labelKey] != null) {
return widgetRender(widgetContext, params[labelKey]);
}
return null;
}
void labelValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'DyWtAf5ltTA';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'K1XSnQQKLy4';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'rh_use5VL83';
}
params[labelKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: RaisedButton.icon(
autofocus: autofocusVal,
clipBehavior: clipBehaviorVal,
color: colorVal,
colorBrightness: colorBrightnessVal,
disabledColor: disabledColorVal,
disabledElevation: disabledElevationVal,
disabledTextColor: disabledTextColorVal,
elevation: elevationVal,
focusColor: focusColorVal,
highlightColor: highlightColorVal,
highlightElevation: highlightElevationVal,
hoverColor: hoverColorVal,
icon: !widgetContext.isDragging ||
(widgetContext.isDragging && iconVal?.build(context) != null)
? (iconVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': 'F1DwqUprdx6',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(50.0, 35.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_iconListen.value = false;
if (val != null) {
iconValUpdate(val?.data);
}
},
onLeave: (val) {
_iconListen.value = false;
},
onWillAccept: (val) {
_iconListen.value = true;
return _iconListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _iconListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(50.0, 35.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
key: keyVal,
label: !widgetContext.isDragging ||
(widgetContext.isDragging && labelVal?.build(context) != null)
? (labelVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': 'm1Z9SgUEZon',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(35.0, 35.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_labelListen.value = false;
if (val != null) {
labelValUpdate(val?.data);
}
},
onLeave: (val) {
_labelListen.value = false;
},
onWillAccept: (val) {
_labelListen.value = true;
return _labelListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _labelListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(35.0, 35.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
mouseCursor: mouseCursorVal,
onLongPress: () => onAction(context, onLongPressVal),
onPressed: () => onAction(context, onPressedVal),
padding: paddingVal,
splashColor: splashColorVal,
textColor: textColorVal,
textTheme: textThemeVal,
),
);
}
}
@@ -0,0 +1,47 @@
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../enums.dart';
import '../library.dart';
part 'row.g.dart';
@WidgetClass('Row')
class RowBase extends _$RowBase {
RowBase(this.widgetData, this.widgetContext, this.widgetRender);
List<Widget> children;
Key key;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@enumMainAxisSize
MainAxisSize mainAxisSize;
@enumTextBaseline
TextBaseline textBaseline;
@enumTextDirection
TextDirection textDirection;
@enumMainAxisAlignment
MainAxisAlignment mainAxisAlignment;
@enumCrossAxisAlignment
CrossAxisAlignment crossAxisAlignment;
@enumVerticalDirection
VerticalDirection verticalDirection;
}
@@ -0,0 +1,268 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'row.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$RowBase extends WidgetBase {
String childrenKey = 'children';
String keyKey = 'key';
String mainAxisSizeKey = 'mainAxisSize';
String textBaselineKey = 'textBaseline';
String textDirectionKey = 'textDirection';
String mainAxisAlignmentKey = 'mainAxisAlignment';
String crossAxisAlignmentKey = 'crossAxisAlignment';
String verticalDirectionKey = 'verticalDirection';
@override
Map<String, String> get properties => {
'children': 'List<Widget>',
'key': 'Key',
'mainAxisSize': 'MainAxisSize',
'textBaseline': 'TextBaseline',
'textDirection': 'TextDirection',
'mainAxisAlignment': 'MainAxisAlignment',
'crossAxisAlignment': 'CrossAxisAlignment',
'verticalDirection': 'VerticalDirection',
};
final _childrenListen = ValueNotifier<bool>(false);
List<WidgetBase> get childrenVal {
if (params[childrenKey] != null) {
final _children = <WidgetBase>[];
final _list = List.from(params[childrenKey]);
for (final item in _list) {
if (item is Map<String, dynamic>) {
_children.add(widgetRender(widgetContext, item));
}
}
return _children;
}
return null;
}
void childrenValUpdate(Map<String, dynamic> val) {
if (params[childrenKey] == null) {
params[childrenKey] = [];
}
params[childrenKey].add(val);
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
List<MainAxisSize> get mainAxisSizeValues => [
MainAxisSize.max,
MainAxisSize.min,
];
MainAxisSize get mainAxisSizeVal {
if (params[mainAxisSizeKey] != null) {
final _value = params[mainAxisSizeKey].toString().replaceAll('#', '');
return mainAxisSizeValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => MainAxisSize.max,
);
}
return MainAxisSize.max;
}
set mainAxisSizeVal(MainAxisSize val) {
params[mainAxisSizeKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<TextBaseline> get textBaselineValues => [
TextBaseline.alphabetic,
TextBaseline.ideographic,
];
TextBaseline get textBaselineVal {
if (params[textBaselineKey] != null) {
final _value = params[textBaselineKey].toString().replaceAll('#', '');
return textBaselineValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set textBaselineVal(TextBaseline val) {
params[textBaselineKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<TextDirection> get textDirectionValues => [
TextDirection.ltr,
TextDirection.rtl,
];
TextDirection get textDirectionVal {
if (params[textDirectionKey] != null) {
final _value = params[textDirectionKey].toString().replaceAll('#', '');
return textDirectionValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set textDirectionVal(TextDirection val) {
params[textDirectionKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<MainAxisAlignment> get mainAxisAlignmentValues => [
MainAxisAlignment.center,
MainAxisAlignment.end,
MainAxisAlignment.spaceAround,
MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceEvenly,
MainAxisAlignment.start,
];
MainAxisAlignment get mainAxisAlignmentVal {
if (params[mainAxisAlignmentKey] != null) {
final _value =
params[mainAxisAlignmentKey].toString().replaceAll('#', '');
return mainAxisAlignmentValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => MainAxisAlignment.start,
);
}
return MainAxisAlignment.start;
}
set mainAxisAlignmentVal(MainAxisAlignment val) {
params[mainAxisAlignmentKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<CrossAxisAlignment> get crossAxisAlignmentValues => [
CrossAxisAlignment.baseline,
CrossAxisAlignment.center,
CrossAxisAlignment.end,
CrossAxisAlignment.start,
CrossAxisAlignment.stretch,
];
CrossAxisAlignment get crossAxisAlignmentVal {
if (params[crossAxisAlignmentKey] != null) {
final _value =
params[crossAxisAlignmentKey].toString().replaceAll('#', '');
return crossAxisAlignmentValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => CrossAxisAlignment.center,
);
}
return CrossAxisAlignment.center;
}
set crossAxisAlignmentVal(CrossAxisAlignment val) {
params[crossAxisAlignmentKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<VerticalDirection> get verticalDirectionValues => [
VerticalDirection.up,
VerticalDirection.down,
];
VerticalDirection get verticalDirectionVal {
if (params[verticalDirectionKey] != null) {
final _value =
params[verticalDirectionKey].toString().replaceAll('#', '');
return verticalDirectionValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => VerticalDirection.down,
);
}
return VerticalDirection.down;
}
set verticalDirectionVal(VerticalDirection val) {
params[verticalDirectionKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: Row(
children: childrenVal == null && !widgetContext.isDragging
? []
: [
if (childrenVal != null)
for (final item in childrenVal) item.build(context),
if (widgetContext.isDragging)
DragTarget<WidgetBaseData>(
onAccept: (val) {
_childrenListen.value = false;
if (val != null) {
childrenValUpdate(val?.data);
}
},
onLeave: (val) {
_childrenListen.value = false;
},
onWillAccept: (val) {
_childrenListen.value = true;
return _childrenListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childrenListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(30, 30),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
],
crossAxisAlignment: crossAxisAlignmentVal,
key: keyVal,
mainAxisAlignment: mainAxisAlignmentVal,
mainAxisSize: mainAxisSizeVal,
textBaseline: textBaselineVal,
textDirection: textDirectionVal,
verticalDirection: verticalDirectionVal,
),
);
}
}
@@ -0,0 +1,86 @@
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dynamic_widget/src/material/enums.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../library.dart';
part 'scaffold.g.dart';
@WidgetClass('Scaffold')
class ScaffoldBase extends _$ScaffoldBase {
ScaffoldBase(this.widgetData, this.widgetContext, this.widgetRender);
Color backgroundColor;
Widget bottomSheet;
Widget drawer;
double drawerEdgeDragWidth;
Color drawerScrimColor;
Widget endDrawer;
FloatingActionButtonAnimator floatingActionButtonAnimator;
Key key;
bool resizeToAvoidBottomInset;
bool resizeToAvoidBottomPadding;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@WidgetKey.sizedWidget(
acceptWidth: 100,
acceptHeight: kToolbarHeight,
)
Widget appBar;
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
)
Widget body;
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 50,
)
Widget bottomNavigationBar;
@WidgetKey.widget(
acceptWidth: 50,
acceptHeight: 50,
)
Widget floatingActionButton;
@ListWidgetKey(empty: false)
List<Widget> persistentFooterButtons;
@enumFloatingActionButtonLocation
FloatingActionButtonLocation floatingActionButtonLocation;
@PropertyKey(defaultValue: 'true')
bool primary;
@enumDragStartBehavior
DragStartBehavior drawerDragStartBehavior;
@PropertyKey(defaultValue: 'false')
bool extendBody;
@PropertyKey(defaultValue: 'false')
bool extendBodyBehindAppBar;
@PropertyKey(defaultValue: 'true')
bool drawerEnableOpenDragGesture;
@PropertyKey(defaultValue: 'true')
bool endDrawerEnableOpenDragGesture;
}
@@ -0,0 +1,656 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'scaffold.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$ScaffoldBase extends WidgetBase {
String backgroundColorKey = 'backgroundColor';
String bottomSheetKey = 'bottomSheet';
String drawerKey = 'drawer';
String drawerEdgeDragWidthKey = 'drawerEdgeDragWidth';
String drawerScrimColorKey = 'drawerScrimColor';
String endDrawerKey = 'endDrawer';
String keyKey = 'key';
String resizeToAvoidBottomInsetKey = 'resizeToAvoidBottomInset';
String resizeToAvoidBottomPaddingKey = 'resizeToAvoidBottomPadding';
String appBarKey = 'appBar';
String bodyKey = 'body';
String bottomNavigationBarKey = 'bottomNavigationBar';
String floatingActionButtonKey = 'floatingActionButton';
String persistentFooterButtonsKey = 'persistentFooterButtons';
String floatingActionButtonLocationKey = 'floatingActionButtonLocation';
String primaryKey = 'primary';
String drawerDragStartBehaviorKey = 'drawerDragStartBehavior';
String extendBodyKey = 'extendBody';
String extendBodyBehindAppBarKey = 'extendBodyBehindAppBar';
String drawerEnableOpenDragGestureKey = 'drawerEnableOpenDragGesture';
String endDrawerEnableOpenDragGestureKey = 'endDrawerEnableOpenDragGesture';
@override
Map<String, String> get properties => {
'backgroundColor': 'Color',
'bottomSheet': 'Widget',
'drawer': 'Widget',
'drawerEdgeDragWidth': 'double',
'drawerScrimColor': 'Color',
'endDrawer': 'Widget',
'key': 'Key',
'resizeToAvoidBottomInset': 'bool',
'resizeToAvoidBottomPadding': 'bool',
'appBar': 'Widget',
'body': 'Widget',
'bottomNavigationBar': 'Widget',
'floatingActionButton': 'Widget',
'persistentFooterButtons': 'List<Widget>',
'floatingActionButtonLocation': 'FloatingActionButtonLocation',
'primary': 'bool',
'drawerDragStartBehavior': 'DragStartBehavior',
'extendBody': 'bool',
'extendBodyBehindAppBar': 'bool',
'drawerEnableOpenDragGesture': 'bool',
'endDrawerEnableOpenDragGesture': 'bool',
};
Color get backgroundColorVal {
if (params[backgroundColorKey] != null) {
int _value = null;
String description = params[backgroundColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[backgroundColorKey] is Map) {
if (params[backgroundColorKey]['name'] == 'Color' &&
params[backgroundColorKey]['params'] != null &&
params[backgroundColorKey]['params']['0'] != null) {
_value = int.tryParse(params[backgroundColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set backgroundColorVal(Color val) {
params[backgroundColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
WidgetBase get bottomSheetVal {
if (params[bottomSheetKey] != null) {
return widgetRender(widgetContext, params[bottomSheetKey]);
}
return null;
}
void bottomSheetValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'I4q6Uy7GEIh';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'J9azwBNjfuj';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'mDAfwi9XDIG';
}
params[bottomSheetKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
WidgetBase get drawerVal {
if (params[drawerKey] != null) {
return widgetRender(widgetContext, params[drawerKey]);
}
return null;
}
void drawerValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'JnFm7SiCEVm';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'B6AnOAwfHNr';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'dvF8QmLbTqI';
}
params[drawerKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
double get drawerEdgeDragWidthVal {
if (params[drawerEdgeDragWidthKey] != null) {
return params[drawerEdgeDragWidthKey] as double;
}
return null;
}
set drawerEdgeDragWidthVal(double val) {
params[drawerEdgeDragWidthKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Color get drawerScrimColorVal {
if (params[drawerScrimColorKey] != null) {
int _value = null;
String description = params[drawerScrimColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[drawerScrimColorKey] is Map) {
if (params[drawerScrimColorKey]['name'] == 'Color' &&
params[drawerScrimColorKey]['params'] != null &&
params[drawerScrimColorKey]['params']['0'] != null) {
_value = int.tryParse(params[drawerScrimColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set drawerScrimColorVal(Color val) {
params[drawerScrimColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
WidgetBase get endDrawerVal {
if (params[endDrawerKey] != null) {
return widgetRender(widgetContext, params[endDrawerKey]);
}
return null;
}
void endDrawerValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'L8al4s_rfdU';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'xwo6UUj2So3';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'P7IRlAouhZQ';
}
params[endDrawerKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
bool get resizeToAvoidBottomInsetVal {
if (params[resizeToAvoidBottomInsetKey] != null) {
return params[resizeToAvoidBottomInsetKey] as bool;
}
return null;
}
set resizeToAvoidBottomInsetVal(bool val) {
params[resizeToAvoidBottomInsetKey] = val;
widgetContext.onUpdate(id, widgetData);
}
bool get resizeToAvoidBottomPaddingVal {
if (params[resizeToAvoidBottomPaddingKey] != null) {
return params[resizeToAvoidBottomPaddingKey] as bool;
}
return null;
}
set resizeToAvoidBottomPaddingVal(bool val) {
params[resizeToAvoidBottomPaddingKey] = val;
widgetContext.onUpdate(id, widgetData);
}
final _appBarListen = ValueNotifier<bool>(false);
WidgetBase get appBarVal {
if (params[appBarKey] != null) {
return widgetRender(widgetContext, params[appBarKey]);
}
return null;
}
void appBarValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = '5_D946EWQsI';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'qd-32NGdeEJ';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'pCRE5Gul_7s';
}
params[appBarKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
final _bodyListen = ValueNotifier<bool>(false);
WidgetBase get bodyVal {
if (params[bodyKey] != null) {
return widgetRender(widgetContext, params[bodyKey]);
}
return null;
}
void bodyValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'TKQcbQKNiGx';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'HbrlFiW7K2_';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = '_qrogDf43qS';
}
params[bodyKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
final _bottomNavigationBarListen = ValueNotifier<bool>(false);
WidgetBase get bottomNavigationBarVal {
if (params[bottomNavigationBarKey] != null) {
return widgetRender(widgetContext, params[bottomNavigationBarKey]);
}
return null;
}
void bottomNavigationBarValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'eu6FStw9ufM';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'nl6Swcd5qVS';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'GVKxExlEfT9';
}
params[bottomNavigationBarKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
final _floatingActionButtonListen = ValueNotifier<bool>(false);
WidgetBase get floatingActionButtonVal {
if (params[floatingActionButtonKey] != null) {
return widgetRender(widgetContext, params[floatingActionButtonKey]);
}
return null;
}
void floatingActionButtonValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'EBgUdYqIKas';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'bt3TZZvVVoC';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'hodnir3yYsn';
}
params[floatingActionButtonKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
final _persistentFooterButtonsListen = ValueNotifier<bool>(false);
List<WidgetBase> get persistentFooterButtonsVal {
if (params[persistentFooterButtonsKey] != null) {
final _children = <WidgetBase>[];
final _list = List.from(params[persistentFooterButtonsKey]);
for (final item in _list) {
if (item is Map<String, dynamic>) {
_children.add(widgetRender(widgetContext, item));
}
}
return _children;
}
return null;
}
void persistentFooterButtonsValUpdate(Map<String, dynamic> val) {
if (params[persistentFooterButtonsKey] == null) {
params[persistentFooterButtonsKey] = [];
}
params[persistentFooterButtonsKey].add(val);
widgetContext.onUpdate(id, widgetData);
}
List<FloatingActionButtonLocation> get floatingActionButtonLocationValues => [
FloatingActionButtonLocation.endDocked,
FloatingActionButtonLocation.endFloat,
FloatingActionButtonLocation.miniCenterDocked,
FloatingActionButtonLocation.miniCenterFloat,
FloatingActionButtonLocation.miniCenterTop,
FloatingActionButtonLocation.miniEndDocked,
FloatingActionButtonLocation.miniEndFloat,
FloatingActionButtonLocation.miniEndTop,
FloatingActionButtonLocation.miniStartDocked,
FloatingActionButtonLocation.miniStartFloat,
FloatingActionButtonLocation.miniStartTop,
FloatingActionButtonLocation.startDocked,
FloatingActionButtonLocation.startFloat,
FloatingActionButtonLocation.startTop,
];
FloatingActionButtonLocation get floatingActionButtonLocationVal {
if (params[floatingActionButtonLocationKey] != null) {
final _value = params[floatingActionButtonLocationKey]
.toString()
.replaceAll('#', '');
return floatingActionButtonLocationValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set floatingActionButtonLocationVal(FloatingActionButtonLocation val) {
params[floatingActionButtonLocationKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
bool get primaryVal {
if (params[primaryKey] != null) {
return params[primaryKey] as bool;
}
return true;
}
set primaryVal(bool val) {
params[primaryKey] = val;
widgetContext.onUpdate(id, widgetData);
}
List<DragStartBehavior> get drawerDragStartBehaviorValues => [
DragStartBehavior.start,
DragStartBehavior.down,
];
DragStartBehavior get drawerDragStartBehaviorVal {
if (params[drawerDragStartBehaviorKey] != null) {
final _value =
params[drawerDragStartBehaviorKey].toString().replaceAll('#', '');
return drawerDragStartBehaviorValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => DragStartBehavior.start,
);
}
return DragStartBehavior.start;
}
set drawerDragStartBehaviorVal(DragStartBehavior val) {
params[drawerDragStartBehaviorKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
bool get extendBodyVal {
if (params[extendBodyKey] != null) {
return params[extendBodyKey] as bool;
}
return false;
}
set extendBodyVal(bool val) {
params[extendBodyKey] = val;
widgetContext.onUpdate(id, widgetData);
}
bool get extendBodyBehindAppBarVal {
if (params[extendBodyBehindAppBarKey] != null) {
return params[extendBodyBehindAppBarKey] as bool;
}
return false;
}
set extendBodyBehindAppBarVal(bool val) {
params[extendBodyBehindAppBarKey] = val;
widgetContext.onUpdate(id, widgetData);
}
bool get drawerEnableOpenDragGestureVal {
if (params[drawerEnableOpenDragGestureKey] != null) {
return params[drawerEnableOpenDragGestureKey] as bool;
}
return true;
}
set drawerEnableOpenDragGestureVal(bool val) {
params[drawerEnableOpenDragGestureKey] = val;
widgetContext.onUpdate(id, widgetData);
}
bool get endDrawerEnableOpenDragGestureVal {
if (params[endDrawerEnableOpenDragGestureKey] != null) {
return params[endDrawerEnableOpenDragGestureKey] as bool;
}
return true;
}
set endDrawerEnableOpenDragGestureVal(bool val) {
params[endDrawerEnableOpenDragGestureKey] = val;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: Scaffold(
appBar: !widgetContext.isDragging ||
(widgetContext.isDragging && appBarVal?.build(context) != null)
? (appBarVal?.build(context))
: PreferredSize(
preferredSize: Size(100.0, 56.0),
child: DragTarget<WidgetPreferredSizeBaseData>(
onAccept: (val) {
_appBarListen.value = false;
if (val != null) {
appBarValUpdate(val?.data);
}
},
onLeave: (val) {
_appBarListen.value = false;
},
onWillAccept: (val) {
_appBarListen.value = true;
return _appBarListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _appBarListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 56.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
backgroundColor: backgroundColorVal,
body: !widgetContext.isDragging ||
(widgetContext.isDragging && bodyVal?.build(context) != null)
? (bodyVal?.build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_bodyListen.value = false;
if (val != null) {
bodyValUpdate(val?.data);
}
},
onLeave: (val) {
_bodyListen.value = false;
},
onWillAccept: (val) {
_bodyListen.value = true;
return _bodyListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _bodyListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
bottomNavigationBar: !widgetContext.isDragging ||
(widgetContext.isDragging &&
bottomNavigationBarVal?.build(context) != null)
? (bottomNavigationBarVal?.build(context))
: PreferredSize(
preferredSize: Size(100.0, 50.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_bottomNavigationBarListen.value = false;
if (val != null) {
bottomNavigationBarValUpdate(val?.data);
}
},
onLeave: (val) {
_bottomNavigationBarListen.value = false;
},
onWillAccept: (val) {
_bottomNavigationBarListen.value = true;
return _bottomNavigationBarListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _bottomNavigationBarListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 50.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
bottomSheet: bottomSheetVal?.build(context),
drawer: drawerVal?.build(context),
drawerDragStartBehavior: drawerDragStartBehaviorVal,
drawerEdgeDragWidth: drawerEdgeDragWidthVal,
drawerEnableOpenDragGesture: drawerEnableOpenDragGestureVal,
drawerScrimColor: drawerScrimColorVal,
endDrawer: endDrawerVal?.build(context),
endDrawerEnableOpenDragGesture: endDrawerEnableOpenDragGestureVal,
extendBody: extendBodyVal,
extendBodyBehindAppBar: extendBodyBehindAppBarVal,
floatingActionButton: !widgetContext.isDragging ||
(widgetContext.isDragging &&
floatingActionButtonVal?.build(context) != null)
? (floatingActionButtonVal?.build(context))
: PreferredSize(
preferredSize: Size(50.0, 50.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_floatingActionButtonListen.value = false;
if (val != null) {
floatingActionButtonValUpdate(val?.data);
}
},
onLeave: (val) {
_floatingActionButtonListen.value = false;
},
onWillAccept: (val) {
_floatingActionButtonListen.value = true;
return _floatingActionButtonListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _floatingActionButtonListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(50.0, 50.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
floatingActionButtonLocation: floatingActionButtonLocationVal,
key: keyVal,
persistentFooterButtons:
persistentFooterButtonsVal == null && !widgetContext.isDragging
? null
: [
if (persistentFooterButtonsVal != null)
for (final item in persistentFooterButtonsVal)
item.build(context),
if (widgetContext.isDragging)
DragTarget<WidgetBaseData>(
onAccept: (val) {
_persistentFooterButtonsListen.value = false;
if (val != null) {
persistentFooterButtonsValUpdate(val?.data);
}
},
onLeave: (val) {
_persistentFooterButtonsListen.value = false;
},
onWillAccept: (val) {
_persistentFooterButtonsListen.value = true;
return _persistentFooterButtonsListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _persistentFooterButtonsListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(30, 30),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
],
primary: primaryVal,
resizeToAvoidBottomInset: resizeToAvoidBottomInsetVal,
resizeToAvoidBottomPadding: resizeToAvoidBottomPaddingVal,
),
);
}
}
@@ -0,0 +1,52 @@
import 'dart:convert';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../enums.dart';
import '../library.dart';
part 'single_child_scroll_view.g.dart';
@WidgetClass('SingleChildScrollView')
class SingleChildScrollViewBase extends _$SingleChildScrollViewBase {
SingleChildScrollViewBase(this.widgetData, this.widgetContext, this.widgetRender);
@enumClipHardEdge
Clip clipBehavior;
ScrollController controller;
@enumDragStartBehavior
DragStartBehavior dragStartBehavior;
Key key;
EdgeInsets padding;
ScrollPhysics physics;
bool primary;
@enumAxis
Axis scrollDirection;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@WidgetKey.widget(
defaultValue: 'Placeholder',
)
Widget child;
@PropertyKey(defaultValue: 'false')
bool reverse;
}
@@ -0,0 +1,257 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'single_child_scroll_view.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$SingleChildScrollViewBase extends WidgetBase {
String clipBehaviorKey = 'clipBehavior';
String dragStartBehaviorKey = 'dragStartBehavior';
String keyKey = 'key';
String paddingKey = 'padding';
String primaryKey = 'primary';
String scrollDirectionKey = 'scrollDirection';
String childKey = 'child';
String reverseKey = 'reverse';
@override
Map<String, String> get properties => {
'clipBehavior': 'Clip',
'dragStartBehavior': 'DragStartBehavior',
'key': 'Key',
'padding': 'EdgeInsets',
'primary': 'bool',
'scrollDirection': 'Axis',
'child': 'Widget',
'reverse': 'bool',
};
List<Clip> get clipBehaviorValues => [
Clip.none,
Clip.antiAlias,
Clip.antiAliasWithSaveLayer,
Clip.hardEdge,
];
Clip get clipBehaviorVal {
if (params[clipBehaviorKey] != null) {
final _value = params[clipBehaviorKey].toString().replaceAll('#', '');
return clipBehaviorValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => Clip.hardEdge,
);
}
return Clip.hardEdge;
}
set clipBehaviorVal(Clip val) {
params[clipBehaviorKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<DragStartBehavior> get dragStartBehaviorValues => [
DragStartBehavior.start,
DragStartBehavior.down,
];
DragStartBehavior get dragStartBehaviorVal {
if (params[dragStartBehaviorKey] != null) {
final _value =
params[dragStartBehaviorKey].toString().replaceAll('#', '');
return dragStartBehaviorValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => DragStartBehavior.start,
);
}
return DragStartBehavior.start;
}
set dragStartBehaviorVal(DragStartBehavior val) {
params[dragStartBehaviorKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
EdgeInsets get paddingVal {
EdgeInsets _spacing = EdgeInsets.all(0.0);
if (params[paddingKey] != null) {
double top = 0;
double bottom = 0;
double left = 0;
double right = 0;
Map<String, dynamic> _spacingParams = params[paddingKey]['params'];
top = _spacingParams['top'] ?? 0;
bottom = _spacingParams['bottom'] ?? 0;
left = _spacingParams['left'] ?? 0;
right = _spacingParams['right'] ?? 0;
_spacing = EdgeInsets.fromLTRB(left, top, right, bottom);
}
return _spacing;
}
set paddingVal(EdgeInsets val) {
params[paddingKey] = {
"name": "EdgeInsets.only",
"id": "paddingKeyEdgeInsets",
"params": {
"top": val.top,
"bottom": val.bottom,
"left": val.left,
"right": val.right,
}
};
widgetContext.onUpdate(id, widgetData);
}
bool get primaryVal {
if (params[primaryKey] != null) {
return params[primaryKey] as bool;
}
return null;
}
set primaryVal(bool val) {
params[primaryKey] = val;
widgetContext.onUpdate(id, widgetData);
}
List<Axis> get scrollDirectionValues => [
Axis.horizontal,
Axis.vertical,
];
Axis get scrollDirectionVal {
if (params[scrollDirectionKey] != null) {
final _value = params[scrollDirectionKey].toString().replaceAll('#', '');
return scrollDirectionValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => Axis.vertical,
);
}
return Axis.vertical;
}
set scrollDirectionVal(Axis val) {
params[scrollDirectionKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'uQwrTTKp7';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'ki31QXZogS';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'iblkchlboD';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
bool get reverseVal {
if (params[reverseKey] != null) {
return params[reverseKey] as bool;
}
return false;
}
set reverseVal(bool val) {
params[reverseKey] = val;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: SingleChildScrollView(
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': '6tKIMyPEXW',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(30.0, 30.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(30.0, 30.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
clipBehavior: clipBehaviorVal,
dragStartBehavior: dragStartBehaviorVal,
key: keyVal,
padding: paddingVal,
primary: primaryVal,
reverse: reverseVal,
scrollDirection: scrollDirectionVal,
),
);
}
}
@@ -0,0 +1,34 @@
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../library.dart';
part 'sized_box.g.dart';
@WidgetClass('SizedBox')
class SizedBoxBase extends _$SizedBoxBase {
SizedBoxBase(this.widgetData, this.widgetContext, this.widgetRender);
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
)
Widget child;
double width;
Key key;
double height;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@override
final GenerateWidget widgetRender;
}
@@ -0,0 +1,141 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'sized_box.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$SizedBoxBase extends WidgetBase {
String childKey = 'child';
String widthKey = 'width';
String keyKey = 'key';
String heightKey = 'height';
@override
Map<String, String> get properties => {
'child': 'Widget',
'width': 'double',
'key': 'Key',
'height': 'double',
};
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'CYErAYW-uxu';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'XLRnB7SQStb';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'wsswiCJUz1E';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
double get widthVal {
if (params[widthKey] != null) {
return params[widthKey] as double;
}
return null;
}
set widthVal(double val) {
params[widthKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
double get heightVal {
if (params[heightKey] != null) {
return params[heightKey] as double;
}
return null;
}
set heightVal(double val) {
params[heightKey] = val;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: SizedBox(
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
height: heightVal,
key: keyVal,
width: widthVal,
),
);
}
}
@@ -0,0 +1,41 @@
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../enums.dart';
import '../library.dart';
part 'stack.g.dart';
@WidgetClass('Stack')
class StackBase extends _$StackBase {
StackBase(this.widgetData, this.widgetContext, this.widgetRender);
List<Widget> children;
Key key;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@enumOverflow
Overflow overflow;
@enumAlignmentTopLeft
Alignment alignment;
@enumTextDirection
TextDirection textDirection;
@enumStackFit
StackFit fit;
}
@@ -0,0 +1,218 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'stack.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$StackBase extends WidgetBase {
String childrenKey = 'children';
String keyKey = 'key';
String overflowKey = 'overflow';
String alignmentKey = 'alignment';
String textDirectionKey = 'textDirection';
String fitKey = 'fit';
@override
Map<String, String> get properties => {
'children': 'List<Widget>',
'key': 'Key',
'overflow': 'Overflow',
'alignment': 'Alignment',
'textDirection': 'TextDirection',
'fit': 'StackFit',
};
final _childrenListen = ValueNotifier<bool>(false);
List<WidgetBase> get childrenVal {
if (params[childrenKey] != null) {
final _children = <WidgetBase>[];
final _list = List.from(params[childrenKey]);
for (final item in _list) {
if (item is Map<String, dynamic>) {
_children.add(widgetRender(widgetContext, item));
}
}
return _children;
}
return null;
}
void childrenValUpdate(Map<String, dynamic> val) {
if (params[childrenKey] == null) {
params[childrenKey] = [];
}
params[childrenKey].add(val);
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
List<Overflow> get overflowValues => [
Overflow.clip,
Overflow.visible,
];
Overflow get overflowVal {
if (params[overflowKey] != null) {
final _value = params[overflowKey].toString().replaceAll('#', '');
return overflowValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => Overflow.clip,
);
}
return Overflow.clip;
}
set overflowVal(Overflow val) {
params[overflowKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<Alignment> get alignmentValues => [
Alignment.bottomCenter,
Alignment.bottomLeft,
Alignment.bottomRight,
Alignment.center,
Alignment.centerLeft,
Alignment.centerRight,
Alignment.topCenter,
Alignment.topLeft,
Alignment.topRight,
];
Alignment get alignmentVal {
if (params[alignmentKey] != null) {
final _value = params[alignmentKey].toString().replaceAll('#', '');
return alignmentValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => Alignment.topLeft,
);
}
return Alignment.topLeft;
}
set alignmentVal(Alignment val) {
params[alignmentKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<TextDirection> get textDirectionValues => [
TextDirection.ltr,
TextDirection.rtl,
];
TextDirection get textDirectionVal {
if (params[textDirectionKey] != null) {
final _value = params[textDirectionKey].toString().replaceAll('#', '');
return textDirectionValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set textDirectionVal(TextDirection val) {
params[textDirectionKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<StackFit> get fitValues => [
StackFit.loose,
StackFit.expand,
StackFit.passthrough,
];
StackFit get fitVal {
if (params[fitKey] != null) {
final _value = params[fitKey].toString().replaceAll('#', '');
return fitValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => StackFit.loose,
);
}
return StackFit.loose;
}
set fitVal(StackFit val) {
params[fitKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: Stack(
alignment: alignmentVal,
children: childrenVal == null && !widgetContext.isDragging
? []
: [
if (childrenVal != null)
for (final item in childrenVal) item.build(context),
if (widgetContext.isDragging)
DragTarget<WidgetBaseData>(
onAccept: (val) {
_childrenListen.value = false;
if (val != null) {
childrenValUpdate(val?.data);
}
},
onLeave: (val) {
_childrenListen.value = false;
},
onWillAccept: (val) {
_childrenListen.value = true;
return _childrenListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childrenListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(30, 30),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
],
fit: fitVal,
key: keyVal,
overflow: overflowVal,
textDirection: textDirectionVal,
),
);
}
}
@@ -0,0 +1,54 @@
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../enums.dart';
import '../library.dart';
import '../properties/text_style.dart';
part 'text.g.dart';
@WidgetClass('Text')
class TextBase extends _$TextBase {
TextBase(this.widgetData, this.widgetContext, this.widgetRender);
Key key;
Locale locale;
int maxLines;
String semanticsLabel;
bool softWrap;
StrutStyle strutStyle;
TextHeightBehavior textHeightBehavior;
double textScaleFactor;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@PropertyKey(key: '0', defaultValue: '')
String data;
@SupportedKey()
TextStyleBase style;
@enumTextAlign
TextAlign textAlign;
@enumTextDirection
TextDirection textDirection;
@enumTextOverflow
TextOverflow overflow;
@enumTextWidthBasis
TextWidthBasis textWidthBasis;
}
@@ -0,0 +1,246 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'text.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$TextBase extends WidgetBase {
String keyKey = 'key';
String maxLinesKey = 'maxLines';
String semanticsLabelKey = 'semanticsLabel';
String softWrapKey = 'softWrap';
String textScaleFactorKey = 'textScaleFactor';
String dataKey = '0';
String styleKey = 'style';
String textAlignKey = 'textAlign';
String textDirectionKey = 'textDirection';
String overflowKey = 'overflow';
String textWidthBasisKey = 'textWidthBasis';
@override
Map<String, String> get properties => {
'key': 'Key',
'maxLines': 'int',
'semanticsLabel': 'String',
'softWrap': 'bool',
'textScaleFactor': 'double',
'0': 'String',
'style': 'TextStyleBase',
'textAlign': 'TextAlign',
'textDirection': 'TextDirection',
'overflow': 'TextOverflow',
'textWidthBasis': 'TextWidthBasis',
};
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
int get maxLinesVal {
if (params[maxLinesKey] != null) {
return params[maxLinesKey] as int;
}
return null;
}
set maxLinesVal(int val) {
params[maxLinesKey] = val;
widgetContext.onUpdate(id, widgetData);
}
String get semanticsLabelVal {
if (params[semanticsLabelKey] != null) {
return params[semanticsLabelKey] as String;
}
return null;
}
set semanticsLabelVal(String val) {
params[semanticsLabelKey] = val;
widgetContext.onUpdate(id, widgetData);
}
bool get softWrapVal {
if (params[softWrapKey] != null) {
return params[softWrapKey] as bool;
}
return null;
}
set softWrapVal(bool val) {
params[softWrapKey] = val;
widgetContext.onUpdate(id, widgetData);
}
double get textScaleFactorVal {
if (params[textScaleFactorKey] != null) {
return params[textScaleFactorKey] as double;
}
return null;
}
set textScaleFactorVal(double val) {
params[textScaleFactorKey] = val;
widgetContext.onUpdate(id, widgetData);
}
String get dataVal {
if (params[dataKey] != null) {
return params[dataKey] as String;
}
return '';
}
set dataVal(String val) {
params[dataKey] = val;
widgetContext.onUpdate(id, widgetData);
}
TextStyleBase get styleVal {
if (params[styleKey] != null) {
return TextStyleBase(params[styleKey], widgetContext, widgetRender);
}
return null;
}
set styleVal(TextStyleBase val) {
params[styleKey] = val;
widgetContext.onUpdate(id, widgetData);
}
List<TextAlign> get textAlignValues => [
TextAlign.center,
TextAlign.end,
TextAlign.justify,
TextAlign.left,
TextAlign.right,
TextAlign.start,
];
TextAlign get textAlignVal {
if (params[textAlignKey] != null) {
final _value = params[textAlignKey].toString().replaceAll('#', '');
return textAlignValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set textAlignVal(TextAlign val) {
params[textAlignKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<TextDirection> get textDirectionValues => [
TextDirection.ltr,
TextDirection.rtl,
];
TextDirection get textDirectionVal {
if (params[textDirectionKey] != null) {
final _value = params[textDirectionKey].toString().replaceAll('#', '');
return textDirectionValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set textDirectionVal(TextDirection val) {
params[textDirectionKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<TextOverflow> get overflowValues => [
TextOverflow.clip,
TextOverflow.ellipsis,
TextOverflow.fade,
TextOverflow.visible,
];
TextOverflow get overflowVal {
if (params[overflowKey] != null) {
final _value = params[overflowKey].toString().replaceAll('#', '');
return overflowValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set overflowVal(TextOverflow val) {
params[overflowKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<TextWidthBasis> get textWidthBasisValues => [
TextWidthBasis.parent,
TextWidthBasis.longestLine,
];
TextWidthBasis get textWidthBasisVal {
if (params[textWidthBasisKey] != null) {
final _value = params[textWidthBasisKey].toString().replaceAll('#', '');
return textWidthBasisValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set textWidthBasisVal(TextWidthBasis val) {
params[textWidthBasisKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: Text(
dataVal,
key: keyVal,
maxLines: maxLinesVal,
overflow: overflowVal,
semanticsLabel: semanticsLabelVal,
softWrap: softWrapVal,
style: styleVal?.build(context),
textAlign: textAlignVal,
textDirection: textDirectionVal,
textScaleFactor: textScaleFactorVal,
textWidthBasis: textWidthBasisVal,
),
);
}
}
@@ -0,0 +1,43 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../library.dart';
import '../theme/theme_data.dart';
part 'theme.g.dart';
@WidgetClass('Theme')
class ThemeBase extends _$ThemeBase {
ThemeBase(this.widgetData, this.widgetContext, this.widgetRender);
Key key;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@SupportedKey()
ThemeDataBase data;
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
defaultValue: 'Placeholder',
)
Widget child;
@PropertyKey(defaultValue: 'false')
bool isMaterialAppTheme;
}
@@ -0,0 +1,148 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'theme.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$ThemeBase extends WidgetBase {
String keyKey = 'key';
String dataKey = 'data';
String childKey = 'child';
String isMaterialAppThemeKey = 'isMaterialAppTheme';
@override
Map<String, String> get properties => {
'key': 'Key',
'data': 'ThemeDataBase',
'child': 'Widget',
'isMaterialAppTheme': 'bool',
};
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
ThemeDataBase get dataVal {
if (params[dataKey] != null) {
return ThemeDataBase(params[dataKey], widgetContext, widgetRender);
}
return null;
}
set dataVal(ThemeDataBase val) {
params[dataKey] = val;
widgetContext.onUpdate(id, widgetData);
}
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 't-ydQvDY8zX';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'NnB4PB9U7Be';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'cjbsEX3-PaI';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
bool get isMaterialAppThemeVal {
if (params[isMaterialAppThemeKey] != null) {
return params[isMaterialAppThemeKey] as bool;
}
return false;
}
set isMaterialAppThemeVal(bool val) {
params[isMaterialAppThemeKey] = val;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: Theme(
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': 'PbsLHuEXMT1',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
data: dataVal?.build(context),
isMaterialAppTheme: isMaterialAppThemeVal,
key: keyVal,
),
);
}
}
@@ -0,0 +1,84 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../enums.dart';
import '../library.dart';
import '../theme/theme_data.dart';
part 'widgets_app.g.dart';
@WidgetClass('WidgetsApp', allowTap: false)
class WidgetsAppBase extends _$WidgetsAppBase {
WidgetsAppBase(this.widgetData, this.widgetContext, this.widgetRender);
@ListWidgetKey(acceptType: '')
List<NavigatorObserver> navigatorObservers = const <NavigatorObserver>[];
Map<Type, Action<Intent>> actions;
Color color;
Map<String, Widget Function(BuildContext)> routes =
const <String, WidgetBuilder>{};
String initialRoute;
Key key;
Locale locale;
Iterable<LocalizationsDelegate<dynamic>> localizationsDelegates;
GlobalKey<NavigatorState> navigatorKey;
Map<LogicalKeySet, Intent> shortcuts;
Iterable<Locale> supportedLocales = const <Locale>[Locale('en', 'US')];
String title = '';
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@PropertyKey(defaultValue: 'false')
bool checkerboardOffscreenLayers;
@PropertyKey(defaultValue: 'false')
bool checkerboardRasterCacheImages;
@PropertyKey(defaultValue: 'true')
bool debugShowCheckedModeBanner;
@PropertyKey(defaultValue: 'false')
bool showPerformanceOverlay;
@PropertyKey(defaultValue: 'false')
bool showSemanticsDebugger;
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
defaultValue: 'Placeholder',
)
Widget home;
// Route<dynamic> Function(RouteSettings) onGenerateRoute;
// List<Route<dynamic>> Function(String) onGenerateInitialRoutes;
// Route<dynamic> Function(RouteSettings) onUnknownRoute;
// Widget Function(BuildContext, Widget) builder;
// String Function(BuildContext) onGenerateTitle;
// Locale Function(List<Locale>, Iterable<Locale>) localeListResolutionCallback;
// Locale Function(Locale, Iterable<Locale>) localeResolutionCallback;
}
@@ -0,0 +1,281 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'widgets_app.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$WidgetsAppBase extends WidgetBase {
String navigatorObserversKey = 'navigatorObservers';
String colorKey = 'color';
String initialRouteKey = 'initialRoute';
String keyKey = 'key';
String titleKey = 'title';
String checkerboardOffscreenLayersKey = 'checkerboardOffscreenLayers';
String checkerboardRasterCacheImagesKey = 'checkerboardRasterCacheImages';
String debugShowCheckedModeBannerKey = 'debugShowCheckedModeBanner';
String showPerformanceOverlayKey = 'showPerformanceOverlay';
String showSemanticsDebuggerKey = 'showSemanticsDebugger';
String homeKey = 'home';
@override
Map<String, String> get properties => {
'navigatorObservers': 'List<NavigatorObserver>',
'color': 'Color',
'initialRoute': 'String',
'key': 'Key',
'title': 'String',
'checkerboardOffscreenLayers': 'bool',
'checkerboardRasterCacheImages': 'bool',
'debugShowCheckedModeBanner': 'bool',
'showPerformanceOverlay': 'bool',
'showSemanticsDebugger': 'bool',
'home': 'Widget',
};
final _navigatorObserversListen = ValueNotifier<bool>(false);
List<WidgetBase> get navigatorObserversVal {
if (params[navigatorObserversKey] != null) {
final _children = <WidgetBase>[];
final _list = List.from(params[navigatorObserversKey]);
for (final item in _list) {
if (item is Map<String, dynamic>) {
_children.add(widgetRender(widgetContext, item));
}
}
return _children;
}
return null;
}
void navigatorObserversValUpdate(Map<String, dynamic> val) {
if (params[navigatorObserversKey] == null) {
params[navigatorObserversKey] = [];
}
params[navigatorObserversKey].add(val);
widgetContext.onUpdate(id, widgetData);
}
Color get colorVal {
if (params[colorKey] != null) {
int _value = null;
String description = params[colorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[colorKey] is Map) {
if (params[colorKey]['name'] == 'Color' &&
params[colorKey]['params'] != null &&
params[colorKey]['params']['0'] != null) {
_value = int.tryParse(params[colorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set colorVal(Color val) {
params[colorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
String get initialRouteVal {
if (params[initialRouteKey] != null) {
return params[initialRouteKey] as String;
}
return null;
}
set initialRouteVal(String val) {
params[initialRouteKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
String get titleVal {
if (params[titleKey] != null) {
return params[titleKey] as String;
}
return null;
}
set titleVal(String val) {
params[titleKey] = val;
widgetContext.onUpdate(id, widgetData);
}
bool get checkerboardOffscreenLayersVal {
if (params[checkerboardOffscreenLayersKey] != null) {
return params[checkerboardOffscreenLayersKey] as bool;
}
return false;
}
set checkerboardOffscreenLayersVal(bool val) {
params[checkerboardOffscreenLayersKey] = val;
widgetContext.onUpdate(id, widgetData);
}
bool get checkerboardRasterCacheImagesVal {
if (params[checkerboardRasterCacheImagesKey] != null) {
return params[checkerboardRasterCacheImagesKey] as bool;
}
return false;
}
set checkerboardRasterCacheImagesVal(bool val) {
params[checkerboardRasterCacheImagesKey] = val;
widgetContext.onUpdate(id, widgetData);
}
bool get debugShowCheckedModeBannerVal {
if (params[debugShowCheckedModeBannerKey] != null) {
return params[debugShowCheckedModeBannerKey] as bool;
}
return true;
}
set debugShowCheckedModeBannerVal(bool val) {
params[debugShowCheckedModeBannerKey] = val;
widgetContext.onUpdate(id, widgetData);
}
bool get showPerformanceOverlayVal {
if (params[showPerformanceOverlayKey] != null) {
return params[showPerformanceOverlayKey] as bool;
}
return false;
}
set showPerformanceOverlayVal(bool val) {
params[showPerformanceOverlayKey] = val;
widgetContext.onUpdate(id, widgetData);
}
bool get showSemanticsDebuggerVal {
if (params[showSemanticsDebuggerKey] != null) {
return params[showSemanticsDebuggerKey] as bool;
}
return false;
}
set showSemanticsDebuggerVal(bool val) {
params[showSemanticsDebuggerKey] = val;
widgetContext.onUpdate(id, widgetData);
}
final _homeListen = ValueNotifier<bool>(false);
WidgetBase get homeVal {
if (params[homeKey] != null) {
return widgetRender(widgetContext, params[homeKey]);
}
return null;
}
void homeValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'wOt4TdPI--';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'vi6TcrDRcoP';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = '1h_TtKtg4ot';
}
params[homeKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return WidgetsApp(
checkerboardOffscreenLayers: checkerboardOffscreenLayersVal,
checkerboardRasterCacheImages: checkerboardRasterCacheImagesVal,
color: colorVal,
debugShowCheckedModeBanner: debugShowCheckedModeBannerVal,
home: !widgetContext.isDragging ||
(widgetContext.isDragging && homeVal?.build(context) != null)
? (homeVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': 'Acy1f5i-Yqd',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_homeListen.value = false;
if (val != null) {
homeValUpdate(val?.data);
}
},
onLeave: (val) {
_homeListen.value = false;
},
onWillAccept: (val) {
_homeListen.value = true;
return _homeListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _homeListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
initialRoute: initialRouteVal,
key: keyVal,
navigatorObservers: navigatorObserversVal == null &&
!widgetContext.isDragging
? []
: [
if (navigatorObserversVal != null)
for (final item in navigatorObserversVal) item.build(context),
],
showPerformanceOverlay: showPerformanceOverlayVal,
showSemanticsDebugger: showSemanticsDebuggerVal,
title: titleVal,
);
}
}
@@ -0,0 +1,50 @@
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../enums.dart';
import '../library.dart';
part 'wrap.g.dart';
@WidgetClass('Wrap')
class WrapBase extends _$WrapBase {
WrapBase(this.widgetData, this.widgetContext, this.widgetRender);
List<Widget> children;
Key key;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@enumAxisHorizontal
Axis direction;
@enumTextDirection
TextDirection textDirection;
@enumWrapAlignment
WrapAlignment alignment, runAlignment;
@enumWrapCrossAlignment
WrapCrossAlignment crossAxisAlignment;
@enumVerticalDirection
VerticalDirection verticalDirection;
@PropertyKey(defaultValue: '0.0')
double runSpacing;
@PropertyKey(defaultValue: '0.0')
double spacing;
}
@@ -0,0 +1,299 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'wrap.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$WrapBase extends WidgetBase {
String childrenKey = 'children';
String keyKey = 'key';
String directionKey = 'direction';
String textDirectionKey = 'textDirection';
String alignmentKey = 'alignment';
String runAlignmentKey = 'runAlignment';
String crossAxisAlignmentKey = 'crossAxisAlignment';
String verticalDirectionKey = 'verticalDirection';
String runSpacingKey = 'runSpacing';
String spacingKey = 'spacing';
@override
Map<String, String> get properties => {
'children': 'List<Widget>',
'key': 'Key',
'direction': 'Axis',
'textDirection': 'TextDirection',
'alignment': 'WrapAlignment',
'runAlignment': 'WrapAlignment',
'crossAxisAlignment': 'WrapCrossAlignment',
'verticalDirection': 'VerticalDirection',
'runSpacing': 'double',
'spacing': 'double',
};
final _childrenListen = ValueNotifier<bool>(false);
List<WidgetBase> get childrenVal {
if (params[childrenKey] != null) {
final _children = <WidgetBase>[];
final _list = List.from(params[childrenKey]);
for (final item in _list) {
if (item is Map<String, dynamic>) {
_children.add(widgetRender(widgetContext, item));
}
}
return _children;
}
return null;
}
void childrenValUpdate(Map<String, dynamic> val) {
if (params[childrenKey] == null) {
params[childrenKey] = [];
}
params[childrenKey].add(val);
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
List<Axis> get directionValues => [
Axis.horizontal,
Axis.vertical,
];
Axis get directionVal {
if (params[directionKey] != null) {
final _value = params[directionKey].toString().replaceAll('#', '');
return directionValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => Axis.horizontal,
);
}
return Axis.horizontal;
}
set directionVal(Axis val) {
params[directionKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<TextDirection> get textDirectionValues => [
TextDirection.ltr,
TextDirection.rtl,
];
TextDirection get textDirectionVal {
if (params[textDirectionKey] != null) {
final _value = params[textDirectionKey].toString().replaceAll('#', '');
return textDirectionValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set textDirectionVal(TextDirection val) {
params[textDirectionKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<WrapAlignment> get alignmentValues => [
WrapAlignment.center,
WrapAlignment.end,
WrapAlignment.spaceAround,
WrapAlignment.spaceBetween,
WrapAlignment.spaceEvenly,
WrapAlignment.start,
];
WrapAlignment get alignmentVal {
if (params[alignmentKey] != null) {
final _value = params[alignmentKey].toString().replaceAll('#', '');
return alignmentValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => WrapAlignment.start,
);
}
return WrapAlignment.start;
}
set alignmentVal(WrapAlignment val) {
params[alignmentKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<WrapAlignment> get runAlignmentValues => [
WrapAlignment.center,
WrapAlignment.end,
WrapAlignment.spaceAround,
WrapAlignment.spaceBetween,
WrapAlignment.spaceEvenly,
WrapAlignment.start,
];
WrapAlignment get runAlignmentVal {
if (params[runAlignmentKey] != null) {
final _value = params[runAlignmentKey].toString().replaceAll('#', '');
return runAlignmentValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => WrapAlignment.start,
);
}
return WrapAlignment.start;
}
set runAlignmentVal(WrapAlignment val) {
params[runAlignmentKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<WrapCrossAlignment> get crossAxisAlignmentValues => [
WrapCrossAlignment.center,
WrapCrossAlignment.end,
WrapCrossAlignment.start,
];
WrapCrossAlignment get crossAxisAlignmentVal {
if (params[crossAxisAlignmentKey] != null) {
final _value =
params[crossAxisAlignmentKey].toString().replaceAll('#', '');
return crossAxisAlignmentValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => WrapCrossAlignment.center,
);
}
return WrapCrossAlignment.center;
}
set crossAxisAlignmentVal(WrapCrossAlignment val) {
params[crossAxisAlignmentKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<VerticalDirection> get verticalDirectionValues => [
VerticalDirection.up,
VerticalDirection.down,
];
VerticalDirection get verticalDirectionVal {
if (params[verticalDirectionKey] != null) {
final _value =
params[verticalDirectionKey].toString().replaceAll('#', '');
return verticalDirectionValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => VerticalDirection.down,
);
}
return VerticalDirection.down;
}
set verticalDirectionVal(VerticalDirection val) {
params[verticalDirectionKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
double get runSpacingVal {
if (params[runSpacingKey] != null) {
return params[runSpacingKey] as double;
}
return 0.0;
}
set runSpacingVal(double val) {
params[runSpacingKey] = val;
widgetContext.onUpdate(id, widgetData);
}
double get spacingVal {
if (params[spacingKey] != null) {
return params[spacingKey] as double;
}
return 0.0;
}
set spacingVal(double val) {
params[spacingKey] = val;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: Wrap(
alignment: alignmentVal,
children: childrenVal == null && !widgetContext.isDragging
? []
: [
if (childrenVal != null)
for (final item in childrenVal) item.build(context),
if (widgetContext.isDragging)
DragTarget<WidgetBaseData>(
onAccept: (val) {
_childrenListen.value = false;
if (val != null) {
childrenValUpdate(val?.data);
}
},
onLeave: (val) {
_childrenListen.value = false;
},
onWillAccept: (val) {
_childrenListen.value = true;
return _childrenListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childrenListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(30, 30),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
],
crossAxisAlignment: crossAxisAlignmentVal,
direction: directionVal,
key: keyVal,
runAlignment: runAlignmentVal,
runSpacing: runSpacingVal,
spacing: spacingVal,
textDirection: textDirectionVal,
verticalDirection: verticalDirectionVal,
),
);
}
}
@@ -0,0 +1,389 @@
import 'package:widget_gen/widget_gen_annotations.dart';
const enumAlignment = EnumKey(
defaultValue: 'Alignment.center',
propertyType: 'Alignment',
values: _alignmentValues,
);
const enumFloatingActionButtonLocation = EnumKey(
propertyType: 'FloatingActionButtonLocation',
values: const [
'FloatingActionButtonLocation.endDocked',
'FloatingActionButtonLocation.endFloat',
'FloatingActionButtonLocation.miniCenterDocked',
'FloatingActionButtonLocation.miniCenterFloat',
'FloatingActionButtonLocation.miniCenterTop',
'FloatingActionButtonLocation.miniEndDocked',
'FloatingActionButtonLocation.miniEndFloat',
'FloatingActionButtonLocation.miniEndTop',
'FloatingActionButtonLocation.miniStartDocked',
'FloatingActionButtonLocation.miniStartFloat',
'FloatingActionButtonLocation.miniStartTop',
'FloatingActionButtonLocation.startDocked',
'FloatingActionButtonLocation.startFloat',
'FloatingActionButtonLocation.startTop',
],
);
const enumClip = EnumKey(
propertyType: 'Clip',
defaultValue: 'Clip.none',
values: _clipValues,
);
const enumTargetPlatform = EnumKey(
propertyType: 'TargetPlatform',
values: [
'TargetPlatform.android',
'TargetPlatform.fuchsia',
'TargetPlatform.iOS',
'TargetPlatform.linux',
'TargetPlatform.macOS',
'TargetPlatform.windows',
],
);
const enumVisualDensity = EnumKey(
propertyType: 'VisualDensity',
values: [
'VisualDensity.adaptivePlatformDensity',
'VisualDensity.comfortable',
'VisualDensity.compact',
'VisualDensity.standard',
],
);
const enumBrightness = EnumKey(
propertyType: 'Brightness',
values: [
'Brightness.light',
'Brightness.dark',
],
);
const enumTextBaseline = EnumKey(
propertyType: 'TextBaseline',
values: [
'TextBaseline.alphabetic',
'TextBaseline.ideographic',
],
);
const enumTextDirection = EnumKey(
propertyType: 'TextDirection',
values: [
'TextDirection.ltr',
'TextDirection.rtl',
],
);
const enumMainAxisSize = EnumKey(
propertyType: 'MainAxisSize',
defaultValue: 'MainAxisSize.max',
values: [
'MainAxisSize.max',
'MainAxisSize.min',
],
);
const enumFontStyle = EnumKey(
propertyType: 'FontStyle',
values: [
'FontStyle.normal',
'FontStyle.italic',
],
);
const enumTextDecorationStyle = EnumKey(
propertyType: 'TextDecorationStyle',
values: [
'TextDecorationStyle.dashed',
'TextDecorationStyle.dotted',
'TextDecorationStyle.double',
'TextDecorationStyle.solid',
'TextDecorationStyle.wavy',
],
);
const enumFontWeight = EnumKey(
propertyType: 'FontWeight',
values: [
'FontWeight.bold',
'FontWeight.normal',
'FontWeight.w100',
'FontWeight.w200',
'FontWeight.w300',
'FontWeight.w400',
'FontWeight.w500',
'FontWeight.w600',
'FontWeight.w700',
'FontWeight.w800',
'FontWeight.w900',
],
);
const enumDragStartBehavior = EnumKey(
propertyType: 'DragStartBehavior',
defaultValue: 'DragStartBehavior.start',
values: [
'DragStartBehavior.start',
'DragStartBehavior.down',
],
);
const _axisValues = [
'Axis.horizontal',
'Axis.vertical',
];
const enumAxis = EnumKey(
propertyType: 'Axis',
defaultValue: 'Axis.vertical',
values: _axisValues,
);
const enumAxisHorizontal = EnumKey(
propertyType: 'Axis',
defaultValue: 'Axis.horizontal',
values: _axisValues,
);
const enumOverflow = EnumKey(
propertyType: 'Overflow',
defaultValue: 'Overflow.clip',
values: [
'Overflow.clip',
'Overflow.visible',
],
);
const _alignmentValues = const [
'Alignment.bottomCenter',
'Alignment.bottomLeft',
'Alignment.bottomRight',
'Alignment.center',
'Alignment.centerLeft',
'Alignment.centerRight',
'Alignment.topCenter',
'Alignment.topLeft',
'Alignment.topRight',
];
const enumAlignmentTopLeft = EnumKey(
defaultValue: 'Alignment.topLeft',
propertyType: 'Alignment',
values: _alignmentValues,
);
const enumStackFit = EnumKey(
propertyType: 'StackFit',
defaultValue: 'StackFit.loose',
values: [
'StackFit.loose',
'StackFit.expand',
'StackFit.passthrough',
],
);
const _clipValues = [
'Clip.none',
'Clip.antiAlias',
'Clip.antiAliasWithSaveLayer',
'Clip.hardEdge',
];
const enumClipHardEdge = EnumKey(
propertyType: 'Clip',
defaultValue: 'Clip.hardEdge',
values: _clipValues,
);
const enumMouseCursor = EnumKey(
propertyType: 'MouseCursor',
defaultValue: 'SystemMouseCursors.click',
values: [
'SystemMouseCursors.click',
'SystemMouseCursors.basic',
'SystemMouseCursors.forbidden',
'SystemMouseCursors.grab',
'SystemMouseCursors.grabbing',
'SystemMouseCursors.text',
'SystemMouseCursors.none',
],
);
const enumTextAlign = EnumKey(
propertyType: 'TextAlign',
values: [
'TextAlign.center',
'TextAlign.end',
'TextAlign.justify',
'TextAlign.left',
'TextAlign.right',
'TextAlign.start',
],
);
const enumTextOverflow = EnumKey(
propertyType: 'TextOverflow',
values: [
'TextOverflow.clip',
'TextOverflow.ellipsis',
'TextOverflow.fade',
'TextOverflow.visible',
],
);
const enumTextWidthBasis = EnumKey(
propertyType: 'TextWidthBasis',
values: [
'TextWidthBasis.parent',
'TextWidthBasis.longestLine',
],
);
const enumVerticalDirection = EnumKey(
defaultValue: 'VerticalDirection.down',
propertyType: 'VerticalDirection',
values: [
'VerticalDirection.up',
'VerticalDirection.down',
],
);
const enumWrapAlignment = EnumKey(
defaultValue: 'WrapAlignment.start',
propertyType: 'WrapAlignment',
values: [
'WrapAlignment.center',
'WrapAlignment.end',
'WrapAlignment.spaceAround',
'WrapAlignment.spaceBetween',
'WrapAlignment.spaceEvenly',
'WrapAlignment.start',
],
);
const enumWrapCrossAlignment = EnumKey(
defaultValue: 'WrapCrossAlignment.center',
propertyType: 'WrapCrossAlignment',
values: [
'WrapCrossAlignment.center',
'WrapCrossAlignment.end',
'WrapCrossAlignment.start',
],
);
const enumCrossAxisAlignment = EnumKey(
propertyType: 'CrossAxisAlignment',
defaultValue: 'CrossAxisAlignment.center',
values: [
'CrossAxisAlignment.baseline',
'CrossAxisAlignment.center',
'CrossAxisAlignment.end',
'CrossAxisAlignment.start',
'CrossAxisAlignment.stretch',
],
);
const enumMainAxisAlignment = EnumKey(
propertyType: 'MainAxisAlignment',
defaultValue: 'MainAxisAlignment.start',
values: [
'MainAxisAlignment.center',
'MainAxisAlignment.end',
'MainAxisAlignment.spaceAround',
'MainAxisAlignment.spaceBetween',
'MainAxisAlignment.spaceEvenly',
'MainAxisAlignment.start',
],
);
const enumFlexFit = EnumKey(
propertyType: 'FlexFit',
defaultValue: 'FlexFit.loose',
values: [
'FlexFit.loose',
'FlexFit.tight',
],
);
const enumMaterialTapTargetSize = EnumKey(
propertyType: 'MaterialTapTargetSize',
values: [
'MaterialTapTargetSize.shrinkWrap',
'MaterialTapTargetSize.padded',
],
);
const enumFlutterLogoStyle = EnumKey(
defaultValue: 'FlutterLogoStyle.markOnly',
values: [
'FlutterLogoStyle.horizontal',
'FlutterLogoStyle.markOnly',
'FlutterLogoStyle.stacked',
],
);
const enumThemeMode = EnumKey(
defaultValue: 'ThemeMode.system',
values: [
'ThemeMode.dark',
'ThemeMode.light',
'ThemeMode.system',
],
);
const enumImageRepeat = EnumKey(
defaultValue: 'ImageRepeat.noRepeat',
values: [
'ImageRepeat.noRepeat',
'ImageRepeat.repeat',
'ImageRepeat.repeatX',
'ImageRepeat.repeatY',
],
);
const enumFilterQuality = EnumKey(
defaultValue: 'FilterQuality.low',
values: [
'FilterQuality.high',
'FilterQuality.low',
'FilterQuality.medium',
'FilterQuality.none',
],
);
const enumBoxFit = EnumKey(
propertyType: 'BoxFit',
defaultValue: 'BoxFit.contain',
values: [
'BoxFit.contain',
'BoxFit.cover',
'BoxFit.fill',
'BoxFit.fitHeight',
'BoxFit.fitWidth',
'BoxFit.none',
'BoxFit.scaleDown',
],
);
const enumBottomNavigationBarType = EnumKey(
defaultValue: 'BottomNavigationBarType.fixed',
values: [
'BottomNavigationBarType.fixed',
'BottomNavigationBarType.shifting',
],
);
const enumButtonBarLayoutBehavior = EnumKey(
values: [
'ButtonBarLayoutBehavior.constrained',
'ButtonBarLayoutBehavior.padded',
],
);
const enumButtonTextTheme = EnumKey(
values: [
'ButtonTextTheme.normal',
'ButtonTextTheme.accent',
'ButtonTextTheme.primary',
],
);
@@ -0,0 +1,64 @@
export 'basics/appbar.dart';
export 'basics/column.dart';
export 'basics/expanded.dart';
export 'basics/flat_button.dart';
export 'basics/flat_button_icon.dart';
export 'basics/flex.dart';
export 'basics/flexible.dart';
export 'basics/floating_action_button.dart';
export 'basics/flutter_logo.dart';
export 'basics/form.dart';
export 'basics/fractionally_sized_box.dart';
export 'basics/icon.dart';
export 'basics/icon_button.dart';
export 'basics/image_network.dart';
export 'basics/material_app.dart';
export 'basics/outline_button.dart';
export 'basics/placeholder.dart';
export 'basics/positioned.dart';
export 'basics/raised_button.dart';
export 'basics/raised_button_icon.dart';
export 'basics/row.dart';
export 'basics/scaffold.dart';
export 'basics/single_child_scroll_view.dart';
export 'basics/sized_box.dart';
export 'basics/stack.dart';
export 'basics/text.dart';
export 'basics/theme.dart';
export 'basics/widgets_app.dart';
export 'basics/wrap.dart';
export 'layout/align.dart';
export 'layout/aspect_ratio.dart';
export 'layout/baseline.dart';
export 'layout/center.dart';
export 'layout/constrainted_box.dart';
export 'layout/container.dart';
export 'layout/fitted_box.dart';
export 'layout/intrinsic_height.dart';
export 'layout/intrinsic_width.dart';
export 'layout/limited_box.dart';
export 'layout/offstage.dart';
export 'layout/overflow_box.dart';
export 'layout/padding.dart';
export 'layout/preferred_size.dart';
export 'layout/sized_overflow_box.dart';
export 'layout/transform.dart';
export 'misc/bottom_navigation_bar.dart';
export 'misc/button_bar.dart';
export 'misc/card.dart';
export 'misc/chip.dart';
export 'misc/circular_progress_indicator.dart';
export 'misc/divider.dart';
export 'misc/drawer.dart';
export 'misc/linear_progress_indicator.dart';
export 'misc/list_tile.dart';
export 'misc/tooltip.dart';
export 'properties/bottom_navigation_bar_item.dart';
export 'properties/box_constraints.dart';
export 'properties/icon_data.dart';
export 'properties/text_style.dart';
export 'theme/app_bar_theme.dart';
export 'theme/floating_action_button_theme.dart';
export 'theme/icon_theme_data.dart';
export 'theme/text_theme.dart';
export 'theme/theme_data.dart';
@@ -0,0 +1,41 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../enums.dart';
import '../library.dart';
part 'align.g.dart';
@WidgetClass('Align')
class AlignBase extends _$AlignBase {
AlignBase(this.widgetData, this.widgetContext, this.widgetRender);
double heightFactor;
Key key;
double widthFactor;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
defaultValue: 'Placeholder',
)
Widget child;
@enumAlignment
Alignment alignment;
}
@@ -0,0 +1,179 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'align.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$AlignBase extends WidgetBase {
String heightFactorKey = 'heightFactor';
String keyKey = 'key';
String widthFactorKey = 'widthFactor';
String childKey = 'child';
String alignmentKey = 'alignment';
@override
Map<String, String> get properties => {
'heightFactor': 'double',
'key': 'Key',
'widthFactor': 'double',
'child': 'Widget',
'alignment': 'Alignment',
};
double get heightFactorVal {
if (params[heightFactorKey] != null) {
return params[heightFactorKey] as double;
}
return null;
}
set heightFactorVal(double val) {
params[heightFactorKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
double get widthFactorVal {
if (params[widthFactorKey] != null) {
return params[widthFactorKey] as double;
}
return null;
}
set widthFactorVal(double val) {
params[widthFactorKey] = val;
widgetContext.onUpdate(id, widgetData);
}
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'Bypft2aG9gH';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'jH_KeQhEgLF';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'fAFu_aBeNd7';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
List<Alignment> get alignmentValues => [
Alignment.bottomCenter,
Alignment.bottomLeft,
Alignment.bottomRight,
Alignment.center,
Alignment.centerLeft,
Alignment.centerRight,
Alignment.topCenter,
Alignment.topLeft,
Alignment.topRight,
];
Alignment get alignmentVal {
if (params[alignmentKey] != null) {
final _value = params[alignmentKey].toString().replaceAll('#', '');
return alignmentValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => Alignment.center,
);
}
return Alignment.center;
}
set alignmentVal(Alignment val) {
params[alignmentKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: Align(
alignment: alignmentVal,
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': 'SPbYV19ScJt',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
heightFactor: heightFactorVal,
key: keyVal,
widthFactor: widthFactorVal,
),
);
}
}
@@ -0,0 +1,38 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../library.dart';
part 'aspect_ratio.g.dart';
@WidgetClass('AspectRatio')
class AspectRatioBase extends _$AspectRatioBase {
AspectRatioBase(this.widgetData, this.widgetContext, this.widgetRender);
Key key;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
defaultValue: 'Placeholder',
)
Widget child;
@PropertyKey(defaultValue: '1')
double aspectRatio;
}
@@ -0,0 +1,133 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'aspect_ratio.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$AspectRatioBase extends WidgetBase {
String keyKey = 'key';
String childKey = 'child';
String aspectRatioKey = 'aspectRatio';
@override
Map<String, String> get properties => {
'key': 'Key',
'child': 'Widget',
'aspectRatio': 'double',
};
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'LoZHQ5QwVh2';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'v56Qc8ylD5t';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = '25u1ldFBw_i';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
double get aspectRatioVal {
if (params[aspectRatioKey] != null) {
return params[aspectRatioKey] as double;
}
return 1;
}
set aspectRatioVal(double val) {
params[aspectRatioKey] = val;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: AspectRatio(
aspectRatio: aspectRatioVal,
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': 'kPfWPJueg5v',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
key: keyVal,
),
);
}
}
@@ -0,0 +1,40 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../enums.dart';
import '../library.dart';
part 'baseline.g.dart';
@WidgetClass('Baseline')
class BaselineBase extends _$BaselineBase {
BaselineBase(this.widgetData, this.widgetContext, this.widgetRender);
double baseline;
Key key;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
defaultValue: 'Placeholder',
)
Widget child;
@enumTextBaseline
TextBaseline baselineType;
}
@@ -0,0 +1,157 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'baseline.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$BaselineBase extends WidgetBase {
String baselineKey = 'baseline';
String keyKey = 'key';
String childKey = 'child';
String baselineTypeKey = 'baselineType';
@override
Map<String, String> get properties => {
'baseline': 'double',
'key': 'Key',
'child': 'Widget',
'baselineType': 'TextBaseline',
};
double get baselineVal {
if (params[baselineKey] != null) {
return params[baselineKey] as double;
}
return null;
}
set baselineVal(double val) {
params[baselineKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'xOQaLmvnTt';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'OSAJ9Ht-iP';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'SUFcz2CeFo';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
List<TextBaseline> get baselineTypeValues => [
TextBaseline.alphabetic,
TextBaseline.ideographic,
];
TextBaseline get baselineTypeVal {
if (params[baselineTypeKey] != null) {
final _value = params[baselineTypeKey].toString().replaceAll('#', '');
return baselineTypeValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set baselineTypeVal(TextBaseline val) {
params[baselineTypeKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: Baseline(
baseline: baselineVal,
baselineType: baselineTypeVal,
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': 'Dq8t4FmT4K',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
key: keyVal,
),
);
}
}
@@ -0,0 +1,37 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../library.dart';
part 'center.g.dart';
@WidgetClass('Center')
class CenterBase extends _$CenterBase {
CenterBase(this.widgetData, this.widgetContext, this.widgetRender);
double heightFactor;
Key key;
double widthFactor;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
defaultValue: 'Placeholder',
)
Widget child;
}
@@ -0,0 +1,148 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'center.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$CenterBase extends WidgetBase {
String heightFactorKey = 'heightFactor';
String keyKey = 'key';
String widthFactorKey = 'widthFactor';
String childKey = 'child';
@override
Map<String, String> get properties => {
'heightFactor': 'double',
'key': 'Key',
'widthFactor': 'double',
'child': 'Widget',
};
double get heightFactorVal {
if (params[heightFactorKey] != null) {
return params[heightFactorKey] as double;
}
return null;
}
set heightFactorVal(double val) {
params[heightFactorKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
double get widthFactorVal {
if (params[widthFactorKey] != null) {
return params[widthFactorKey] as double;
}
return null;
}
set widthFactorVal(double val) {
params[widthFactorKey] = val;
widgetContext.onUpdate(id, widgetData);
}
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'MgVKCOEtE';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = '2vKD3sb39V';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'U4WO1I7_Ju';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: Center(
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': 'bRr8en125K',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
heightFactor: heightFactorVal,
key: keyVal,
widthFactor: widthFactorVal,
),
);
}
}
@@ -0,0 +1,40 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_dynamic_widget/src/material/properties/box_constraints.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../library.dart';
part 'constrainted_box.g.dart';
@WidgetClass('ConstrainedBox')
class ConstrainedBoxBase extends _$ConstrainedBoxBase {
ConstrainedBoxBase(this.widgetData, this.widgetContext, this.widgetRender);
Key key;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
defaultValue: 'Placeholder',
)
Widget child;
@SupportedKey()
BoxConstraintsBase constraints;
}
@@ -0,0 +1,134 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'constrainted_box.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$ConstrainedBoxBase extends WidgetBase {
String keyKey = 'key';
String childKey = 'child';
String constraintsKey = 'constraints';
@override
Map<String, String> get properties => {
'key': 'Key',
'child': 'Widget',
'constraints': 'BoxConstraintsBase',
};
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'LyuuUg8cTi4';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'j-yc4n8RlUJ';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'OCaMjlPFv7Y';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
BoxConstraintsBase get constraintsVal {
if (params[constraintsKey] != null) {
return BoxConstraintsBase(
params[constraintsKey], widgetContext, widgetRender);
}
return null;
}
set constraintsVal(BoxConstraintsBase val) {
params[constraintsKey] = val;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: ConstrainedBox(
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': '41bZupv3YH2',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
constraints: constraintsVal?.build(context),
key: keyVal,
),
);
}
}
@@ -0,0 +1,49 @@
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../enums.dart';
import '../library.dart';
import '../properties/box_constraints.dart';
part 'container.g.dart';
@WidgetClass('Container')
class ContainerBase extends _$ContainerBase {
ContainerBase(this.widgetData, this.widgetContext, this.widgetRender);
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
)
Widget child;
Color color;
BoxConstraintsBase constraints;
Decoration decoration;
Decoration foregroundDecoration;
double width;
double height;
Key key;
EdgeInsets margin;
EdgeInsets padding;
Matrix4 transform;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@enumClip
Clip clipBehavior;
@enumAlignment
Alignment alignment;
}
@@ -0,0 +1,369 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'container.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$ContainerBase extends WidgetBase {
String childKey = 'child';
String colorKey = 'color';
String widthKey = 'width';
String heightKey = 'height';
String keyKey = 'key';
String marginKey = 'margin';
String paddingKey = 'padding';
String transformKey = 'transform';
String clipBehaviorKey = 'clipBehavior';
String alignmentKey = 'alignment';
@override
Map<String, String> get properties => {
'child': 'Widget',
'color': 'Color',
'width': 'double',
'height': 'double',
'key': 'Key',
'margin': 'EdgeInsets',
'padding': 'EdgeInsets',
'transform': 'Matrix4',
'clipBehavior': 'Clip',
'alignment': 'Alignment',
};
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'adNloGn9-T';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'PGWbt5yZJA';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'pGUYavohZR';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
Color get colorVal {
if (params[colorKey] != null) {
int _value = null;
String description = params[colorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[colorKey] is Map) {
if (params[colorKey]['name'] == 'Color' &&
params[colorKey]['params'] != null &&
params[colorKey]['params']['0'] != null) {
_value = int.tryParse(params[colorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set colorVal(Color val) {
params[colorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
double get widthVal {
if (params[widthKey] != null) {
return params[widthKey] as double;
}
return null;
}
set widthVal(double val) {
params[widthKey] = val;
widgetContext.onUpdate(id, widgetData);
}
double get heightVal {
if (params[heightKey] != null) {
return params[heightKey] as double;
}
return null;
}
set heightVal(double val) {
params[heightKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
EdgeInsets get marginVal {
EdgeInsets _spacing = EdgeInsets.all(0.0);
if (params[marginKey] != null) {
double top = 0;
double bottom = 0;
double left = 0;
double right = 0;
Map<String, dynamic> _spacingParams = params[marginKey]['params'];
top = _spacingParams['top'] ?? 0;
bottom = _spacingParams['bottom'] ?? 0;
left = _spacingParams['left'] ?? 0;
right = _spacingParams['right'] ?? 0;
_spacing = EdgeInsets.fromLTRB(left, top, right, bottom);
}
return _spacing;
}
set marginVal(EdgeInsets val) {
params[marginKey] = {
"name": "EdgeInsets.only",
"id": "marginKeyEdgeInsets",
"params": {
"top": val.top,
"bottom": val.bottom,
"left": val.left,
"right": val.right,
}
};
widgetContext.onUpdate(id, widgetData);
}
EdgeInsets get paddingVal {
EdgeInsets _spacing = EdgeInsets.all(0.0);
if (params[paddingKey] != null) {
double top = 0;
double bottom = 0;
double left = 0;
double right = 0;
Map<String, dynamic> _spacingParams = params[paddingKey]['params'];
top = _spacingParams['top'] ?? 0;
bottom = _spacingParams['bottom'] ?? 0;
left = _spacingParams['left'] ?? 0;
right = _spacingParams['right'] ?? 0;
_spacing = EdgeInsets.fromLTRB(left, top, right, bottom);
}
return _spacing;
}
set paddingVal(EdgeInsets val) {
params[paddingKey] = {
"name": "EdgeInsets.only",
"id": "paddingKeyEdgeInsets",
"params": {
"top": val.top,
"bottom": val.bottom,
"left": val.left,
"right": val.right,
}
};
widgetContext.onUpdate(id, widgetData);
}
Matrix4 get transformVal {
final _matrix = Matrix4.identity();
if (params[transformKey] != null) {
if (params[transformKey] is List) {
final values = List.from(params[transformKey]);
_matrix.setValues(
values[0],
values[1],
values[2],
values[3],
values[4],
values[5],
values[6],
values[7],
values[8],
values[9],
values[10],
values[11],
values[12],
values[13],
values[14],
values[15],
);
} else if (params[transformKey] is String) {
final description = params[transformKey].toString();
final _entryMatches = 'setEntry('.allMatches(description).toList();
final _rotateXMatches = 'rotateX('.allMatches(description).toList();
final _rotateYMatches = 'rotateY('.allMatches(description).toList();
final _rotateZMatches = 'rotateZ('.allMatches(description).toList();
for (final idx in _entryMatches) {
int start = idx.end;
int end = description.indexOf(')', start);
final _values = description
.substring(start, end)
.split(',')
.map((e) => num.tryParse(e.trim()))
.toList();
_matrix.setEntry(
_values[0].toInt(),
_values[1].toInt(),
_values[2].toDouble(),
);
}
for (final idx in _rotateXMatches) {
int start = idx.end;
int end = description.indexOf(')', start);
final _value = num.tryParse(description.substring(start, end).trim());
_matrix.rotateX(_value.toDouble());
}
for (final idx in _rotateYMatches) {
int start = idx.end;
int end = description.indexOf(')', start);
final _value = num.tryParse(description.substring(start, end).trim());
_matrix.rotateY(_value.toDouble());
}
for (final idx in _rotateZMatches) {
int start = idx.end;
int end = description.indexOf(')', start);
final _value = num.tryParse(description.substring(start, end).trim());
_matrix.rotateZ(_value.toDouble());
}
}
}
return _matrix;
}
set transformVal(Matrix4 val) {
params[transformKey] = val.storage.toList();
widgetContext.onUpdate(id, widgetData);
}
List<Clip> get clipBehaviorValues => [
Clip.none,
Clip.antiAlias,
Clip.antiAliasWithSaveLayer,
Clip.hardEdge,
];
Clip get clipBehaviorVal {
if (params[clipBehaviorKey] != null) {
final _value = params[clipBehaviorKey].toString().replaceAll('#', '');
return clipBehaviorValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => Clip.none,
);
}
return Clip.none;
}
set clipBehaviorVal(Clip val) {
params[clipBehaviorKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<Alignment> get alignmentValues => [
Alignment.bottomCenter,
Alignment.bottomLeft,
Alignment.bottomRight,
Alignment.center,
Alignment.centerLeft,
Alignment.centerRight,
Alignment.topCenter,
Alignment.topLeft,
Alignment.topRight,
];
Alignment get alignmentVal {
if (params[alignmentKey] != null) {
final _value = params[alignmentKey].toString().replaceAll('#', '');
return alignmentValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => Alignment.center,
);
}
return Alignment.center;
}
set alignmentVal(Alignment val) {
params[alignmentKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: Container(
alignment: alignmentVal,
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
clipBehavior: clipBehaviorVal,
color: colorVal,
height: heightVal,
key: keyVal,
margin: marginVal,
padding: paddingVal,
transform: transformVal,
width: widthVal,
),
);
}
}
@@ -0,0 +1,46 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../enums.dart';
import '../library.dart';
part 'fitted_box.g.dart';
@WidgetClass('FittedBox')
class FittedBoxBase extends _$FittedBoxBase {
FittedBoxBase(this.widgetData, this.widgetContext, this.widgetRender);
@enumAlignment
Alignment alignment;
@enumClipHardEdge
Clip clipBehavior;
@enumBoxFit
BoxFit fit;
Key key;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
defaultValue: 'Placeholder',
)
Widget child;
}
@@ -0,0 +1,204 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'fitted_box.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$FittedBoxBase extends WidgetBase {
String alignmentKey = 'alignment';
String clipBehaviorKey = 'clipBehavior';
String fitKey = 'fit';
String keyKey = 'key';
String childKey = 'child';
@override
Map<String, String> get properties => {
'alignment': 'Alignment',
'clipBehavior': 'Clip',
'fit': 'BoxFit',
'key': 'Key',
'child': 'Widget',
};
List<Alignment> get alignmentValues => [
Alignment.bottomCenter,
Alignment.bottomLeft,
Alignment.bottomRight,
Alignment.center,
Alignment.centerLeft,
Alignment.centerRight,
Alignment.topCenter,
Alignment.topLeft,
Alignment.topRight,
];
Alignment get alignmentVal {
if (params[alignmentKey] != null) {
final _value = params[alignmentKey].toString().replaceAll('#', '');
return alignmentValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => Alignment.center,
);
}
return Alignment.center;
}
set alignmentVal(Alignment val) {
params[alignmentKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<Clip> get clipBehaviorValues => [
Clip.none,
Clip.antiAlias,
Clip.antiAliasWithSaveLayer,
Clip.hardEdge,
];
Clip get clipBehaviorVal {
if (params[clipBehaviorKey] != null) {
final _value = params[clipBehaviorKey].toString().replaceAll('#', '');
return clipBehaviorValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => Clip.hardEdge,
);
}
return Clip.hardEdge;
}
set clipBehaviorVal(Clip val) {
params[clipBehaviorKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<BoxFit> get fitValues => [
BoxFit.contain,
BoxFit.cover,
BoxFit.fill,
BoxFit.fitHeight,
BoxFit.fitWidth,
BoxFit.none,
BoxFit.scaleDown,
];
BoxFit get fitVal {
if (params[fitKey] != null) {
final _value = params[fitKey].toString().replaceAll('#', '');
return fitValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => BoxFit.contain,
);
}
return BoxFit.contain;
}
set fitVal(BoxFit val) {
params[fitKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'XVzUa_YyoAk';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'i8gOHYvC_98';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'H69YeKRJ597';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: FittedBox(
alignment: alignmentVal,
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': 'n4tdHXJfWIB',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
clipBehavior: clipBehaviorVal,
fit: fitVal,
key: keyVal,
),
);
}
}
@@ -0,0 +1,36 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../library.dart';
part 'intrinsic_height.g.dart';
@WidgetClass('IntrinsicHeight')
class IntrinsicHeightBase extends _$IntrinsicHeightBase {
IntrinsicHeightBase(this.widgetData, this.widgetContext, this.widgetRender);
Key key;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
defaultValue: 'Placeholder',
)
Widget child;
}
@@ -0,0 +1,118 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'intrinsic_height.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$IntrinsicHeightBase extends WidgetBase {
String keyKey = 'key';
String childKey = 'child';
@override
Map<String, String> get properties => {
'key': 'Key',
'child': 'Widget',
};
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'IK7tmDuEkug';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'zVq8EI1s3qx';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'mqxZ7NTwmto';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: IntrinsicHeight(
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': 'poqCfmo1mx4',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
key: keyVal,
),
);
}
}
@@ -0,0 +1,36 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../library.dart';
part 'intrinsic_width.g.dart';
@WidgetClass('IntrinsicWidth')
class IntrinsicWidthBase extends _$IntrinsicWidthBase {
IntrinsicWidthBase(this.widgetData, this.widgetContext, this.widgetRender);
Key key;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
defaultValue: 'Placeholder',
)
Widget child;
}
@@ -0,0 +1,118 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'intrinsic_width.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$IntrinsicWidthBase extends WidgetBase {
String keyKey = 'key';
String childKey = 'child';
@override
Map<String, String> get properties => {
'key': 'Key',
'child': 'Widget',
};
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'UZR97dpwYuE';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'W-5bnVIMonb';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'OfPHAW3t913';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: IntrinsicWidth(
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': 'nMOpm21zutT',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
key: keyVal,
),
);
}
}
@@ -0,0 +1,42 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../enums.dart';
import '../library.dart';
part 'limited_box.g.dart';
@WidgetClass('LimitedBox')
class LimitedBoxBase extends _$LimitedBoxBase {
LimitedBoxBase(this.widgetData, this.widgetContext, this.widgetRender);
Key key;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
defaultValue: 'Placeholder',
)
Widget child;
@PropertyKey(defaultValue: 'double.infinity')
double maxWidth;
@PropertyKey(defaultValue: 'double.infinity')
double maxHeight;
}
@@ -0,0 +1,148 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'limited_box.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$LimitedBoxBase extends WidgetBase {
String keyKey = 'key';
String childKey = 'child';
String maxWidthKey = 'maxWidth';
String maxHeightKey = 'maxHeight';
@override
Map<String, String> get properties => {
'key': 'Key',
'child': 'Widget',
'maxWidth': 'double',
'maxHeight': 'double',
};
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = '2aY41kOhDXT';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'NHZPNyydlbj';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'fP6KZed7TiW';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
double get maxWidthVal {
if (params[maxWidthKey] != null) {
return params[maxWidthKey] as double;
}
return double.infinity;
}
set maxWidthVal(double val) {
params[maxWidthKey] = val;
widgetContext.onUpdate(id, widgetData);
}
double get maxHeightVal {
if (params[maxHeightKey] != null) {
return params[maxHeightKey] as double;
}
return double.infinity;
}
set maxHeightVal(double val) {
params[maxHeightKey] = val;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: LimitedBox(
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': 'JH4fWPCa16r',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
key: keyVal,
maxHeight: maxHeightVal,
maxWidth: maxWidthVal,
),
);
}
}
@@ -0,0 +1,39 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../enums.dart';
import '../library.dart';
part 'offstage.g.dart';
@WidgetClass('Offstage')
class OffstageBase extends _$OffstageBase {
OffstageBase(this.widgetData, this.widgetContext, this.widgetRender);
@PropertyKey(defaultValue: 'true')
bool offstage;
Key key;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
defaultValue: 'Placeholder',
)
Widget child;
}
@@ -0,0 +1,133 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'offstage.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$OffstageBase extends WidgetBase {
String offstageKey = 'offstage';
String keyKey = 'key';
String childKey = 'child';
@override
Map<String, String> get properties => {
'offstage': 'bool',
'key': 'Key',
'child': 'Widget',
};
bool get offstageVal {
if (params[offstageKey] != null) {
return params[offstageKey] as bool;
}
return true;
}
set offstageVal(bool val) {
params[offstageKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = '13O9z-AetFK';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'UMmN56YZ_wo';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = '6ezb3IoNoR9';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: Offstage(
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': 'sAuzXMPGYiC',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
key: keyVal,
offstage: offstageVal,
),
);
}
}
@@ -0,0 +1,44 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../enums.dart';
import '../library.dart';
part 'overflow_box.g.dart';
@WidgetClass('OverflowBox')
class OverflowBoxBase extends _$OverflowBoxBase {
OverflowBoxBase(this.widgetData, this.widgetContext, this.widgetRender);
Key key;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
defaultValue: 'Placeholder',
)
Widget child;
@enumAlignment
Alignment alignment;
double minWidth;
double maxWidth;
double minHeight;
double maxHeight;
}
@@ -0,0 +1,209 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'overflow_box.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$OverflowBoxBase extends WidgetBase {
String keyKey = 'key';
String childKey = 'child';
String alignmentKey = 'alignment';
String minWidthKey = 'minWidth';
String maxWidthKey = 'maxWidth';
String minHeightKey = 'minHeight';
String maxHeightKey = 'maxHeight';
@override
Map<String, String> get properties => {
'key': 'Key',
'child': 'Widget',
'alignment': 'Alignment',
'minWidth': 'double',
'maxWidth': 'double',
'minHeight': 'double',
'maxHeight': 'double',
};
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'Q9AfPlPJtFj';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'LousVh1r11G';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'xHBrjGAmoxO';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
List<Alignment> get alignmentValues => [
Alignment.bottomCenter,
Alignment.bottomLeft,
Alignment.bottomRight,
Alignment.center,
Alignment.centerLeft,
Alignment.centerRight,
Alignment.topCenter,
Alignment.topLeft,
Alignment.topRight,
];
Alignment get alignmentVal {
if (params[alignmentKey] != null) {
final _value = params[alignmentKey].toString().replaceAll('#', '');
return alignmentValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => Alignment.center,
);
}
return Alignment.center;
}
set alignmentVal(Alignment val) {
params[alignmentKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
double get minWidthVal {
if (params[minWidthKey] != null) {
return params[minWidthKey] as double;
}
return null;
}
set minWidthVal(double val) {
params[minWidthKey] = val;
widgetContext.onUpdate(id, widgetData);
}
double get maxWidthVal {
if (params[maxWidthKey] != null) {
return params[maxWidthKey] as double;
}
return null;
}
set maxWidthVal(double val) {
params[maxWidthKey] = val;
widgetContext.onUpdate(id, widgetData);
}
double get minHeightVal {
if (params[minHeightKey] != null) {
return params[minHeightKey] as double;
}
return null;
}
set minHeightVal(double val) {
params[minHeightKey] = val;
widgetContext.onUpdate(id, widgetData);
}
double get maxHeightVal {
if (params[maxHeightKey] != null) {
return params[maxHeightKey] as double;
}
return null;
}
set maxHeightVal(double val) {
params[maxHeightKey] = val;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: OverflowBox(
alignment: alignmentVal,
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': 'BUhHAiVUgG5',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
key: keyVal,
maxHeight: maxHeightVal,
maxWidth: maxWidthVal,
minHeight: minHeightVal,
minWidth: minWidthVal,
),
);
}
}
@@ -0,0 +1,39 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../library.dart';
part 'padding.g.dart';
@WidgetClass('Padding')
class PaddingBase extends _$PaddingBase {
PaddingBase(this.widgetData, this.widgetContext, this.widgetRender);
Key key;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
defaultValue: 'Placeholder',
)
Widget child;
EdgeInsets padding;
}
@@ -0,0 +1,152 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'padding.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$PaddingBase extends WidgetBase {
String keyKey = 'key';
String childKey = 'child';
String paddingKey = 'padding';
@override
Map<String, String> get properties => {
'key': 'Key',
'child': 'Widget',
'padding': 'EdgeInsets',
};
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'USqj1FZYPsc';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'PROC4-knc2U';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'DCGETQBNRdp';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
EdgeInsets get paddingVal {
EdgeInsets _spacing = EdgeInsets.all(0.0);
if (params[paddingKey] != null) {
double top = 0;
double bottom = 0;
double left = 0;
double right = 0;
Map<String, dynamic> _spacingParams = params[paddingKey]['params'];
top = _spacingParams['top'] ?? 0;
bottom = _spacingParams['bottom'] ?? 0;
left = _spacingParams['left'] ?? 0;
right = _spacingParams['right'] ?? 0;
_spacing = EdgeInsets.fromLTRB(left, top, right, bottom);
}
return _spacing;
}
set paddingVal(EdgeInsets val) {
params[paddingKey] = {
"name": "EdgeInsets.only",
"id": "paddingKeyEdgeInsets",
"params": {
"top": val.top,
"bottom": val.bottom,
"left": val.left,
"right": val.right,
}
};
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: Padding(
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': 'jDYYlBvb3uW',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
key: keyVal,
padding: paddingVal,
),
);
}
}
@@ -0,0 +1,39 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../library.dart';
part 'preferred_size.g.dart';
@WidgetClass('PreferredSize')
class PreferredSizeBase extends _$PreferredSizeBase {
PreferredSizeBase(this.widgetData, this.widgetContext, this.widgetRender);
Key key;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
defaultValue: 'Placeholder',
)
Widget child;
Size preferredSize;
}
@@ -0,0 +1,146 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'preferred_size.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$PreferredSizeBase extends WidgetBase {
String keyKey = 'key';
String childKey = 'child';
String preferredSizeKey = 'preferredSize';
@override
Map<String, String> get properties => {
'key': 'Key',
'child': 'Widget',
'preferredSize': 'Size',
};
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'RMwWVNCx1q';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = '1YRUz55m6f';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'wZKXubWyAw';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
Size get preferredSizeVal {
Size _size = Size(0.0, 0.0);
if (params[preferredSizeKey] != null) {
double width = 0;
double height = 0;
Map<String, dynamic> _sizeParams = params[preferredSizeKey]['params'];
width = _sizeParams['0'] ?? 0;
height = _sizeParams['1'] ?? 0;
_size = Size(width, height);
}
return _size;
}
set preferredSizeVal(Size val) {
params[preferredSizeKey] = {
"name": "Size",
"id": "preferredSizeKeySize",
"params": {
"0": val.width,
"1": val.height,
}
};
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: PreferredSize(
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': 'eUXzeMDqKk',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
key: keyVal,
preferredSize: preferredSizeVal,
),
);
}
}
@@ -0,0 +1,40 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../library.dart';
part 'sized_box.g.dart';
@WidgetClass('SizedBox')
class SizedBoxBase extends _$SizedBoxBase {
SizedBoxBase(this.widgetData, this.widgetContext, this.widgetRender);
Key key;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
defaultValue: 'Placeholder',
)
Widget child;
double width;
double height;
}
@@ -0,0 +1,148 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'sized_box.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$SizedBoxBase extends WidgetBase {
String keyKey = 'key';
String childKey = 'child';
String widthKey = 'width';
String heightKey = 'height';
@override
Map<String, String> get properties => {
'key': 'Key',
'child': 'Widget',
'width': 'double',
'height': 'double',
};
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'saIyCYQAYPm';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'zo1qOAa4jOo';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'KPsqEWFGKFs';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
double get widthVal {
if (params[widthKey] != null) {
return params[widthKey] as double;
}
return null;
}
set widthVal(double val) {
params[widthKey] = val;
widgetContext.onUpdate(id, widgetData);
}
double get heightVal {
if (params[heightKey] != null) {
return params[heightKey] as double;
}
return null;
}
set heightVal(double val) {
params[heightKey] = val;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: SizedBox(
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': 'SNdWGRRuKac',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
height: heightVal,
key: keyVal,
width: widthVal,
),
);
}
}
@@ -0,0 +1,43 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_dynamic_widget/src/material/enums.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../library.dart';
part 'sized_overflow_box.g.dart';
@WidgetClass('SizedOverflowBox')
class SizedOverflowBoxBase extends _$SizedOverflowBoxBase {
SizedOverflowBoxBase(this.widgetData, this.widgetContext, this.widgetRender);
Key key;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
defaultValue: 'Placeholder',
)
Widget child;
@enumAlignment
Alignment alignment;
Size size;
}
@@ -0,0 +1,177 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'sized_overflow_box.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$SizedOverflowBoxBase extends WidgetBase {
String keyKey = 'key';
String childKey = 'child';
String alignmentKey = 'alignment';
String sizeKey = 'size';
@override
Map<String, String> get properties => {
'key': 'Key',
'child': 'Widget',
'alignment': 'Alignment',
'size': 'Size',
};
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'dJeEtuFxpG';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'Uf4s4ryE-n-';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = 'Rc-nZi_VHv9';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
List<Alignment> get alignmentValues => [
Alignment.bottomCenter,
Alignment.bottomLeft,
Alignment.bottomRight,
Alignment.center,
Alignment.centerLeft,
Alignment.centerRight,
Alignment.topCenter,
Alignment.topLeft,
Alignment.topRight,
];
Alignment get alignmentVal {
if (params[alignmentKey] != null) {
final _value = params[alignmentKey].toString().replaceAll('#', '');
return alignmentValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => Alignment.center,
);
}
return Alignment.center;
}
set alignmentVal(Alignment val) {
params[alignmentKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
Size get sizeVal {
Size _size = Size(0.0, 0.0);
if (params[sizeKey] != null) {
double width = 0;
double height = 0;
Map<String, dynamic> _sizeParams = params[sizeKey]['params'];
width = _sizeParams['0'] ?? 0;
height = _sizeParams['1'] ?? 0;
_size = Size(width, height);
}
return _size;
}
set sizeVal(Size val) {
params[sizeKey] = {
"name": "Size",
"id": "sizeKeySize",
"params": {
"0": val.width,
"1": val.height,
}
};
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: SizedOverflowBox(
alignment: alignmentVal,
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': 'OrtQ9-grYah',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
key: keyVal,
size: sizeVal,
),
);
}
}
@@ -0,0 +1,46 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_dynamic_widget/src/material/enums.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../library.dart';
part 'transform.g.dart';
@WidgetClass('Transform')
class TransformBase extends _$TransformBase {
TransformBase(this.widgetData, this.widgetContext, this.widgetRender);
@enumAlignment
Alignment alignment;
Key key;
Offset origin;
Matrix4 transform;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
defaultValue: 'Placeholder',
)
Widget child;
@PropertyKey(defaultValue: 'true')
bool transformHitTests;
}
@@ -0,0 +1,266 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'transform.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$TransformBase extends WidgetBase {
String alignmentKey = 'alignment';
String keyKey = 'key';
String originKey = 'origin';
String transformKey = 'transform';
String childKey = 'child';
String transformHitTestsKey = 'transformHitTests';
@override
Map<String, String> get properties => {
'alignment': 'Alignment',
'key': 'Key',
'origin': 'Offset',
'transform': 'Matrix4',
'child': 'Widget',
'transformHitTests': 'bool',
};
List<Alignment> get alignmentValues => [
Alignment.bottomCenter,
Alignment.bottomLeft,
Alignment.bottomRight,
Alignment.center,
Alignment.centerLeft,
Alignment.centerRight,
Alignment.topCenter,
Alignment.topLeft,
Alignment.topRight,
];
Alignment get alignmentVal {
if (params[alignmentKey] != null) {
final _value = params[alignmentKey].toString().replaceAll('#', '');
return alignmentValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => Alignment.center,
);
}
return Alignment.center;
}
set alignmentVal(Alignment val) {
params[alignmentKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
Offset get originVal {
Offset _offset = Offset(0.0, 0.0);
if (params[originKey] != null) {
double dx = 0;
double dy = 0;
Map<String, dynamic> _offsetParams = params[originKey]['params'];
dx = _offsetParams['0'] ?? 0;
dy = _offsetParams['1'] ?? 0;
_offset = Offset(dx, dy);
}
return _offset;
}
set originVal(Offset val) {
params[originKey] = {
"name": "Offset",
"id": "originKeyOffset",
"params": {
"0": val.dx,
"1": val.dy,
}
};
widgetContext.onUpdate(id, widgetData);
}
Matrix4 get transformVal {
final _matrix = Matrix4.identity();
if (params[transformKey] != null) {
if (params[transformKey] is List) {
final values = List.from(params[transformKey]);
_matrix.setValues(
values[0],
values[1],
values[2],
values[3],
values[4],
values[5],
values[6],
values[7],
values[8],
values[9],
values[10],
values[11],
values[12],
values[13],
values[14],
values[15],
);
} else if (params[transformKey] is String) {
final description = params[transformKey].toString();
final _entryMatches = 'setEntry('.allMatches(description).toList();
final _rotateXMatches = 'rotateX('.allMatches(description).toList();
final _rotateYMatches = 'rotateY('.allMatches(description).toList();
final _rotateZMatches = 'rotateZ('.allMatches(description).toList();
for (final idx in _entryMatches) {
int start = idx.end;
int end = description.indexOf(')', start);
final _values = description
.substring(start, end)
.split(',')
.map((e) => num.tryParse(e.trim()))
.toList();
_matrix.setEntry(
_values[0].toInt(),
_values[1].toInt(),
_values[2].toDouble(),
);
}
for (final idx in _rotateXMatches) {
int start = idx.end;
int end = description.indexOf(')', start);
final _value = num.tryParse(description.substring(start, end).trim());
_matrix.rotateX(_value.toDouble());
}
for (final idx in _rotateYMatches) {
int start = idx.end;
int end = description.indexOf(')', start);
final _value = num.tryParse(description.substring(start, end).trim());
_matrix.rotateY(_value.toDouble());
}
for (final idx in _rotateZMatches) {
int start = idx.end;
int end = description.indexOf(')', start);
final _value = num.tryParse(description.substring(start, end).trim());
_matrix.rotateZ(_value.toDouble());
}
}
}
return _matrix;
}
set transformVal(Matrix4 val) {
params[transformKey] = val.storage.toList();
widgetContext.onUpdate(id, widgetData);
}
final _childListen = ValueNotifier<bool>(false);
WidgetBase get childVal {
if (params[childKey] != null) {
return widgetRender(widgetContext, params[childKey]);
}
return null;
}
void childValUpdate(Map<String, dynamic> val) {
final _data = val;
_data['id'] = 'GRdzSoi2Uxf';
if (_data['name'] == 'Text') {
_data['params']['style']['id'] = 'YusDW4ygUa4';
}
if (_data['name'] == 'Icon') {
_data['params']['0']['id'] = '9b3RzODyRq_';
}
params[childKey] = _data;
widgetContext.onUpdate(id, widgetData);
}
bool get transformHitTestsVal {
if (params[transformHitTestsKey] != null) {
return params[transformHitTestsKey] as bool;
}
return true;
}
set transformHitTestsVal(bool val) {
params[transformHitTestsKey] = val;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: Transform(
alignment: alignmentVal,
child: !widgetContext.isDragging ||
(widgetContext.isDragging && childVal?.build(context) != null)
? (childVal?.build(context) ??
(widgetRender(
widgetContext,
json.decode(json.encode({
'id': 'IU9EJOj74f5',
'name': 'Placeholder',
'params': {},
})))).build(context))
: PreferredSize(
preferredSize: Size(100.0, 100.0),
child: DragTarget<WidgetBaseData>(
onAccept: (val) {
_childListen.value = false;
if (val != null) {
childValUpdate(val?.data);
}
},
onLeave: (val) {
_childListen.value = false;
},
onWillAccept: (val) {
_childListen.value = true;
return _childListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(100.0, 100.0),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
),
key: keyVal,
origin: originVal,
transform: transformVal,
transformHitTests: transformHitTestsVal,
),
);
}
}
@@ -0,0 +1,143 @@
import '../../flutter_dynamic_widget.dart';
import '../base.dart';
import './index.dart';
class MaterialBase extends WidgetLibrary {
MaterialBase(this.data, this.widgetContext);
final Map<String, dynamic> data;
final WidgetContext widgetContext;
GenerateWidget get widgetRender => (context, data) {
if (data is Map) {
final _base = MaterialBase(data, context);
final _config = _base?.base;
if (_config is WidgetBase) {
return _config;
}
}
return null;
};
@override
Map<String, WidgetConfig> get library => {
...basics,
...layout,
...misc,
...themes,
...properties,
'FloatingActionButton':
FloatingActionButtonBase(data, widgetContext, widgetRender),
'Wrap': WrapBase(data, widgetContext, widgetRender),
'SizedBox': SizedBoxBase(data, widgetContext, widgetRender),
'FractionallySizedBox':
FractionallySizedBoxBase(data, widgetContext, widgetRender),
'IconButton': IconButtonBase(data, widgetContext, widgetRender),
'SingleChildScrollView':
SingleChildScrollViewBase(data, widgetContext, widgetRender),
"Theme": ThemeBase(data, widgetContext, widgetRender),
"Form": FormBase(data, widgetContext, widgetRender),
};
@override
WidgetConfig get base {
if (data == null) return null;
final name = data['name'].toString();
final _materialBase = library[name];
if (_materialBase != null) return _materialBase;
return DynamicWidget(
data: data,
widgetContext: widgetContext,
)?.base;
}
static ActionCallback onAction = (context, val) {
DynamicWidget.onAction(context, val);
};
Map<String, Map<String, WidgetConfig>> get categories => {
'Basics': basics,
'Layout': layout,
'Misc': misc,
};
Map<String, WidgetConfig> get layout => {
'Center': CenterBase(data, widgetContext, widgetRender),
'Expanded': ExpandedBase(data, widgetContext, widgetRender),
'Flexible': FlexibleBase(data, widgetContext, widgetRender),
'Stack': StackBase(data, widgetContext, widgetRender),
'Positioned': PositionedBase(data, widgetContext, widgetRender),
'Flex': FlexBase(data, widgetContext, widgetRender),
'Align': AlignBase(data, widgetContext, widgetRender),
'AspectRatio': AspectRatioBase(data, widgetContext, widgetRender),
'Baseline': BaselineBase(data, widgetContext, widgetRender),
'ConstrainedBox': ConstrainedBoxBase(data, widgetContext, widgetRender),
'FittedBox': FittedBoxBase(data, widgetContext, widgetRender),
'IntrinsicWidth': IntrinsicWidthBase(data, widgetContext, widgetRender),
'IntrinsicHeight':
IntrinsicHeightBase(data, widgetContext, widgetRender),
'LimitedBox': LimitedBoxBase(data, widgetContext, widgetRender),
'Offstage': OffstageBase(data, widgetContext, widgetRender),
'OverflowBox': OverflowBoxBase(data, widgetContext, widgetRender),
'SizedBox': SizedBoxBase(data, widgetContext, widgetRender),
'Padding': PaddingBase(data, widgetContext, widgetRender),
'SizedOverflowBox':
SizedOverflowBoxBase(data, widgetContext, widgetRender),
'Transform': TransformBase(data, widgetContext, widgetRender),
'PreferredSize': PreferredSizeBase(data, widgetContext, widgetRender),
};
Map<String, WidgetConfig> get properties => {
'IconData': IconDataBase(data, widgetContext, widgetRender),
'TextStyle': TextStyleBase(data, widgetContext, widgetRender),
'BoxConstraints': BoxConstraintsBase(data, widgetContext, widgetRender),
'BottomNavigationBarItem':
BottomNavigationBarItemBase(data, widgetContext, widgetRender),
};
Map<String, WidgetConfig> get themes => {
'ThemeData': ThemeDataBase(data, widgetContext, widgetRender),
'IconThemeData': IconThemeDataBase(data, widgetContext, widgetRender),
'TextTheme': TextThemeBase(data, widgetContext, widgetRender),
'AppBarTheme': AppBarThemeBase(data, widgetContext, widgetRender),
'FloatingActionButtonThemeData': FloatingActionButtonThemeDataBase(
data, widgetContext, widgetRender),
};
Map<String, WidgetConfig> get basics => {
'AppBar': AppBarBase(data, widgetContext, widgetRender),
'Column': ColumnBase(data, widgetContext, widgetRender),
'Container': ContainerBase(data, widgetContext, widgetRender),
"FlutterLogo": FlutterLogoBase(data, widgetContext, widgetRender),
'Icon': IconBase(data, widgetContext, widgetRender),
'Image.network': ImageNetworkBase(data, widgetContext, widgetRender),
"Placeholder": PlaceholderBase(data, widgetContext, widgetRender),
'RaisedButton': RaisedButtonBase(data, widgetContext, widgetRender),
'RaisedButton.icon':
RaisedButtonIconBase(data, widgetContext, widgetRender),
"FlatButton": FlatButtonBase(data, widgetContext, widgetRender),
"FlatButton.icon":
FlatButtonIconBase(data, widgetContext, widgetRender),
"OutlineButton": OutlineButtonBase(data, widgetContext, widgetRender),
'Row': RowBase(data, widgetContext, widgetRender),
'Scaffold': ScaffoldBase(data, widgetContext, widgetRender),
'Text': TextBase(data, widgetContext, widgetRender),
};
Map<String, WidgetConfig> get misc => {
'BottomNavigationBar':
BottomNavigationBarBase(data, widgetContext, widgetRender),
'Drawer': DrawerBase(data, widgetContext, widgetRender),
'MaterialApp': MaterialAppBase(data, widgetContext, widgetRender),
'WidgetsApp': WidgetsAppBase(data, widgetContext, widgetRender),
'ButtonBar': ButtonBarBase(data, widgetContext, widgetRender),
'Card': CardBase(data, widgetContext, widgetRender),
'Chip': ChipBase(data, widgetContext, widgetRender),
'Tooltip': TooltipBase(data, widgetContext, widgetRender),
'Divider': DividerBase(data, widgetContext, widgetRender),
'ListTile': ListTileBase(data, widgetContext, widgetRender),
'CircularProgressIndicator':
CircularProgressIndicatorBase(data, widgetContext, widgetRender),
'LinearProgressIndicator':
LinearProgressIndicatorBase(data, widgetContext, widgetRender),
};
}
@@ -0,0 +1,66 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../enums.dart';
import '../library.dart';
import '../properties/bottom_navigation_bar_item.dart';
import '../properties/text_style.dart';
import '../theme/icon_theme_data.dart';
part 'bottom_navigation_bar.g.dart';
@WidgetClass('BottomNavigationBar')
class BottomNavigationBarBase extends _$BottomNavigationBarBase {
BottomNavigationBarBase(this.widgetData, this.widgetContext, this.widgetRender);
Color backgroundColor;
double elevation;
Color fixedColor;
double iconSize;
Key key;
double selectedFontSize;
Color selectedItemColor;
bool showSelectedLabels;
bool showUnselectedLabels;
@enumBottomNavigationBarType
BottomNavigationBarType type;
double unselectedFontSize;
Color unselectedItemColor;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@ListWidgetKey(acceptType: '')
List<BottomNavigationBarItemBase> items;
void Function(int) onTap;
@PropertyKey(defaultValue: '0')
int currentIndex;
@SupportedKey()
IconThemeDataBase selectedIconTheme;
@SupportedKey()
IconThemeDataBase unselectedIconTheme;
@SupportedKey()
TextStyleBase selectedLabelStyle;
@SupportedKey()
TextStyleBase unselectedLabelStyle;
}
@@ -0,0 +1,394 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'bottom_navigation_bar.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$BottomNavigationBarBase extends WidgetBase {
String backgroundColorKey = 'backgroundColor';
String elevationKey = 'elevation';
String fixedColorKey = 'fixedColor';
String iconSizeKey = 'iconSize';
String keyKey = 'key';
String selectedFontSizeKey = 'selectedFontSize';
String selectedItemColorKey = 'selectedItemColor';
String showSelectedLabelsKey = 'showSelectedLabels';
String showUnselectedLabelsKey = 'showUnselectedLabels';
String typeKey = 'type';
String unselectedFontSizeKey = 'unselectedFontSize';
String unselectedItemColorKey = 'unselectedItemColor';
String itemsKey = 'items';
String currentIndexKey = 'currentIndex';
String selectedIconThemeKey = 'selectedIconTheme';
String unselectedIconThemeKey = 'unselectedIconTheme';
String selectedLabelStyleKey = 'selectedLabelStyle';
String unselectedLabelStyleKey = 'unselectedLabelStyle';
@override
Map<String, String> get properties => {
'backgroundColor': 'Color',
'elevation': 'double',
'fixedColor': 'Color',
'iconSize': 'double',
'key': 'Key',
'selectedFontSize': 'double',
'selectedItemColor': 'Color',
'showSelectedLabels': 'bool',
'showUnselectedLabels': 'bool',
'type': 'BottomNavigationBarType',
'unselectedFontSize': 'double',
'unselectedItemColor': 'Color',
'items': 'List<BottomNavigationBarItemBase>',
'currentIndex': 'int',
'selectedIconTheme': 'IconThemeDataBase',
'unselectedIconTheme': 'IconThemeDataBase',
'selectedLabelStyle': 'TextStyleBase',
'unselectedLabelStyle': 'TextStyleBase',
};
Color get backgroundColorVal {
if (params[backgroundColorKey] != null) {
int _value = null;
String description = params[backgroundColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[backgroundColorKey] is Map) {
if (params[backgroundColorKey]['name'] == 'Color' &&
params[backgroundColorKey]['params'] != null &&
params[backgroundColorKey]['params']['0'] != null) {
_value = int.tryParse(params[backgroundColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set backgroundColorVal(Color val) {
params[backgroundColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
double get elevationVal {
if (params[elevationKey] != null) {
return params[elevationKey] as double;
}
return null;
}
set elevationVal(double val) {
params[elevationKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Color get fixedColorVal {
if (params[fixedColorKey] != null) {
int _value = null;
String description = params[fixedColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[fixedColorKey] is Map) {
if (params[fixedColorKey]['name'] == 'Color' &&
params[fixedColorKey]['params'] != null &&
params[fixedColorKey]['params']['0'] != null) {
_value = int.tryParse(params[fixedColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set fixedColorVal(Color val) {
params[fixedColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
double get iconSizeVal {
if (params[iconSizeKey] != null) {
return params[iconSizeKey] as double;
}
return null;
}
set iconSizeVal(double val) {
params[iconSizeKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
double get selectedFontSizeVal {
if (params[selectedFontSizeKey] != null) {
return params[selectedFontSizeKey] as double;
}
return null;
}
set selectedFontSizeVal(double val) {
params[selectedFontSizeKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Color get selectedItemColorVal {
if (params[selectedItemColorKey] != null) {
int _value = null;
String description = params[selectedItemColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[selectedItemColorKey] is Map) {
if (params[selectedItemColorKey]['name'] == 'Color' &&
params[selectedItemColorKey]['params'] != null &&
params[selectedItemColorKey]['params']['0'] != null) {
_value = int.tryParse(params[selectedItemColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set selectedItemColorVal(Color val) {
params[selectedItemColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
bool get showSelectedLabelsVal {
if (params[showSelectedLabelsKey] != null) {
return params[showSelectedLabelsKey] as bool;
}
return null;
}
set showSelectedLabelsVal(bool val) {
params[showSelectedLabelsKey] = val;
widgetContext.onUpdate(id, widgetData);
}
bool get showUnselectedLabelsVal {
if (params[showUnselectedLabelsKey] != null) {
return params[showUnselectedLabelsKey] as bool;
}
return null;
}
set showUnselectedLabelsVal(bool val) {
params[showUnselectedLabelsKey] = val;
widgetContext.onUpdate(id, widgetData);
}
List<BottomNavigationBarType> get typeValues => [
BottomNavigationBarType.fixed,
BottomNavigationBarType.shifting,
];
BottomNavigationBarType get typeVal {
if (params[typeKey] != null) {
final _value = params[typeKey].toString().replaceAll('#', '');
return typeValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => BottomNavigationBarType.fixed,
);
}
return BottomNavigationBarType.fixed;
}
set typeVal(BottomNavigationBarType val) {
params[typeKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
double get unselectedFontSizeVal {
if (params[unselectedFontSizeKey] != null) {
return params[unselectedFontSizeKey] as double;
}
return null;
}
set unselectedFontSizeVal(double val) {
params[unselectedFontSizeKey] = val;
widgetContext.onUpdate(id, widgetData);
}
Color get unselectedItemColorVal {
if (params[unselectedItemColorKey] != null) {
int _value = null;
String description = params[unselectedItemColorKey].toString();
if (description.startsWith('#')) {
description = description.replaceAll('#Color(', '').replaceAll(')', '');
_value = int.tryParse(description);
} else if (params[unselectedItemColorKey] is Map) {
if (params[unselectedItemColorKey]['name'] == 'Color' &&
params[unselectedItemColorKey]['params'] != null &&
params[unselectedItemColorKey]['params']['0'] != null) {
_value = int.tryParse(params[unselectedItemColorKey]['params']['0']);
}
}
if (_value != null) {
return Color(_value);
}
}
return null;
}
set unselectedItemColorVal(Color val) {
params[unselectedItemColorKey] = "#Color(${val.value})";
widgetContext.onUpdate(id, widgetData);
}
final _itemsListen = ValueNotifier<bool>(false);
List<WidgetBase> get itemsVal {
if (params[itemsKey] != null) {
final _children = <WidgetBase>[];
final _list = List.from(params[itemsKey]);
for (final item in _list) {
if (item is Map<String, dynamic>) {
_children.add(widgetRender(widgetContext, item));
}
}
return _children;
}
return null;
}
void itemsValUpdate(Map<String, dynamic> val) {
if (params[itemsKey] == null) {
params[itemsKey] = [];
}
params[itemsKey].add(val);
widgetContext.onUpdate(id, widgetData);
}
int get currentIndexVal {
if (params[currentIndexKey] != null) {
return params[currentIndexKey] as int;
}
return 0;
}
set currentIndexVal(int val) {
params[currentIndexKey] = val;
widgetContext.onUpdate(id, widgetData);
}
IconThemeDataBase get selectedIconThemeVal {
if (params[selectedIconThemeKey] != null) {
return IconThemeDataBase(
params[selectedIconThemeKey], widgetContext, widgetRender);
}
return null;
}
set selectedIconThemeVal(IconThemeDataBase val) {
params[selectedIconThemeKey] = val;
widgetContext.onUpdate(id, widgetData);
}
IconThemeDataBase get unselectedIconThemeVal {
if (params[unselectedIconThemeKey] != null) {
return IconThemeDataBase(
params[unselectedIconThemeKey], widgetContext, widgetRender);
}
return null;
}
set unselectedIconThemeVal(IconThemeDataBase val) {
params[unselectedIconThemeKey] = val;
widgetContext.onUpdate(id, widgetData);
}
TextStyleBase get selectedLabelStyleVal {
if (params[selectedLabelStyleKey] != null) {
return TextStyleBase(
params[selectedLabelStyleKey], widgetContext, widgetRender);
}
return null;
}
set selectedLabelStyleVal(TextStyleBase val) {
params[selectedLabelStyleKey] = val;
widgetContext.onUpdate(id, widgetData);
}
TextStyleBase get unselectedLabelStyleVal {
if (params[unselectedLabelStyleKey] != null) {
return TextStyleBase(
params[unselectedLabelStyleKey], widgetContext, widgetRender);
}
return null;
}
set unselectedLabelStyleVal(TextStyleBase val) {
params[unselectedLabelStyleKey] = val;
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: BottomNavigationBar(
backgroundColor: backgroundColorVal,
currentIndex: currentIndexVal,
elevation: elevationVal,
fixedColor: fixedColorVal,
iconSize: iconSizeVal,
items: itemsVal == null && !widgetContext.isDragging
? []
: [
if (itemsVal != null)
for (final item in itemsVal) item.build(context),
],
key: keyVal,
selectedFontSize: selectedFontSizeVal,
selectedIconTheme: selectedIconThemeVal?.build(context),
selectedItemColor: selectedItemColorVal,
selectedLabelStyle: selectedLabelStyleVal?.build(context),
showSelectedLabels: showSelectedLabelsVal,
showUnselectedLabels: showUnselectedLabelsVal,
type: typeVal,
unselectedFontSize: unselectedFontSizeVal,
unselectedIconTheme: unselectedIconThemeVal?.build(context),
unselectedItemColor: unselectedItemColorVal,
unselectedLabelStyle: unselectedLabelStyleVal?.build(context),
),
);
}
}
@@ -0,0 +1,50 @@
import 'package:flutter/material.dart';
import 'package:flutter_dynamic_widget/src/material/enums.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../library.dart';
part 'button_bar.g.dart';
@WidgetClass('ButtonBar')
class ButtonBarBase extends _$ButtonBarBase {
ButtonBarBase(this.widgetData, this.widgetContext, this.widgetRender);
@enumMainAxisAlignment
MainAxisAlignment alignment;
bool buttonAlignedDropdown;
double buttonHeight;
double buttonMinWidth;
EdgeInsets buttonPadding;
@enumButtonTextTheme
ButtonTextTheme buttonTextTheme;
Key key;
@enumButtonBarLayoutBehavior
ButtonBarLayoutBehavior layoutBehavior;
@enumMainAxisSize
MainAxisSize mainAxisSize;
double overflowButtonSpacing;
@enumVerticalDirection
VerticalDirection overflowDirection;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@ListWidgetKey()
List<Widget> children;
}
@@ -0,0 +1,334 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'button_bar.dart';
// **************************************************************************
// WidgetGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, avoid_init_to_null
abstract class _$ButtonBarBase extends WidgetBase {
String alignmentKey = 'alignment';
String buttonAlignedDropdownKey = 'buttonAlignedDropdown';
String buttonHeightKey = 'buttonHeight';
String buttonMinWidthKey = 'buttonMinWidth';
String buttonPaddingKey = 'buttonPadding';
String buttonTextThemeKey = 'buttonTextTheme';
String keyKey = 'key';
String layoutBehaviorKey = 'layoutBehavior';
String mainAxisSizeKey = 'mainAxisSize';
String overflowButtonSpacingKey = 'overflowButtonSpacing';
String overflowDirectionKey = 'overflowDirection';
String childrenKey = 'children';
@override
Map<String, String> get properties => {
'alignment': 'MainAxisAlignment',
'buttonAlignedDropdown': 'bool',
'buttonHeight': 'double',
'buttonMinWidth': 'double',
'buttonPadding': 'EdgeInsets',
'buttonTextTheme': 'ButtonTextTheme',
'key': 'Key',
'layoutBehavior': 'ButtonBarLayoutBehavior',
'mainAxisSize': 'MainAxisSize',
'overflowButtonSpacing': 'double',
'overflowDirection': 'VerticalDirection',
'children': 'List<Widget>',
};
List<MainAxisAlignment> get alignmentValues => [
MainAxisAlignment.center,
MainAxisAlignment.end,
MainAxisAlignment.spaceAround,
MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceEvenly,
MainAxisAlignment.start,
];
MainAxisAlignment get alignmentVal {
if (params[alignmentKey] != null) {
final _value = params[alignmentKey].toString().replaceAll('#', '');
return alignmentValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => MainAxisAlignment.start,
);
}
return MainAxisAlignment.start;
}
set alignmentVal(MainAxisAlignment val) {
params[alignmentKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
bool get buttonAlignedDropdownVal {
if (params[buttonAlignedDropdownKey] != null) {
return params[buttonAlignedDropdownKey] as bool;
}
return null;
}
set buttonAlignedDropdownVal(bool val) {
params[buttonAlignedDropdownKey] = val;
widgetContext.onUpdate(id, widgetData);
}
double get buttonHeightVal {
if (params[buttonHeightKey] != null) {
return params[buttonHeightKey] as double;
}
return null;
}
set buttonHeightVal(double val) {
params[buttonHeightKey] = val;
widgetContext.onUpdate(id, widgetData);
}
double get buttonMinWidthVal {
if (params[buttonMinWidthKey] != null) {
return params[buttonMinWidthKey] as double;
}
return null;
}
set buttonMinWidthVal(double val) {
params[buttonMinWidthKey] = val;
widgetContext.onUpdate(id, widgetData);
}
EdgeInsets get buttonPaddingVal {
EdgeInsets _spacing = EdgeInsets.all(0.0);
if (params[buttonPaddingKey] != null) {
double top = 0;
double bottom = 0;
double left = 0;
double right = 0;
Map<String, dynamic> _spacingParams = params[buttonPaddingKey]['params'];
top = _spacingParams['top'] ?? 0;
bottom = _spacingParams['bottom'] ?? 0;
left = _spacingParams['left'] ?? 0;
right = _spacingParams['right'] ?? 0;
_spacing = EdgeInsets.fromLTRB(left, top, right, bottom);
}
return _spacing;
}
set buttonPaddingVal(EdgeInsets val) {
params[buttonPaddingKey] = {
"name": "EdgeInsets.only",
"id": "buttonPaddingKeyEdgeInsets",
"params": {
"top": val.top,
"bottom": val.bottom,
"left": val.left,
"right": val.right,
}
};
widgetContext.onUpdate(id, widgetData);
}
List<ButtonTextTheme> get buttonTextThemeValues => [
ButtonTextTheme.normal,
ButtonTextTheme.accent,
ButtonTextTheme.primary,
];
ButtonTextTheme get buttonTextThemeVal {
if (params[buttonTextThemeKey] != null) {
final _value = params[buttonTextThemeKey].toString().replaceAll('#', '');
return buttonTextThemeValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set buttonTextThemeVal(ButtonTextTheme val) {
params[buttonTextThemeKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
Key get keyVal {
if (params[keyKey] != null) {
String _val = params[keyKey].toString();
if (_val.startsWith('#')) {
_val = _val.substring(1);
if (_val.startsWith('ValueKey')) {
_val = _val.replaceAll('ValueKey', '');
_val = _val.replaceAll('<String>', '');
_val = _val.replaceAll('(', '');
_val = _val.replaceAll(')', '');
}
}
return ValueKey('$_val');
}
return null;
}
set keyVal(Key val) {
if (val == null) {
params[keyKey] = null;
} else {
params[keyKey] = "#ValueKey('$val')";
}
widgetContext.onUpdate(id, widgetData);
}
List<ButtonBarLayoutBehavior> get layoutBehaviorValues => [
ButtonBarLayoutBehavior.constrained,
ButtonBarLayoutBehavior.padded,
];
ButtonBarLayoutBehavior get layoutBehaviorVal {
if (params[layoutBehaviorKey] != null) {
final _value = params[layoutBehaviorKey].toString().replaceAll('#', '');
return layoutBehaviorValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => null,
);
}
return null;
}
set layoutBehaviorVal(ButtonBarLayoutBehavior val) {
params[layoutBehaviorKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
List<MainAxisSize> get mainAxisSizeValues => [
MainAxisSize.max,
MainAxisSize.min,
];
MainAxisSize get mainAxisSizeVal {
if (params[mainAxisSizeKey] != null) {
final _value = params[mainAxisSizeKey].toString().replaceAll('#', '');
return mainAxisSizeValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => MainAxisSize.max,
);
}
return MainAxisSize.max;
}
set mainAxisSizeVal(MainAxisSize val) {
params[mainAxisSizeKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
double get overflowButtonSpacingVal {
if (params[overflowButtonSpacingKey] != null) {
return params[overflowButtonSpacingKey] as double;
}
return null;
}
set overflowButtonSpacingVal(double val) {
params[overflowButtonSpacingKey] = val;
widgetContext.onUpdate(id, widgetData);
}
List<VerticalDirection> get overflowDirectionValues => [
VerticalDirection.up,
VerticalDirection.down,
];
VerticalDirection get overflowDirectionVal {
if (params[overflowDirectionKey] != null) {
final _value =
params[overflowDirectionKey].toString().replaceAll('#', '');
return overflowDirectionValues.firstWhere(
(element) => element.toString() == _value,
orElse: () => VerticalDirection.down,
);
}
return VerticalDirection.down;
}
set overflowDirectionVal(VerticalDirection val) {
params[overflowDirectionKey] = "$val";
widgetContext.onUpdate(id, widgetData);
}
final _childrenListen = ValueNotifier<bool>(false);
List<WidgetBase> get childrenVal {
if (params[childrenKey] != null) {
final _children = <WidgetBase>[];
final _list = List.from(params[childrenKey]);
for (final item in _list) {
if (item is Map<String, dynamic>) {
_children.add(widgetRender(widgetContext, item));
}
}
return _children;
}
return null;
}
void childrenValUpdate(Map<String, dynamic> val) {
if (params[childrenKey] == null) {
params[childrenKey] = [];
}
params[childrenKey].add(val);
widgetContext.onUpdate(id, widgetData);
}
@override
Object build(BuildContext context) {
return GestureDetector(
onTap: () => widgetContext.onTap(id, widgetData),
child: ButtonBar(
alignment: alignmentVal,
buttonAlignedDropdown: buttonAlignedDropdownVal,
buttonHeight: buttonHeightVal,
buttonMinWidth: buttonMinWidthVal,
buttonPadding: buttonPaddingVal,
buttonTextTheme: buttonTextThemeVal,
children: childrenVal == null && !widgetContext.isDragging
? []
: [
if (childrenVal != null)
for (final item in childrenVal) item.build(context),
if (widgetContext.isDragging)
DragTarget<WidgetBaseData>(
onAccept: (val) {
_childrenListen.value = false;
if (val != null) {
childrenValUpdate(val?.data);
}
},
onLeave: (val) {
_childrenListen.value = false;
},
onWillAccept: (val) {
_childrenListen.value = true;
return _childrenListen.value;
},
builder: (context, accepted, rejected) {
return ValueListenableBuilder<bool>(
valueListenable: _childrenListen,
builder: (context, _accepting, child) =>
SizedBox.fromSize(
size: Size(30, 30),
child: Placeholder(
color: !_accepting
? Colors.grey
: Theme.of(context).accentColor,
),
));
},
),
],
key: keyVal,
layoutBehavior: layoutBehaviorVal,
mainAxisSize: mainAxisSizeVal,
overflowButtonSpacing: overflowButtonSpacingVal,
overflowDirection: overflowDirectionVal,
),
);
}
}
@@ -0,0 +1,51 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_dynamic_widget/src/material/enums.dart';
import 'package:widget_gen/widget_gen_annotations.dart';
import '../../../flutter_dynamic_widget.dart';
import '../library.dart';
part 'card.g.dart';
@WidgetClass('Card')
class CardBase extends _$CardBase {
CardBase(this.widgetData, this.widgetContext, this.widgetRender);
@enumClip
Clip clipBehavior;
Color color;
double elevation;
Key key;
EdgeInsets margin;
Color shadowColor;
ShapeBorder shape;
@override
final Map<String, dynamic> widgetData;
@override
final WidgetContext widgetContext;
@override
final GenerateWidget widgetRender;
@override
get onAction => (context, val) => MaterialBase.onAction(context, val);
@WidgetKey.widget(
acceptWidth: 100,
acceptHeight: 100,
defaultValue: 'Placeholder',
)
Widget child;
@PropertyKey(defaultValue: 'true')
bool borderOnForeground;
@PropertyKey(defaultValue: 'true')
bool semanticContainer;
}

Some files were not shown because too many files have changed in this diff Show More