Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3. class ImageGridGallaryInsideList extends StatelessWidget {
  4. @override
  5. Widget build(BuildContext context) {
  6. return Scaffold(
  7. body: Container(
  8. color: Colors.grey,
  9. child: ListView.builder(
  10. itemCount: 5,
  11. itemBuilder: (BuildContext context, int index) {
  12. if (index % 2 != 1) {
  13. return Container(
  14. padding: EdgeInsets.all(10),
  15. color: Colors.red,
  16. child: Center(child: Text("Header Index: " + index.toString())),
  17. );
  18. } else {
  19. return GridView.builder(
  20. shrinkWrap: true,
  21. itemCount: 20,
  22. gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  23. crossAxisCount: 2, childAspectRatio: .7),
  24. physics: NeverScrollableScrollPhysics(),
  25. itemBuilder: (context, index) {
  26. String asset = "assets/images/templates/model_" +
  27. (index + 1).toString() +
  28. ".jpg";
  29. return Center(
  30. child: Container(
  31. margin: EdgeInsets.all(2),
  32. color: Colors.blueAccent.withOpacity(0.2),
  33. // child: Image.asset(asset),
  34. child: FadeInImage(
  35. fadeInDuration: Duration(milliseconds: 100),
  36. image: Image.asset(asset).image,
  37. fit: BoxFit.fill,
  38. placeholder: Image.asset(
  39. "assets/images/templates/place_holder.png")
  40. .image,
  41. ),
  42. ),
  43. );
  44. },
  45. );
  46. }
  47. },
  48. ),
  49. ));
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement