{"id":611,"date":"2023-02-18T19:48:02","date_gmt":"2023-02-18T11:48:02","guid":{"rendered":"http:\/\/gjweb.top\/?p=611"},"modified":"2023-02-18T19:48:02","modified_gmt":"2023-02-18T11:48:02","slug":"26-%e6%8b%8d%e7%85%a7%e7%9b%b8%e5%86%8c%e7%9b%b8%e5%85%b3%e6%93%8d%e4%bd%9c","status":"publish","type":"post","link":"https:\/\/gjweb.top\/?p=611","title":{"rendered":"26. \u62cd\u7167&#038;\u76f8\u518c&#038;\u76f8\u5173\u64cd\u4f5c"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"image-picker-\u7b2c\u4e09\u65b9\">image_picker \u7b2c\u4e09\u65b9<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>import 'package:image_picker\/image_picker.dart';<br>    inal ImagePicker _picker = ImagePicker();<br> &nbsp; &nbsp;\/\/ \u6253\u5f00\u76f8\u518c<br> &nbsp; &nbsp;final XFile? image = await _picker.pickImage(source: ImageSource.gallery);<br> &nbsp; &nbsp;\/\/ \u6253\u5f00\u76f8\u673a<br> &nbsp; &nbsp;final XFile? photo = await _picker.pickImage(source: ImageSource.camera);<br> &nbsp; &nbsp;\/\/ \u6253\u5f00\u76f8\u673a\u76f8\u518c<br> &nbsp; &nbsp;final XFile? image = await _picker.pickVideo(source: ImageSource.gallery);<br> &nbsp; &nbsp;\/\/ \u6253\u5f00\u6444\u50cf\u673a<br> &nbsp; &nbsp;final XFile? video = await _picker.pickVideo(source: ImageSource.camera);<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u7167\u7247\u56de\u663e\">\u7167\u7247\u56de\u663e<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>import \"darat:io\";<br>Image.File(File(image!.path))<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u89c6\u9891\u56de\u663e\">\u89c6\u9891\u56de\u663e<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>late VideoPlayerController videoPlayerController ;<br>late ChewieController chewieController ;<br>\u200b<br>initVoide(url){<br> &nbsp; &nbsp;videoPlayerController = VideoPlayerController.file(url);<br> &nbsp; &nbsp;chewieController = ChewieController(<br> &nbsp;      videoPlayerController:videoPlayerController<br> &nbsp;  )<br>}<br>\u200b<br>Chewie(<br>    controller: chewieController,<br>)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>image_picker \u7b2c\u4e09\u65b9 \u7167\u7247\u56de\u663e \u89c6\u9891\u56de\u663e<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[],"class_list":["post-611","post","type-post","status-publish","format-standard","hentry","category-flutter"],"_links":{"self":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/611","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=611"}],"version-history":[{"count":1,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/611\/revisions"}],"predecessor-version":[{"id":612,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/611\/revisions\/612"}],"wp:attachment":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=611"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=611"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=611"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}