add notification, fix appbar,fix style subscription
This commit is contained in:
@@ -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,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user