rwa_camera 0.0.31
rwa_camera: ^0.0.31 copied to clipboard
This is custom camera with flash mode and multiple photo camera preview all you need to do is call OpenCamera and wait for List of XFile which will contain the list of image that the user have taken. [...]
example/lib/main.dart
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:rwa_camera/CameraModule/OpenCamera.dart';
void main() {
runApp(HomePage());
}
class HomePage extends StatelessWidget {
const HomePage({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
home: MainPage(),
);
}
}
class MainPage extends StatefulWidget {
MainPage({
Key key,
}) : super(key: key);
@override
_MainPageState createState() => _MainPageState();
}
class _MainPageState extends State<MainPage> {
List<XFile> listImageFile = [];
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Column(
children: [
Row(
children: [
Column(children: [
ElevatedButton(
onPressed: () async {
listImageFile.addAll(await Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => new OpenCamera(
switchCamera: true,
totalQuestion: 1,
))));
setState(() {
});
},
child: Text('default')),
ElevatedButton(
onPressed: () async {
listImageFile.addAll(await Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => new OpenCamera(
switchCamera: true,
totalQuestion: 1,
uiStyle: UiStyle.smooth,
))));
setState(() {
});
},
child: Text('smooth')),
ElevatedButton(
onPressed: () async {
listImageFile.addAll(await Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => new OpenCamera(
switchCamera: true,
totalQuestion: 1,
uiStyle: UiStyle.overlay,
))));
setState(() {
});
},
child: Text('overlay')),
ElevatedButton(
onPressed: () async {
listImageFile.addAll(await Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => new OpenCamera(
switchCamera: true,
totalQuestion: 1,
uiStyle: UiStyle.cropOverlay,
))));
setState(() {
});
},
child: Text('crop')),
],),
Column(children: [
ElevatedButton(
onPressed: () async {
listImageFile.addAll(await Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => new OpenCamera(
switchCamera: true,
totalQuestion: 5,
))));
setState(() {
});
},
child: Text('default')),
ElevatedButton(
onPressed: () async {
listImageFile.addAll(await Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => new OpenCamera(
switchCamera: true,
totalQuestion: 5,
uiStyle: UiStyle.smooth,
))));
setState(() {
});
},
child: Text('smooth')),
ElevatedButton(
onPressed: () async {
listImageFile.addAll(await Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => new OpenCamera(
switchCamera: true,
totalQuestion: 5,
uiStyle: UiStyle.overlay,
))));
setState(() {
});
},
child: Text('overlay')),
ElevatedButton(
onPressed: () async {
listImageFile.addAll(await Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => new OpenCamera(
switchCamera: true,
totalQuestion: 5,
uiStyle: UiStyle.cropOverlay,
))));
setState(() {
});
},
child: Text('crop')),
],)
],
),
Divider(
thickness: 3,
color: Colors.black,
),
Expanded(
child: GridView.count(
// Create a grid with 2 columns. If you change the scrollDirection to
// horizontal, this produces 2 rows.
crossAxisCount: 3,
// Generate 100 widgets that display their index in the List.
children: List.generate(listImageFile.length, (index) {
return Center(
child: Image.file(File(listImageFile[index].path)),
);
}),
),
),
],
),
),
);
}
}