import 'package:flutter/material.dart'; class StoreScreen03 extends StatefulWidget { const StoreScreen03({super.key}); @override State createState() => _StoreScreen03State(); } class _StoreScreen03State extends State { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text("Store"), actions: [ IconButton( icon: const Icon(Icons.shopping_cart), onPressed: () { // place save function here }, ), ], ), body: LayoutBuilder( builder: (context, constraints) => Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( child: MediaQuery.removePadding( context: context, removeTop: true, child: GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: (constraints.maxWidth > 412) ? 4 : 2, mainAxisSpacing: 2, crossAxisSpacing: 2, ), itemCount: 10, itemBuilder: (BuildContext context, int index) { return const GridItem(); }, ), ), ), ], ), ), ); } } class GridItem extends StatelessWidget { const GridItem({ super.key, }); @override Widget build(BuildContext context) { return LayoutBuilder( builder: (context, constraints) => Card( clipBehavior: Clip.antiAliasWithSaveLayer, child: GridTile( child: Stack( children: [ SizedBox( width: constraints.maxWidth, height: constraints.maxWidth, child: Image.asset( 'assets/images/placeholder.png', fit: BoxFit.cover, ), ), Positioned( bottom: 4, width: constraints.maxWidth, child: Column( children: [ Container( padding: const EdgeInsets.all(4.0), decoration: BoxDecoration( color: Theme.of(context).primaryColor, borderRadius: BorderRadius.circular(20)), child: const Text( "\$12.00", style: TextStyle( fontWeight: FontWeight.w500, color: Colors.white, ), ), ), Container( padding: const EdgeInsets.symmetric(vertical: 4.0), child: const Text( "Product Name", style: TextStyle( fontWeight: FontWeight.w500, fontSize: 16.0), ), ), Container( padding: const EdgeInsets.symmetric(vertical: 4.0), child: const Text( "Short Description", ), ), ], ), ), ], ), ), ), ); } }