Created
August 17, 2020 19:37
-
-
Save AdamMusa/7567d6f5e743de62f9f035f7a96481f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter_app/widgets/cloudinary.dart'; | |
import 'package:flutter_app/widgets/images_picker.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:provider/provider.dart'; | |
class MyHomePage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
final _files = Provider.of<FetchImage>(context); | |
final _response = Provider.of<CloudImage>(context); | |
return Scaffold( | |
appBar: AppBar( | |
title: const Text('Cloudinary'), | |
), | |
body: _response.isloading | |
? Center(child: Text("Click to pick images")) | |
: Padding( | |
padding: const EdgeInsets.only(left: 5, right: 5, top: 12), | |
child: GridView.builder( | |
itemCount: 8, | |
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( | |
crossAxisCount: 2, | |
crossAxisSpacing: 1.0, | |
mainAxisSpacing: 1.0), | |
itemBuilder: (BuildContext context, int index) { | |
return Image.network(_response.urlList[index]); | |
})), | |
floatingActionButton: FloatingActionButton( | |
child: Icon(Icons.image), | |
onPressed: () async { | |
await _files.init(); | |
await _response.upload(_files.list); | |
})); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment