diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 04903ba..49a622d 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,8 +1,8 @@ http.Response.fromStream(response), + ); + } else { + switch (method.toLowerCase()) { + case 'get': + response = await http.get(Uri.parse(url), headers: requestHeaders); + break; + case 'post': + response = await http.post( + Uri.parse(url), + body: jsonEncode(body), + headers: requestHeaders, + encoding: encoding, + ); + break; + case 'put': + response = await http.put( + Uri.parse(url), + body: jsonEncode(body), + headers: requestHeaders, + encoding: encoding, + ); + break; + case 'delete': + response = await http.delete( + Uri.parse(url), + body: jsonEncode(body), + headers: requestHeaders, + ); + break; + case 'patch': + response = await http.patch( + Uri.parse(url), + body: jsonEncode(body), + headers: requestHeaders, + encoding: encoding, + ); + break; + default: + throw ApiException('Unsupported HTTP method: $method', 405); + } } final int statusCode = response.statusCode; @@ -189,4 +198,48 @@ class Https { baseUrl: baseUrl, ); } + + Future uploadFormData( + String desturl, { + required Map formData, + Map headers = const {}, + String? baseUrl, + }) async { + var request = http.MultipartRequest( + 'POST', + Uri.parse("${baseUrl ?? _baseUrl}$desturl"), + ); + + request.headers.addAll(await _getHeaders()); + + formData.forEach((key, value) async { + if (value is String) { + request.fields[key] = value; + } else if (value is File) { + String fileName = value.uri.pathSegments.last; + + if (value.lengthSync() > 10485760) { + throw ApiException('File size exceeds 10MB', 401); + } + + request.files.add( + await http.MultipartFile.fromPath( + key, + value.path, + filename: fileName, + contentType: MediaType('image', 'png'), + ), + ); + } else { + throw ApiException('Unsupported value type for field $key', 401); + } + }); + + return await _request( + 'post', + desturl: desturl, + headers: headers, + multipartRequest: request, + ); + } } diff --git a/lib/features/home/presentation/components/about_comp.dart b/lib/features/home/presentation/components/about_comp.dart index 042571d..3c1bb74 100644 --- a/lib/features/home/presentation/components/about_comp.dart +++ b/lib/features/home/presentation/components/about_comp.dart @@ -133,7 +133,9 @@ class AboutComponentState extends State { Brightness.dark ? Colors.blue : Colors.blue) - .withOpacity(_current == entry.key ? 0.9 : 0.2), + .withValues( + alpha: _current == entry.key ? 0.9 : 0.2, + ), ), ), ); diff --git a/lib/features/home/presentation/screen/home_screen.dart b/lib/features/home/presentation/screen/home_screen.dart index 4d91912..ff6180a 100644 --- a/lib/features/home/presentation/screen/home_screen.dart +++ b/lib/features/home/presentation/screen/home_screen.dart @@ -81,11 +81,7 @@ class _HomeScreenState extends State { ], ), const Gap(15), - Container( - height: - 250, // Tentukan tinggi yang sesuai untuk AboutComponent - child: AboutComponent(), - ), + AboutComponent(), ], ), Gap(20), diff --git a/lib/features/requestpick/presentation/screen/requestpickup_screen.dart b/lib/features/requestpick/presentation/screen/requestpickup_screen.dart index 36b7ab8..bea352f 100644 --- a/lib/features/requestpick/presentation/screen/requestpickup_screen.dart +++ b/lib/features/requestpick/presentation/screen/requestpickup_screen.dart @@ -55,6 +55,7 @@ class RequestPickScreen extends StatelessWidget { fit: BoxFit.cover, ), title: Text(category.name), + subtitle: Text("${category.price}"), ), ); }, diff --git a/lib/globaldata/trash/trash_model.dart b/lib/globaldata/trash/trash_model.dart index cadf017..90c7dee 100644 --- a/lib/globaldata/trash/trash_model.dart +++ b/lib/globaldata/trash/trash_model.dart @@ -1,6 +1,7 @@ class Category { final String id; final String name; + final dynamic price; final String icon; final String createdAt; final String updatedAt; @@ -8,6 +9,7 @@ class Category { Category({ required this.id, required this.name, + required this.price, required this.icon, required this.createdAt, required this.updatedAt, @@ -17,6 +19,7 @@ class Category { return Category( id: json['id'], name: json['name'], + price: json['estimatedprice'], icon: json['icon'], createdAt: json['createdAt'], updatedAt: json['updatedAt'], diff --git a/lib/main.dart b/lib/main.dart index d127a7a..0fda871 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -39,6 +39,7 @@ class MyApp extends StatelessWidget { builder: (_, child) { return MaterialApp.router( debugShowCheckedModeBanner: false, + title: "Rijig", routerConfig: router, ); }, diff --git a/pubspec.lock b/pubspec.lock index 7a774db..abeebd8 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,6 +1,14 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + archive: + dependency: transitive + description: + name: archive + sha256: "2fde1607386ab523f7a36bb3e7edb43bd58e6edaf2ffb29d8a6d578b297fdbbd" + url: "https://pub.dev" + source: hosted + version: "4.0.7" args: dependency: transitive description: @@ -41,6 +49,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.4.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff + url: "https://pub.dev" + source: hosted + version: "2.0.3" + cli_util: + dependency: transitive + description: + name: cli_util + sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c + url: "https://pub.dev" + source: hosted + version: "0.4.2" clock: dependency: transitive description: @@ -174,6 +198,14 @@ packages: url: "https://pub.dev" source: hosted version: "5.2.1" + flutter_launcher_icons: + dependency: "direct main" + description: + name: flutter_launcher_icons + sha256: bfa04787c85d80ecb3f8777bde5fc10c3de809240c48fa061a2c2bf15ea5211c + url: "https://pub.dev" + source: hosted + version: "0.14.3" flutter_lints: dependency: "direct dev" description: @@ -297,7 +329,7 @@ packages: source: hosted version: "1.3.0" http_parser: - dependency: transitive + dependency: "direct main" description: name: http_parser sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" @@ -312,6 +344,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.0" + image: + dependency: transitive + description: + name: image + sha256: "4e973fcf4caae1a4be2fa0a13157aa38a8f9cb049db6529aa00b4d71abc4d928" + url: "https://pub.dev" + source: hosted + version: "4.5.4" intl: dependency: "direct main" description: @@ -328,6 +368,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.7" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.dev" + source: hosted + version: "4.9.0" jwt_decoder: dependency: "direct main" description: @@ -512,6 +560,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.8" + posix: + dependency: transitive + description: + name: posix + sha256: f0d7856b6ca1887cfa6d1d394056a296ae33489db914e365e2044fdada449e62 + url: "https://pub.dev" + source: hosted + version: "6.0.2" provider: dependency: "direct main" description: @@ -749,6 +805,14 @@ packages: url: "https://pub.dev" source: hosted version: "6.5.0" + yaml: + dependency: transitive + description: + name: yaml + sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce + url: "https://pub.dev" + source: hosted + version: "3.1.3" sdks: dart: ">=3.7.2 <4.0.0" flutter: ">=3.27.0" diff --git a/pubspec.yaml b/pubspec.yaml index 1c59ce4..f06d3c6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,6 +17,7 @@ dependencies: sdk: flutter flutter_carousel_widget: ^3.1.0 flutter_dotenv: ^5.2.1 + flutter_launcher_icons: ^0.14.3 flutter_screenutil: ^5.9.3 flutter_secure_storage: ^9.2.4 flutter_svg: ^2.1.0 @@ -25,6 +26,7 @@ dependencies: go_router: ^15.1.1 google_fonts: ^6.0.0 http: ^1.3.0 + http_parser: ^4.1.2 iconsax_flutter: ^1.0.0 intl: ^0.20.2 jwt_decoder: ^2.0.1 @@ -40,6 +42,12 @@ dev_dependencies: flutter_test: sdk: flutter +flutter_launcher_icons: + android: "launcher_icon" + ios: true + image_path: "assets/icon/logorijig.png" + min_sdk_android: 21 # android min sdk min:16, default 21 + flutter: uses-material-design: true assets: