fb_image_picker 0.0.1
fb_image_picker: ^0.0.1 copied to clipboard
FaceBook image picker.
example/main.dart
import 'dart:io';
import 'package:fb_image_picker/fb_image_picker.dart';
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(
title: 'FB Image Picker',
home: Example(),
);
}
}
class Example extends StatefulWidget {
const Example({Key? key}) : super(key: key);
@override
State<Example> createState() => _ExampleState();
}
class _ExampleState extends State<Example> {
List imageList = [];
@override
Widget build(BuildContext context) {
return Scaffold(
body: SingleChildScrollView(
child: Container(
width: MediaQuery.of(context).size.width,
// height: MediaQuery.of(context).size.height,
color: Colors.black.withOpacity(0.9),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Padding(
padding: EdgeInsets.only(top: 60, bottom: 20),
child: Text(
'FB Image Picker',
style: TextStyle(color: Colors.white, fontSize: 18),
)),
Padding(
padding: const EdgeInsets.only(bottom: 15),
child: TextButton(
child: const Text(
'FB Image Picker',
style: TextStyle(color: Colors.green, fontSize: 16),
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => FBImagePicker(
btnColor: Colors.blue,
title: 'FB Image Picker',
afterNextBTN: () {
Navigator.pop(context);
},
backOnSystem: () {
Navigator.pop(context);
},
onComplete: (final imagePickerList) {
setState(() {
imageList = imagePickerList;
});
},
)),
);
})),
if (imageList.length == 1)
Image.file(
File(imageList[0]),
fit: BoxFit.cover,
),
if (imageList.length == 2)
Column(
children: [
Image.file(
File(imageList[0]),
fit: BoxFit.cover,
),
Image.file(
File(imageList[1]),
fit: BoxFit.cover,
),
],
)
],
),
)));
}
}