Commit d16e50a1 authored by Budi Prasetyo's avatar Budi Prasetyo

dashboard

parent 0a349f0f
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();
}
}
......@@ -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 : 40,
width : 180,
height : 45,
width : 175,
child: ElevatedButton(
onPressed: (){},
style: ElevatedButton.styleFrom(
primary: Colors.blue[900],
primary: Colors.blueAccent[200],
onSurface: Colors.white,
side: BorderSide(
color: Colors.white
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(30)
borderRadius: BorderRadius.all(Radius.circular(10)
),
),
),
......@@ -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();
}
}
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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment