@@ -332,47 +332,66 @@ class _DashboardScreenState extends State<DashboardScreen> with TickerProviderSt
332332 ),
333333 ),
334334 const SizedBox (height: 16 ),
335- GridView .count (
336- shrinkWrap: true ,
337- physics: const NeverScrollableScrollPhysics (),
338- crossAxisCount: 2 ,
339- crossAxisSpacing: 16 ,
340- mainAxisSpacing: 16 ,
341- childAspectRatio: 1.5 ,
342- children: [
343- _buildKPICard (
344- title: 'Товары' ,
345- value: '${stats ['products' ]['total_products' ] ?? 0 }' ,
346- subtitle: 'Всего товаров' ,
347- icon: Icons .inventory,
348- color: Colors .blue,
349- trend: stats['products' ]['trend' ] ?? 'stable' ,
350- ),
351- _buildKPICard (
352- title: 'Продажи' ,
353- value: '${stats ['products' ]['total_products' ] ?? 0 }' ,
354- subtitle: 'За ${_getPeriodText (_selectedPeriod )}' ,
355- icon: Icons .shopping_cart,
356- color: Colors .green,
357- trend: 'increasing' ,
358- ),
359- _buildKPICard (
360- title: 'AI рекомендации' ,
361- value: '${stats ['ai' ]['personal_recommendations_count' ] ?? 0 }' ,
362- subtitle: 'Персональных' ,
363- icon: Icons .psychology,
364- color: Colors .purple,
365- trend: stats['ai' ]['trend' ] ?? 'stable' ,
366- ),
367- _buildKPICard (
368- title: 'Web3 активность' ,
369- value: '${stats ['web3' ]['total_nfts' ] ?? 0 }' ,
370- subtitle: 'NFT токенов' ,
371- icon: Icons .token,
372- color: Colors .orange,
373- trend: 'increasing' ,
374- ),
375- ],
335+ LayoutBuilder (
336+ builder: (context, constraints) {
337+ final screenWidth = constraints.maxWidth;
338+ int crossAxisCount = 2 ;
339+ double childAspectRatio = 1.5 ;
340+
341+ if (screenWidth >= 600 ) {
342+ crossAxisCount = 3 ;
343+ childAspectRatio = 1.2 ;
344+ } else if (screenWidth >= 400 ) {
345+ crossAxisCount = 2 ;
346+ childAspectRatio = 1.4 ;
347+ } else {
348+ crossAxisCount = 1 ;
349+ childAspectRatio = 2.0 ;
350+ }
351+
352+ return GridView .count (
353+ shrinkWrap: true ,
354+ physics: const NeverScrollableScrollPhysics (),
355+ crossAxisCount: crossAxisCount,
356+ crossAxisSpacing: 16 ,
357+ mainAxisSpacing: 16 ,
358+ childAspectRatio: childAspectRatio,
359+ children: [
360+ _buildKPICard (
361+ title: 'Товары' ,
362+ value: '${stats ['products' ]['total_products' ] ?? 0 }' ,
363+ subtitle: 'Всего товаров' ,
364+ icon: Icons .inventory,
365+ color: Colors .blue,
366+ trend: stats['products' ]['trend' ] ?? 'stable' ,
367+ ),
368+ _buildKPICard (
369+ title: 'Продажи' ,
370+ value: '${stats ['products' ]['total_products' ] ?? 0 }' ,
371+ subtitle: 'За ${_getPeriodText (_selectedPeriod )}' ,
372+ icon: Icons .shopping_cart,
373+ color: Colors .green,
374+ trend: 'increasing' ,
375+ ),
376+ _buildKPICard (
377+ title: 'AI рекомендации' ,
378+ value: '${stats ['ai' ]['personal_recommendations_count' ] ?? 0 }' ,
379+ subtitle: 'Персональных' ,
380+ icon: Icons .psychology,
381+ color: Colors .purple,
382+ trend: stats['ai' ]['trend' ] ?? 'stable' ,
383+ ),
384+ _buildKPICard (
385+ title: 'Web3 активность' ,
386+ value: '${stats ['web3' ]['total_nfts' ] ?? 0 }' ,
387+ subtitle: 'NFT токенов' ,
388+ icon: Icons .token,
389+ color: Colors .orange,
390+ trend: 'increasing' ,
391+ ),
392+ ],
393+ );
394+ },
376395 ),
377396 ],
378397 );
0 commit comments