2020-05-29 07:45:27 +06:30
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:fcs/model/notification_model.dart';
|
|
|
|
|
import 'package:fcs/vo/notification.dart' as Noti;
|
|
|
|
|
import 'package:fcs/widget/progress.dart';
|
|
|
|
|
|
|
|
|
|
import '../theme/theme.dart';
|
2020-05-29 16:14:17 +06:30
|
|
|
import '../widget/local_text.dart';
|
2020-05-29 07:45:27 +06:30
|
|
|
|
|
|
|
|
class NotificationList extends StatefulWidget {
|
|
|
|
|
@override
|
|
|
|
|
_NotificationListState createState() => _NotificationListState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _NotificationListState extends State<NotificationList> {
|
|
|
|
|
var timeFormatter = new DateFormat('KK:mm a');
|
2020-05-29 16:14:17 +06:30
|
|
|
var dateFormatter = new DateFormat('dd MMM yyyy');
|
2020-05-29 07:45:27 +06:30
|
|
|
final double dotSize = 15.0;
|
|
|
|
|
int _selectedIndex = 0;
|
|
|
|
|
bool _isLoading = false;
|
|
|
|
|
bool _isClicked = false;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
NotificationModel notificationModel =
|
|
|
|
|
Provider.of<NotificationModel>(context);
|
|
|
|
|
|
|
|
|
|
return LocalProgress(
|
|
|
|
|
inAsyncCall: _isLoading,
|
|
|
|
|
child: Scaffold(
|
|
|
|
|
appBar: AppBar(
|
2020-05-31 15:00:11 +06:30
|
|
|
centerTitle: true,
|
|
|
|
|
leading: new IconButton(
|
2020-06-01 14:24:45 +06:30
|
|
|
icon: new Icon(
|
|
|
|
|
Icons.close,
|
|
|
|
|
),
|
2020-05-31 15:00:11 +06:30
|
|
|
onPressed: () => Navigator.of(context).pop(),
|
|
|
|
|
),
|
2020-05-29 07:45:27 +06:30
|
|
|
backgroundColor: primaryColor,
|
2020-05-29 16:14:17 +06:30
|
|
|
title: LocalText(
|
|
|
|
|
context,
|
2020-06-01 14:24:45 +06:30
|
|
|
'noti.list.title',
|
|
|
|
|
fontSize: 20,
|
2020-05-29 16:14:17 +06:30
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
2020-05-29 07:45:27 +06:30
|
|
|
),
|
|
|
|
|
body: new ListView.separated(
|
|
|
|
|
separatorBuilder: (context, index) => Divider(
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
),
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
padding: EdgeInsets.only(left: 15, right: 15, top: 15),
|
|
|
|
|
shrinkWrap: true,
|
2020-05-29 16:14:17 +06:30
|
|
|
itemCount: notificationModel.notifications.length,
|
2020-05-29 07:45:27 +06:30
|
|
|
itemBuilder: (BuildContext context, int index) {
|
2020-05-29 16:14:17 +06:30
|
|
|
Noti.Notification noti = notificationModel.notifications[index];
|
2020-05-29 07:45:27 +06:30
|
|
|
return Stack(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () => _display(noti),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
child: new Padding(
|
2020-05-29 16:14:17 +06:30
|
|
|
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
2020-05-29 07:45:27 +06:30
|
|
|
child: new Row(
|
|
|
|
|
children: <Widget>[
|
2020-06-01 14:24:45 +06:30
|
|
|
new Padding(
|
|
|
|
|
padding: new EdgeInsets.symmetric(
|
|
|
|
|
horizontal: 32.0 - dotSize / 2),
|
|
|
|
|
child: Icon(Icons.message,color: primaryColor,),
|
|
|
|
|
),
|
2020-05-29 07:45:27 +06:30
|
|
|
new Expanded(
|
|
|
|
|
child: new Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
new Text(
|
|
|
|
|
noti.getDesc,
|
|
|
|
|
style: new TextStyle(
|
|
|
|
|
fontSize: 15.0,
|
2020-05-31 15:00:11 +06:30
|
|
|
color: primaryColor),
|
2020-05-29 07:45:27 +06:30
|
|
|
),
|
2020-05-31 15:00:11 +06:30
|
|
|
noti.marketPlace == null
|
|
|
|
|
? Container()
|
|
|
|
|
: Padding(
|
2020-06-01 14:24:45 +06:30
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
|
top: 8.0),
|
|
|
|
|
child: new Text(
|
2020-05-31 15:00:11 +06:30
|
|
|
noti.marketPlace,
|
|
|
|
|
style: new TextStyle(
|
|
|
|
|
fontSize: 15.0,
|
|
|
|
|
color: primaryColor),
|
|
|
|
|
),
|
2020-06-01 14:24:45 +06:30
|
|
|
),
|
2020-05-31 15:00:11 +06:30
|
|
|
Padding(
|
2020-06-01 14:24:45 +06:30
|
|
|
padding:
|
|
|
|
|
const EdgeInsets.only(top: 8.0),
|
2020-05-31 15:00:11 +06:30
|
|
|
child: new Text(
|
2020-06-01 14:24:45 +06:30
|
|
|
noti.status == null
|
|
|
|
|
? ""
|
|
|
|
|
: noti.status,
|
2020-05-31 15:00:11 +06:30
|
|
|
style: new TextStyle(
|
2020-06-01 14:24:45 +06:30
|
|
|
fontSize: 15.0,
|
2020-05-31 15:00:11 +06:30
|
|
|
color: Colors.grey),
|
|
|
|
|
),
|
2020-05-29 07:45:27 +06:30
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: Text(timeFormatter.format(noti.time)),
|
|
|
|
|
),
|
|
|
|
|
noti.fromToday()
|
|
|
|
|
? Container()
|
|
|
|
|
: Text(dateFormatter.format(noti.time)),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
2020-06-01 14:24:45 +06:30
|
|
|
),
|
2020-05-29 07:45:27 +06:30
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-29 16:14:17 +06:30
|
|
|
_display(Noti.Notification noti) {}
|
2020-05-29 07:45:27 +06:30
|
|
|
}
|