Selaa lähdekoodia

koneksi dio+java

athrainsky 8 kuukautta sitten
vanhempi
commit
55944720fa

BIN
assets/images/additional.png


BIN
assets/images/bathtub.png


BIN
assets/images/building.jpg


BIN
assets/images/danger-sign.png


BIN
assets/images/database.png


BIN
assets/images/firstaid.png


BIN
assets/images/food.png


BIN
assets/images/noise-pollution.png


BIN
assets/images/scan_icon_183865.png


BIN
assets/images/service.png


BIN
assets/images/ticket.png


BIN
assets/images/transportation.png


BIN
assets/images/vacation.png


+ 1 - 1
lib/editbug.dart

@@ -1,7 +1,7 @@
 import 'package:flutter/material.dart';
 import 'package:namer_app/footer.dart';
 import 'package:namer_app/head.dart';
-import 'package:namer_app/header.dart';
+// import 'package:namer_app/header.dart';
 
 class EditBugPage extends StatelessWidget {
   const EditBugPage({super.key});

+ 1 - 1
lib/editplatform.dart

@@ -1,7 +1,7 @@
 import 'package:flutter/material.dart';
 import 'package:namer_app/footer.dart';
 import 'package:namer_app/head.dart';
-import 'package:namer_app/header.dart';
+// import 'package:namer_app/header.dart';
 
 class EditPlatformPage extends StatelessWidget {
   const EditPlatformPage({super.key});

+ 1 - 1
lib/edituser.dart

@@ -1,7 +1,7 @@
 import 'package:flutter/material.dart';
 import 'package:namer_app/footer.dart';
 import 'package:namer_app/head.dart';
-import 'package:namer_app/header.dart';
+// import 'package:namer_app/header.dart';
 
 class EditUserPage extends StatelessWidget {
   const EditUserPage({super.key});

+ 1 - 1
lib/listbug.dart

@@ -3,7 +3,7 @@ import 'package:go_router/go_router.dart';
 import 'package:namer_app/databug.dart';
 import 'package:namer_app/footer.dart';
 import 'package:namer_app/head.dart';
-import 'package:namer_app/header.dart';
+// import 'package:namer_app/header.dart';
 
 class ListBugPage extends StatelessWidget {
   const ListBugPage({super.key});

+ 1 - 1
lib/listcomment.dart

@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
 import 'package:namer_app/datacomment.dart';
 import 'package:namer_app/footer.dart';
 import 'package:namer_app/head.dart';
-import 'package:namer_app/header.dart';
+// import 'package:namer_app/header.dart';
 
 class ListCommentPage extends StatelessWidget {
   const ListCommentPage({super.key});

+ 1 - 1
lib/listmember.dart

@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
 import 'package:namer_app/datamember.dart';
 import 'package:namer_app/footer.dart';
 import 'package:namer_app/head.dart';
-import 'package:namer_app/header.dart';
+// import 'package:namer_app/header.dart';
 
 class ListMemberPage extends StatelessWidget {
   const ListMemberPage({super.key});

+ 1 - 1
lib/listplatform.dart

@@ -3,7 +3,7 @@ import 'package:go_router/go_router.dart';
 import 'package:namer_app/dataplatform.dart';
 import 'package:namer_app/footer.dart';
 import 'package:namer_app/head.dart';
-import 'package:namer_app/header.dart';
+// import 'package:namer_app/header.dart';
 
 class ListPlatformPage extends StatelessWidget {
   const ListPlatformPage({super.key});

+ 1 - 1
lib/listtable.dart

@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
 import 'package:namer_app/datatable.dart';
 import 'package:namer_app/footer.dart';
 import 'package:namer_app/head.dart';
-import 'package:namer_app/header.dart';
+// import 'package:namer_app/header.dart';
 
 class ListTablePage extends StatelessWidget {
   const ListTablePage({super.key});

+ 1 - 1
lib/listuser.dart

@@ -3,7 +3,7 @@ import 'package:go_router/go_router.dart';
 import 'package:namer_app/datauser.dart';
 import 'package:namer_app/footer.dart';
 import 'package:namer_app/head.dart';
-import 'package:namer_app/header.dart';
+// import 'package:namer_app/header.dart';
 
 class ListUserPage extends StatelessWidget {
   const ListUserPage({super.key});

+ 22 - 3
lib/login.dart

@@ -1,14 +1,26 @@
+import 'dart:convert';
+
+import 'package:dio/dio.dart';
 import 'package:flutter/material.dart';
-import 'package:go_router/go_router.dart';
+// import 'package:go_router/go_router.dart';
 import 'package:namer_app/footer.dart';
 import 'package:namer_app/head.dart';
-import 'package:namer_app/header.dart';
+// import 'package:dio/dio.dart';
+// import 'package:namer_app/models/user_model.dart';
+// import 'package:namer_app/services/login_service.dart';
+// import 'package:namer_app/header.dart';
 
 class LoginPage extends StatelessWidget {
   const LoginPage({super.key});
 
   @override
   Widget build(BuildContext context) {
+    var dio = Dio();
+    Response response;
+    final usernameController = TextEditingController();
+    final passwordController = TextEditingController();
+    var auth =
+        'Basic ${base64Encode(utf8.encode('$usernameController:$passwordController'))}';
     return Scaffold(
       // appBar: Header(
       //   title: Text('title'),
@@ -55,6 +67,7 @@ class LoginPage extends StatelessWidget {
                         fillColor: Colors.white.withOpacity(0.25)),
                     cursorColor: Colors.black,
                     style: TextStyle(color: Colors.black),
+                    controller: usernameController,
                   ),
                 ),
               ),
@@ -77,6 +90,7 @@ class LoginPage extends StatelessWidget {
                       fillColor: Colors.white.withOpacity(0.25)),
                   cursorColor: Colors.black,
                   style: TextStyle(color: Colors.black),
+                  controller: passwordController,
                 ),
               ),
               Padding(
@@ -85,7 +99,12 @@ class LoginPage extends StatelessWidget {
                   width: 396,
                   height: 61,
                   child: ElevatedButton(
-                    onPressed: () => context.go('/login/bug'),
+                    onPressed: () async {
+                      response = await dio.post('http://localhost:8080/api/v1',
+                          options: Options(headers: <String, String>{
+                            'authorization': auth
+                          }));
+                    },
                     style: ElevatedButton.styleFrom(
                       backgroundColor: Colors.black, //todo putih lage
                       side: BorderSide(color: Colors.white),

+ 1 - 1
lib/signup.dart

@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
 import 'package:go_router/go_router.dart';
 import 'package:namer_app/footer.dart';
 import 'package:namer_app/head.dart';
-import 'package:namer_app/header.dart';
+// import 'package:namer_app/header.dart';
 
 class SignupPage extends StatelessWidget {
   const SignupPage({super.key});

+ 41 - 1
pubspec.lock

@@ -49,6 +49,14 @@ packages:
       url: "https://pub.dev"
     source: hosted
     version: "2.0.7"
+  dio:
+    dependency: "direct main"
+    description:
+      name: dio
+      sha256: "49af28382aefc53562459104f64d16b9dfd1e8ef68c862d5af436cc8356ce5a8"
+      url: "https://pub.dev"
+    source: hosted
+    version: "5.4.1"
   dotted_line:
     dependency: "direct main"
     description:
@@ -120,6 +128,22 @@ packages:
       url: "https://pub.dev"
     source: hosted
     version: "13.2.0"
+  http:
+    dependency: "direct main"
+    description:
+      name: http
+      sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938"
+      url: "https://pub.dev"
+    source: hosted
+    version: "1.2.1"
+  http_parser:
+    dependency: transitive
+    description:
+      name: http_parser
+      sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b"
+      url: "https://pub.dev"
+    source: hosted
+    version: "4.0.2"
   leak_tracker:
     dependency: transitive
     description:
@@ -293,6 +317,14 @@ packages:
       url: "https://pub.dev"
     source: hosted
     version: "0.1.0"
+  typed_data:
+    dependency: transitive
+    description:
+      name: typed_data
+      sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
+      url: "https://pub.dev"
+    source: hosted
+    version: "1.3.2"
   vector_math:
     dependency: transitive
     description:
@@ -309,6 +341,14 @@ packages:
       url: "https://pub.dev"
     source: hosted
     version: "13.0.0"
+  web:
+    dependency: transitive
+    description:
+      name: web
+      sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
+      url: "https://pub.dev"
+    source: hosted
+    version: "0.5.1"
 sdks:
-  dart: ">=3.2.0 <4.0.0"
+  dart: ">=3.3.0 <4.0.0"
   flutter: ">=3.13.0"

+ 2 - 0
pubspec.yaml

@@ -21,6 +21,8 @@ dependencies:
   timeline_tile: ^2.0.0
   lint: ^2.3.0  
   dropdown_button2: ^2.3.9
+  dio: ^5.4.1
+  http: ^1.2.1
 
 dev_dependencies:
   flutter_test:

+ 0 - 2
test/widget_test.dart

@@ -11,8 +11,6 @@ import 'package:flutter/material.dart';
 import 'package:flutter_test/flutter_test.dart';
 import 'package:namer_app/main.dart';
 
-import 'package:bug_listing/main.dart';
-
 void main() {
   testWidgets('Counter increments smoke test', (WidgetTester tester) async {
     // Build our app and trigger a frame.