Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- class ImageGridGallaryInsideList extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- body: Container(
- color: Colors.grey,
- child: ListView.builder(
- itemCount: 5,
- itemBuilder: (BuildContext context, int index) {
- if (index % 2 != 1) {
- return Container(
- padding: EdgeInsets.all(10),
- color: Colors.red,
- child: Center(child: Text("Header Index: " + index.toString())),
- );
- } else {
- return GridView.builder(
- shrinkWrap: true,
- itemCount: 20,
- gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
- crossAxisCount: 2, childAspectRatio: .7),
- physics: NeverScrollableScrollPhysics(),
- itemBuilder: (context, index) {
- String asset = "assets/images/templates/model_" +
- (index + 1).toString() +
- ".jpg";
- return Center(
- child: Container(
- margin: EdgeInsets.all(2),
- color: Colors.blueAccent.withOpacity(0.2),
- // child: Image.asset(asset),
- child: FadeInImage(
- fadeInDuration: Duration(milliseconds: 100),
- image: Image.asset(asset).image,
- fit: BoxFit.fill,
- placeholder: Image.asset(
- "assets/images/templates/place_holder.png")
- .image,
- ),
- ),
- );
- },
- );
- }
- },
- ),
- ));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement