Skip to content

Instantly share code, notes, and snippets.

Last active June 3, 2020 07:07
Show Gist options
  • Save Wizpna/eab058e15cc1533bdb73bf764078f642 to your computer and use it in GitHub Desktop.
Save Wizpna/eab058e15cc1533bdb73bf764078f642 to your computer and use it in GitHub Desktop.
9 Easiest Steps to Build Photo Diary App Using Flutter and Cloudinary
import 'package:flutter/material.dart';
import 'package:flutter_and_cloudinary/data.dart';
import 'package:flutter_and_cloudinary/fullScreen.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter and Cloudinary',
debugShowCheckedModeBanner: false,
theme: ThemeData(
home: MyHomePage(),
class MyHomePage extends StatefulWidget {
_MyHomePageState createState() => _MyHomePageState();
class _MyHomePageState extends State<MyHomePage> {
String baseUrl =
'https://API Key:API name/resources/image';
//Replace API Key with your cloudinary API Key
//and also replace API Secret key with your cloudinary API Secret key.
//When done, your baseUrl should look like this url below
Future<List<Resources>> getPhotos() async {
return await http.get(baseUrl).then((response) {
Data an = Data.fromJson(json.decode(response.body.toString()));
return an.resources;
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Flutter and Cloudinary'),
centerTitle: true,
body: FutureBuilder(
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.hasData) {
if ( != null) {
List<Resources> resources =;
return GridView.count(
crossAxisCount: 2,
childAspectRatio: 0.74,
shrinkWrap: false,
children: {
return GestureDetector(
onTap: () {
builder: (context) => FullScreen(i)));
child: Card(
elevation: 5.0,
child: Column(
children: <Widget>[
new ClipRRect(
borderRadius: BorderRadius.circular(4.0),
child: Hero(
tag: i.secureUrl,
width: MediaQuery.of(context).size.width,
height: 208,
fit: BoxFit.cover,
} else {
return Center(child: CircularProgressIndicator());
future: getPhotos(),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment