使用 Web UI (web_ui) 库(例如 mylib)创建示例 Web 应用程序
打开 mylib.dart,将其设为库:
library mylib;
import 'dart:html';
import 'package:web_ui/web_ui.dart';
part 'xclickcounter.dart';
...
Run Code Online (Sandbox Code Playgroud)
打开 xclickcounter.dart,删除导入并插入:
part of mylib;
Run Code Online (Sandbox Code Playgroud)
web/out/mylib.dart并web/out/xclickcounter.dart变得一团糟:
包含的部分“xclickcounter.dart”必须有一个part-of指令
类只能混入其他类
Mixin只能应用于类
...更多错误如下
我究竟做错了什么?请帮忙 :(
编辑:如果我不编辑生成的示例代码,wdc 将生成属于单独库的代码:
这是否意味着,如果我们使用 web_ui,我们不应该创建自己的库,而 wdc 会自动为我们执行此操作?
更新:如果我不使用任何库名称,类似于生成的示例代码,并且仅依赖 xdc 在 web/out/... 文件中生成的库名称,那么在导入两个组件时我仍然会遇到麻烦进入第三个文件。Dart 编辑器将产生以下警告:
导入的库“compa.dart”和“compb.dart”不应具有相同的名称
解决方法是根据 xdc 在 web/out/... 文件中生成的内容来命名您的库,即:
将组件显式放入此类库后,Dart 编辑器警告就会消失。
有谁知道这个截图
正确反映这种布局?
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/text_view1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:background="#FFFFFF80"
style="@android:style/TextAppearance.DeviceDefault.Large"
android:text="@string/text_1"/>
<TextView
android:id="@+id/text_view2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
app:layout_anchor="@id/text_view1"
app:layout_anchorGravity="bottom|right"
android:background="#FFFF8080"
style="@android:style/TextAppearance.DeviceDefault.Large"
android:text="@string/text_2"/>
<TextView
android:id="@+id/text_view3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
app:layout_anchor="@id/text_view2"
app:layout_anchorGravity="bottom|right"
android:background="#FF8080FF"
style="@android:style/TextAppearance.DeviceDefault.Large"
android:text="@string/text_3"/>
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)
我没想到文本视图有任何重叠,但可能是我的期望不正确?
Ktor 的 HttpClient 允许安装 Json 功能。有谁知道这个功能是否可以使用kotlinx.serialization 库还是仅限于 Gson?我有兴趣为MPP项目启用 Json 功能。
覆盖以下三个生命周期方法WebComponent:created(),inserted()和之后removed(),我可以看到前两个被一致地调用但removed()从未调用过.有什么特别的东西需要做才能removed()被调用吗?或者它根本就没有被称为?