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'; ...@@ -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_contact.dart';
import 'package:medapp_eksad/dashboard/admin/admin_dashboard.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_sosmed.dart';
import 'package:medapp_eksad/dashboard/admin/admin_userControl.dart';
import 'package:medapp_eksad/dashboard/admin/admin_whatsapp.dart'; import 'package:medapp_eksad/dashboard/admin/admin_whatsapp.dart';
class DashboardAdmin extends StatefulWidget { class DashboardAdmin extends StatefulWidget {
...@@ -22,10 +23,13 @@ class _DashboardAdminState extends State<DashboardAdmin> { ...@@ -22,10 +23,13 @@ class _DashboardAdminState extends State<DashboardAdmin> {
backgroundColor: Colors.white, backgroundColor: Colors.white,
leadingWidth: 230, leadingWidth: 230,
leading: Padding( leading: Padding(
padding: const EdgeInsets.symmetric(vertical: 8,horizontal: 30), padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 30),
child: Container( child: Container(
width: 200, 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: [ actions: [
...@@ -52,7 +56,6 @@ class _DashboardAdminState extends State<DashboardAdmin> { ...@@ -52,7 +56,6 @@ class _DashboardAdminState extends State<DashboardAdmin> {
style: TextStyle(), style: TextStyle(),
), ),
), ),
], ],
), ),
body: Row( body: Row(
...@@ -93,7 +96,9 @@ class _DashboardAdminState extends State<DashboardAdmin> { ...@@ -93,7 +96,9 @@ class _DashboardAdminState extends State<DashboardAdmin> {
// indent: 8.0, // indent: 8.0,
// endIndent: 8.0, // endIndent: 8.0,
// ), // ),
Container(height: 20,) Container(
height: 20,
)
], ],
), ),
footer: const Padding( footer: const Padding(
...@@ -140,7 +145,13 @@ class _DashboardAdminState extends State<DashboardAdmin> { ...@@ -140,7 +145,13 @@ class _DashboardAdminState extends State<DashboardAdmin> {
}, },
icon: const Icon(Icons.contact_mail), icon: const Icon(Icons.contact_mail),
), ),
SideMenuItem(
onTap: () {
page.jumpToPage(4);
},
title: 'User Control',
icon: const Icon(Icons.admin_panel_settings),
priority: 4)
], ],
), ),
Expanded( Expanded(
...@@ -160,6 +171,7 @@ class _DashboardAdminState extends State<DashboardAdmin> { ...@@ -160,6 +171,7 @@ class _DashboardAdminState extends State<DashboardAdmin> {
SosmedDashboard(), SosmedDashboard(),
//Dashboard3(), //Dashboard3(),
Dashboard4(), Dashboard4(),
UserControl()
], ],
), ),
), ),
......
...@@ -7,7 +7,7 @@ packages: ...@@ -7,7 +7,7 @@ packages:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.8.2" version: "2.9.0"
badges: badges:
dependency: transitive dependency: transitive
description: description:
...@@ -42,21 +42,14 @@ packages: ...@@ -42,21 +42,14 @@ packages:
name: characters name: characters
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.2.1"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
clock: clock:
dependency: transitive dependency: transitive
description: description:
name: clock name: clock
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.1"
collection: collection:
dependency: transitive dependency: transitive
description: description:
...@@ -105,7 +98,7 @@ packages: ...@@ -105,7 +98,7 @@ packages:
name: fake_async name: fake_async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0" version: "1.3.1"
ffi: ffi:
dependency: transitive dependency: transitive
description: description:
...@@ -211,28 +204,28 @@ packages: ...@@ -211,28 +204,28 @@ packages:
name: matcher name: matcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.11" version: "0.12.12"
material_color_utilities: material_color_utilities:
dependency: transitive dependency: transitive
description: description:
name: material_color_utilities name: material_color_utilities
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.4" version: "0.1.5"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.7.0" version: "1.8.0"
path: path:
dependency: transitive dependency: transitive
description: description:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.1" version: "1.8.2"
path_provider: path_provider:
dependency: transitive dependency: transitive
description: description:
...@@ -342,7 +335,7 @@ packages: ...@@ -342,7 +335,7 @@ packages:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.2" version: "1.9.0"
spring: spring:
dependency: "direct main" dependency: "direct main"
description: description:
...@@ -370,7 +363,7 @@ packages: ...@@ -370,7 +363,7 @@ packages:
name: string_scanner name: string_scanner
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.1"
supercharged: supercharged:
dependency: transitive dependency: transitive
description: description:
...@@ -391,14 +384,14 @@ packages: ...@@ -391,14 +384,14 @@ packages:
name: term_glyph name: term_glyph
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.2.1"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.9" version: "0.4.12"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: 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