Skip to content

Commit 527bccd

Browse files
committed
diff ..
1 parent 4e5266a commit 527bccd

5 files changed

Lines changed: 469 additions & 188 deletions

File tree

TODO.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Исправление адаптивности приложения PoSPro
2+
3+
## Задачи для выполнения
4+
5+
### 1. Создание кастомного скроллируемого BottomNavigationBar
6+
- [ ] Создать новый виджет ScrollableBottomNavigationBar в main_screen.dart
7+
- [ ] Заменить стандартный BottomNavigationBar на кастомный
8+
- [ ] Добавить горизонтальный скролл с SingleChildScrollView
9+
- [ ] Реализовать логику выбора активного элемента
10+
11+
### 2. Адаптивные размеры иконок
12+
- [ ] Изменить MyModusIconWidgets в custom_icons.dart
13+
- [ ] Добавить MediaQuery проверки для ширины экрана
14+
- [ ] Уменьшать размер иконок на экранах < 400px
15+
- [ ] Адаптивный padding (4-8px в зависимости от экрана)
16+
17+
### 3. Улучшение адаптивности GridView в Home Screen
18+
- [ ] Изменить crossAxisCount в home_screen.dart
19+
- [ ] Добавить MediaQuery для определения количества колонок
20+
- [ ] Адаптивные размеры карточек
21+
22+
### 4. Адаптивность Dashboard экрана
23+
- [ ] Исправить GridView в dashboard.dart
24+
- [ ] Адаптивные размеры карточек статистики
25+
- [ ] Responsive padding и margins
26+
27+
### 5. Тестирование и доработки
28+
- [ ] Тестировать на разных размерах экранов (320px, 360px, 400px)
29+
- [ ] Проверить скроллинг нижнего меню
30+
- [ ] Убедиться в корректной работе всех элементов
31+
32+
## Прогресс
33+
- [x] Анализ кода и создание плана
34+
- [x] Создание TODO файла
35+
- [x] Реализация кастомного BottomNavigationBar
36+
- [x] Адаптивные иконки
37+
- [ ] Адаптивность Home Screen
38+
- [ ] Адаптивность Dashboard
39+
- [ ] Тестирование

lib/Screens/Home/home_screen.dart

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -617,21 +617,40 @@ class _HomeScreenState extends State<HomeScreen> {
617617
const SizedBox(
618618
height: 20,
619619
),
620-
GridView.count(
621-
physics: const NeverScrollableScrollPhysics(),
622-
shrinkWrap: true,
623-
childAspectRatio: 3.0,
624-
crossAxisSpacing: 10,
625-
mainAxisSpacing: 10,
626-
crossAxisCount: 2,
627-
children: List.generate(
628-
freeIcons.length,
629-
(index) => HomeGridCards(
630-
gridItems: freeIcons[index],
631-
color: color[index],
632-
visibility: businessInfo.value?.user?.visibility,
633-
),
634-
),
620+
LayoutBuilder(
621+
builder: (context, constraints) {
622+
final screenWidth = constraints.maxWidth;
623+
int crossAxisCount = 2;
624+
double childAspectRatio = 3.0;
625+
626+
if (screenWidth >= 600) {
627+
crossAxisCount = 3;
628+
childAspectRatio = 2.5;
629+
} else if (screenWidth >= 400) {
630+
crossAxisCount = 2;
631+
childAspectRatio = 2.8;
632+
} else {
633+
crossAxisCount = 1;
634+
childAspectRatio = 4.0;
635+
}
636+
637+
return GridView.count(
638+
physics: const NeverScrollableScrollPhysics(),
639+
shrinkWrap: true,
640+
childAspectRatio: childAspectRatio,
641+
crossAxisSpacing: 10,
642+
mainAxisSpacing: 10,
643+
crossAxisCount: crossAxisCount,
644+
children: List.generate(
645+
freeIcons.length,
646+
(index) => HomeGridCards(
647+
gridItems: freeIcons[index],
648+
color: color[index],
649+
visibility: businessInfo.value?.user?.visibility,
650+
),
651+
),
652+
);
653+
},
635654
),
636655
const SizedBox(height: 20),
637656
Container(

lib/Screens/dashboard_screen.dart

Lines changed: 60 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)