Wednesday, 10 July 2024

flutter grid withimages

 import 'package:flutter/material.dart';



List<String> imagetry =[
  'images/try/image0.jpg',
  'images/try/image1.jpg',
  'images/try/image2.jpg',
  'images/try/image3.jpg',
];
class MenCategory extends StatelessWidget {
  const MenCategory({super.key});

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start, //check by comment
      children: [
        const Padding(
          padding: EdgeInsets.all(30.0),
          child: Text(
            "Men",
            style: TextStyle(
                fontSize: 24, fontWeight: FontWeight.bold, letterSpacing: 1.5),
          ),
        ),
        SizedBox(
          height: MediaQuery.of(context).size.height * 0.68,
          child: GridView.count(
            mainAxisSpacing: 70, //c and check
            crossAxisSpacing: 15, //c and check
            crossAxisCount: 3,
            children: List.generate(4, (index) {
              return Column(
                children: [
                  SizedBox(
                    height: 70,
                    width: 70,
                    child: Image(
                      // image: AssetImage(imagetry[index]),
                      image: AssetImage('images/try/image$index.jpg'),
                    ),
                  ),
                  Text('Shirt')
                ],
              );
            }),
          ),
        )
      ],
    );
  }
}

No comments:

Post a Comment

7 Common mistakes in Dot Net — You can avoid

  There are many common mistakes made during .NET (ASP.NET, .NET Core) development, which affect performance, security, and code… Code Crack...