Browse Source

update ui notification screen

master
daivph 5 years ago
parent
commit
8a64887c33
2 changed files with 74 additions and 70 deletions
  1. +73
    -69
      lib/presentation/screens/notification/sc_notification.dart
  2. +1
    -1
      pubspec.yaml

+ 73
- 69
lib/presentation/screens/notification/sc_notification.dart View File

@@ -68,82 +68,86 @@ class _NotificationScreenState extends State<NotificationScreen> {
} else if (state is NotiSuccess) {
updateCountNotiBloc.getNotifications((data) {}, (err) {});
if (state.items.isEmpty) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 8,
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text('Thông báo',
style:
TextStyle(fontWeight: FontWeight.w500, fontSize: 22)),
),
Expanded(
child: Center(child: Text("Không có thông báo")),
),
],
return SafeArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 8,
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text('Thông báo',
style: TextStyle(
fontWeight: FontWeight.w500, fontSize: 22)),
),
Expanded(
child: Center(child: Text("Không có thông báo")),
),
],
),
);
}
currentItems = List<NotificationDTO>.from(state.items);
currentPage = state.page;
currentHasReachedMax = state.hasReachedMax;

return Column(
children: <Widget>[
Container(
padding: EdgeInsets.all(8),
color: Colors.white,
child: Row(
children: [
SizedBox(
height: 8,
),
Expanded(
child: Text(
'Thông báo',
style: TextStyle(
fontWeight: FontWeight.w500, fontSize: 22),
)),
FlatButton(
onPressed: () {
notiBloc
.add(MarkAllNotificationUpdate(status: "1"));
return SafeArea(
child: Column(
children: <Widget>[
Container(
padding: EdgeInsets.all(8),
color: Colors.white,
child: Row(
children: [
SizedBox(
height: 8,
),
Expanded(
child: Text(
'Thông báo',
style: TextStyle(
fontWeight: FontWeight.w500, fontSize: 22),
)),
FlatButton(
onPressed: () {
notiBloc
.add(MarkAllNotificationUpdate(status: "1"));
},
child: Text('Đánh dấu đã đọc tất cả',
style: TextStyle(
fontWeight: FontWeight.normal,
fontSize: 14,
color: Colors.blue)))
],
)),
Expanded(
child: RefreshIndicator(
child: ListView.builder(
physics: AlwaysScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index) {
return index >= state.items.length
? BottomLoader()
: ItemInfinityWidget(
notiBloc: notiBloc,
unread: state.unread,
read: state.read,
currentItems: currentItems,
item: state.items[index],
currentPage: state.page,
currentReachedMax: state.hasReachedMax,
);
},
child: Text('Đánh dấu đã đọc tất cả',
style: TextStyle(
fontWeight: FontWeight.normal,
fontSize: 14,
color: Colors.blue)))
],
)),
Expanded(
child: RefreshIndicator(
child: ListView.builder(
physics: AlwaysScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index) {
return index >= state.items.length
? BottomLoader()
: ItemInfinityWidget(
notiBloc: notiBloc,
unread: state.unread,
read: state.read,
currentItems: currentItems,
item: state.items[index],
currentPage: state.page,
currentReachedMax: state.hasReachedMax,
);
},
itemCount: state.hasReachedMax
? state.items.length
: state.items.length + 1,
controller: _scrollController,
),
onRefresh: () async {
notiBloc.add(OnRefresh());
}))
],
itemCount: state.hasReachedMax
? state.items.length
: state.items.length + 1,
controller: _scrollController,
),
onRefresh: () async {
notiBloc.add(OnRefresh());
}))
],
),
);
} else if (state is NotiLoadding) {
return Center(

+ 1
- 1
pubspec.yaml View File

@@ -2,7 +2,7 @@ name: farm_tpf
description: A new Flutter project.

publish_to: 'none'
version: 1.0.0+1
version: 1.0.1+1

environment:
sdk: ">=2.7.0 <3.0.0"

Loading…
Cancel
Save