add notification, fix appbar,fix style subscription
This commit is contained in:
@@ -35,6 +35,7 @@ class AddCardScreen extends StatelessWidget {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
const CustomAppBar(title: 'Добавление карты'),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ class LicenseAgreementScreen extends StatelessWidget {
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
// 🔹 APPBAR С КНОПКОЙ НАЗАД
|
||||
const SizedBox(height: 16),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||
child: CustomAppBar(title: ' '),
|
||||
|
||||
@@ -696,13 +696,13 @@ class _MapScreenState extends State<MapScreen> {
|
||||
children: [
|
||||
_RoundIconButton(
|
||||
icon: Icons.notifications_sharp,
|
||||
onPressed: _onNotificationTap,
|
||||
onPressed: () => context.push("/home/notifications"),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_RoundIconButton(
|
||||
icon: Icons.directions_run,
|
||||
_RoundButton(
|
||||
imagePath: 'assets/icons/scooter_placemark.png',
|
||||
onPressed: () => context.push("/home/current-rides-sheet"),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -810,6 +810,40 @@ class _RoundIconButton extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class _RoundButton extends StatelessWidget {
|
||||
final String imagePath;
|
||||
final VoidCallback onPressed;
|
||||
|
||||
const _RoundButton({
|
||||
required this.imagePath,
|
||||
required this.onPressed,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.darkBlue,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: GestureDetector(
|
||||
onTap: onPressed,
|
||||
child: Center(
|
||||
child: Image.asset(
|
||||
imagePath,
|
||||
width: 20,
|
||||
height: 20,
|
||||
fit: BoxFit.contain,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _CircleIconButton extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final VoidCallback onPressed;
|
||||
|
||||
@@ -61,7 +61,7 @@ class _NewsDetailScreenState extends State<NewsDetailScreen> {
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
// 🔹 Заголовок в AppBar
|
||||
const SizedBox(height: 16),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: CustomAppBar(title: widget.title),
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'dart:developer' as dev;
|
||||
import '../../core/app_colors.dart';
|
||||
import '../../di/service_locator.dart';
|
||||
import '../components/custom_app_bar.dart';
|
||||
import '../components/gradient_button.dart';
|
||||
import '../event/news_event.dart';
|
||||
import '../state/news_state.dart';
|
||||
import '../viewmodel/news_bloc.dart';
|
||||
@@ -14,11 +15,8 @@ class NewsScreen extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
dev.log('🔍 NewsScreen: Создание экрана новостей');
|
||||
|
||||
return BlocProvider(
|
||||
create: (context) {
|
||||
dev.log('🔍 NewsScreen: Создание NewsBloc');
|
||||
return getIt<NewsBloc>()..add(const NewsFetchRequested());
|
||||
},
|
||||
child: const NewsView(),
|
||||
@@ -31,7 +29,6 @@ class NewsView extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
dev.log('🔍 NewsView: Построение UI');
|
||||
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
@@ -48,7 +45,6 @@ class NewsView extends StatelessWidget {
|
||||
Expanded(
|
||||
child: BlocBuilder<NewsBloc, NewsState>(
|
||||
builder: (context, state) {
|
||||
dev.log('🔍 NewsView: Состояние ${state.status}, новостей: ${state.news.length}');
|
||||
|
||||
if (state.status == NewsStatus.initial || state.status == NewsStatus.loading) {
|
||||
return const Center(
|
||||
@@ -84,7 +80,6 @@ class NewsView extends StatelessWidget {
|
||||
const SizedBox(height: 24),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
dev.log('🔍 NewsView: Повторная загрузка');
|
||||
context.read<NewsBloc>().add(const NewsFetchRequested());
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
@@ -173,7 +168,7 @@ class _NewsCard extends StatelessWidget {
|
||||
margin: const EdgeInsets.only(bottom: 16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF141530),
|
||||
color: const Color(0xFF0A0F2E).withOpacity(0.7),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Column(
|
||||
@@ -196,6 +191,18 @@ class _NewsCard extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 80,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('assets/news_def.png'),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
news.previewText,
|
||||
style: const TextStyle(
|
||||
@@ -205,51 +212,28 @@ class _NewsCard extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
SizedBox(
|
||||
height: 40,
|
||||
child: OutlinedButton(
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => NewsDetailScreen(
|
||||
newsId: news.id,
|
||||
title: news.title,
|
||||
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 150),
|
||||
child: GradientButton(
|
||||
text: 'Подробнее',
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => NewsDetailScreen(
|
||||
newsId: news.id,
|
||||
title: news.title,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
style: OutlinedButton.styleFrom(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
),
|
||||
side: BorderSide(color: AppColors.smsDigit.withOpacity(0.3)),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Text(
|
||||
'Подробнее',
|
||||
style: TextStyle(color: AppColors.smsDigit),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Icon(
|
||||
Icons.arrow_forward_ios_sharp,
|
||||
size: 12,
|
||||
color: AppColors.smsDigit,
|
||||
),
|
||||
Icon(
|
||||
Icons.arrow_forward_ios_sharp,
|
||||
size: 12,
|
||||
color: AppColors.smsDigit.withOpacity(0.6),
|
||||
),
|
||||
Icon(
|
||||
Icons.arrow_forward_ios_sharp,
|
||||
size: 12,
|
||||
color: AppColors.smsDigit.withOpacity(0.3),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
showArrows: true,
|
||||
fontSize: 14,
|
||||
height: 40,
|
||||
width: double.infinity,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
350
lib/presentation/screens/notifications_screen.dart
Normal file
350
lib/presentation/screens/notifications_screen.dart
Normal file
@@ -0,0 +1,350 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'dart:developer' as dev;
|
||||
|
||||
import '../../core/app_colors.dart';
|
||||
import '../../di/service_locator.dart';
|
||||
import '../../domain/entities/client_notification.dart';
|
||||
import '../components/custom_app_bar.dart';
|
||||
import '../event/notifications_event.dart';
|
||||
import '../state/notifications_state.dart';
|
||||
import '../viewmodel/notifications_bloc.dart';
|
||||
|
||||
enum NotificationFilter {
|
||||
all,
|
||||
auth,
|
||||
payment,
|
||||
order,
|
||||
}
|
||||
|
||||
class NotificationsScreen extends StatelessWidget {
|
||||
const NotificationsScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return _NotificationsScreenContent();
|
||||
}
|
||||
}
|
||||
|
||||
class _NotificationsScreenContent extends StatefulWidget {
|
||||
const _NotificationsScreenContent();
|
||||
|
||||
@override
|
||||
State<_NotificationsScreenContent> createState() => _NotificationsScreenContentState();
|
||||
}
|
||||
|
||||
class _NotificationsScreenContentState extends State<_NotificationsScreenContent> {
|
||||
NotificationFilter _filter = NotificationFilter.all;
|
||||
|
||||
void _setFilter(NotificationFilter filter) {
|
||||
setState(() {
|
||||
_filter = filter;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => getIt<NotificationsBloc>()..add(NotificationsFetchRequested()),
|
||||
child: NotificationsView(
|
||||
filter: _filter,
|
||||
onFilterChanged: _setFilter,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class NotificationsView extends StatelessWidget {
|
||||
final NotificationFilter filter;
|
||||
final ValueChanged<NotificationFilter> onFilterChanged;
|
||||
|
||||
const NotificationsView({
|
||||
super.key,
|
||||
this.filter = NotificationFilter.all,
|
||||
required this.onFilterChanged,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
decoration: const BoxDecoration(gradient: AppColors.phoneScreenBg),
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||
child: CustomAppBar(title: 'Уведомления'),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
_buildFilterBar(),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
Expanded(
|
||||
child: BlocBuilder<NotificationsBloc, NotificationsState>(
|
||||
builder: (context, state) {
|
||||
if (state.status == NotificationsStatus.loading) {
|
||||
return const Center(child: CircularProgressIndicator(color: Colors.white));
|
||||
}
|
||||
|
||||
if (state.status == NotificationsStatus.failure) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Text(
|
||||
'Ошибка загрузки уведомлений',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||
child: Text(
|
||||
state.errorMessage ?? '',
|
||||
style: TextStyle(
|
||||
color: Colors.white.withOpacity(0.6),
|
||||
fontSize: 14,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
context.read<NotificationsBloc>().add(NotificationsFetchRequested());
|
||||
},
|
||||
child: const Text('Повторить'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
final filtered = state.notifications.where((n) {
|
||||
switch (filter) {
|
||||
case NotificationFilter.all:
|
||||
return true;
|
||||
case NotificationFilter.auth:
|
||||
return n.category == NotificationCategory.auth;
|
||||
case NotificationFilter.payment:
|
||||
return n.category == NotificationCategory.payment;
|
||||
case NotificationFilter.order:
|
||||
return n.category == NotificationCategory.scooter;
|
||||
// || n.category == NotificationCategory.adminInfo
|
||||
// || n.category == NotificationCategory.companyInfo;
|
||||
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}).toList();
|
||||
|
||||
if (filtered.isEmpty) {
|
||||
return const _EmptyState();
|
||||
}
|
||||
|
||||
return RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
context.read<NotificationsBloc>().add(NotificationsFetchRequested());
|
||||
},
|
||||
child: ListView.builder(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
itemCount: filtered.length,
|
||||
itemBuilder: (context, index) {
|
||||
return _NotificationCard(notification: filtered[index]);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildFilterBar() {
|
||||
final items = [
|
||||
{'label': 'Все', 'value': NotificationFilter.all},
|
||||
{'label': 'Авторизация', 'value': NotificationFilter.auth},
|
||||
{'label': 'Оплата', 'value': NotificationFilter.payment},
|
||||
{'label': 'Поездка', 'value': NotificationFilter.order},
|
||||
];
|
||||
|
||||
return Container(
|
||||
height: 40,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
children: items.map((item) {
|
||||
final isActive = item['value'] == filter;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 12),
|
||||
child: GestureDetector(
|
||||
onTap: () => onFilterChanged(item['value'] as NotificationFilter),
|
||||
child: Container(
|
||||
height: 32,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
gradient: isActive ? AppColors.activeButtonGradient : null,
|
||||
color: isActive ? null : Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(
|
||||
color: isActive
|
||||
? Colors.transparent
|
||||
: Colors.white.withOpacity(0.4),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
item['label'] as String,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: isActive
|
||||
? AppColors.activeButtonText
|
||||
: Colors.white,
|
||||
fontSize: 14,
|
||||
fontWeight: isActive ? FontWeight.bold : FontWeight.normal,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _EmptyState extends StatelessWidget {
|
||||
const _EmptyState();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/notification_empty.png',
|
||||
width: 280,
|
||||
height: 280,
|
||||
fit: BoxFit.contain,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
return const Icon(
|
||||
Icons.notifications_none_outlined,
|
||||
size: 120,
|
||||
color: Colors.white38,
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 32),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 40),
|
||||
child: Text(
|
||||
'У вас пока нет уведомлений.',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white70,
|
||||
fontSize: 16,
|
||||
height: 1.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _NotificationCard extends StatelessWidget {
|
||||
final ClientNotification notification;
|
||||
|
||||
const _NotificationCard({required this.notification});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final date = _formatDate(notification.createdAt);
|
||||
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF141530).withOpacity(0.7),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
date,
|
||||
style: TextStyle(
|
||||
color: Colors.white.withOpacity(0.6),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
notification.content,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String _formatDate(DateTime date) {
|
||||
final now = DateTime.now();
|
||||
final difference = now.difference(date);
|
||||
|
||||
if (difference.inDays == 0) {
|
||||
return 'Сегодня, ${date.hour.toString().padLeft(2, '0')}:${date.minute.toString().padLeft(2, '0')}';
|
||||
} else if (difference.inDays == 1) {
|
||||
return 'Вчера, ${date.hour.toString().padLeft(2, '0')}:${date.minute.toString().padLeft(2, '0')}';
|
||||
} else {
|
||||
return '${date.day.toString().padLeft(2, '0')}.${date.month.toString().padLeft(2, '0')}.${date.year}';
|
||||
}
|
||||
}
|
||||
|
||||
String _getTypeLabel(NotificationType type) {
|
||||
switch (type) {
|
||||
case NotificationType.info:
|
||||
return 'Информация';
|
||||
case NotificationType.attention:
|
||||
return 'Внимание';
|
||||
case NotificationType.warning:
|
||||
return 'Предупреждение';
|
||||
}
|
||||
}
|
||||
|
||||
String _getCategoryLabel(NotificationCategory category) {
|
||||
switch (category) {
|
||||
case NotificationCategory.auth:
|
||||
return 'Авторизация';
|
||||
case NotificationCategory.zone:
|
||||
return 'Зоны';
|
||||
case NotificationCategory.payment:
|
||||
return 'Оплата';
|
||||
case NotificationCategory.companyInfo:
|
||||
return 'Акции';
|
||||
case NotificationCategory.adminInfo:
|
||||
return 'Админ';
|
||||
case NotificationCategory.scooter:
|
||||
return 'Самокат';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ class OrderHistoryDetailScreen extends StatelessWidget {
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
// 🔹 HEADER
|
||||
const SizedBox(height: 16),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: CustomAppBar(title: 'Поездка $date'),
|
||||
|
||||
@@ -32,6 +32,7 @@ class OrderHistoryView extends StatelessWidget {
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||
child: CustomAppBar(title: 'История поездок'),
|
||||
|
||||
@@ -62,6 +62,7 @@ class _PaymentConfirmScreenContent extends StatelessWidget {
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||
child: CustomAppBar(title: 'Завершение поездки'),
|
||||
|
||||
@@ -19,6 +19,7 @@ class PaymentMethodsScreen extends StatelessWidget {
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||
child: CustomAppBar(title: 'Способы оплаты'),
|
||||
|
||||
@@ -14,6 +14,7 @@ class PrivacyPolicyScreen extends StatelessWidget {
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||
child: CustomAppBar(title: ''),
|
||||
|
||||
@@ -45,6 +45,7 @@ class _PromoCodeScreenState extends State<PromoCodeScreen> {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
CustomAppBar(title: 'Промокоды'),
|
||||
const SizedBox(height: 32),
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ class QRScanInfoScreen extends StatelessWidget {
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: CustomAppBar(title: "Сканирование QR-кода"),
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:mobile_scanner/mobile_scanner.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:be_happy/di/service_locator.dart';
|
||||
import 'package:be_happy/domain/usecase/get_scooter_by_title_usecase.dart';
|
||||
import '../components/custom_app_bar.dart';
|
||||
import '../components/gradient_button.dart';
|
||||
|
||||
class QrScanScreen extends StatefulWidget {
|
||||
@@ -149,15 +150,17 @@ class _QrScanScreenState extends State<QrScanScreen> {
|
||||
),
|
||||
),
|
||||
|
||||
// ✅ ИЗМЕНЕНО: прижимаем аппбар к левому краю
|
||||
SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start, // ✅ Выравнивание по левому краю
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
CustomAppBar(title: "Сканирование QR-кода"),
|
||||
const SizedBox(height: 60),
|
||||
const Text(
|
||||
'Наведите рамку на QR-код — номер будет распознан автоматически',
|
||||
textAlign: TextAlign.center,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
@@ -170,7 +173,6 @@ class _QrScanScreenState extends State<QrScanScreen> {
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
SafeArea(
|
||||
child: Align(
|
||||
|
||||
@@ -58,6 +58,7 @@ class _ScooterCodeInputScreenState extends State<ScooterCodeInputScreen> {
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: CustomAppBar(title: "Ввод QR-кода"),
|
||||
|
||||
@@ -70,6 +70,7 @@ class ScooterDetailScreen extends StatelessWidget {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24),
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
CustomAppBar(
|
||||
title: scooter?.title != null ? 'Самокат ${scooter!.title}' : 'Самокат',
|
||||
),
|
||||
|
||||
@@ -123,6 +123,11 @@ class _SendPhotoViewState extends State<SendPhotoView> {
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: CustomAppBar(title: "Отправить фото"),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 100),
|
||||
child: Text(
|
||||
|
||||
@@ -2,7 +2,9 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import '../../core/app_colors.dart';
|
||||
import '../components/app_checkbox.dart';
|
||||
import '../components/custom_app_bar.dart'; // ✅ Добавь импорт
|
||||
import '../components/gradient_button.dart';
|
||||
import '../components/period_selector.dart';
|
||||
import '../event/subscription_details_event.dart';
|
||||
@@ -17,66 +19,74 @@ class SubscriptionDetailsScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFF1A2355),
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back_ios, color: Colors.white),
|
||||
onPressed: () => context.pop(),
|
||||
),
|
||||
title: BlocBuilder<SubscriptionDetailsBloc, SubscriptionDetailsState>(
|
||||
builder: (context, state) {
|
||||
if (state is DetailsContentState) {
|
||||
return Text(state.subscription.title);
|
||||
}
|
||||
return const Text("Загрузка...");
|
||||
},
|
||||
body: Container(
|
||||
decoration: const BoxDecoration(gradient: AppColors.phoneScreenBg),
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: BlocBuilder<SubscriptionDetailsBloc, SubscriptionDetailsState>(
|
||||
builder: (context, state) {
|
||||
String title = "Загрузка...";
|
||||
if (state is DetailsContentState) {
|
||||
title = state.subscription.title;
|
||||
}
|
||||
return CustomAppBar(title: title);
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// 🔹 Контент
|
||||
Expanded(
|
||||
child: Stack(
|
||||
children: [
|
||||
// Волна снизу
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Opacity(
|
||||
opacity: 0.5,
|
||||
child: Image.asset('assets/wave.png'),
|
||||
),
|
||||
),
|
||||
BlocBuilder<SubscriptionDetailsBloc, SubscriptionDetailsState>(
|
||||
builder: (context, state) {
|
||||
if (state is DetailsLoading) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(color: Color(0xFF80FFD1)),
|
||||
);
|
||||
}
|
||||
if (state is DetailsError) {
|
||||
return Center(
|
||||
child: Text(
|
||||
state.message,
|
||||
style: const TextStyle(color: Colors.white),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (state is DetailsContentState) {
|
||||
return _buildContent(context, state);
|
||||
}
|
||||
return const SizedBox();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
body: Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Opacity(
|
||||
opacity: 0.5,
|
||||
child: Image.asset('assets/wave.png'),
|
||||
),
|
||||
),
|
||||
BlocBuilder<SubscriptionDetailsBloc, SubscriptionDetailsState>(
|
||||
builder: (context, state) {
|
||||
if (state is DetailsLoading) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(color: Color(0xFF80FFD1)),
|
||||
);
|
||||
}
|
||||
if (state is DetailsError) {
|
||||
return Center(
|
||||
child: Text(
|
||||
state.message,
|
||||
style: const TextStyle(color: Colors.white),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (state is DetailsContentState) {
|
||||
return _buildContent(context, state);
|
||||
}
|
||||
return const SizedBox();
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
Widget _buildContent(BuildContext context, DetailsContentState state) {
|
||||
return SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -104,6 +114,7 @@ class SubscriptionDetailsScreen extends StatelessWidget {
|
||||
fontSize: 16,
|
||||
showArrows: true,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -125,9 +136,6 @@ class _ActionCard extends StatelessWidget {
|
||||
state.selectedPeriod,
|
||||
);
|
||||
|
||||
context.read<SubscriptionDetailsBloc>().add(
|
||||
SelectPeriodEvent(state.subscription.options[selectedIndex]));
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(24),
|
||||
decoration: BoxDecoration(
|
||||
@@ -205,7 +213,7 @@ class _PriceRow extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset("assets/icons/money_icon.png", width: 72, height: 72),
|
||||
SizedBox(width: 15),
|
||||
const SizedBox(width: 15),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -224,5 +232,4 @@ class _PriceRow extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,6 +21,7 @@ class SubscriptionsListScreen extends StatelessWidget {
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: CustomAppBar(title: 'Абонементы'),
|
||||
|
||||
@@ -21,53 +21,55 @@ class TopUpScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFF1A234E),
|
||||
body: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
const CustomAppBar(title: 'Пополнение баланса'),
|
||||
const SizedBox(height: 20),
|
||||
body: Container(
|
||||
decoration: const BoxDecoration(gradient: AppColors.phoneScreenBg),
|
||||
child: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
const CustomAppBar(title: 'Пополнение баланса'),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
BlocBuilder<TopUpBloc, TopUpState>(
|
||||
builder: (context, state) {
|
||||
if (state.isLoading) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
BlocBuilder<TopUpBloc, TopUpState>(
|
||||
builder: (context, state) {
|
||||
if (state.isLoading) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
|
||||
return Expanded(
|
||||
child: Stack(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildTariffList(state, context),
|
||||
const SizedBox(height: 30),
|
||||
_buildPriceInfo(state),
|
||||
const SizedBox(height: 40),
|
||||
const Text(
|
||||
'Способ оплаты',
|
||||
style: TextStyle(color: Colors.white70),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
_buildCardSelector(state, context),
|
||||
const SizedBox(height: 20),
|
||||
_buildAgreement(state, context),
|
||||
const Spacer(),
|
||||
_buildPayButton(state),
|
||||
const SizedBox(height: 30),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
return Expanded(
|
||||
child: Stack(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildTariffList(state, context),
|
||||
const SizedBox(height: 30),
|
||||
_buildPriceInfo(state),
|
||||
const SizedBox(height: 40),
|
||||
const Text(
|
||||
'Способ оплаты',
|
||||
style: TextStyle(color: Colors.white70),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
_buildCardSelector(state, context),
|
||||
const SizedBox(height: 20),
|
||||
_buildAgreement(state, context),
|
||||
const Spacer(),
|
||||
_buildPayButton(state),
|
||||
const SizedBox(height: 30),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user