Skip to content

Instantly share code, notes, and snippets.

@anoochit
Created January 30, 2024 11:13
Show Gist options
  • Save anoochit/b80a97d81d7256702242ad8963d022fb to your computer and use it in GitHub Desktop.
Save anoochit/b80a97d81d7256702242ad8963d022fb to your computer and use it in GitHub Desktop.
simmer effect with gidview
GridView.builder(
itemCount: 8,
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
mainAxisSpacing: 4,
crossAxisSpacing: 4,
),
itemBuilder: (context, index) {
return Shimmer.fromColors(
baseColor: Colors.grey.shade200,
highlightColor: Colors.white,
child: Container(
decoration: BoxDecoration(
border: Border.all(width: 1.0),
borderRadius: BorderRadius.circular(12.0)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
for (int i = 0; i < 5; i++)
Padding(
padding: const EdgeInsets.all(8.0),
child: LayoutBuilder(builder: (context, constraints) {
return Container(
width: constraints.maxWidth * (0.5 * (5 - i)),
height: 16,
decoration: BoxDecoration(
color: Colors.grey.shade50,
borderRadius: BorderRadius.circular(6.0),
),
);
}),
)
],
),
),
);
},
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment