赞
踩
界面很简陋,可以根据自己的需求进行修改界面
camera: 0.5.7+4
permission_handler: 3.2.2
path_provider: 1.6.0
class MyHomePage extends StatefulWidget { @override _MyHomePageState createState() => _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { String imagePath; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text("自定义camera"),), body: Container( width: double.infinity, height: double.infinity, alignment: Alignment.center, child: Column( children: <Widget>[ RaisedButton( onPressed: (){ requestPermission(); }, child: Text("自定义相机"), ), Container( width: 100, height: 100, margin: EdgeInsets.only(top: 50), alignment: Alignment.center, child: imagePath!=null?Image.asset(imagePath,):Text("未选择图片") ) ], ), ), )
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。