Created
August 17, 2020 16:33
-
-
Save AdamMusa/a117d0eb0ffb4c8f3ddadeb29b00f5a2 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 StatefulWidget { | |
@override | |
_MyHomePageState createState() => _MyHomePageState(); | |
} | |
class _MyHomePageState extends State<MyHomePage> { | |
@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