本文主要是介绍Flutter-选取图库图片和拍照功能,选取视频和拍摄视频,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1.先引入库image_picker
2.功能代码
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:image_picker/image_picker.dart';void main() => runApp(selectImag());class selectImag extends StatelessWidget {@overrideWidget build(BuildContext context) {// TODO: implement buildreturn MaterialApp(home: Scaffold(body: Container(child: Column(children: <Widget>[RaisedButton(onPressed: _takePhoto,child: Text("拍照"),),RaisedButton(onPressed: _openGallery,child: Text("选择照片"),),],),)));} }
这篇关于Flutter-选取图库图片和拍照功能,选取视频和拍摄视频的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!