Parcourir la source

masih belum edit

athrainsky il y a 7 mois
Parent
commit
a178a9d6b0

+ 4 - 4
lib/bug/addbug.dart

@@ -53,7 +53,7 @@ class AddBugPage extends StatelessWidget {
                                 borderRadius:
                                     BorderRadius.all(Radius.circular(12)),
                                 borderSide: BorderSide(color: Colors.black)),
-                            labelText: 'Enter Description', //todo get data
+                            labelText: 'Enter Description',  
                             labelStyle: TextStyle(color: Colors.black),
                             filled: true,
                             fillColor: Colors.white.withOpacity(0.25)),
@@ -153,7 +153,7 @@ class AddBugPage extends StatelessWidget {
                                 borderRadius:
                                     BorderRadius.all(Radius.circular(12)),
                                 borderSide: BorderSide(color: Colors.black)),
-                            labelText: 'Enter Goodday URL', //todo get data
+                            labelText: 'Enter Goodday URL', 
                             labelStyle: TextStyle(color: Colors.black),
                             filled: true,
                             fillColor: Colors.white.withOpacity(0.25)),
@@ -178,7 +178,7 @@ class AddBugPage extends StatelessWidget {
                                 borderRadius:
                                     BorderRadius.all(Radius.circular(12)),
                                 borderSide: BorderSide(color: Colors.black)),
-                            labelText: 'Enter Image URL', //todo get data
+                            labelText: 'Enter Image URL', 
                             labelStyle: TextStyle(color: Colors.black),
                             filled: true,
                             fillColor: Colors.white.withOpacity(0.25)),
