Comments (6)
@rizalgunawan FLUI-Dynamic will add dynamic value binding in the future, may also support this kind of splicing to meet your needs... thanks.
from flui.
hi @rizalgunawan, dynamic component is a container, u can use setState
to change json object in dynamic or just return widget directly:
FutureBuilder<CommonModel>(
future: fetchPost(),
builder:
(BuildContext context, AsyncSnapshot<CommonModel> snapshot) {
return FLDyContainer(
jsonObject: $JSON_STRING_OR_OBJECT,
placeholder: CircularProgressIndicator(
strokeWidth: 3.0,
valueColor: AlwaysStoppedAnimation(Theme.of(context).accentColor),
),
);
}),
from flui.
hi @rizalgunawan, dynamic component is a container, u can use
setState
to change json object in dynamic or just return widget directly:FutureBuilder<CommonModel>( future: fetchPost(), builder: (BuildContext context, AsyncSnapshot<CommonModel> snapshot) { return FLDyContainer( jsonObject: $JSON_STRING_OR_OBJECT,
so what should I set inside $JSON_STRING_OR_OBJECT ?
what I mean is, I want to populate ListView children from FutureBuilder
{
"uniqueId": "flui-list01",
"unitName": "ListView",
"shrinkWrap": true,
"separatedDivider": {
"height": 1
},
"children": []
}
basically, we can set widget to children like this, right?
return FutureBuilder(
builder: (context, projectSnap) {
return ListView.builder(
itemCount: projectSnap.data.length,
itemBuilder: (context, index) {
ProjectModel project = projectSnap.data[index];
return Column(
children: <Widget>[
// Widget to display the list of project
],
);
},
);
},
future: getProjectDetails(),
);
May I have an example?
Thank you, this is great's plugin btw..
from flui.
hi @rizalgunawan,i think you can try like this:
(jsonlist) => {
final list = [];
jsonlist.forEach((item) {
list.add(FLDyContainer(
jsonObject: item));
});
// return list or set state to change children.
}
FLDyContainer will not add widget level, so u can use it like above.
from flui.
Hi @Rannie, thanks for your quick response,
I think you misinterpreted what I meant,
Try to see the example Dynamic ListView at :
https://github.com/Rannie/flui/blob/master/example/lib/pages/dylistview_page.dart
it contains a static widget from this :
const ListJson =
'{
"uniqueId": "flui-safearea",
"unitName": "SafeArea",
"child": {
"uniqueId": "flui-list01",
"unitName": "ListView",
"shrinkWrap": true,
"separatedDivider": {
"height": 1
},
"children": [
{
"uniqueId": "tile-01",
"unitName": "ListTile",
"title": {
"unitName": "Text",
"text": "FLUI"
},
"subtitle": {
"unitName": "Text",
"text": "An UI framework for Flutter"
}
},
]
}
}';
I want to refresh or load more data to the ListView children from the API, without re-creating ListView from json, is that possible?
Maybe we can add some params to the widget config, like this:
{
"uniqueId": "flui-safearea",
"unitName": "SafeArea",
"child": {
"uniqueId": "flui-list01",
"unitName": "ListView",
"loadMoreUrl" : "http://route-to-api.com/action?page=1&perPage=10",
"children": [
]
}
}
from flui.
@rizalgunawan i see, It is not supported to disassemble it for refreshing children. so i only can suggest you to write a list view in code and just change children...
from flui.
Related Issues (20)
- button in FLToast is unclickable HOT 1
- FLGradientLoadingButton HOT 1
- 动态配色建议 HOT 1
- [input] long press the input widget will crash HOT 3
- Enabled params missing into FLRaisedButton HOT 2
- 使用 Toast 导致 文本框双击就报错 HOT 2
- Flutter版本 1.12.13+hotfix.8运行报错 HOT 3
- FLStaticListView 使用,当sections元素很多的时候不能支持页面滚动吗? HOT 1
- FLCountStepper 组件报错 HOT 4
- FlToast 提示字体过粗 且无法配置 HOT 1
- 这个库还在维护么?
- 这个库不维护了吗? HOT 4
- FLToast
- 希望适配下 null safety HOT 1
- 官网域名到期看不了 HOT 1
- 什么时候支持控安全 HOT 2
- version solving failed
- Help me setup locally
- Is this package still in development?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flui.