flutter_ipfs 0.0.2 flutter_ipfs: ^0.0.2 copied to clipboard
A Flutter package that helps you to upload image, video or file to IPFS in a single click.
// ignore_for_file: deprecated_member_use
import 'package:flutter/material.dart';
import 'package:flutter_ipfs/src/service/file_picker.dart';
import 'package:flutter_ipfs/src/service/image_picker.dart';
import 'package:flutter_ipfs/src/service/video_picker.dart';
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
backgroundColor: Colors.white,
elevation: 1,
centerTitle: true,
title: const Text(
'Flutter Ipfs',
style: TextStyle(
letterSpacing: 1.2,
color: Colors.black,
fontSize: 19,
fontWeight: FontWeight.w600,
),
),
),
body: Container(
padding: const EdgeInsets.symmetric(horizontal: 25),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Center(
child: RaisedButton(
onPressed: () => ImagePickerService.pickImage(context),
color: Colors.black,
textColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(25),
),
child: const SizedBox(
height: 50,
child: Center(
child: Text(
'Upload Image',
style: TextStyle(fontSize: 18, fontFamily: 'Brand-Bold'),
),
),
),
),
),
const SizedBox(height: 20),
Center(
child: RaisedButton(
onPressed: () => VideoPickerService.pickVideo(context),
color: Colors.black,
textColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(25),
),
child: const SizedBox(
height: 50,
child: Center(
child: Text(
'Upload Video',
style: TextStyle(fontSize: 18, fontFamily: 'Brand-Bold'),
),
),
),
),
),
const SizedBox(height: 20),
Center(
child: RaisedButton(
onPressed: () => FilePickerService.pickFile(context),
color: Colors.black,
textColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(25),
),
child: const SizedBox(
height: 50,
child: Center(
child: Text(
'Upload File',
style: TextStyle(fontSize: 18, fontFamily: 'Brand-Bold'),
),
),
),
),
),
],
),
),
);
}
}