import 'package:flutter/material.dart'; import '../../../core/constants/color_constants.dart'; import '../../../models/daily_info_model.dart'; import '../../../responsive.dart'; import 'mini_information_widget.dart'; class MiniInformation extends StatelessWidget { const MiniInformation({ Key? key, }) : super(key: key); @override Widget build(BuildContext context) { final Size _size = MediaQuery.of(context).size; return Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ SizedBox( width: 10, ), ElevatedButton.icon( style: TextButton.styleFrom( backgroundColor: Colors.green, padding: EdgeInsets.symmetric( horizontal: defaultPadding * 1.5, vertical: defaultPadding / (Responsive.isMobile(context) ? 2 : 1), ), ), onPressed: () {}, icon: Icon(Icons.add), label: Text( "Add New", ), ), ], ), SizedBox(height: defaultPadding), Responsive( mobile: InformationCard( crossAxisCount: _size.width < 650 ? 2 : 4, childAspectRatio: _size.width < 650 ? 1.2 : 1, ), tablet: InformationCard(), desktop: InformationCard( childAspectRatio: _size.width < 1400 ? 1.2 : 1.4, ), ), ], ); } } class InformationCard extends StatelessWidget { const InformationCard({ Key? key, this.crossAxisCount = 5, this.childAspectRatio = 1, }) : super(key: key); final int crossAxisCount; final double childAspectRatio; @override Widget build(BuildContext context) { return GridView.builder( physics: const NeverScrollableScrollPhysics(), shrinkWrap: true, itemCount: dailyDatas.length, gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: crossAxisCount, crossAxisSpacing: defaultPadding, mainAxisSpacing: defaultPadding, childAspectRatio: childAspectRatio, ), itemBuilder: (context, index) => MiniInformationWidget(dailyData: dailyDatas[index]), ); } }