dengyin2000 / dynamic_widget Goto Github PK
View Code? Open in Web Editor NEWA Backend-Driven UI toolkit, build your dynamic UI with json, and the json format is very similar with flutter widget code.
License: Apache License 2.0
A Backend-Driven UI toolkit, build your dynamic UI with json, and the json format is very similar with flutter widget code.
License: Apache License 2.0
After running flutter upgrade, I am now seeing this error when attempting to compile.
Target dart2js failed: Exception: /C:/Users/user_folder/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/dynamic_widget-2.0.3/lib/dynamic_widget/utils.dart:496:1:
Error: Type 'Overflow' not found.
Overflow parseOverflow(String value) {
^^^^^^^^
/C:/Users/user_folder/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/dynamic_widget-2.0.3/lib/dynamic_widget/basic/stack_positioned_widgets_parser.dart:37:7:
Error: No named parameter with the name 'overflow'.
overflow: map.containsKey("overflow")
^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/widgets/basic.dart:3273:3:
Info: Found this candidate, but the arguments don't match.
Stack({
^^^^^
/C:/Users/user_folder/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/dynamic_widget-2.0.3/lib/dynamic_widget/utils.dart:503:14:
Error: Getter not found: 'Overflow'.
return Overflow.visible;
^^^^^^^^
/C:/Users/user_folder/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/dynamic_widget-2.0.3/lib/dynamic_widget/utils.dart:505:14:
Error: Getter not found: 'Overflow'.
return Overflow.clip;
^^^^^^^^
/C:/Users/user_folder/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/dynamic_widget-2.0.3/lib/dynamic_widget/utils.dart:507:14:
Error: Getter not found: 'Overflow'.
return Overflow.clip;
^^^^^^^^
Error: Compilation failed.
I just need to know, this dynamic widget can support of this format?
onPressed: () { BlocProvider.of<HomeBloc>(context) .add(StartBackgroundLocation()); })
Please let me know is this possible to convert the above. Thanks
参数将如何动态的显示出来呢?
Is there a blog post or live app on the stores that use this, or live examples from the network?
This just really seems like it shows a lot of promise re: code push competition?
Thanks
Is it possible to add business logic dynamically?
For example get business logic from api call. Like on click on button change the text of text view .
Hi, Dengyin.
Thanks for shared good project.
Has one question.
Does this have any relevance to JS? In other words, is it a dynamic DSL solution?
Hi, @dengyin2000
Congratulations for dynamic_widget! It´s a very useful package.
I need to do something like this for BL layer too. For example: My app has a default business logic for sales commission, but each of my clients wants to create their own rule. I would like to be able to inject this custom code according to the user who has logged in my app.
Would you have any idea how to meet this scenario on Flutter?
Thanks
Leandro
Hi, @dengyin2000 How to read a remote JSON file ex: https://raw.githubusercontent.com/farukx/Flutter-Dynamic-Widget/master/widget.json
`dependencies:
flutter:
sdk: flutter
dynamic_widget: ^0.0.3
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
`
I am not sure where I did wrong but am I wrong to put it inside pubspec.yaml?
I got an error as following:
`Running "flutter pub get" in dynamic_widget...
Error on line 23, column 3 of pubspec.yaml: A package may not list itself as a dependency.
╷
23 │ dynamic_widget: ^0.0.3
│ ^^^^^^^^^^^^^^
╵
pub get failed (65; ╵)
Process finished with exit code 65`
Just an issue for myself not to forget to PR it
I would like to do a post back and collect form data in the widget.
SO this means databinding from the value of the widget to a JSON or name value array and then adding that to the URL as a payload.
this would allow editable forms
Hi, im having issue in rendering ListView with horizontal scroll direction. I want to create a scrollable horizontal listview. Am i missing out some settings?
Thank you
This is my JSON:
{ "type": "Container", "alignment": "center", "child": { "type": "ListView", "scrollDirection": "horizontal", "margin": "8,8,8,8", "children" : [{ "type": "Container", "color":"#FF00FF", "width": 500.0, "height": 50, "child":{ "type": "Text", "data":"kimmy1", "textAlign":"center" } }, { "type": "Container", "color":"#FF00FF", "width": 500.0, "height": 50, "child":{ "type": "Text", "data":"kimmyB", "textAlign":"center" } }, { "type": "Container", "color":"#FF00FF", "width": 500.0, "height": 50, "child":{ "type": "Text", "data":"kimmy3", "textAlign":"center" } }] } }
I'm starting to use your library which is awesome and help me a lot, and I've been thinking that maybe onClicked in ClickListener should pass 'dynamic' rather than 'String' so we could pass custom objects or even map.
Thanks!
You're welcome to PR your library on https://github.com/Solido/awesome-flutter (17000 stars)
So more people can discover your work ! thank you.
change
static Widget buildFromMap(Map<String, dynamic> map,
BuildContext buildContext, ClickListener listener) {
to
static Widget buildFromMap(dynamic map,
BuildContext buildContext, ClickListener listener) {
if(map is String)
return Text(map);
if((map==null) || !map.containsKey('type'))
return null;
so the meta data can be more simple, more error tolerable, support setting like
{ "type":"Padding", "padding":"0,4,0,0" }
{ "type":"Padding", "padding":"0,4,0,0", "child":"test" }
Firstly Thank you very much for the Library. This is so helpful.
Question:
I want to add few views dynamically in a single page. How do I need to define in the JSON and how to parse that data to your library?
使用listview加載的資料後, event就不見了
When minifying a JSON. any double
without decimal are converted into int
type
Original
{
"type": "SizedBox",
"height": 19.0,
"child": {
"type": "Container",
"color": "#FFFFFF"
}
},
minified
{"type":"SizedBox","height":19,"child":{"type":"Container","color":"#FFFFFF"}}
https://codebeautify.org/jsonminifier
Error when building above JSON
The following _TypeError was thrown building BlocBuilder<Cubit, String>
type 'int' is not a subtype of type 'double'
The relevant error-causing widget was:
BlocBuilder<Cubit, String>home_page.dart:
When the exception was thrown, this was the stack:
#0 SizedBoxWidgetParser.parse (package:dynamic_widget/dynamic_widget/basic/sizedbox_widget_parser.dart:34:18)
#1 DynamicWidgetBuilder.buildFromMap (package:dynamic_widget/dynamic_widget.dart:116:21)
#2 DynamicWidgetBuilder.buildWidgets (package:dynamic_widget/dynamic_widget.dart:127:14)
#3 ListViewWidgetParser.parse (package:dynamic_widget/dynamic_widget/scrolling/listview_widget_parser.dart:27:41)
#4 DynamicWidgetBuilder.buildFromMap (package:dynamic_widget/dynamic_widget.dart:116:21)
There is a PR #48 which solve this issue on some Parser. Still missing the fix in SizedBox
parser though.
it will be great if we get the Flare support
Widget build(BuildContext context) {
return new FlareActor("animations/boring_star.flr",
alignment: Alignment.center,
fit: BoxFit.contain,
animation: "rotate_scale_color");
}
How do I page detail a click_event route
Navigator.pushNamed(context, '/second');
Hi, amazing package. Love what you are doing.
Just wondering, any plans to update the package to null safety?
Thank you
First - Thank you for the library.
A feature proposal: In my use case I already have a parsed json (using for my own widgets) and it will be helpful to have a method that will accept a map (not a jsonString) if it is already available in runtime.
Hello, i am using click event, but unable to understand how can i open specific page by check route params ?
route://userDetails?userid=123
Want to goto user details page and read 123
Good job.
If I want to enhance the parsers, how do I add my parse into the parser list?
With this project, you can build your UIs from a json string, which is the UI protocal. The json string is very similar with the Flutter widget dart code. All widget type and widget properties are the same.
看了咸鱼的Flutter动态化探索的文章,了解到这个库的,初学Flutter想问下这个动态更新Wiget的库,支持listview动态加载数据吗?listview是那种需要分页加载数据的,能否通过动态更新widget的方式实现listview分页加载的效果呢?还是说这种方式只能更新静态的界面
How can I use TextField and Dropdown using the dynamic widget
When using RTL app and not specifying any text/layout direction the library's default is LTR.
I think it would be better if none specified by the JSON, than let the system decide the right direction ("start" direction for example).
Good job. When I use it, I fell the below features are necessary.
1, A way to add custom parsers. I use listener to do it.
2, A way to pass more objects, for example, pass the context into the parsers. I am using the listener to do it now
3, Pass extra parameters to click event
Hi, great work!
I was thinking of creating a similar library, but hey, you already implemented most of what I had in mind. Is there a LICENSE for this library?
Could you please look into https://pub.dartlang.org/packages/dynamic_widget#-analysis-tab-
Some of them are easy wins - I'd love to see this package go from 65 score to 80 - you could get 9 just from a longer description
how to receive and update value after widget has created
I want to read text of button and change after click button
第一次ListVist產生沒有問題, 但加載更多的時候, 只需要將loadMoreUrl參數帶上, 但是要如何變動loadMoreUrl參數?
例如第一次加載10筆, loadMoreUrl 也指定了第10-20的url, 那第20-30筆怎進行?
Thank you for the great plugin,
Is this plugin support callback event from child to parent widget?
if it does not support, do you have any ideas on how to implement it?
This Icon has been deleted from FontAwesome
https://fontawesome.com/icons/adobe
|-- dynamic_widget 2.0.3
| |-- flutter...
| |-- font_awesome_flutter 8.9.0
https://github.com/FortAwesome/Font-Awesome/blob/57005cea6da7d1c67f3466974aecd25485f60452/UPGRADING.md#5140-to-5150
## 5.14.0 to 5.15.0
--
18 |
19 | The adobe icon has been removed by legal request of Adobe.
20 |
21 | Font Awesome is no longer able to provide any logos or marks for the Adobe
Use this in pubspec.yaml
dependency_overrides:
font_awesome_flutter: 8.8.1 # https://pub.dev/packages/font_awesome_flutter
It is possible to button click to change clicked button background color or add new widget on button click.
Something like in wrap example to 7 button and I click on 3rd button then change background color of 3rd button then I click 5th button then set background color on 5th button and 3rd button to remove background and set as default
If it's possible then please help me.
Thank you
It would be great to have support for text fields as well.
Would it be possible, if we are able to export a widget to json data. Later we can import the json data and generate widget from it.
This way, we can speed up building the json data.
Hi, I found typo text in your documentation about ClipRRect Widget.
ClipRRect, here to see flutter TextSpan definition. Supported json properties:
You can check it in here
https://github.com/dengyin2000/dynamic_widget/blob/master/WIDGETS.md#cliprrect-widget
void onClicked(String event)
上面的clicked方法中,参数context都没有,后续怎样通过Navigator.of(context)方法跳转?
Hi, thanks for sharing such a useful library.
For i18n, how do we support translation from JSON data?
Thanks in advance.
例如:
String clickEvent = map.containsKey("click_event") ? map['click_event'] : "";
// 等价
String clickEvent = map['click_event'] ?? '';
请更新下pub上的版本多谢
status and inspiration bullet point links do not work
i can't wait to try this out though, i love this library from what i see so far.
Hello dengyin,
How can I run function on button click,
Looks to be because of this line
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.