Commit c54b2782 authored by Tohap Maruli Pasaribu's avatar Tohap Maruli Pasaribu

create Menu : User Control on Dashboard

parent e81ecf89
import 'dart:convert';
import 'package:http/http.dart' as http;
var qry = 'https://dmsdev-api.eksad.com/gateway/medapp/v1/qry';
Future<List<dynamic>> getUserControl() async {
var response = await http.get(Uri.parse('$qry/user/get'));
return jsonDecode(response.body)['data'];
}
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:medapp_eksad/api/userControl_api.dart';
class UserControl extends StatefulWidget {
const UserControl({Key? key}) : super(key: key);
@override
State<UserControl> createState() => _UserControlState();
}
class _UserControlState extends State<UserControl> {
final formKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
var screenSize = MediaQuery.of(context).size;
return Padding(
padding: const EdgeInsets.all(30.0),
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
color: Colors.white60,
borderRadius: BorderRadius.circular(20),
boxShadow: [
BoxShadow(
color: const Color.fromARGB(255, 10, 116, 255).withAlpha(60),
blurRadius: 5.0,
spreadRadius: 5.0,
offset: const Offset(0.0, 3.0))
]),
child: Column(
children: [
Container(
height: screenSize.height * 0.15,
child: Center(
child: Text(
'Data User',
style: GoogleFonts.poppins(
height: 1.5,
fontSize: 31,
fontWeight: FontWeight.bold,
color: Colors.blueAccent[200]),
),
),
),
Container(
height: screenSize.height * 0.65,
child: ListView(
controller: ScrollController(),
children: [
FutureBuilder<List<dynamic>>(
future: getUserControl(),
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.hasError ||
snapshot.data == null ||
snapshot.connectionState ==
ConnectionState.waiting) {
return const CircularProgressIndicator();
}
return DataTable(
decoration:
const BoxDecoration(color: Colors.white),
columnSpacing: 55,
columns: const [
DataColumn(
label: Text(
"ID",
style: TextStyle(fontWeight: FontWeight.bold),
)),
DataColumn(
label: Text(
"Nama Rumah Sakit",
style: TextStyle(fontWeight: FontWeight.bold),
)),
// DataColumn(label: Text("Telp Rumah Sakit")),
DataColumn(
label: Text(
"Alamat Rumah Sakit",
style: TextStyle(fontWeight: FontWeight.bold),
)),
// DataColumn(label: Text("Nama PIC")),
// DataColumn(label: Text("Telp PIC")),
// DataColumn(label: Text("Email PIC")),
DataColumn(
label: Text(
"STATUS",
style: TextStyle(fontWeight: FontWeight.bold),
)),
DataColumn(
label: Text(
"ACTION",
style: TextStyle(fontWeight: FontWeight.bold),
))
],
rows: List.generate(snapshot.data.length, (index) {
var pgm = snapshot.data[index];
return DataRow(cells: [
DataCell(Text(pgm['idUser'].toString())),
DataCell(Text(pgm['namaRs'].toString())),
// DataCell(Text(pgm['noRs'].toString())),
DataCell(Text(pgm['alamatRs'].toString())),
// DataCell(Text(pgm['namaPic'].toString())),
// DataCell(Text(pgm['noPic'].toString())),
// DataCell(Text(pgm['emailPic'].toString())),
DataCell(Text(pgm['statusUser'].toString())),
DataCell(PopupMenuButton(
icon: Icon(Icons.more_vert_outlined),
itemBuilder: (context) => [
PopupMenuItem(
child: Text("Edit"), value: 1),
PopupMenuItem(
child: Text("Delete"), value: 2),
PopupMenuItem(
child: Text("View"), value: 3)
]))
]);
}).toList());
})
],
),
)
],
),
),
);
}
}
......@@ -3,6 +3,7 @@ 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_sosmed.dart';
import 'package:medapp_eksad/dashboard/admin/admin_userControl.dart';
import 'package:medapp_eksad/dashboard/admin/admin_whatsapp.dart';
class DashboardAdmin extends StatefulWidget {
......@@ -22,10 +23,13 @@ class _DashboardAdminState extends State<DashboardAdmin> {
backgroundColor: Colors.white,
leadingWidth: 230,
leading: Padding(
padding: const EdgeInsets.symmetric(vertical: 8,horizontal: 30),
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 30),
child: Container(
width: 200,
decoration: const BoxDecoration(image: DecorationImage(image: AssetImage('assets/logo/medapp-logo.png'),fit: BoxFit.fill)),
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/logo/medapp-logo.png'),
fit: BoxFit.fill)),
),
),
actions: [
......@@ -52,7 +56,6 @@ class _DashboardAdminState extends State<DashboardAdmin> {
style: TextStyle(),
),
),
],
),
body: Row(
......@@ -76,7 +79,7 @@ class _DashboardAdminState extends State<DashboardAdmin> {
// decoration: BoxDecoration(
// borderRadius: BorderRadius.all(Radius.circular(10)),
// ),
backgroundColor: Colors.blueAccent[200],
backgroundColor: Colors.blueAccent[200],
),
title: Column(
children: [
......@@ -93,7 +96,9 @@ class _DashboardAdminState extends State<DashboardAdmin> {
// indent: 8.0,
// endIndent: 8.0,
// ),
Container(height: 20,)
Container(
height: 20,
)
],
),
footer: const Padding(
......@@ -140,7 +145,13 @@ class _DashboardAdminState extends State<DashboardAdmin> {
},
icon: const Icon(Icons.contact_mail),
),
SideMenuItem(
onTap: () {
page.jumpToPage(4);
},
title: 'User Control',
icon: const Icon(Icons.admin_panel_settings),
priority: 4)
],
),
Expanded(
......@@ -160,6 +171,7 @@ class _DashboardAdminState extends State<DashboardAdmin> {
SosmedDashboard(),
//Dashboard3(),
Dashboard4(),
UserControl()
],
),
),
......
......@@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.2"
version: "2.9.0"
badges:
dependency: transitive
description:
......@@ -42,21 +42,14 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
version: "1.2.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
collection:
dependency: transitive
description:
......@@ -105,7 +98,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.3.1"
ffi:
dependency: transitive
description:
......@@ -211,28 +204,28 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.11"
version: "0.12.12"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
version: "0.1.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.8.2"
path_provider:
dependency: transitive
description:
......@@ -342,7 +335,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
version: "1.9.0"
spring:
dependency: "direct main"
description:
......@@ -370,7 +363,7 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
supercharged:
dependency: transitive
description:
......@@ -391,14 +384,14 @@ packages:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.9"
version: "0.4.12"
typed_data:
dependency: transitive
description:
......
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