-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNotification.dart
More file actions
163 lines (157 loc) · 5.46 KB
/
Copy pathNotification.dart
File metadata and controls
163 lines (157 loc) · 5.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
import 'package:flutter/material.dart';
import 'package:treva_shop_flutter/ListItem/notificationsData.dart';
class notification extends StatefulWidget {
@override
_notificationState createState() => _notificationState();
}
class _notificationState extends State<notification> {
final List<Post> items = new List();
@override
void initState() {
super.initState();
setState(() {
items.add( Post(
image:"assets/img/Logo.png",
id: 1,
title:"ASL Shop",
desc: "Thanks for downloaded ASL Shop application"),);
items.add( Post(
image:"assets/img/Logo.png",
id: 2,
title:"ASL Shop",
desc: "Your Item Delivery"),);
items.add( Post(
image:"assets/img/Logo.png",
id: 3,
title:"ASL Shop",
desc: "Pending List Item Shoes"),);
items.add( Post(
image:"assets/img/Logo.png",
id: 4,
title:"ASL Shop",
desc: "Get 10% Discount for macbook pro 2018"),);
});
}
Widget build(BuildContext context) {
MediaQueryData mediaQuery = MediaQuery.of(context);
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
title: Text(
"Notification",
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 18.0,
color: Colors.white,
fontFamily: "Gotik"),
),
iconTheme: IconThemeData(
color: Colors.black,
),
centerTitle: true,
elevation: 0.0,
backgroundColor: Color.fromRGBO(101, 36, 255, 99),
),
body: items.length>0?
ListView.builder(
itemCount: items.length,
padding: const EdgeInsets.all(5.0),
itemBuilder: (context, position) {
return Dismissible(
key: Key(items[position].id.toString()),
onDismissed: (direction) {
setState(() {
items.removeAt(position);
});
},
background: Container(
color: Colors.white30,
),
child: Container(
height: 88.0,
child: Column(
children: <Widget>[
Divider(height: 5.0),
ListTile(
title: Text(
'${items[position].title}',
style: TextStyle(
fontSize: 17.5,
color: Colors.black,
fontWeight: FontWeight.w600
),
),
subtitle: Padding(
padding: const EdgeInsets.only(top:6.0),
child: Container(
width: 440.0,
child: Text(
'${items[position].desc}',
style: new TextStyle(
fontSize: 15.0,
fontStyle: FontStyle.italic,
color: Colors.black
),
overflow: TextOverflow.ellipsis,
),
),
),
leading: Column(
children: <Widget>[
Container(
height: 40.0,
width: 40.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(60.0)),
image: DecorationImage(image: AssetImage('${items[position].image}'),fit: BoxFit.cover)
),
)
],
),
onTap: () => _onTapItem(context, items[position]),
),
Divider(height: 5.0),
],
),
));
}):noItemNotifications()
);
}
}
void _onTapItem(BuildContext context, Post post) {
Scaffold
.of(context)
.showSnackBar(new SnackBar(content: new Text(post.id.toString() + ' - ' + post.title)));
}
class noItemNotifications extends StatelessWidget {
@override
Widget build(BuildContext context) {
MediaQueryData mediaQueryData = MediaQuery.of(context);
return Container(
width: 500.0,
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Padding(
padding:
EdgeInsets.only(top: mediaQueryData.padding.top + 100.0)),
Image.asset(
"assets/img/noNotification.png",
height: 200.0,
),
Padding(padding: EdgeInsets.only(bottom: 30.0)),
Text(
"Not Have Notification",
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 18.5,
color: Colors.black,
fontFamily: "Gotik"),
),
],
),
),
);
}
}