我试图将一个列表的值复制到另一个列表,我使用三个按钮,第一个按钮将值附加到 mylist,第二个按钮清除 mylist,第三个按钮将值从 mynewlist 复制到 mylist。
我试过这个
List<String> mylist = [
'Albania',
'Andorra',
'Armenia',
'Austria',
'Azerbaijan',
'Belarus',
'Belgium',
'Albania',
'Andorra',
'Armenia',
'Austria',
'Azerbaijan',
'Belarus',
'Belgium',
];
List<String> mynewlist = [
'Albania',
'Andorra',
'Armenia',
'Austria',
'Azerbaijan',
'Belarus',
'Belgium',
'Albania',
'Andorra',
'Armenia',
'Austria',
'Azerbaijan',
'Belarus',
'Belgium',
];
Padding(
padding: const EdgeInsets.all(5.0),
child: Row(
children: <Widget>[
Expanded(
child: FlatButton(
onPressed: () {
setState(() {
print('clicked 1st');
print(mylist.length);
print(mynewlist.length);
mylist.add('sdsds');
});
},
child: Container(
child: Column(
children: <Widget>[
Image.asset(
'images/bulb.png',
width: 100,
height: 100, …Run Code Online (Sandbox Code Playgroud) 我正在使用 progress_dialog 1.2.0 包在我的应用程序中显示进度对话框,它在我调用 pr.show() 时显示,但在我调用 pr.hide() 时没有隐藏。
onTap: () async {
pr.show();
print('clicked custom category');
print(categorylist[index].catName);
print(categorylist[index].catId);
// await getAllProductsInCategory(categorylist[index].catId);
setState(() {
catId = categorylist[index].catId;
myinitlist.clear();
myinitlist = List.from(productList);
pr.hide();
});
},
Run Code Online (Sandbox Code Playgroud)
当我取消注释“getAllProductsInCategory()”函数时,它会隐藏对话框。谁能帮我这个。先感谢您。
我正在开发一个产品信息应用程序,我需要分享产品的规格PDF,有什么办法可以做到。我使用了这个包,share_extend但在使用这个包时出现异常
E/flutter (11283): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: MissingPluginException(No implementation found for method share on channel com.zt.shareextend/share_extend)
E/flutter (11283): #0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:314:7)
Run Code Online (Sandbox Code Playgroud)
这是我的代码
Widget build(BuildContext context) {
return Scaffold(
floatingActionButton: FloatingActionButton(
tooltip: 'Share File',
onPressed: () async {
var dir = await getApplicationDocumentsDirectory();
File file = File('${dir.path}/${widget.product}.pdf');
if (!await file.exists()) {
await file.create(recursive: true);
file.writeAsStringSync("test for share documents file");
}
ShareExtend.share(file.path, "file");
},
backgroundColor: Color(0xffECECEC),
child: Icon(
Icons.share,
color: Color(0xff6F6F6F),
size: 30.0,
),
),);
}
Run Code Online (Sandbox Code Playgroud)