@@ -271,7 +271,7 @@ class AddBugPage extends StatelessWidget {
                       child: ElevatedButton(
                         onPressed: () => addbug(context, bugdesc.text, bugqc.text, bugdev.text, bugplatform.text, buggoodday.text, bugimage.text, buglevel.text, bugstatus.text, bugdevStatus.text), //todo save edit
                         style: ElevatedButton.styleFrom(
-                          backgroundColor: Colors.black, //todo putih lage
+                          backgroundColor: Colors.black, 
                           side: BorderSide(color: Colors.white),
                           shape: RoundedRectangleBorder(
                             borderRadius: BorderRadius.circular(12.0),

+ 296 - 0
lib/bug/addcomment.dart

@@ -0,0 +1,296 @@
+import 'package:flutter/material.dart';
+import 'package:namer_app/footer.dart';
+import 'package:namer_app/header.dart';
+
+import '../service/addbug_serv.dart';
+
+class AddCommentPage extends StatelessWidget {
+  const AddCommentPage({super.key});
+
+  @override
+  Widget build(BuildContext context) {
+    var bugdesc = TextEditingController();
+    var bugqc = TextEditingController();
+    var bugdev = TextEditingController();
+    var bugplatform = TextEditingController();
+    var buggoodday = TextEditingController();
+    var bugimage = TextEditingController();
+    var buglevel = TextEditingController();
+    var bugstatus = TextEditingController();
+    var bugdevStatus = TextEditingController();
+    return Scaffold(
+      appBar: CustomAppbar(),
+      backgroundColor: Colors.white,
+      body: Stack(children: [
+        SingleChildScrollView(
+          child: Column(
+            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
+            children: [
+              Center(
+                  child: Row(
+                mainAxisAlignment: MainAxisAlignment.center,
+                children: [
+                  Text(
+                    'ADD COMMENT',
+                    style: TextStyle(color: Colors.black, fontSize: 48),
+                  ),
+                ],
+              )),
+              Column(
+                children: [
+                  Padding(
+                    padding: const EdgeInsets.all(8.0),
+                    child: SizedBox(
+                      width: 396,
+                      child: TextField(
+                        decoration: InputDecoration(
+                            border: OutlineInputBorder(),
+                            focusedBorder: OutlineInputBorder(
+                                borderRadius:
+                                    BorderRadius.all(Radius.circular(12)),
+                                borderSide: BorderSide(color: Colors.black)),
+                            enabledBorder: OutlineInputBorder(
+                                borderRadius:
+                                    BorderRadius.all(Radius.circular(12)),
+                                borderSide: BorderSide(color: Colors.black)),
+                            labelText: 'Enter Description',  
+                            labelStyle: TextStyle(color: Colors.black),
+                            filled: true,
+                            fillColor: Colors.white.withOpacity(0.25)),
+                        cursorColor: Colors.black,
+                        style: TextStyle(color: Colors.black),
+                        controller: bugdesc,
+                      ),
+                    ),
+                  ),
+                  Padding(
+                    padding: const EdgeInsets.all(8.0),
+                    child: SizedBox(
+                      width: 396,
+                      child: TextField(
+                        decoration: InputDecoration(
+                            border: OutlineInputBorder(),
+                            focusedBorder: OutlineInputBorder(
+                                borderRadius:
+                                    BorderRadius.all(Radius.circular(12)),
+                                borderSide: BorderSide(color: Colors.black)),
+                            enabledBorder: OutlineInputBorder(
+                                borderRadius:
+                                    BorderRadius.all(Radius.circular(12)),
+                                borderSide: BorderSide(color: Colors.black)),
+                            labelText: 'Enter QC', //todo get data
+                            labelStyle: TextStyle(color: Colors.black),
+                            filled: true,
+                            fillColor: Colors.white.withOpacity(0.25)),
+                        cursorColor: Colors.black,
+                        style: TextStyle(color: Colors.black),
+                        controller: bugqc,
+                      ),
+                    ),
+                  ),
+                  Padding(
+                    padding: const EdgeInsets.all(8.0),
+                    child: SizedBox(
+                      width: 396,
+                      child: TextField(
+                        decoration: InputDecoration(
+                            border: OutlineInputBorder(),
+                            focusedBorder: OutlineInputBorder(
+                                borderRadius:
+                                    BorderRadius.all(Radius.circular(12)),
+                                borderSide: BorderSide(color: Colors.black)),
+                            enabledBorder: OutlineInputBorder(
+                                borderRadius:
+                                    BorderRadius.all(Radius.circular(12)),
+                                borderSide: BorderSide(color: Colors.black)),
+                            labelText: 'Enter Dev', //todo get data
+                            labelStyle: TextStyle(color: Colors.black),
+                            filled: true,
+                            fillColor: Colors.white.withOpacity(0.25)),
+                        cursorColor: Colors.black,
+                        style: TextStyle(color: Colors.black),
+                        controller: bugdev,
+                      ),
+                    ),
+                  ),
+                  Padding(
+                    padding: const EdgeInsets.all(8.0),
+                    child: SizedBox(
+                      width: 396,
+                      child: TextField(
+                        decoration: InputDecoration(
+                            border: OutlineInputBorder(),
+                            focusedBorder: OutlineInputBorder(
+                                borderRadius:
+                                    BorderRadius.all(Radius.circular(12)),
+                                borderSide: BorderSide(color: Colors.black)),
+                            enabledBorder: OutlineInputBorder(
+                                borderRadius:
+                                    BorderRadius.all(Radius.circular(12)),
+                                borderSide: BorderSide(color: Colors.black)),
+                            labelText: 'Enter Platform', //todo get data
+                            labelStyle: TextStyle(color: Colors.black),
+                            filled: true,
+                            fillColor: Colors.white.withOpacity(0.25)),
+                        cursorColor: Colors.black,
+                        style: TextStyle(color: Colors.black),
+                        controller: bugplatform,
+                      ),
+                    ),
+                  ),
+                  Padding(
+                    padding: const EdgeInsets.all(8.0),
+                    child: SizedBox(
+                      width: 396,
+                      child: TextField(
+                        decoration: InputDecoration(
+                            border: OutlineInputBorder(),
+                            focusedBorder: OutlineInputBorder(
+                                borderRadius:
+                                    BorderRadius.all(Radius.circular(12)),
+                                borderSide: BorderSide(color: Colors.black)),
+                            enabledBorder: OutlineInputBorder(
+                                borderRadius:
+                                    BorderRadius.all(Radius.circular(12)),
+                                borderSide: BorderSide(color: Colors.black)),
+                            labelText: 'Enter Goodday URL', 
+                            labelStyle: TextStyle(color: Colors.black),
+                            filled: true,
+                            fillColor: Colors.white.withOpacity(0.25)),
+                        cursorColor: Colors.black,
+                        style: TextStyle(color: Colors.black),
+                        controller: buggoodday,
+                      ),
+                    ),
+                  ),
+                  Padding(
+                    padding: const EdgeInsets.all(8.0),
+                    child: SizedBox(
+                      width: 396,
+                      child: TextField(
+                        decoration: InputDecoration(
+                            border: OutlineInputBorder(),
+                            focusedBorder: OutlineInputBorder(
+                                borderRadius:
+                                    BorderRadius.all(Radius.circular(12)),
+                                borderSide: BorderSide(color: Colors.black)),
+                            enabledBorder: OutlineInputBorder(
+                                borderRadius:
+                                    BorderRadius.all(Radius.circular(12)),
+                                borderSide: BorderSide(color: Colors.black)),
+                            labelText: 'Enter Image URL', 
+                            labelStyle: TextStyle(color: Colors.black),
+                            filled: true,
+                            fillColor: Colors.white.withOpacity(0.25)),
+                        cursorColor: Colors.black,
+                        style: TextStyle(color: Colors.black),
+                        controller: bugimage,
+                      ),
+                    ),
+                  ),
+                  Padding(
+                    padding: const EdgeInsets.all(8.0),
+                    child: SizedBox(
+                      width: 396,
+                      child: TextField(
+                        decoration: InputDecoration(
+                            border: OutlineInputBorder(),
+                            focusedBorder: OutlineInputBorder(
+                                borderRadius:
+                                    BorderRadius.all(Radius.circular(12)),
+                                borderSide: BorderSide(color: Colors.black)),
+                            enabledBorder: OutlineInputBorder(
+                                borderRadius:
+                                    BorderRadius.all(Radius.circular(12)),
+                                borderSide: BorderSide(color: Colors.black)),
+                            labelText: 'Enter Level', //todo get data
+                            labelStyle: TextStyle(color: Colors.black),
+                            filled: true,
+                            fillColor: Colors.white.withOpacity(0.25)),
+                        cursorColor: Colors.black,
+                        style: TextStyle(color: Colors.black),
+                        controller: buglevel,
+                      ),
+                    ),
+                  ),
+                  Padding(
+                    padding: const EdgeInsets.all(8.0),
+                    child: SizedBox(
+                      width: 396,
+                      child: TextField(
+                        decoration: InputDecoration(
+                            border: OutlineInputBorder(),
+                            focusedBorder: OutlineInputBorder(
+                                borderRadius:
+                                    BorderRadius.all(Radius.circular(12)),
+                                borderSide: BorderSide(color: Colors.black)),
+                            enabledBorder: OutlineInputBorder(
+                                borderRadius:
+                                    BorderRadius.all(Radius.circular(12)),
+                                borderSide: BorderSide(color: Colors.black)),
+                            labelText: 'Enter Status', //todo get data
+                            labelStyle: TextStyle(color: Colors.black),
+                            filled: true,
+                            fillColor: Colors.white.withOpacity(0.25)),
+                        cursorColor: Colors.black,
+                        style: TextStyle(color: Colors.black),
+                        controller: bugstatus,
+                      ),
+                    ),
+                  ),
+                  Padding(
+                    padding: const EdgeInsets.all(8.0),
+                    child: SizedBox(
+                      width: 396,
+                      child: TextField(
+                        decoration: InputDecoration(
+                            border: OutlineInputBorder(),
+                            focusedBorder: OutlineInputBorder(
+                                borderRadius:
+                                    BorderRadius.all(Radius.circular(12)),
+                                borderSide: BorderSide(color: Colors.black)),
+                            enabledBorder: OutlineInputBorder(
+                                borderRadius:
+                                    BorderRadius.all(Radius.circular(12)),
+                                borderSide: BorderSide(color: Colors.black)),
+                            labelText: 'Enter Dev Status', //todo get data
+                            labelStyle: TextStyle(color: Colors.black),
+                            filled: true,
+                            fillColor: Colors.white.withOpacity(0.25)),
+                        cursorColor: Colors.black,
+                        style: TextStyle(color: Colors.black),
+                        controller: bugdevStatus,
+                      ),
+                    ),
+                  ),
+                  Padding(
+                    padding: const EdgeInsets.all(20.0),
+                    child: SizedBox(
+                      width: 396,
+                      height: 61,
+                      child: ElevatedButton(
+                        onPressed: () => addbug(context, bugdesc.text, bugqc.text, bugdev.text, bugplatform.text, buggoodday.text, bugimage.text, buglevel.text, bugstatus.text, bugdevStatus.text), //todo save edit
+                        style: ElevatedButton.styleFrom(
+                          backgroundColor: Colors.black, 
+                          side: BorderSide(color: Colors.white),
+                          shape: RoundedRectangleBorder(
+                            borderRadius: BorderRadius.circular(12.0),
+                          ),
+                        ),
+                        child: Text(
+                          'Save',
+                          style: TextStyle(color: Colors.white),
+                        ),
+                      ),
+                    ),
+                  ),
+                ],
+              ),
+            ],
+          ),
+        ),
+      ]),
+      bottomNavigationBar: Footer(),
+    );
+  }
+}

+ 11 - 1
lib/bug/listbug.dart

@@ -145,13 +145,23 @@ class ButtonUser extends StatelessWidget {
             style: TextStyle(color: Colors.white),
           ),
         ),
+        ElevatedButton(
+          onPressed: () => context.go('/addcomment'),
+          style: ElevatedButton.styleFrom(
+            backgroundColor: Colors.black,
+          ),
+          child: Text(
+            'Add Comment',
+            style: TextStyle(color: Colors.white),
+          ),
+        ),        
         ElevatedButton(
           onPressed: () => context.go('/login/bug/comment'),
           style: ElevatedButton.styleFrom(
             backgroundColor: Colors.black,
           ),
           child: Text(
-            'Comment',
+            'List Comment',
             style: TextStyle(color: Colors.white),
           ),
         ),

+ 37 - 5
lib/bug/listcomment.dart

@@ -1,16 +1,48 @@
+// ignore_for_file: must_call_super, prefer_typing_uninitialized_variables, no_logic_in_create_state
+
+import 'package:dio/dio.dart';
 import 'package:flutter/material.dart';
-import 'package:namer_app/data/datacomment.dart';
 import 'package:namer_app/footer.dart';
 import 'package:namer_app/header.dart';
 
+import '../globals.dart';
+
 class ListCommentPage extends StatefulWidget {
-  const ListCommentPage({super.key});
+  final int bugId;
+  const ListCommentPage({super.key, required this.bugId});
 
   @override
-  State<ListCommentPage> createState() => _ListCommentPageState();
+  State<ListCommentPage> createState() => _ListCommentPageState(
+    bugId: bugId
+    );
 }
 
 class _ListCommentPageState extends State<ListCommentPage> {
+  int bugId;
+  _ListCommentPageState({required this.bugId});
+    var comments;
+  @override
+void initState(){
+  getData(bugId);
+}
+
+void getData(int bugId) async { 
+    try { 
+      var response = await Dio() 
+          .get('http://localhost:8080/api/v1/bugs/$bugId/comment',
+          options: Options(headers: headers)); 
+      if (response.statusCode == 200) { 
+        setState(() { 
+          comments = response.data['results'] as List; 
+        }); 
+        print(comments);
+      } else { 
+        print(response.statusCode); 
+      } 
+    } catch (e) { 
+      print(e); 
+    } 
+  } 
   @override
   Widget build(BuildContext context) {
     return Scaffold(
@@ -31,13 +63,13 @@ class _ListCommentPageState extends State<ListCommentPage> {
               )),
               Column(
                 children: List.generate(
-                    4,
+                    comments == null ? 0 : comments.length,
                     (i) => SizedBox(
                           child: ListTile(
                             leading: SizedBox(
                               child: Icon(Icons.chat),
                             ),
-                            title: Text(comments[i]['comment']),
+                            title: Text(comments[i]['content']),
                             subtitle: Column(
                               crossAxisAlignment: CrossAxisAlignment.start,
                               children: [

+ 0 - 18
lib/data/datamember.dart

@@ -1,18 +0,0 @@
-// ignore_for_file: file_names
-
-final List members = [
-  {
-    'project': 'TelMessenger',
-    'member1': 'irma',
-    'role1': 'QC',
-    'member2': 'agus',
-    'role2': 'Programmer'
-  },
-  {
-    'project': 'PropInspector',
-    'member1': 'mita',
-    'role1': 'QC',
-    'member2': 'dama',
-    'role2': 'Programmer'
-  },
-];

+ 58 - 10
lib/header.dart

@@ -99,7 +99,7 @@ class _CustomAppbarState extends State<CustomAppbar> {
                 BugItems.onChanged(context, value!);
               },
               dropdownStyleData: DropdownStyleData(
-                width: 100,
+                width: 120,
                 padding: const EdgeInsets.symmetric(vertical: 6),
                 decoration: BoxDecoration(
                   borderRadius: BorderRadius.circular(4),
@@ -203,25 +203,36 @@ class _CustomAppbarState extends State<CustomAppbar> {
             ),
           ),
         ),
-        Padding(
-          padding: const EdgeInsets.symmetric(horizontal: 6),
+                Padding(
+          padding: const EdgeInsets.symmetric(horizontal: 8.0),
           child: DropdownButtonHideUnderline(
             child: DropdownButton2(
               customButton: const Icon(Icons.logout),
               items: [
-                DropdownMenuItem(
-                  child: Text('Log Out'),
-                )
+                ...LogoutItems.firstItems.map(
+                  (item) => DropdownMenuItem<MenuItem>(
+                    value: item,
+                    child: LogoutItems.buildItem(item),
+                  ),
+                ),
               ],
-              onChanged: null,
+              onChanged: (value) {
+                LogoutItems.onChanged(context, value!);
+              },
               dropdownStyleData: DropdownStyleData(
-                width: 130,
+                width: 170,
                 padding: const EdgeInsets.symmetric(vertical: 6),
                 decoration: BoxDecoration(
                   borderRadius: BorderRadius.circular(4),
                 ),
                 offset: const Offset(0, 8),
               ),
+              menuItemStyleData: MenuItemStyleData(
+                customHeights: [
+                  ...List<double>.filled(LogoutItems.firstItems.length, 48),
+                ],
+                padding: const EdgeInsets.only(left: 16, right: 16),
+              ),
             ),
           ),
         ),
@@ -276,11 +287,12 @@ mixin PlatformItems {
 }
 
 mixin BugItems {
-  static const List<MenuItem> firstItems = [add, edit, list];
+  static const List<MenuItem> firstItems = [add, edit, list/*, listcomment*/];
 
   static const add = MenuItem(text: 'Add Bug');
   static const edit = MenuItem(text: 'Edit Bug');
   static const list = MenuItem(text: 'List Bug');
+  static const listcomment = MenuItem(text: 'List Comment');
 
   static Widget buildItem(MenuItem item) {
     return Row(
@@ -308,6 +320,9 @@ mixin BugItems {
       case BugItems.list:
         context.go('/login/bug');
         break;
+      case BugItems.listcomment:
+        context.go('/listcomment');
+        break;
     }
   }
 }
@@ -350,7 +365,7 @@ mixin UserItems {
 }
 
 mixin ProjectItems {
-  static const List<MenuItem> firstItems = [add, edit, list, addMember, listMember];
+  static const List<MenuItem> firstItems = [add, edit, list, /*addMember, listMember*/];
 
   static const add = MenuItem(text: 'Add Project');
   static const edit = MenuItem(text: 'Edit Project');
@@ -392,4 +407,37 @@ mixin ProjectItems {
         break;
     }
   }
+}
+
+mixin LogoutItems {
+  static const List<MenuItem> firstItems = [changepass, logout];
+
+  static const logout = MenuItem(text: 'Log Out');
+  static const changepass = MenuItem(text: 'Change Password');
+
+  static Widget buildItem(MenuItem item) {
+    return Row(
+      children: [
+        Expanded(
+          child: Text(
+            item.text,
+            style: const TextStyle(
+              color: Colors.black,
+            ),
+          ),
+        ),
+      ],
+    );
+  }
+
+  static void onChanged(BuildContext context, MenuItem item) {
+    switch (item) {
+      case LogoutItems.changepass:
+        context.go('/changepass');
+        break;
+      case LogoutItems.logout:
+        // context.go('/editproject');
+        break;
+    }
+  }
 }

+ 1 - 1
lib/login.dart

@@ -88,7 +88,7 @@ class LoginPage extends StatelessWidget {
                   child: ElevatedButton(
                     onPressed: () => submit(context, usernameController.text, passwordController.text),
                     style: ElevatedButton.styleFrom(
-                      backgroundColor: Colors.black, //todo putih lage
+                      backgroundColor: Colors.black,
                       side: BorderSide(color: Colors.white),
                       shape: RoundedRectangleBorder(
                         borderRadius: BorderRadius.circular(12.0),

+ 34 - 4
lib/main.dart

@@ -10,6 +10,7 @@ import 'package:namer_app/project/addmember.dart';
 import 'package:namer_app/project/addproject.dart';
 import 'package:namer_app/project/editproject.dart';
 import 'package:namer_app/project/listproject.dart';
+import 'package:namer_app/user/chgpass.dart';
 import 'package:namer_app/user/edituser.dart';
 import 'package:namer_app/footer.dart';
 import 'package:namer_app/header.dart';
@@ -23,11 +24,37 @@ import 'package:namer_app/login.dart';
 import 'package:flutter/rendering.dart';
 import 'package:namer_app/user/signup.dart';
 
+import 'bug/addcomment.dart';
+
 
 void main() {
+  
   runApp(MyApp());
 }
 
+// @override
+// void initState(){
+  
+//   getData();
+// }
+// var jsonList;
+// void getData() async { 
+//     try { 
+//       var response = await Dio() 
+//           .get('http://localhost:8080/api/v1/projects',
+//           options: Options(headers: headers)); 
+//       if (response.statusCode == 200) { 
+//         setState(() { 
+//           jsonList = response.data['results'] as List; 
+//         }); 
+//       } else { 
+//         print(response.statusCode); 
+//       } 
+//     } catch (e) { 
+//       print(e); 
+//     } 
+//   } 
+
   // var jsonList;
   final _router = GoRouter(
   routes: [
@@ -39,7 +66,7 @@ void main() {
             routes: [
               GoRoute(
                 path: 'comment',
-                builder: (context, state) => ListCommentPage(),
+                builder: (context, state) => ListCommentPage(bugId: 1,),
               ),
               GoRoute(
                 path: 'editbug',
@@ -75,7 +102,7 @@ void main() {
           routes: [
             GoRoute(
               path: 'listmember',
-              builder: (context, state) => ListMemberPage(),
+              builder: (context, state) => ListMemberPage(projId: 1,),
             ),
             GoRoute(
               path: 'editplatform',
@@ -100,9 +127,12 @@ void main() {
         builder: (context, state) => EditProjectPage(),
         ),
       GoRoute(path: 'addmember',
-        builder: (context, state) => AddMemberPage(),
+        builder: (context, state) => AddMemberPage(projId: 1),
         ),
-
+      GoRoute(path: 'changepass',
+        builder: (context, state) => ChangepassPage(), ),
+      GoRoute(path: 'addcomment',
+        builder: (context, state) => AddCommentPage(/*bugId: 1*/),),
     ]),
   ],
 ); 

+ 32 - 7
lib/project/addmember.dart

@@ -1,15 +1,17 @@
 import 'package:flutter/material.dart';
 import 'package:namer_app/footer.dart';
 import 'package:namer_app/header.dart';
-import 'package:namer_app/service/addproj_serv.dart';
+import '../service/addmember_serv.dart';
 
 class AddMemberPage extends StatelessWidget {
-  const AddMemberPage({super.key});
+  final int projId;
+  const AddMemberPage({super.key, required this.projId});
 
   @override
   Widget build(BuildContext context) {
-    var projname = TextEditingController();
-    var projdesc = TextEditingController();
+    // var projId = TextEditingController();
+    var userId = TextEditingController();
+    var role = TextEditingController();
     return Scaffold(
       appBar: CustomAppbar(),
       backgroundColor: Colors.white,
@@ -28,6 +30,29 @@ class AddMemberPage extends StatelessWidget {
           )),
           Column(
             children: [
+              // Padding(
+              //   padding: const EdgeInsets.all(8.0),
+              //   child: SizedBox(
+              //     width: 396,
+              //     child: TextField(
+              //       decoration: InputDecoration(
+              //           border: OutlineInputBorder(),
+              //           focusedBorder: OutlineInputBorder(
+              //               borderRadius: BorderRadius.all(Radius.circular(12)),
+              //               borderSide: BorderSide(color: Colors.black)),
+              //           enabledBorder: OutlineInputBorder(
+              //               borderRadius: BorderRadius.all(Radius.circular(12)),
+              //               borderSide: BorderSide(color: Colors.black)),
+              //           labelText: 'Enter Project ID', //todo get data
+              //           labelStyle: TextStyle(color: Colors.black),
+              //           filled: true,
+              //           fillColor: Colors.white.withOpacity(0.25)),
+              //       cursorColor: Colors.black,
+              //       style: TextStyle(color: Colors.black),
+              //       controller: projId,
+              //     ),
+              //   ),
+              // ),
               Padding(
                 padding: const EdgeInsets.all(8.0),
                 child: SizedBox(
@@ -47,7 +72,7 @@ class AddMemberPage extends StatelessWidget {
                         fillColor: Colors.white.withOpacity(0.25)),
                     cursorColor: Colors.black,
                     style: TextStyle(color: Colors.black),
-                    controller: projname,
+                    controller: userId,
                   ),
                 ),
               ),
@@ -70,7 +95,7 @@ class AddMemberPage extends StatelessWidget {
                         fillColor: Colors.white.withOpacity(0.25)),
                     cursorColor: Colors.black,
                     style: TextStyle(color: Colors.black),
-                    controller: projdesc,
+                    controller: role,
                   ),
                 ),
               ),
@@ -80,7 +105,7 @@ class AddMemberPage extends StatelessWidget {
                   width: 396,
                   height: 61,
                   child: ElevatedButton(
-                    onPressed: () => addproject(context, projname.text, projdesc.text), 
+                    onPressed: () => addmember(context, projId, int.parse(userId.text), role.text), 
                     style: ElevatedButton.styleFrom(
                       backgroundColor: Colors.black, //todo putih lage
                       side: BorderSide(color: Colors.white),

+ 19 - 32
lib/project/listmember.dart

@@ -1,36 +1,40 @@
-// ignore_for_file: must_call_super, prefer_typing_uninitialized_variables
+// ignore_for_file: must_call_super, prefer_typing_uninitialized_variables, no_logic_in_create_state
 
 import 'package:dio/dio.dart';
 import 'package:flutter/material.dart';
-import 'package:namer_app/data/datamember.dart';
 import 'package:namer_app/footer.dart';
 import 'package:namer_app/header.dart';
+import 'package:namer_app/service/delete_member.dart';
 import '../globals.dart';
 
 class ListMemberPage extends StatefulWidget {
-  final int id;
-  const ListMemberPage({super.key, required this.id});
+  final int projId;
+  
+  const ListMemberPage({super.key, required this.projId});
 
   @override
-  State<ListMemberPage> createState() => _ListMemberPageState();
+  State<ListMemberPage> createState() => _ListMemberPageState(
+    id: projId
+  );
 }
 
 class _ListMemberPageState extends State<ListMemberPage> {
-var jsonList;
+ int id;
+ _ListMemberPageState({required this.id});
+var members;
 @override
 void initState(){
-  getData();
+  getData(id);
 }
 
-void getData() async { 
+void getData(int id) async { 
     try { 
       var response = await Dio() 
-          // .get('http://localhost:8080/api/v1/projects/$id/member',
-          .get('http://localhost:8080/api/v1/projects/member',
+          .get('http://localhost:8080/api/v1/projects/$id/member',
           options: Options(headers: headers)); 
       if (response.statusCode == 200) { 
         setState(() { 
-          jsonList = response.data['results'] as List; 
+          members = response.data['results'] as List; 
         }); 
       } else { 
         print(response.statusCode); 
@@ -59,7 +63,7 @@ void getData() async {
               )),
               Column(
                 children: List.generate(
-                    2,
+                    members == null ? 0 : members.length,
                     (i) => SizedBox(
                           child: ListTile(
                             leading: SizedBox(
@@ -71,18 +75,11 @@ void getData() async {
                               children: [
                                 Row(
                                   children: [
-                                    Text(members[i]['member1']),
+                                    Text(members[i]['user']),
                                     Expanded(child: Container()),
-                                    Text(members[i]['role1'])
+                                    Text(members[i]['role'])
                                   ],
                                 ),
-                                Row(
-                                  children: [
-                                    Text(members[i]['member2']),
-                                    Expanded(child: Container()),
-                                    Text(members[i]['role2'])
-                                  ],
-                                )
                               ],
                             ),
                             trailing: ButtonUser(
@@ -115,17 +112,7 @@ class ButtonUser extends StatelessWidget {
       mainAxisSize: MainAxisSize.min,
       children: [
         ElevatedButton(
-          onPressed: null,
-          style: ElevatedButton.styleFrom(
-            backgroundColor: Colors.black,
-          ),
-          child: Text(
-            'Edit',
-            style: TextStyle(color: Colors.white),
-          ),
-        ),
-        ElevatedButton(
-          onPressed: null,
+          onPressed: () => delmember(context, items['id']),
           style: ElevatedButton.styleFrom(
             backgroundColor: Colors.black,
           ),

+ 12 - 2
lib/project/listproject.dart

@@ -121,13 +121,23 @@ class ButtonUser extends StatelessWidget {
             style: TextStyle(color: Colors.white),
           ),
         ),
-                ElevatedButton(
+        ElevatedButton(
+          onPressed: () => context.go('/addmember'),
+          style: ElevatedButton.styleFrom(
+            backgroundColor: Colors.black,
+          ),
+          child: Text(
+            'Add Member',
+            style: TextStyle(color: Colors.white),
+          ),
+        ),
+        ElevatedButton(
           onPressed: () => context.go('/listplatform/listmember'),
           style: ElevatedButton.styleFrom(
             backgroundColor: Colors.black,
           ),
           child: Text(
-            'Member',
+            'List Member',
             style: TextStyle(color: Colors.white),
           ),
         ),

+ 46 - 0
lib/service/addcomment_serv.dart

@@ -0,0 +1,46 @@
+// ignore_for_file: use_build_context_synchronously
+
+import 'dart:convert';
+
+import 'package:dio/dio.dart';
+import 'package:flutter/material.dart';
+import 'package:go_router/go_router.dart';
+import '../globals.dart';
+
+Future<void> addcomment(BuildContext context, String desc, String qc, String dev, String platform, String goodday, String image, String level, String status, String devStatus /*Map data*/) async {
+    final dio = Dio();
+    Response response;
+
+    AlertDialog alert2 = AlertDialog(
+      title: Text("Add Bug Gagal"),
+      content: Text("Data Invalid"),
+      actions: [
+        TextButton( 
+          child: Text('Ok'),
+          onPressed: () => Navigator.of(context).pop(),
+        ),
+      ],
+    );
+        var auth = 'Basic ${base64Encode(utf8.encode('$USER_LOGIN:$PASS_LOGIN'))}';
+        Map<String, String> headers = {
+          'content-type': 'application/json',
+          'accept': 'application/json',
+          'authorization': auth
+      };
+    try{
+      response = await dio.post("http://localhost:8080/api/v1/bugs", 
+                  options: Options(headers: headers),
+                  data: 
+                  // data 
+                  {'description':desc, 'qc': qc, 'dev': dev, 'platform':platform, 'goodday_url':goodday, 'image_url':image, 'level':level, 'status':status, 'dev_status':devStatus}
+                  );    
+      if (response.statusCode == 201){
+          return context.go('/listbug');
+      } 
+    } catch (error){     
+      
+      showDialog(context: context, builder: (context) => alert2);
+      }
+          
+  }
+

+ 45 - 0
lib/service/addmember_serv.dart

@@ -0,0 +1,45 @@
+// ignore_for_file: use_build_context_synchronously
+
+import 'dart:convert';
+import 'package:dio/dio.dart';
+import 'package:flutter/material.dart';
+import 'package:go_router/go_router.dart';
+import '../globals.dart';
+
+Future<void> addmember(BuildContext context, int projId, int userId, String role /*Map data*/) async {
+    final dio = Dio();
+    Response response;
+
+    AlertDialog alert2 = AlertDialog(
+      title: Text("Add Member Gagal"),
+      content: Text("Data Invalid"),
+      actions: [
+        TextButton( 
+          child: Text('Ok'),
+          onPressed: () => Navigator.of(context).pop(),
+        ),
+      ],
+    );
+        var auth = 'Basic ${base64Encode(utf8.encode('$USER_LOGIN:$PASS_LOGIN'))}';
+        Map<String, String> headers = {
+          'content-type': 'application/json',
+          'accept': 'application/json',
+          'authorization': auth
+      };
+    try{
+      response = await dio.post("http://localhost:8080/api/v1/projects/$projId/member", 
+                  options: Options(headers: headers),
+                  data: 
+                  // data 
+                  {'user_id':userId,'role':role}
+                  );    
+      if (response.statusCode == 201){
+          return context.go('/listplatform/listmember');
+      } 
+    } catch (error){     
+      
+      showDialog(context: context, builder: (context) => alert2);
+      }
+          
+  }
+

+ 49 - 0
lib/service/delete_member.dart

@@ -0,0 +1,49 @@
+
+// ignore_for_file: use_build_context_synchronously
+
+import 'dart:convert';
+import 'package:dio/dio.dart';
+import 'package:flutter/material.dart';
+import '../globals.dart';
+
+Future<void> delmember(BuildContext context, int id) async{
+  final dio = Dio();
+  Response response;
+    AlertDialog alert = AlertDialog(
+      title: Text("Delete Sukses"),
+      content: Text("Data terhapus"),
+      actions: [
+        TextButton( 
+          child: Text('Ok'),
+          onPressed: () => Navigator.of(context).pop(),
+        ),
+      ],
+    );
+        AlertDialog alert2 = AlertDialog(
+      title: Text("Delete Gagal"),
+      content: Text("Data Invalid"),
+      actions: [
+        TextButton( 
+          child: Text('Ok'),
+          onPressed: () => Navigator.of(context).pop(),
+        ),
+      ],
+    );
+            var auth = 'Basic ${base64Encode(utf8.encode('$USER_LOGIN:$PASS_LOGIN'))}';
+        Map<String, String> headers = {
+          'content-type': 'application/json',
+          'accept': 'application/json',
+          'authorization': auth
+      };
+try {
+  response = await dio.delete("http://localhost:8080/api/v1/projects/member/$id",
+              options: Options(headers: headers)
+              );
+  if(response.statusCode == 200){
+    showDialog(context: context, builder: (context) => alert);
+    
+  }
+} catch (error){
+  showDialog(context: context, builder: (context) => alert2);
+}
+} 

+ 42 - 25
lib/service/get_user.dart

@@ -1,35 +1,52 @@
-// ignore_for_file: camel_case_types
+
+
+// ignore_for_file: library_private_types_in_public_api
 
 import 'package:dio/dio.dart';
 import 'package:flutter/material.dart';
-import '../globals.dart';
+import 'package:namer_app/globals.dart';
+
+final globalState = _GlobalsState();
+
+void main() {
+  globalState.getuser();//call this way
+  runApp(
+    MaterialApp(
+      debugShowCheckedModeBanner: false,
+      title: "Taxiyee_Messaging_app",
+      home: Container(),
+    ),
+  );
+}
 
-class _getuser extends StatefulWidget {
-  const _getuser();
+class Globals extends StatefulWidget {
+  const Globals({super.key});
 
   @override
-  State<_getuser> createState() => _getuserState();
+  _GlobalsState createState() => _GlobalsState();
 }
 
-class _getuserState extends State<_getuser> {
-  late List jsonList;
-
-  void getuser() async {
-    
-    try { 
-      var response = await Dio() 
-          .get('http://localhost:8080/api/v1/users',
-          options: Options(headers: headers)); 
-      if (response.statusCode == 200) { 
-        setState(() { 
-        jsonList = response.data['results'] as List; 
-        }); 
-      } 
-    } catch (e) { 
-      print(e); 
-    } 
-  } 
-  
+class _GlobalsState extends State<Globals> {
+  // int counter = 0;
+  var jsonList = '';
   @override
-  dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
+  Widget build(BuildContext context) {
+    return Container();
+  }
+
+  getuser() async{
+    try {
+  var response = await Dio()
+      .get('http://localhost:8080/api/v1/users',
+      options: Options(headers: headers));
+  // print('Method Call');
+  if (response.statusCode == 200) {
+  setState(() {
+    // counter++;
+    jsonList = response.data['results'];
+  });}
+} on Exception catch (e) {
+  print(e);
+}
   }
+}

+ 1 - 0
pubspec.yaml

@@ -24,6 +24,7 @@ dependencies:
   dio: ^5.4.2
   http: ^1.2.1
   shared_preferences: ^2.2.2
+  # get: ^4.6.6
 
 my_storage:
   path: '../my_storage'