Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
medapp_eksad
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qorri_di
medapp_eksad
Commits
d16e50a1
Commit
d16e50a1
authored
Sep 02, 2022
by
Budi Prasetyo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard
parent
0a349f0f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
278 additions
and
34 deletions
+278
-34
admin_contact.dart
lib/dashboard/admin/admin_contact.dart
+154
-0
admin_whatsapp.dart
lib/dashboard/admin/admin_whatsapp.dart
+120
-23
main_dashboard_admin.dart
lib/dashboard/admin/main_dashboard_admin.dart
+4
-11
No files found.
lib/dashboard/admin/admin_contact.dart
0 → 100644
View file @
d16e50a1
import
'package:flutter/material.dart'
;
import
'package:google_fonts/google_fonts.dart'
;
class
Dashboard4
extends
StatefulWidget
{
const
Dashboard4
({
Key
?
key
})
:
super
(
key:
key
);
@override
State
<
Dashboard4
>
createState
()
=>
_Dashboard4State
();
}
class
MessageUser
{
int
id
;
String
name
;
String
email
;
String
message
;
String
number
;
MessageUser
(
this
.
id
,
this
.
name
,
this
.
email
,
this
.
message
,
this
.
number
);
}
class
_Dashboard4State
extends
State
<
Dashboard4
>
{
List
<
MessageUser
>
ListMessage
=
<
MessageUser
>[
MessageUser
(
1
,
"Jay"
,
'email'
,
'message'
,
'number'
),
MessageUser
(
2
,
'nama'
,
'email'
,
'message'
,
'nomer'
),
MessageUser
(
1
,
"Jay"
,
'email'
,
'message'
,
'number'
),
MessageUser
(
2
,
'nama'
,
'email'
,
'message'
,
'nomer'
),
MessageUser
(
1
,
"Jay"
,
'email'
,
'message'
,
'number'
),
MessageUser
(
2
,
'nama'
,
'email'
,
'message'
,
'nomer'
),
MessageUser
(
1
,
"Jay"
,
'email'
,
'message'
,
'number'
),
MessageUser
(
2
,
'nama'
,
'email'
,
'message'
,
'nomer'
),
];
@override
void
initState
()
{
super
.
initState
();
}
refreshList
()
{
setState
(()
{
ListMessage
=
ListMessage
;
});
}
@override
Widget
build
(
BuildContext
context
)
{
var
screenSize
=
MediaQuery
.
of
(
context
).
size
;
return
Padding
(
padding:
const
EdgeInsets
.
all
(
30.0
),
child:
Container
(
padding:
EdgeInsets
.
all
(
10
),
height:
screenSize
.
height
*
0.91
,
width:
screenSize
.
width
*
0.9
,
decoration:
BoxDecoration
(
color:
Colors
.
white60
,
borderRadius:
BorderRadius
.
circular
(
20
),
border:
Border
.
all
(
width:
5
,
color:
Colors
.
blueAccent
),
),
child:
Column
(
children:
[
Container
(
height:
screenSize
.
height
*
0.11
,
color:
Colors
.
white60
,
child:
Center
(
child:
Text
(
'Data Messages from User'
,
style:
GoogleFonts
.
poppins
(
fontSize:
30
,
fontWeight:
FontWeight
.
w500
),),
),
),
Container
(
height:
screenSize
.
height
*
0.63
,
color:
Colors
.
white
,
child:
PaginatedDataTable
(
rowsPerPage:
5
,
// header :Text("Data Message User"),
columnSpacing:
170
,
columns:
[
DataColumn
(
label:
Text
(
"ID"
),),
DataColumn
(
label:
Text
(
"Name"
),),
DataColumn
(
label:
Text
(
"Email"
),),
DataColumn
(
label:
Text
(
"Message"
),),
DataColumn
(
label:
Text
(
"Number"
),),
],
source
:
UserDataTableSource
(
userData:
ListMessage
)),
)
],
),
),
);
}
}
class
UserDataTableSource
extends
DataTableSource
{
UserDataTableSource
({
required
List
<
MessageUser
>
userData
,
})
:
_userData
=
userData
,
assert
(
userData
!=
null
);
final
List
<
MessageUser
>
_userData
;
@override
DataRow
?
getRow
(
int
index
)
{
assert
(
index
>=
0
);
if
(
index
>=
_userData
.
length
)
{
return
null
;
}
final
_user
=
_userData
[
index
];
return
DataRow
.
byIndex
(
index:
index
,
cells:
<
DataCell
>[
DataCell
(
Text
(
'
${_user.id}
'
)),
DataCell
(
Text
(
'
${_user.name}
'
)),
DataCell
(
Text
(
'
${_user.email}
'
)),
DataCell
(
Text
(
'
${_user.message}
'
)),
DataCell
(
Text
(
'
${_user.number}
'
)),
],
);
}
@override
bool
get
isRowCountApproximate
=>
false
;
@override
int
get
rowCount
=>
_userData
.
length
;
@override
int
get
selectedRowCount
=>
0
;
void
sort
<
T
>(
Comparable
<
T
>
Function
(
MessageUser
d
)
getField
,
bool
ascending
)
{
_userData
.
sort
((
a
,
b
)
{
final
aValue
=
getField
(
a
);
final
bValue
=
getField
(
b
);
return
ascending
?
Comparable
.
compare
(
aValue
,
bValue
)
:
Comparable
.
compare
(
bValue
,
aValue
);
});
notifyListeners
();
}
}
lib/dashboard/admin/admin_whatsapp.dart
View file @
d16e50a1
...
...
@@ -9,8 +9,38 @@ class Dashboard3 extends StatefulWidget {
State
<
Dashboard3
>
createState
()
=>
_Dashboard3State
();
}
class
WhatsappNumber
{
String
name
;
String
number
;
String
status
;
WhatsappNumber
(
this
.
name
,
this
.
number
,
this
.
status
);
}
class
_Dashboard3State
extends
State
<
Dashboard3
>
{
List
<
WhatsappNumber
>
ListWhatsapp
=
<
WhatsappNumber
>[
WhatsappNumber
(
"Jay"
,
'email'
,
'ACTIVE'
,),
WhatsappNumber
(
'Rizky'
,
'email'
,
'INACTIVE'
,),
WhatsappNumber
(
'Fahrur'
,
'email'
,
'INACTIVE'
,),
];
@override
void
initState
()
{
super
.
initState
();
}
refreshList
()
{
setState
(()
{
ListWhatsapp
=
ListWhatsapp
;
});
}
final
TextEditingController
phoneController
=
TextEditingController
();
@override
...
...
@@ -19,17 +49,14 @@ class _Dashboard3State extends State<Dashboard3> {
return
Container
(
height:
screenSize
.
height
,
width:
screenSize
.
width
,
child:
Center
(
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
21.0
),
child:
Container
(
height:
screenSize
.
height
*
0.7
,
width:
screenSize
.
width
*
0.6
,
height:
screenSize
.
height
,
width:
screenSize
.
width
,
decoration:
BoxDecoration
(
color:
Colors
.
white60
,
borderRadius:
BorderRadius
.
circular
(
20
),
border:
Border
.
all
(
width:
5
,
color:
const
Color
.
fromARGB
(
255
,
10
,
116
,
255
),
),
boxShadow:
[
BoxShadow
(
color:
const
Color
.
fromARGB
(
255
,
10
,
116
,
255
)
...
...
@@ -43,25 +70,26 @@ class _Dashboard3State extends State<Dashboard3> {
),
]),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
children:
[
Padding
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
screenSize
.
width
*
0.08
),
child:
ListTile
(
minLeadingWidth:
10
,
leading:
Icon
(
Icons
.
whatsapp
,
color:
Colors
.
green
,
size:
40
)
,
title:
Text
(
'Change WhatsApp Admin Number'
,
style:
GoogleFonts
.
poppins
(
height:
1.5
,
fontSize:
25
,
fontWeight:
FontWeight
.
bold
,
color:
Colors
.
green
),
title:
Center
(
child:
Text
(
'WhatsApp Admin Number'
,
style:
GoogleFonts
.
poppins
(
height:
1.5
,
fontSize:
31
,
fontWeight:
FontWeight
.
bold
,
color:
Colors
.
green
)
,
),
),
),
),
Form
(
child:
Column
(
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
spaceAround
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Container
(
height:
45
,
width:
250
,
child:
TextFormField
(
controller:
phoneController
,
...
...
@@ -82,20 +110,18 @@ class _Dashboard3State extends State<Dashboard3> {
),
),
),
SizedBox
(
height:
20
,),
SizedBox
(
width:
15
,),
Container
(
height
:
4
0
,
width
:
1
80
,
height
:
4
5
,
width
:
1
75
,
child:
ElevatedButton
(
onPressed:
(){},
style:
ElevatedButton
.
styleFrom
(
primary:
Colors
.
blue
[
9
00
],
primary:
Colors
.
blue
Accent
[
2
00
],
onSurface:
Colors
.
white
,
side:
BorderSide
(
color:
Colors
.
white
),
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
3
0
)
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
1
0
)
),
),
),
...
...
@@ -110,7 +136,26 @@ class _Dashboard3State extends State<Dashboard3> {
),
],
),
)
),
Center
(
child:
Container
(
width:
screenSize
.
width
*
0.75
,
child:
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
30
),
child:
PaginatedDataTable
(
rowsPerPage:
4
,
// header :Text("Data Message User"),
columnSpacing:
170
,
columns:
[
DataColumn
(
label:
Text
(
"Name"
),),
DataColumn
(
label:
Text
(
"Number"
),),
DataColumn
(
label:
Text
(
"Status"
),),
],
source
:
UserDataTableSource
(
userData:
ListWhatsapp
)),
),
),
),
],
),
),
...
...
@@ -119,3 +164,55 @@ class _Dashboard3State extends State<Dashboard3> {
);
}
}
class
UserDataTableSource
extends
DataTableSource
{
UserDataTableSource
({
required
List
<
WhatsappNumber
>
userData
,
})
:
_userData
=
userData
,
assert
(
userData
!=
null
);
final
List
<
WhatsappNumber
>
_userData
;
@override
DataRow
?
getRow
(
int
index
)
{
assert
(
index
>=
0
);
if
(
index
>=
_userData
.
length
)
{
return
null
;
}
final
_user
=
_userData
[
index
];
return
DataRow
.
byIndex
(
index:
index
,
cells:
<
DataCell
>[
DataCell
(
Text
(
'
${_user.name}
'
)),
DataCell
(
Text
(
'
${_user.number}
'
)),
DataCell
(
Text
(
'
${_user.status}
'
)),
],
);
}
@override
bool
get
isRowCountApproximate
=>
false
;
@override
int
get
rowCount
=>
_userData
.
length
;
@override
int
get
selectedRowCount
=>
0
;
void
sort
<
T
>(
Comparable
<
T
>
Function
(
WhatsappNumber
d
)
getField
,
bool
ascending
)
{
_userData
.
sort
((
a
,
b
)
{
final
aValue
=
getField
(
a
);
final
bValue
=
getField
(
b
);
return
ascending
?
Comparable
.
compare
(
aValue
,
bValue
)
:
Comparable
.
compare
(
bValue
,
aValue
);
});
notifyListeners
();
}
}
lib/dashboard/admin/main_dashboard_admin.dart
View file @
d16e50a1
import
'package:flutter/material.dart'
;
import
'package:easy_sidemenu/easy_sidemenu.dart'
;
import
'package:medapp_eksad/dashboard/admin/admin_contact.dart'
;
import
'package:medapp_eksad/dashboard/admin/admin_dashboard.dart'
;
import
'package:medapp_eksad/dashboard/admin/admin_whatsapp.dart'
;
...
...
@@ -132,11 +133,11 @@ class _DashboardAdminState extends State<DashboardAdmin> {
),
SideMenuItem
(
priority:
4
,
title:
'
Settings
'
,
title:
'
Message User
'
,
onTap:
()
{
page
.
jumpToPage
(
4
);
},
icon:
const
Icon
(
Icons
.
settings
),
icon:
const
Icon
(
Icons
.
contact_mail
),
),
],
...
...
@@ -165,15 +166,7 @@ class _DashboardAdminState extends State<DashboardAdmin> {
),
),
Dashboard3
(),
Container
(
color:
Colors
.
white
,
child:
const
Center
(
child:
Text
(
'Settings'
,
style:
TextStyle
(
fontSize:
35
),
),
),
),
Dashboard4
(),
Container
(
color:
Colors
.
white
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment