Skip to content

Staggered Item Count #358

@rinsarmu

Description

@rinsarmu

I can't find out a way to place item count in staggered Widget. here is my code the same as on official readme fie.
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:gabaa/core/values/media_values.dart';

class CheckFashionPage extends StatelessWidget {
const CheckFashionPage({super.key});

@OverRide
Widget build(BuildContext context) {
final screenWidth = MediaQuery.of(context).size.width;

final List<String> testImages = [MediaValues.shopOne,MediaValues.shopOne,MediaValues.shopOne,MediaValues.shopOne,];

return Scaffold(
  appBar: AppBar(
    title: const Text(
      "Fashion View",
      style: TextStyle(color: Colors.black),
    ),
  ),
  body: StaggeredGrid.count(
    crossAxisCount: 4,
    mainAxisSpacing: 2,
    crossAxisSpacing: 2,
    children: [
      StaggeredGridTile.count(
        crossAxisCellCount: 2,
        mainAxisCellCount: 2,
        child: Tile(),
      ),
      StaggeredGridTile.count(
        crossAxisCellCount: 2,
        mainAxisCellCount: 1,
        child: Tile(),
      ),
      StaggeredGridTile.count(
        crossAxisCellCount: 1,
        mainAxisCellCount: 1,
        child: Tile(),
      ),
      StaggeredGridTile.count(
        crossAxisCellCount: 1,
        mainAxisCellCount: 1,
        child: Tile(),
      ),
      StaggeredGridTile.count(
        crossAxisCellCount: 4,
        mainAxisCellCount: 2,
        child: Tile(),
      ),
    ],
  ),
);

}

Widget Tile() {
return Image.asset(MediaValues.shopOne, fit: BoxFit.cover);
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions