Comments (22)
贴一下doctor信息
from fair.
from fair.
错误原因是无法创建编译中间产物,没有权限。
可以flutter clean后,清除.dart_tool文件试试。
另外使用的是自带demo还是?
把更多的runner编译日志发一下,看看是哪一步权限问题
from fair.
这个问题flutter clean之后就解决了。又出现了另一个问题 budle过程farmat错误,我这个widght是可以跑起来的,是fair语法哪里用错了吗?
就像这样相应的地方我已经加了
from fair.
@SionChen 恭喜你进入接入流程了
budle过程farmat错误 => bundle构建过程format错误?
该问题一般是由于build函数中出现了不支持的语法格式;导致进行代码格式化时出现异常。
这个widght是可以跑起来的
指的是原生运行ok对吧?原生ok的情况下,根据错误日志提示,定位出语法问题,进行组件封装或者引用替换即可。具体示例可以参考example,里面有多重业务场景的替换方法(不唯一)。如果不介意,也可把这个widget的代码贴出来,帮你分析下。
from fair.
import 'package:flutter/material.dart';
import 'package:guangshop_flutter_module/components/home_goods_tab_indicator.dart';
import 'dart:math';
import 'package:fair/fair.dart';
@FairPatch()
class HomeTabGoodsView extends StatefulWidget {
@override
_HomeTabGoodsViewState createState() => _HomeTabGoodsViewState();
}
class _HomeTabGoodsViewState extends State<HomeTabGoodsView>
with SingleTickerProviderStateMixin {
@FairWell('_scrollViewController')
ScrollController _scrollViewController;
@FairWell('_tabController')
TabController _tabController;
@FairWell('_tabs')
List<String> _tabs = ['综合', '佣金', '销量', '销量'];
@FairWell('_myColor')
Color _myColor = Colors.red;
@override
void initState() {
super.initState();
_scrollViewController = ScrollController(initialScrollOffset: 0.0);
_tabController = TabController(vsync: this, length: _tabs.length);
_tabController.addListener(() {
if (_tabController.indexIsChanging) {
setState(() {
_myColor = Color.fromARGB(255, Random().nextInt(256) + 0,
Random().nextInt(256) + 0, Random().nextInt(256) + 0);
});
}
});
}
@override
void dispose() {
super.dispose();
_scrollViewController.dispose();
_tabController.dispose();
}
@override
Widget build(BuildContext context) {
return _buildGoodsTab();
}
// 构建商品tab
@FairWell('_buildGoodsTab')
Widget _buildGoodsTab() {
return Column(children: [
_buildGoodsTabBar(),
Column(
children: [
_buildListitemView(),
Container(
color: _myColor,
height: 1000,
),
],
)
]);
}
@FairWell('_buildGoodsTabBar')
Widget _buildGoodsTabBar() {
return Column(
children: [
SizedBox(
height: 5,
),
Row(
children: [
Expanded(
child: TabBar(
indicator: AGBubbleTabIndicator(
insets: EdgeInsets.symmetric(horizontal: 5)),
// indicator: BubbleTabIndicator(indicatorHeight: 25),
// isScrollable: true,
controller: _tabController,
tabs: _tabs.map((e) => _buildTabItem(e)).toList(),
// labelPadding: EdgeInsets.symmetric(horizontal: 10, vertical: 0),
labelColor: Colors.black,
),
),
GestureDetector(
onTap: () async {
//弹出对话框并等待其关闭
bool delete = await _showDeleteConfirmDialog1();
if (delete == null) {
print("取消");
} else {
print("确认");
//... 删除文件
}
},
child: Row(
children: [
SizedBox(
width: 10,
),
Text(
'筛选',
style: TextStyle(
color: Colors.red,
),
),
Icon(
Icons.favorite_rounded,
color: Colors.grey,
),
SizedBox(
width: 10,
),
],
),
),
],
),
Row(
children: [
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Text('猜你喜欢'),
Text('高佣必买'),
Text('30天热销'),
Text('卡片显示'),
],
),
),
SizedBox(
width: 5,
),
Row(
children: [
Text(
'快速选货',
style: TextStyle(
color: Colors.black,
),
),
SizedBox(
width: 10,
),
],
),
],
),
SizedBox(
height: 10,
),
],
);
}
@FairWell('_buildTabItem')
Widget _buildTabItem(String text) {
return Container(
height: 30,
child: Padding(
padding: EdgeInsets.only(top: 5),
child: Text(text, style: TextStyle(color: Colors.black)),
),
);
}
@FairWell('_buildListitemView')
Widget _buildListitemView() {
return Padding(
padding: EdgeInsets.all(8),
child: Card(
elevation: 5,
child: Padding(
padding: EdgeInsets.all(10),
child: Row(
children: [
Container(
decoration: new BoxDecoration(
color: Colors.grey,
borderRadius: BorderRadius.circular(3)),
height: 100,
width: 100,
),
SizedBox(
width: 10,
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'中秋节苏式月饼礼盒装荷花',
style: TextStyle(fontWeight: FontWeight.bold),
),
Text(
'234位主播在卖 | 已售3232',
style: TextStyle(fontSize: 12),
),
SizedBox(
height: 5,
),
Container(
decoration: BoxDecoration(
border:
Border.all(color: Colors.orange, width: 0.5)),
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 3),
child: Text(
'大主播同款',
style:
TextStyle(color: Colors.orange, fontSize: 10),
),
),
),
SizedBox(
height: 5,
),
Row(
children: [
Expanded(
child: Column(
children: [
Text(
'预计赚',
style: TextStyle(color: Colors.red),
),
Text(
'¥223',
style: TextStyle(color: Colors.red),
)
],
crossAxisAlignment: CrossAxisAlignment.start,
)),
Expanded(
child: Column(
children: [Text('佣金'), Text('50.34%')],
crossAxisAlignment: CrossAxisAlignment.start,
)),
Expanded(
child: Column(
children: [Text('粉丝购买价'), Text('¥59.3')],
crossAxisAlignment: CrossAxisAlignment.start,
)),
],
)
],
),
),
],
)),
),
);
}
// 弹出对话框
@FairWell('_showDeleteConfirmDialog1')
Future<bool> _showDeleteConfirmDialog1() {
return showDialog<bool>(
context: context,
builder: (context) {
return AlertDialog(
title: Text("提示"),
content: Text("此处弹出筛选"),
actions: <Widget>[
FlatButton(
child: Text("取消"),
onPressed: () => Navigator.of(context).pop(), // 关闭对话框
),
FlatButton(
child: Text("确认"),
onPressed: () {
//关闭对话框并返回true
Navigator.of(context).pop(true);
},
),
],
);
},
);
}
}
from fair.
这个log也没有看出来是哪个语法出了问题
from fair.
这段代码包含逻辑运算,所以报错。目前编译器没有输出更多错误信息,会补充日志,方便开发是排查转义问题
from fair.
好的 目前支持Function的转义吗?@Fairwell修饰?
from fair.
from fair.
针对函数成员,建议封装为Widget后,添加@FairBinding,会自动生成组件表。
如果需要引用函数,通过Delegate进行配置。
demo中存在数组循环的逻辑,这部分目前还处于实验性质。将你的代码,略加调整后,转换得到如下效果。
from fair.
调整后的参考代码见附件:
sample.zip
from fair.
from fair.
Sugar.mapEach 转义出来的代码是不对的:
转义后:
from fair.
针对函数成员,建议封装为Widget后,添加@FairBinding,会自动生成组件表。
如果需要引用函数,通过Delegate进行配置。
demo中存在数组循环的逻辑,这部分目前还处于实验性质。将你的代码,略加调整后,转换得到如下效果。
你这里的GoodsContent json可以发出来看一下吗?
from fair.
data绑定参数,只能使用基础类型,不能使用数组,对象也不建议
{
"className": "Column",
"na": {
"children": [
{
"className": "Column",
"na": {
"children": [
{
"className": "SizedBox",
"na": {
"height": 5
}
},
{
"className": "Row",
"na": {
"children": [
{
"className": "Expanded",
"na": {
"child": {
"className": "TabBar",
"na": {
"controller": "#(tabController)",
"tabs": {
"className": "Sugar.mapEach",
"pa": [
"#(tabs)",
{
"className": "Container",
"na": {
"height": 30,
"child": {
"className": "Padding",
"na": {
"padding": {
"className": "EdgeInsets.only",
"na": {
"top": 5
}
},
"child": {
"className": "Text",
"pa": [
"item"
],
"na": {
"style": {
"className": "TextStyle",
"na": {
"color": "#(Colors.black)"
}
}
}
}
}
}
}
}
]
},
"labelColor": "#(Colors.black)"
}
}
}
},
{
"className": "GestureDetector",
"na": {
"onTap": "#(onTap)",
"child": {
"className": "Row",
"na": {
"children": [
{
"className": "SizedBox",
"na": {
"width": 10
}
},
{
"className": "Text",
"pa": [
"筛选"
],
"na": {
"style": {
"className": "TextStyle",
"na": {
"color": "#(Colors.red)"
}
}
}
},
{
"className": "Icon",
"pa": [
"#(Icons.favorite_rounded)"
],
"na": {
"color": "#(Colors.grey)"
}
},
{
"className": "SizedBox",
"na": {
"width": 10
}
}
]
}
}
}
}
]
}
},
{
"className": "Row",
"na": {
"children": [
{
"className": "Expanded",
"na": {
"child": {
"className": "Row",
"na": {
"mainAxisAlignment": "#(MainAxisAlignment.spaceAround)",
"children": [
{
"className": "Text",
"pa": [
"猜你喜欢"
]
},
{
"className": "Text",
"pa": [
"高佣必买"
]
},
{
"className": "Text",
"pa": [
"30天热销"
]
},
{
"className": "Text",
"pa": [
"卡片显示"
]
}
]
}
}
}
},
{
"className": "SizedBox",
"na": {
"width": 5
}
},
{
"className": "Row",
"na": {
"children": [
{
"className": "Text",
"pa": [
"快速选货"
],
"na": {
"style": {
"className": "TextStyle",
"na": {
"color": "#(Colors.black)"
}
}
}
},
{
"className": "SizedBox",
"na": {
"width": 10
}
}
]
}
}
]
}
},
{
"className": "SizedBox",
"na": {
"height": 10
}
}
]
}
},
{
"className": "Column",
"na": {
"children": [
{
"className": "ListItemView"
},
{
"className": "Container",
"na": {
"color": "#(myColor)"
}
}
]
}
}
]
}
}
from fair.
我看你的demo里面也用了呢。我这边需要一个list来进行数据传输,没有解决方法吗
from fair.
大佬 有没有交流群? 可以加一下吗
from fair.
demo中是一个数组string对象。字符串是基础类型。不能使用对象的原因是没有反射api,所以很困难支持对象。讨论组,有微信群,后面看看搞一个chat通道
from fair.
这个可能是什么问题我加上Sugar.foreach转义就有问题:
from fair.
from fair.
到首页去gitter讨论组聊
from fair.
Related Issues (20)
- duration.js里头的位运算符 >> 存在问题 HOT 1
- fair-online云开发平台 502 HOT 1
- SyntaxError: Identifier 'GLOBAL' has already been declared
- 请问什么时候能支持flutte 3.10 呢 HOT 1
- fair_version版本映射缺少组件
- 如果需要下发的动态页面,包含多自定义widget(也需要动态下发),这种情况一般怎么处理,有什么最佳实践吗 HOT 4
- 58同城App有用到Flutter或者Fair库吗? HOT 1
- 生成Js文件本地可以加载,放到服务器后无法加载 HOT 10
- 执行 flutter pub run build_runner build 后,未生成.js文件 HOT 1
- 在Sugar里的表达式,不支持逻辑运算符 ! & |吗? HOT 2
- 热更新需要重启吗 HOT 8
- FairJSBridge是不是有多线程的问题
- 关于 #344 次改动的问题反馈 HOT 2
- Delegate传参问题 HOT 1
- Google Play 合规性问题 HOT 2
- 在iPhone 8 version13.4上 多次刷新偶现页面取值异常 HOT 1
- iOS AppStore合规问题
- 技术交流群有没有可用的,目前无法加入。二维码过期 HOT 2
- 58小助手添加不成功,希望加群了解一下 fair HOT 6
- [Fair] 警告: 不识别的语法节点类型 BinaryExpressionImpl package:musashinobank_flutter/page/home/home_page.dart:163:30: index > 0
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 fair.