forked from eatvio/eatvio_app
60 lines
2.5 KiB
Dart
60 lines
2.5 KiB
Dart
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
|
import 'package:eatvio_app/core/widgets/custom_divider.dart';
|
|
import 'package:eatvio_app/features/notifications/presentation/notifications_cubit/notifications_cubit.dart';
|
|
import 'package:eatvio_app/features/notifications/presentation/notifications_cubit/notifications_state.dart';
|
|
import 'package:eatvio_app/features/notifications/presentation/widgets/notification_widget.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
|
|
class NotificationsScreen extends StatelessWidget {
|
|
const NotificationsScreen({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocBuilder<NotificationsCubit, NotificationsState>(
|
|
builder: (BuildContext context, NotificationsState state) {
|
|
return Scaffold(
|
|
backgroundColor: appTheme.gray100,
|
|
appBar: AppBar(
|
|
title: const Text('Уведомления'),
|
|
),
|
|
body: state is NotificationsStateLoaded
|
|
? Padding(
|
|
padding: const EdgeInsets.only(top: 8.0),
|
|
child: Container(
|
|
padding: const EdgeInsets.only(top: 16),
|
|
decoration: BoxDecoration(
|
|
color: appTheme.whiteA700,
|
|
borderRadius: const BorderRadius.only(
|
|
topLeft: Radius.circular(12),
|
|
topRight: Radius.circular(12),
|
|
),
|
|
),
|
|
child: CustomScrollView(
|
|
slivers: [
|
|
SliverList.separated(
|
|
separatorBuilder: (context, index) => const Padding(
|
|
padding: EdgeInsets.symmetric(vertical: 12, horizontal: 16),
|
|
child: CustomDivider(),
|
|
),
|
|
itemBuilder: (context, index) {
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
child: NotificationWidget(
|
|
notification: state.notifications[index],
|
|
),
|
|
);
|
|
},
|
|
itemCount: state.notifications.length,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
)
|
|
: const Placeholder(),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|