From bf9a57f23b3e6aacd4dee16a03cc3fefc217b829 Mon Sep 17 00:00:00 2001 From: Irwan Cahyono Date: Fri, 11 Apr 2025 13:09:55 +0700 Subject: [PATCH 1/7] mobile --- lib/components/bottom_navbar.dart | 10 +- lib/components/custom_shape.dart | 2 +- lib/components/main_menu.dart | 22 +- lib/components/menu_button.dart | 5 +- lib/components/navbar_container.dart | 2 +- lib/components/scan_button.dart | 2 +- lib/helpers/image_picker_mobile.dart | 14 ++ lib/helpers/image_picker_stub.dart | 5 + lib/helpers/image_picker_web.dart | 35 +++ lib/helpers/pick_image.dart | 3 + lib/main.dart | 8 +- lib/screen/Home_screen.dart | 113 ++++++---- .../collection_caracter_screen.dart | 16 +- .../collection_fragment_screen.dart | 8 +- .../collection/collection_skin_screen.dart | 14 +- lib/screen/drraw_screen.dart | 2 +- lib/screen/koleksi_screen.dart | 18 +- lib/screen/pustaka/list_detail_screen.dart | 2 +- lib/screen/pustaka/list_education.dart | 20 +- .../pustaka/pustaka_detail_screen copy.dart | 4 +- lib/screen/pustaka_screen copy 2.dart | 2 +- lib/screen/pustaka_screen copy.dart | 2 +- lib/screen/pustaka_screen.dart | 32 +-- lib/screen/saya/akun_saya copy.dart | 211 ++++++++++++++++++ lib/screen/saya/akun_saya.dart | 27 ++- lib/screen/saya/profile_screen copy.dart | 2 +- lib/screen/saya/profile_screen.dart | 31 ++- pubspec.yaml | 26 ++- 28 files changed, 474 insertions(+), 164 deletions(-) create mode 100644 lib/helpers/image_picker_mobile.dart create mode 100644 lib/helpers/image_picker_stub.dart create mode 100644 lib/helpers/image_picker_web.dart create mode 100644 lib/helpers/pick_image.dart create mode 100644 lib/screen/saya/akun_saya copy.dart diff --git a/lib/components/bottom_navbar.dart b/lib/components/bottom_navbar.dart index b9e7e67..3278b96 100644 --- a/lib/components/bottom_navbar.dart +++ b/lib/components/bottom_navbar.dart @@ -1,9 +1,9 @@ import 'package:flutter/material.dart'; -import 'package:furibase/components/navbar_container.dart'; -import 'package:furibase/components/navbar_shape_1.dart'; -import 'package:furibase/components/navbar_shape_2.dart'; -import 'package:furibase/components/navbar_shape_3.dart'; -import 'package:furibase/components/custom_shape.dart'; +import 'package:freekake/components/navbar_container.dart'; +import 'package:freekake/components/navbar_shape_1.dart'; +import 'package:freekake/components/navbar_shape_2.dart'; +import 'package:freekake/components/navbar_shape_3.dart'; +import 'package:freekake/components/custom_shape.dart'; class BottomNavbar extends StatefulWidget { const BottomNavbar({super.key}); diff --git a/lib/components/custom_shape.dart b/lib/components/custom_shape.dart index 345c6e5..5efc010 100644 --- a/lib/components/custom_shape.dart +++ b/lib/components/custom_shape.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:furibase/components/navbar_shape_2.dart'; +import 'package:freekake/components/navbar_shape_2.dart'; class CustomShape extends StatelessWidget { const CustomShape({super.key}); diff --git a/lib/components/main_menu.dart b/lib/components/main_menu.dart index c38ec06..4c581e8 100644 --- a/lib/components/main_menu.dart +++ b/lib/components/main_menu.dart @@ -1,11 +1,11 @@ import 'package:flutter/material.dart'; -import 'package:furibase/components/bottom_navbar.dart'; -import 'package:furibase/components/menu_button.dart'; -import 'package:furibase/components/scan_button.dart'; -import 'package:furibase/screen/Home_screen.dart'; -import 'package:furibase/screen/koleksi_screen.dart'; -import 'package:furibase/screen/pustaka_screen.dart'; -import 'package:furibase/screen/saya/profile_screen.dart'; +import 'package:freekake/components/bottom_navbar.dart'; +import 'package:freekake/components/menu_button.dart'; +import 'package:freekake/components/scan_button.dart'; +import 'package:freekake/screen/Home_screen.dart'; +import 'package:freekake/screen/koleksi_screen.dart'; +import 'package:freekake/screen/pustaka_screen.dart'; +import 'package:freekake/screen/saya/profile_screen.dart'; class MainMenu extends StatelessWidget { const MainMenu({super.key}); @@ -22,7 +22,7 @@ class MainMenu extends StatelessWidget { children: [ MenuButton( label: "E-furibuddy", - icon: 'icons/furrybuddy.svg', + icon: 'assets/icons/furrybuddy.svg', onPress: () => { Navigator.push( @@ -33,7 +33,7 @@ class MainMenu extends StatelessWidget { ), MenuButton( label: "Koleksi", - icon: 'icons/koleksi.svg', + icon: 'assets/icons/koleksi.svg', onPress: () => { Navigator.push( @@ -45,7 +45,7 @@ class MainMenu extends StatelessWidget { SizedBox(width: 120), MenuButton( label: "Pustaka", - icon: 'icons/Pustaka.svg', + icon: 'assets/icons/Pustaka.svg', onPress: () => { Navigator.push( @@ -56,7 +56,7 @@ class MainMenu extends StatelessWidget { ), MenuButton( label: "Saya", - icon: 'icons/Saya.svg', + icon: 'assets/icons/Saya.svg', onPress: () => { Navigator.push( diff --git a/lib/components/menu_button.dart b/lib/components/menu_button.dart index faaf4ef..e979900 100644 --- a/lib/components/menu_button.dart +++ b/lib/components/menu_button.dart @@ -28,8 +28,8 @@ class MenuButton extends StatelessWidget { IconButton( icon: SvgPicture.asset( icon ?? '', - width: w ?? 28, - height: h ?? 28, + width: w ?? 24, + height: h ?? 24, // allowDrawingOutsideViewBox: true, colorFilter: ColorFilter.mode( Color.fromARGB(255, 255, 255, 255), @@ -43,6 +43,7 @@ class MenuButton extends StatelessWidget { style: TextStyle( color: Color.fromARGB(255, 239, 224, 232), fontWeight: FontWeight.bold, + fontSize: 10, ), ), ], diff --git a/lib/components/navbar_container.dart b/lib/components/navbar_container.dart index 418e0f4..2ed12cf 100644 --- a/lib/components/navbar_container.dart +++ b/lib/components/navbar_container.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:furibase/components/navbar_shape_2.dart'; +import 'package:freekake/components/navbar_shape_2.dart'; class NavbarContainer extends StatelessWidget { const NavbarContainer({super.key}); diff --git a/lib/components/scan_button.dart b/lib/components/scan_button.dart index e352f75..4951cc3 100644 --- a/lib/components/scan_button.dart +++ b/lib/components/scan_button.dart @@ -16,7 +16,7 @@ class ScanButton extends StatelessWidget { padding: EdgeInsets.all(10), child: IconButton( icon: SvgPicture.asset( - 'icons/Scan.svg', + 'assets/icons/Scan.svg', width: 60, height: 60, colorFilter: ColorFilter.mode( diff --git a/lib/helpers/image_picker_mobile.dart b/lib/helpers/image_picker_mobile.dart new file mode 100644 index 0000000..bf49f5b --- /dev/null +++ b/lib/helpers/image_picker_mobile.dart @@ -0,0 +1,14 @@ +import 'dart:io'; +import 'package:image_picker/image_picker.dart'; + +class ImagePickerHelper { + Future pickImage() async { + final ImagePicker picker = ImagePicker(); + final XFile? pickedFile = await picker.pickImage(source: ImageSource.gallery); + + if (pickedFile != null) { + File imageFile = File(pickedFile.path); + return imageFile; + } + } +} \ No newline at end of file diff --git a/lib/helpers/image_picker_stub.dart b/lib/helpers/image_picker_stub.dart new file mode 100644 index 0000000..0f4d0d2 --- /dev/null +++ b/lib/helpers/image_picker_stub.dart @@ -0,0 +1,5 @@ +class ImagePickerHelper { + Future pickImage() async { + throw UnsupportedError('pickImage is not supported on this platform'); + } +} \ No newline at end of file diff --git a/lib/helpers/image_picker_web.dart b/lib/helpers/image_picker_web.dart new file mode 100644 index 0000000..86be7f0 --- /dev/null +++ b/lib/helpers/image_picker_web.dart @@ -0,0 +1,35 @@ +// import 'package:image_picker_web/image_picker_web.dart'; +// import 'dart:typed_data'; + +// class ImagePickerHelper { +// Future pickImage() async { +// Uint8List? bytesFromPicker = await ImagePickerWeb.getImageAsBytes(); +// if (bytesFromPicker != null) { +// return bytesFromPicker; +// } +// } +// } + +import 'dart:typed_data'; +import 'dart:html' as html; + +class ImagePickerHelper { + Future pickImage() async { + html.FileUploadInputElement uploadInput = html.FileUploadInputElement(); + uploadInput.accept = 'image/*'; + uploadInput.click(); + + uploadInput.onChange.listen((event) async { + final file = uploadInput.files!.first; + final reader = html.FileReader(); + + reader.readAsArrayBuffer(file); + reader.onLoadEnd.listen((event) { + Uint8List imageBytes = reader.result as Uint8List; + if (imageBytes != null) { + return imageBytes; + } + }); + }); + } +} \ No newline at end of file diff --git a/lib/helpers/pick_image.dart b/lib/helpers/pick_image.dart new file mode 100644 index 0000000..e01473f --- /dev/null +++ b/lib/helpers/pick_image.dart @@ -0,0 +1,3 @@ +export 'image_picker_stub.dart' + if (dart.library.html) 'image_picker_web.dart' + if (dart.library.io) 'image_picker_mobile.dart'; \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index bd53647..1ff87de 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; -import 'package:furibase/components/navbar_container.dart'; -import 'package:furibase/providers/character_provider.dart'; -import 'package:furibase/screen/Home_screen.dart'; -import 'package:furibase/screen/drraw_screen.dart'; +import 'package:freekake/components/navbar_container.dart'; +import 'package:freekake/providers/character_provider.dart'; +import 'package:freekake/screen/Home_screen.dart'; +import 'package:freekake/screen/drraw_screen.dart'; import 'package:provider/provider.dart'; void main() { diff --git a/lib/screen/Home_screen.dart b/lib/screen/Home_screen.dart index 7f1fd44..ed5e26a 100644 --- a/lib/screen/Home_screen.dart +++ b/lib/screen/Home_screen.dart @@ -1,10 +1,11 @@ import 'package:dropdown_button2/dropdown_button2.dart'; import 'package:flutter/material.dart'; -import 'package:furibase/components/bottom_navbar.dart'; -import 'package:furibase/components/buildcard_info.dart'; -import 'package:furibase/components/main_menu.dart'; -import 'package:furibase/components/scan_button.dart'; -import 'package:furibase/components/topbar_container.dart'; +import 'package:freekake/components/bottom_navbar.dart'; +import 'package:freekake/components/buildcard_info.dart'; +import 'package:freekake/components/main_menu.dart'; +import 'package:freekake/components/scan_button.dart'; +import 'package:freekake/components/topbar_container.dart'; +import 'package:flutter_unity_widget/flutter_unity_widget.dart'; class HomeScreen extends StatefulWidget { HomeScreen({super.key}); @@ -18,6 +19,7 @@ class _HomeScreenState extends State { double _sliderValue = 0.0; static const Color transparent = Color(0xFFFFFFFF); // Image image + late UnityWidgetController _unityWidgetController; @override Widget build(BuildContext context) { @@ -71,14 +73,21 @@ class _HomeScreenState extends State { body: Stack( children: [ Positioned.fill( - child: Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage("images/background.jpeg"), - fit: BoxFit.cover, - ), - ), + child: UnityWidget( + onUnityCreated: onUnityCreated, + //isARScene: true, + onUnityMessage: onUnityMessage, + //onUnitySceneLoaded: onUnitySceneLoaded, + fullscreen: false, ), + // child: Container( + // decoration: BoxDecoration( + // image: DecorationImage( + // image: AssetImage("assets/images/background.jpeg"), + // fit: BoxFit.cover, + // ), + // ), + // ), ), // Positioned( // top: 0, @@ -107,7 +116,7 @@ class _HomeScreenState extends State { decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), image: const DecorationImage( - image: AssetImage('images/luffy-u.png'), + image: AssetImage('assets/images/luffy-u.png'), fit: BoxFit.cover, ), ), @@ -191,40 +200,40 @@ class _HomeScreenState extends State { ], ), ), - Positioned( - bottom: 150, - left: 0, - right: 0, - child: Column( - children: [ - Container( - padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10), - decoration: BoxDecoration( - color: Color.fromARGB(255, 247, 224, 236), - borderRadius: BorderRadius.circular(10), - boxShadow: [ - BoxShadow( - color: Color.fromARGB(255, 214, 213, 121), - blurRadius: 5, - spreadRadius: 2, - ), - ], - ), - child: Text( - "Halo....Jotaslim", - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - color: Color(0xFF000000), - ), - ), - ), - SizedBox(height: 10), - setHomeImage("images/luffy.png", 300), - // Image.asset("images/luffy.png", width: 300), - ], - ), - ), + // Positioned( + // bottom: 150, + // left: 0, + // right: 0, + // child: Column( + // children: [ + // Container( + // padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10), + // decoration: BoxDecoration( + // color: Color.fromARGB(255, 247, 224, 236), + // borderRadius: BorderRadius.circular(10), + // boxShadow: [ + // BoxShadow( + // color: Color.fromARGB(255, 214, 213, 121), + // blurRadius: 5, + // spreadRadius: 2, + // ), + // ], + // ), + // child: Text( + // "Halo....Jotaslim", + // style: TextStyle( + // fontSize: 12, + // fontWeight: FontWeight.bold, + // color: Color(0xFF000000), + // ), + // ), + // ), + // SizedBox(height: 10), + // setHomeImage("images/luffy.png", 300), + // // Image.asset("images/luffy.png", width: 300), + // ], + // ), + // ), // BG MEnu Stack( children: [ @@ -250,6 +259,14 @@ class _HomeScreenState extends State { ); } + void onUnityCreated(controller) { + _unityWidgetController = controller; + } + + void onUnityMessage(message) { + print('Received message from unity: ${message.toString()}'); + } + // Widget _menuButton(String label, Widget icon) { // return Expanded( // child: Column( @@ -290,7 +307,7 @@ class _HomeScreenState extends State { // } Widget setHomeImage(String src, double size) { - return Image.asset(src, width: size); + return Image.asset("assets/" + src, width: size); } } diff --git a/lib/screen/collection/collection_caracter_screen.dart b/lib/screen/collection/collection_caracter_screen.dart index 1e7073e..1bfce5f 100644 --- a/lib/screen/collection/collection_caracter_screen.dart +++ b/lib/screen/collection/collection_caracter_screen.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:furibase/components/collection_container.dart'; +import 'package:freekake/components/collection_container.dart'; class CollectionCaraterScreen extends StatefulWidget { const CollectionCaraterScreen({super.key}); @@ -22,7 +22,7 @@ class _CollectionCaraterScreenState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text("Favorite", style: TextStyle(color: Colors.black)), + Text("Favorit", style: TextStyle(color: Colors.black)), Divider(height: 20, color: Colors.transparent), Row( // alignment: WrapAlignment.spaceAround, @@ -31,19 +31,19 @@ class _CollectionCaraterScreenState extends State { children: [ CollectionContainer( label: "Luffy", - imagesrc: 'images/luffy.png', + imagesrc: 'assets/images/luffy.png', colorContiner: Color.fromRGBO(12, 199, 215, 1), onTapAc: () => {}, ), CollectionContainer( label: "Oni Chan", - imagesrc: 'images/klipartz.png', + imagesrc: 'assets/images/klipartz.png', onTapAc: () => {}, ), ], ), Divider(height: 20, color: Colors.transparent), - Text("All", style: TextStyle(color: Colors.black)), + Text("Semua", style: TextStyle(color: Colors.black)), Divider(height: 20, color: Colors.transparent), Row( // alignment: WrapAlignment.spaceAround, @@ -52,18 +52,18 @@ class _CollectionCaraterScreenState extends State { children: [ CollectionContainer( label: "Luffy", - imagesrc: 'images/luffy.png', + imagesrc: 'assets/images/luffy.png', colorContiner: Color.fromRGBO(12, 199, 215, 1), onTapAc: () => {}, ), CollectionContainer( label: "Oni Chan", - imagesrc: 'images/klipartz.png', + imagesrc: 'assets/images/klipartz.png', onTapAc: () => {}, ), CollectionContainer( label: "Cepot", - imagesrc: 'images/cepott.png', + imagesrc: 'assets/images/cepott.png', colorContiner: Color.fromRGBO(237, 207, 100, 1.0), onTapAc: () => {}, ), diff --git a/lib/screen/collection/collection_fragment_screen.dart b/lib/screen/collection/collection_fragment_screen.dart index 0899239..8ce622a 100644 --- a/lib/screen/collection/collection_fragment_screen.dart +++ b/lib/screen/collection/collection_fragment_screen.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; -import 'package:furibase/components/collection_container.dart'; -import 'package:furibase/helpers/color_helper.dart'; +import 'package:freekake/components/collection_container.dart'; +import 'package:freekake/helpers/color_helper.dart'; class CollectionFragmentScreen extends StatefulWidget { const CollectionFragmentScreen({super.key}); @@ -29,13 +29,13 @@ class _CollectionFragmentScreenState extends State { children: [ CollectionContainer( label: "Luffy", - imagesrc: 'images/ft_luffy.png', + imagesrc: 'assets/images/ft_luffy.png', onTapAc: () => {}, colorContiner: ColorHelper.hexToColor("0xE2E5E9"), ), CollectionContainer( label: "Oni Chan", - imagesrc: 'images/ft_cepot.png', + imagesrc: 'assets/images/ft_cepot.png', onTapAc: () => {}, colorContiner: ColorHelper.hexToColor("0xE2E5E9"), ), diff --git a/lib/screen/collection/collection_skin_screen.dart b/lib/screen/collection/collection_skin_screen.dart index efa880a..bc8209b 100644 --- a/lib/screen/collection/collection_skin_screen.dart +++ b/lib/screen/collection/collection_skin_screen.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:furibase/components/collection_container.dart'; +import 'package:freekake/components/collection_container.dart'; class CollectionSkinScreen extends StatefulWidget { const CollectionSkinScreen({super.key}); @@ -32,27 +32,27 @@ class _CollectionSkinScreenState extends State { children: [ CollectionContainer( label: "Luffy Kimono", - imagesrc: 'images/luffy-kimono.png', + imagesrc: 'assets/images/luffy-kimono.png', colorContiner: Color.fromRGBO(12, 199, 215, 1), onTapAc: () => {}, ), CollectionContainer( label: "Luffy (Default)", - imagesrc: 'images/luffy.png', + imagesrc: 'assets/images/luffy.png', colorContiner: Color.fromRGBO(12, 199, 215, 1), onTapAc: () => {}, ), CollectionContainer( label: "Luffy King", - imagesrc: 'images/luffy-king.png', + imagesrc: 'assets/images/luffy-king.png', colorContiner: Color.fromRGBO(12, 199, 215, 1), onTapAc: () => {}, ), ], ), Divider(height: 20, color: Colors.transparent), - Text("Others", style: TextStyle(color: Colors.black)), + Text("Lainnya", style: TextStyle(color: Colors.black)), Divider(height: 10), Row( // alignment: WrapAlignment.start, @@ -61,12 +61,12 @@ class _CollectionSkinScreenState extends State { children: [ CollectionContainer( label: "Oni Chan (Default)", - imagesrc: 'images/klipartz.png', + imagesrc: 'assets/images/klipartz.png', onTapAc: () => {}, ), CollectionContainer( label: "Cepot (Default)", - imagesrc: 'images/cepott.png', + imagesrc: 'assets/images/cepott.png', colorContiner: Color.fromRGBO(237, 207, 100, 1.0), onTapAc: () => {}, ), diff --git a/lib/screen/drraw_screen.dart b/lib/screen/drraw_screen.dart index 904ac6a..0eff846 100644 --- a/lib/screen/drraw_screen.dart +++ b/lib/screen/drraw_screen.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:furibase/components/navbar_container.dart'; +import 'package:freekake/components/navbar_container.dart'; class DrawScreen extends StatelessWidget { const DrawScreen({super.key}); diff --git a/lib/screen/koleksi_screen.dart b/lib/screen/koleksi_screen.dart index 468972f..6e63d0f 100644 --- a/lib/screen/koleksi_screen.dart +++ b/lib/screen/koleksi_screen.dart @@ -1,13 +1,13 @@ import 'package:flutter/material.dart'; -import 'package:furibase/components/bottom_navbar.dart'; -import 'package:furibase/components/buildcard_info.dart'; -import 'package:furibase/components/main_menu.dart'; -import 'package:furibase/components/scan_button.dart'; -import 'package:furibase/components/tab_menu.dart'; -import 'package:furibase/components/topbar_container.dart'; -import 'package:furibase/screen/collection/collection_caracter_screen.dart'; -import 'package:furibase/screen/collection/collection_fragment_screen.dart'; -import 'package:furibase/screen/collection/collection_skin_screen.dart'; +import 'package:freekake/components/bottom_navbar.dart'; +import 'package:freekake/components/buildcard_info.dart'; +import 'package:freekake/components/main_menu.dart'; +import 'package:freekake/components/scan_button.dart'; +import 'package:freekake/components/tab_menu.dart'; +import 'package:freekake/components/topbar_container.dart'; +import 'package:freekake/screen/collection/collection_caracter_screen.dart'; +import 'package:freekake/screen/collection/collection_fragment_screen.dart'; +import 'package:freekake/screen/collection/collection_skin_screen.dart'; class KoleksiScreen extends StatefulWidget { const KoleksiScreen({super.key}); diff --git a/lib/screen/pustaka/list_detail_screen.dart b/lib/screen/pustaka/list_detail_screen.dart index a77cd16..eec5a43 100644 --- a/lib/screen/pustaka/list_detail_screen.dart +++ b/lib/screen/pustaka/list_detail_screen.dart @@ -39,7 +39,7 @@ class _ListDetailScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Image.asset( - 'images/default.png', // Ganti dengan gambar yang sesuai + 'assets/images/default.png', // Ganti dengan gambar yang sesuai width: 100, height: 100, fit: BoxFit.cover, diff --git a/lib/screen/pustaka/list_education.dart b/lib/screen/pustaka/list_education.dart index 1f75386..bc268fa 100644 --- a/lib/screen/pustaka/list_education.dart +++ b/lib/screen/pustaka/list_education.dart @@ -1,10 +1,10 @@ import 'package:flutter/material.dart'; -import 'package:furibase/components/buildcard_info.dart'; -import 'package:furibase/components/card_list.dart'; -import 'package:furibase/components/collection_container%20copy.dart'; -import 'package:furibase/components/main_menu.dart'; -import 'package:furibase/components/topbar_container.dart'; -import 'package:furibase/screen/pustaka/pustaka_detail_screen.dart'; +import 'package:freekake/components/buildcard_info.dart'; +import 'package:freekake/components/card_list.dart'; +import 'package:freekake/components/collection_container%20copy.dart'; +import 'package:freekake/components/main_menu.dart'; +import 'package:freekake/components/topbar_container.dart'; +import 'package:freekake/screen/pustaka/pustaka_detail_screen.dart'; class ListEducation extends StatefulWidget { const ListEducation({super.key}); @@ -44,10 +44,10 @@ class _ListEducationState extends State { Widget build(BuildContext context) { String _searchQuery = ""; final List> _collections = [ - {"label": "Kesehatan", "image": "icons/healthy.svg"}, - {"label": "Gizi", "image": "icons/Nutrition.svg"}, - {"label": "Pendidikan", "image": "icons/Education.svg"}, - {"label": "Keselamatan", "image": "icons/Safety.svg"}, + {"label": "Kesehatan", "image": "assets/icons/healthy.svg"}, + {"label": "Gizi", "image": "assets/icons/Nutrition.svg"}, + {"label": "Pendidikan", "image": "assets/icons/Education.svg"}, + {"label": "Keselamatan", "image": "assets/icons/Safety.svg"}, ]; List> filteredCollections = _collections diff --git a/lib/screen/pustaka/pustaka_detail_screen copy.dart b/lib/screen/pustaka/pustaka_detail_screen copy.dart index 3bf39fc..0fb418f 100644 --- a/lib/screen/pustaka/pustaka_detail_screen copy.dart +++ b/lib/screen/pustaka/pustaka_detail_screen copy.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; -import 'package:furibase/components/buildcard_info.dart'; -import 'package:furibase/components/collection_container.dart'; +import 'package:freekakes/components/buildcard_info.dart'; +import 'package:freekake/components/collection_container.dart'; class DetailScreen extends StatefulWidget { final String title; diff --git a/lib/screen/pustaka_screen copy 2.dart b/lib/screen/pustaka_screen copy 2.dart index 0af1108..13261f9 100644 --- a/lib/screen/pustaka_screen copy 2.dart +++ b/lib/screen/pustaka_screen copy 2.dart @@ -108,7 +108,7 @@ class _PustakaScreenState extends State { children: [ CollectionContainer( label: "Luffy", - imagesrc: 'images/luffy.png', + imagesrc: 'assets/images/luffy.png', width: 100, height: 100, onTapAc: diff --git a/lib/screen/pustaka_screen copy.dart b/lib/screen/pustaka_screen copy.dart index 0af1108..13261f9 100644 --- a/lib/screen/pustaka_screen copy.dart +++ b/lib/screen/pustaka_screen copy.dart @@ -108,7 +108,7 @@ class _PustakaScreenState extends State { children: [ CollectionContainer( label: "Luffy", - imagesrc: 'images/luffy.png', + imagesrc: 'assets/images/luffy.png', width: 100, height: 100, onTapAc: diff --git a/lib/screen/pustaka_screen.dart b/lib/screen/pustaka_screen.dart index 7478428..a36f9c2 100644 --- a/lib/screen/pustaka_screen.dart +++ b/lib/screen/pustaka_screen.dart @@ -1,12 +1,12 @@ import 'package:flutter/material.dart'; -import 'package:furibase/components/bottom_navbar.dart'; -import 'package:furibase/components/buildcard_info.dart'; -import 'package:furibase/components/collection_container.dart'; -import 'package:furibase/components/main_menu.dart'; -import 'package:furibase/components/scan_button.dart'; -import 'package:furibase/components/topbar_container.dart'; -import 'package:furibase/helpers/color_helper.dart'; -import 'package:furibase/screen/pustaka/list_education.dart'; +import 'package:freekake/components/bottom_navbar.dart'; +import 'package:freekake/components/buildcard_info.dart'; +import 'package:freekake/components/collection_container.dart'; +import 'package:freekake/components/main_menu.dart'; +import 'package:freekake/components/scan_button.dart'; +import 'package:freekake/components/topbar_container.dart'; +import 'package:freekake/helpers/color_helper.dart'; +import 'package:freekake/screen/pustaka/list_education.dart'; class PustakaScreen extends StatefulWidget { const PustakaScreen({super.key}); @@ -22,10 +22,10 @@ class _PustakaScreenState extends State { String _searchQuery = ""; final List> _collections = [ - {"label": "Kesehatan", "image": "icons/healthy.svg", "color": "#cdd0ee"}, - {"label": "Gizi", "image": "icons/Nutrition.svg", "color": "#e8e29a"}, - {"label": "Pendidikan", "image": "icons/Education.svg", "color": "#efd8c6"}, - {"label": "Keselamatan", "image": "icons/Safety.svg", "color": "#cef1da"}, + {"label": "Kesehatan", "image": "assets/icons/healthy.svg", "color": "#cdd0ee"}, + {"label": "Gizi", "image": "assets/icons/Nutrition.svg", "color": "#e8e29a"}, + {"label": "Pendidikan", "image": "assets/icons/Education.svg", "color": "#efd8c6"}, + {"label": "Keselamatan", "image": "assets/icons/Safety.svg", "color": "#cef1da"}, ]; void _onMenuTapped(int index) { @@ -131,7 +131,7 @@ class _PustakaScreenState extends State { ), decoration: const InputDecoration( border: InputBorder.none, - hintText: 'Search...', + hintText: 'Cari konten...', hintStyle: TextStyle(color: Colors.grey), ), ), @@ -160,6 +160,7 @@ class _PustakaScreenState extends State { final item = filteredCollections[index]; return CollectionContainer( label: item["label"]!, + lblSize: 11, imageSvg: item["image"]!, width: 30, height: 80, @@ -213,7 +214,7 @@ class _PustakaScreenState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text("List Topic", style: TextStyle(color: Colors.black)), + Text("Daftar Topik", style: TextStyle(color: Colors.black)), Divider(color: Colors.transparent), ], ), @@ -264,9 +265,10 @@ class _PustakaScreenState extends State { color: Colors.blueAccent, ), Text( - 'Topic ' + (index + 1).toString(), + 'Topik ' + (index + 1).toString(), style: const TextStyle( fontWeight: FontWeight.bold, + fontSize: 11, color: Color.fromARGB(255, 0, 0, 0), ), ), diff --git a/lib/screen/saya/akun_saya copy.dart b/lib/screen/saya/akun_saya copy.dart new file mode 100644 index 0000000..95388a0 --- /dev/null +++ b/lib/screen/saya/akun_saya copy.dart @@ -0,0 +1,211 @@ +import 'dart:typed_data'; + +import 'package:flutter/material.dart'; +import 'package:furibase/components/bottom_navbar.dart'; +import 'package:furibase/components/main_menu.dart'; +import 'package:furibase/components/scan_button.dart'; +import 'package:furibase/helpers/pick_image.dart'; +import 'package:flutter/foundation.dart' show kIsWeb; + +class AkunSaya extends StatefulWidget { + @override + _AkunSayaState createState() => _AkunSayaState(); +} + +class _AkunSayaState extends State { + dynamic _profileImage; + dynamic _headerImage; + //final ImagePicker _picker = ImagePicker(); + + Future _pickImage(bool isProfile) async { + final imagePicker = ImagePickerHelper(); + dynamic pic = await imagePicker.pickImage(); + + if (pic != null) { + setState(() { + if (isProfile) { + _profileImage = pic; + } else { + _headerImage = pic; + } + }); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text("Saya"), + backgroundColor: Color.fromARGB(225, 79, 76, 182), + ), + backgroundColor: const Color.fromARGB(255, 255, 255, 255), + body: Stack( + children: [ + Positioned( + bottom: 0, + left: 0, + right: 0, + child: Padding( + padding: const EdgeInsets.only(top: 20.0, left: 20, right: 20), + child: Container( + height: MediaQuery.of(context).size.height * 0.7, + width: MediaQuery.of(context).size.width, + decoration: BoxDecoration( + color: const Color.fromARGB(255, 205, 202, 189), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(20), + topRight: Radius.circular(20), + ), + ), + ), + ), + ), + Column( + children: [ + // Header image (bisa diubah) + SizedBox( + height: 80, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(40), + bottomRight: Radius.circular(40), + ), + color: Color.fromARGB(225, 79, 76, 182), + ), + ), + ), + SizedBox(height: 40), + Expanded( + child: Padding( + padding: EdgeInsets.all(20), + child: ListView( + padding: EdgeInsets.symmetric(horizontal: 20, vertical: 40), + children: [ + TextFormField( + initialValue: "Cepot", + decoration: const InputDecoration( + border: UnderlineInputBorder(), + labelText: 'Nama', + labelStyle: TextStyle(color: Colors.black), + ), + style: TextStyle(color: Colors.black), + ), + TextFormField( + initialValue: "cpt09", + decoration: const InputDecoration( + border: UnderlineInputBorder(), + labelText: 'Nama Pengguna', + labelStyle: TextStyle(color: Colors.black), + ), + style: TextStyle(color: Colors.black), + ), + + TextFormField( + initialValue: "Jl. Sentosa jaya", + decoration: const InputDecoration( + border: UnderlineInputBorder(), + labelText: 'Alamat', + labelStyle: TextStyle(color: Colors.black), + ), + style: TextStyle(color: Colors.black), + ), + + TextFormField( + initialValue: "******", + decoration: const InputDecoration( + border: UnderlineInputBorder(), + labelText: 'Kata Sandi', + labelStyle: TextStyle(color: Colors.black), + ), + style: TextStyle(color: Colors.black), + ), + TextFormField( + initialValue: "+62923", + decoration: const InputDecoration( + border: UnderlineInputBorder(), + labelText: 'No. HP', + labelStyle: TextStyle(color: Colors.black), + ), + style: TextStyle(color: Colors.black), + ), + ], + ), + ), + ), + ], + ), + // Profile Picture (bisa diubah) + Positioned( + top: 25, + left: MediaQuery.of(context).size.width / 2 - 50, + child: GestureDetector( + onTap: () => _pickImage(true), + child: Stack( + alignment: Alignment.bottomRight, + children: [ + CircleAvatar( + radius: 50, + backgroundColor: Colors.grey[300], + backgroundImage: + _profileImage != null + ? (kIsWeb + ? MemoryImage(_profileImage) as ImageProvider + : FileImage(_profileImage) as ImageProvider) + : null, + child: + _profileImage == null + ? Icon(Icons.person, size: 50, color: Colors.white) + : null, + ), + CircleAvatar( + radius: 15, + backgroundColor: Colors.blue, + child: Icon(Icons.edit, color: Colors.white, size: 15), + ), + ], + ), + ), + ), + + Positioned( + top: 130, + left: MediaQuery.of(context).size.width / 2 - 50, + child: GestureDetector( + onTap: () => _pickImage(true), + child: Stack( + alignment: Alignment.bottomRight, + children: [ + Text( + "Nama Akun", + style: TextStyle( + color: Colors.deepPurple, + fontSize: 18, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + ), + ], + ), + ); + } + + Widget _buildListItem(IconData icon, String label, {bool isLogout = false}) { + return ListTile( + leading: Icon( + icon, + color: + isLogout + ? const Color.fromARGB(255, 181, 47, 47) + : const Color.fromARGB(255, 255, 255, 255), + ), + title: Text(label, style: TextStyle(fontSize: 16, color: Colors.black)), + trailing: Icon(Icons.arrow_forward_ios, size: 16), + onTap: () {}, + ); + } +} diff --git a/lib/screen/saya/akun_saya.dart b/lib/screen/saya/akun_saya.dart index 0fb1797..e93d5b7 100644 --- a/lib/screen/saya/akun_saya.dart +++ b/lib/screen/saya/akun_saya.dart @@ -1,13 +1,12 @@ import 'dart:typed_data'; import 'package:flutter/material.dart'; -import 'package:furibase/components/bottom_navbar.dart'; -import 'package:furibase/components/main_menu.dart'; -import 'package:furibase/components/scan_button.dart'; +import 'package:freekake/components/bottom_navbar.dart'; +import 'package:freekake/components/main_menu.dart'; +import 'package:freekake/components/scan_button.dart'; import 'package:image_picker/image_picker.dart'; import 'dart:io'; -import 'package:image_picker_web/image_picker_web.dart'; import 'package:flutter/foundation.dart' show kIsWeb; class AkunSaya extends StatefulWidget { @@ -22,16 +21,16 @@ class _AkunSayaState extends State { Future _pickImage(bool isProfile) async { if (kIsWeb) { - Uint8List? bytesFromPicker = await ImagePickerWeb.getImageAsBytes(); - if (bytesFromPicker != null) { - setState(() { - if (isProfile) { - _profileImage = bytesFromPicker; - } else { - _headerImage = bytesFromPicker; - } - }); - } + // Uint8List? bytesFromPicker = await ImagePickerWeb.getImageAsBytes(); + // if (bytesFromPicker != null) { + // setState(() { + // if (isProfile) { + // _profileImage = bytesFromPicker; + // } else { + // _headerImage = bytesFromPicker; + // } + // }); + // } } else { final pickedFile = await _picker.pickImage(source: ImageSource.gallery); if (pickedFile != null) { diff --git a/lib/screen/saya/profile_screen copy.dart b/lib/screen/saya/profile_screen copy.dart index 639534d..0e9f852 100644 --- a/lib/screen/saya/profile_screen copy.dart +++ b/lib/screen/saya/profile_screen copy.dart @@ -86,7 +86,7 @@ class _ProfileScreenState extends State { as ImageProvider : FileImage(_headerImage) as ImageProvider) - : AssetImage('images/background.jpeg'), + : AssetImage('assets/images/background.jpeg'), fit: BoxFit.cover, ), ), diff --git a/lib/screen/saya/profile_screen.dart b/lib/screen/saya/profile_screen.dart index 8c6043a..1fc22ad 100644 --- a/lib/screen/saya/profile_screen.dart +++ b/lib/screen/saya/profile_screen.dart @@ -2,15 +2,14 @@ import 'dart:typed_data'; import 'package:flutter/material.dart'; import 'package:flutter_html/flutter_html.dart'; -import 'package:furibase/components/bottom_navbar.dart'; -import 'package:furibase/components/main_menu.dart'; -import 'package:furibase/components/scan_button.dart'; -import 'package:furibase/components/topbar_container.dart'; -import 'package:furibase/screen/saya/akun_saya.dart'; +import 'package:freekake/components/bottom_navbar.dart'; +import 'package:freekake/components/main_menu.dart'; +import 'package:freekake/components/scan_button.dart'; +import 'package:freekake/components/topbar_container.dart'; +import 'package:freekake/screen/saya/akun_saya.dart'; import 'package:image_picker/image_picker.dart'; import 'dart:io'; -import 'package:image_picker_web/image_picker_web.dart'; import 'package:flutter/foundation.dart' show kIsWeb; class ProfileScreen extends StatefulWidget { @@ -28,16 +27,16 @@ class _ProfileScreenState extends State { Future _pickImage(bool isProfile) async { if (kIsWeb) { - Uint8List? bytesFromPicker = await ImagePickerWeb.getImageAsBytes(); - if (bytesFromPicker != null) { - setState(() { - if (isProfile) { - _profileImage = bytesFromPicker; - } else { - _headerImage = bytesFromPicker; - } - }); - } + // Uint8List? bytesFromPicker = await ImagePickerWeb.getImageAsBytes(); + // if (bytesFromPicker != null) { + // setState(() { + // if (isProfile) { + // _profileImage = bytesFromPicker; + // } else { + // _headerImage = bytesFromPicker; + // } + // }); + // } } else { final pickedFile = await _picker.pickImage(source: ImageSource.gallery); if (pickedFile != null) { diff --git a/pubspec.yaml b/pubspec.yaml index 7f5ccd5..adb28fe 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,4 +1,4 @@ -name: furibase +name: freekake description: "A new Flutter project." # The following line prevents the package from being accidentally published to # pub.dev using `flutter pub publish`. This is preferred for private packages. @@ -48,6 +48,11 @@ dependencies: # arcore_flutter_plugin: # git: # url: https://github.com/giandifra/arcore_flutter_plugin.git + flutter_unity_widget: ^2022.2.1 + # flutter_unity_widget: + # git: + # url: https://github.com/juicycleff/flutter-unity-view-widget.git + # ref: flutter_3.24_android_hotfix dev_dependencies: flutter_test: @@ -75,6 +80,25 @@ flutter: # assets: # - images/a_dot_burr.jpeg # - images/a_dot_ham.jpeg + assets: + - assets/icons/furrybuddy.svg + - assets/icons/Scan.svg + - assets/icons/Saya.svg + - assets/icons/Pustaka.svg + - assets/icons/koleksi.svg + - assets/icons/healthy.svg + - assets/icons/Nutrition.svg + - assets/icons/Education.svg + - assets/icons/Safety.svg + - assets/images/luffy.png + - assets/images/background.jpeg + - assets/images/luffy-u.png + - assets/images/klipartz.png + - assets/images/cepott.png + - assets/images/ft_luffy.png + - assets/images/ft_cepot.png + - assets/images/luffy-kimono.png + - assets/images/luffy-king.png # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/to/resolution-aware-images From 6348f74b95a0097bde9493ee7f0c1066c996b04f Mon Sep 17 00:00:00 2001 From: Irwan Cahyono Date: Fri, 11 Apr 2025 13:09:55 +0700 Subject: [PATCH 2/7] mobile --- lib/components/bottom_navbar.dart | 10 +- lib/components/custom_shape.dart | 2 +- lib/components/main_menu.dart | 18 +- lib/components/menu_button.dart | 5 +- lib/components/navbar_container.dart | 2 +- lib/helpers/image_picker_mobile.dart | 14 ++ lib/helpers/image_picker_stub.dart | 5 + lib/helpers/image_picker_web.dart | 35 +++ lib/helpers/pick_image.dart | 3 + lib/main.dart | 1 + lib/screen/Home_screen.dart | 21 +- .../collection_caracter_screen.dart | 6 +- .../collection_fragment_screen.dart | 4 +- .../collection/collection_skin_screen.dart | 4 +- lib/screen/drraw_screen.dart | 2 +- lib/screen/koleksi_screen.dart | 18 +- lib/screen/pustaka/list_education.dart | 14 +- .../pustaka/pustaka_detail_screen copy.dart | 4 +- lib/screen/pustaka_screen copy 2.dart | 2 +- lib/screen/pustaka_screen copy.dart | 2 +- lib/screen/pustaka_screen.dart | 22 +- lib/screen/saya/akun_saya copy.dart | 211 ++++++++++++++++++ lib/screen/saya/akun_saya.dart | 7 +- lib/screen/saya/profile_screen.dart | 13 +- pubspec.yaml | 7 +- 25 files changed, 359 insertions(+), 73 deletions(-) create mode 100644 lib/helpers/image_picker_mobile.dart create mode 100644 lib/helpers/image_picker_stub.dart create mode 100644 lib/helpers/image_picker_web.dart create mode 100644 lib/helpers/pick_image.dart create mode 100644 lib/screen/saya/akun_saya copy.dart diff --git a/lib/components/bottom_navbar.dart b/lib/components/bottom_navbar.dart index b9e7e67..3278b96 100644 --- a/lib/components/bottom_navbar.dart +++ b/lib/components/bottom_navbar.dart @@ -1,9 +1,9 @@ import 'package:flutter/material.dart'; -import 'package:furibase/components/navbar_container.dart'; -import 'package:furibase/components/navbar_shape_1.dart'; -import 'package:furibase/components/navbar_shape_2.dart'; -import 'package:furibase/components/navbar_shape_3.dart'; -import 'package:furibase/components/custom_shape.dart'; +import 'package:freekake/components/navbar_container.dart'; +import 'package:freekake/components/navbar_shape_1.dart'; +import 'package:freekake/components/navbar_shape_2.dart'; +import 'package:freekake/components/navbar_shape_3.dart'; +import 'package:freekake/components/custom_shape.dart'; class BottomNavbar extends StatefulWidget { const BottomNavbar({super.key}); diff --git a/lib/components/custom_shape.dart b/lib/components/custom_shape.dart index 345c6e5..5efc010 100644 --- a/lib/components/custom_shape.dart +++ b/lib/components/custom_shape.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:furibase/components/navbar_shape_2.dart'; +import 'package:freekake/components/navbar_shape_2.dart'; class CustomShape extends StatelessWidget { const CustomShape({super.key}); diff --git a/lib/components/main_menu.dart b/lib/components/main_menu.dart index 8c8eb7a..0fcdffb 100644 --- a/lib/components/main_menu.dart +++ b/lib/components/main_menu.dart @@ -1,11 +1,11 @@ import 'package:flutter/material.dart'; -import 'package:furibase/components/bottom_navbar.dart'; -import 'package:furibase/components/menu_button.dart'; -import 'package:furibase/components/scan_button.dart'; -import 'package:furibase/screen/Home_screen.dart'; -import 'package:furibase/screen/koleksi_screen.dart'; -import 'package:furibase/screen/pustaka_screen.dart'; -import 'package:furibase/screen/saya/profile_screen.dart'; +import 'package:freekake/components/bottom_navbar.dart'; +import 'package:freekake/components/menu_button.dart'; +import 'package:freekake/components/scan_button.dart'; +import 'package:freekake/screen/Home_screen.dart'; +import 'package:freekake/screen/koleksi_screen.dart'; +import 'package:freekake/screen/pustaka_screen.dart'; +import 'package:freekake/screen/saya/profile_screen.dart'; class MainMenu extends StatelessWidget { const MainMenu({super.key}); @@ -22,7 +22,7 @@ class MainMenu extends StatelessWidget { children: [ MenuButton( label: "E-furibuddy", - icon: 'assets/icons/furrybuddy.svg', + icon: 'assets/assets/icons/furrybuddy.svg', onPress: () => { Navigator.push( @@ -33,7 +33,7 @@ class MainMenu extends StatelessWidget { ), MenuButton( label: "Koleksi", - icon: 'assets/icons/Koleksi.svg', + icon: 'assets/assets/icons/Koleksi.svg', onPress: () => { Navigator.push( diff --git a/lib/components/menu_button.dart b/lib/components/menu_button.dart index faaf4ef..e979900 100644 --- a/lib/components/menu_button.dart +++ b/lib/components/menu_button.dart @@ -28,8 +28,8 @@ class MenuButton extends StatelessWidget { IconButton( icon: SvgPicture.asset( icon ?? '', - width: w ?? 28, - height: h ?? 28, + width: w ?? 24, + height: h ?? 24, // allowDrawingOutsideViewBox: true, colorFilter: ColorFilter.mode( Color.fromARGB(255, 255, 255, 255), @@ -43,6 +43,7 @@ class MenuButton extends StatelessWidget { style: TextStyle( color: Color.fromARGB(255, 239, 224, 232), fontWeight: FontWeight.bold, + fontSize: 10, ), ), ], diff --git a/lib/components/navbar_container.dart b/lib/components/navbar_container.dart index 418e0f4..2ed12cf 100644 --- a/lib/components/navbar_container.dart +++ b/lib/components/navbar_container.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:furibase/components/navbar_shape_2.dart'; +import 'package:freekake/components/navbar_shape_2.dart'; class NavbarContainer extends StatelessWidget { const NavbarContainer({super.key}); diff --git a/lib/helpers/image_picker_mobile.dart b/lib/helpers/image_picker_mobile.dart new file mode 100644 index 0000000..bf49f5b --- /dev/null +++ b/lib/helpers/image_picker_mobile.dart @@ -0,0 +1,14 @@ +import 'dart:io'; +import 'package:image_picker/image_picker.dart'; + +class ImagePickerHelper { + Future pickImage() async { + final ImagePicker picker = ImagePicker(); + final XFile? pickedFile = await picker.pickImage(source: ImageSource.gallery); + + if (pickedFile != null) { + File imageFile = File(pickedFile.path); + return imageFile; + } + } +} \ No newline at end of file diff --git a/lib/helpers/image_picker_stub.dart b/lib/helpers/image_picker_stub.dart new file mode 100644 index 0000000..0f4d0d2 --- /dev/null +++ b/lib/helpers/image_picker_stub.dart @@ -0,0 +1,5 @@ +class ImagePickerHelper { + Future pickImage() async { + throw UnsupportedError('pickImage is not supported on this platform'); + } +} \ No newline at end of file diff --git a/lib/helpers/image_picker_web.dart b/lib/helpers/image_picker_web.dart new file mode 100644 index 0000000..86be7f0 --- /dev/null +++ b/lib/helpers/image_picker_web.dart @@ -0,0 +1,35 @@ +// import 'package:image_picker_web/image_picker_web.dart'; +// import 'dart:typed_data'; + +// class ImagePickerHelper { +// Future pickImage() async { +// Uint8List? bytesFromPicker = await ImagePickerWeb.getImageAsBytes(); +// if (bytesFromPicker != null) { +// return bytesFromPicker; +// } +// } +// } + +import 'dart:typed_data'; +import 'dart:html' as html; + +class ImagePickerHelper { + Future pickImage() async { + html.FileUploadInputElement uploadInput = html.FileUploadInputElement(); + uploadInput.accept = 'image/*'; + uploadInput.click(); + + uploadInput.onChange.listen((event) async { + final file = uploadInput.files!.first; + final reader = html.FileReader(); + + reader.readAsArrayBuffer(file); + reader.onLoadEnd.listen((event) { + Uint8List imageBytes = reader.result as Uint8List; + if (imageBytes != null) { + return imageBytes; + } + }); + }); + } +} \ No newline at end of file diff --git a/lib/helpers/pick_image.dart b/lib/helpers/pick_image.dart new file mode 100644 index 0000000..e01473f --- /dev/null +++ b/lib/helpers/pick_image.dart @@ -0,0 +1,3 @@ +export 'image_picker_stub.dart' + if (dart.library.html) 'image_picker_web.dart' + if (dart.library.io) 'image_picker_mobile.dart'; \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index 5992fd6..835e226 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:furibase/components/navbar_container.dart'; import 'package:furibase/providers/character_provider.dart'; import 'package:furibase/screen/Home_screen.dart'; import 'package:provider/provider.dart'; diff --git a/lib/screen/Home_screen.dart b/lib/screen/Home_screen.dart index bed443f..bce7774 100644 --- a/lib/screen/Home_screen.dart +++ b/lib/screen/Home_screen.dart @@ -1,9 +1,11 @@ import 'package:dropdown_button2/dropdown_button2.dart'; import 'package:flutter/material.dart'; -import 'package:furibase/components/bottom_navbar.dart'; -import 'package:furibase/components/buildcard_info.dart'; -import 'package:furibase/components/main_menu.dart'; -import 'package:furibase/components/scan_button.dart'; +import 'package:freekake/components/bottom_navbar.dart'; +import 'package:freekake/components/buildcard_info.dart'; +import 'package:freekake/components/main_menu.dart'; +import 'package:freekake/components/scan_button.dart'; +import 'package:freekake/components/topbar_container.dart'; +import 'package:flutter_unity_widget/flutter_unity_widget.dart'; class HomeScreen extends StatefulWidget { HomeScreen({super.key}); @@ -17,6 +19,7 @@ class _HomeScreenState extends State { double _sliderValue = 0.0; static const Color transparent = Color(0xFFFFFFFF); // Image image + late UnityWidgetController _unityWidgetController; @override Widget build(BuildContext context) { @@ -251,6 +254,14 @@ class _HomeScreenState extends State { ); } + void onUnityCreated(controller) { + _unityWidgetController = controller; + } + + void onUnityMessage(message) { + print('Received message from unity: ${message.toString()}'); + } + // Widget _menuButton(String label, Widget icon) { // return Expanded( // child: Column( @@ -291,7 +302,7 @@ class _HomeScreenState extends State { // } Widget setHomeImage(String src, double size) { - return Image.asset(src, width: size); + return Image.asset("assets/" + src, width: size); } } diff --git a/lib/screen/collection/collection_caracter_screen.dart b/lib/screen/collection/collection_caracter_screen.dart index d6629b3..7c835cf 100644 --- a/lib/screen/collection/collection_caracter_screen.dart +++ b/lib/screen/collection/collection_caracter_screen.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:furibase/components/collection_container.dart'; +import 'package:freekake/components/collection_container.dart'; class CollectionCaraterScreen extends StatefulWidget { const CollectionCaraterScreen({super.key}); @@ -22,7 +22,7 @@ class _CollectionCaraterScreenState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text("Favorite", style: TextStyle(color: Colors.black)), + Text("Favorit", style: TextStyle(color: Colors.black)), Divider(height: 20, color: Colors.transparent), SingleChildScrollView( scrollDirection: Axis.horizontal, @@ -46,7 +46,7 @@ class _CollectionCaraterScreenState extends State { ), ), Divider(height: 20, color: Colors.transparent), - Text("All", style: TextStyle(color: Colors.black)), + Text("Semua", style: TextStyle(color: Colors.black)), Divider(height: 20, color: Colors.transparent), SingleChildScrollView( scrollDirection: Axis.horizontal, diff --git a/lib/screen/collection/collection_fragment_screen.dart b/lib/screen/collection/collection_fragment_screen.dart index cf17f8d..8ce622a 100644 --- a/lib/screen/collection/collection_fragment_screen.dart +++ b/lib/screen/collection/collection_fragment_screen.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; -import 'package:furibase/components/collection_container.dart'; -import 'package:furibase/helpers/color_helper.dart'; +import 'package:freekake/components/collection_container.dart'; +import 'package:freekake/helpers/color_helper.dart'; class CollectionFragmentScreen extends StatefulWidget { const CollectionFragmentScreen({super.key}); diff --git a/lib/screen/collection/collection_skin_screen.dart b/lib/screen/collection/collection_skin_screen.dart index 941f5eb..4a05621 100644 --- a/lib/screen/collection/collection_skin_screen.dart +++ b/lib/screen/collection/collection_skin_screen.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:furibase/components/collection_container.dart'; +import 'package:freekake/components/collection_container.dart'; class CollectionSkinScreen extends StatefulWidget { const CollectionSkinScreen({super.key}); @@ -53,7 +53,7 @@ class _CollectionSkinScreenState extends State { ), ), Divider(height: 20, color: Colors.transparent), - Text("Others", style: TextStyle(color: Colors.black)), + Text("Lainnya", style: TextStyle(color: Colors.black)), Divider(height: 10), SingleChildScrollView( scrollDirection: Axis.horizontal, diff --git a/lib/screen/drraw_screen.dart b/lib/screen/drraw_screen.dart index 904ac6a..0eff846 100644 --- a/lib/screen/drraw_screen.dart +++ b/lib/screen/drraw_screen.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:furibase/components/navbar_container.dart'; +import 'package:freekake/components/navbar_container.dart'; class DrawScreen extends StatelessWidget { const DrawScreen({super.key}); diff --git a/lib/screen/koleksi_screen.dart b/lib/screen/koleksi_screen.dart index d36a597..e94aa20 100644 --- a/lib/screen/koleksi_screen.dart +++ b/lib/screen/koleksi_screen.dart @@ -1,13 +1,13 @@ import 'package:flutter/material.dart'; -import 'package:furibase/components/bottom_navbar.dart'; -import 'package:furibase/components/buildcard_info.dart'; -import 'package:furibase/components/main_menu.dart'; -import 'package:furibase/components/scan_button.dart'; -import 'package:furibase/components/tab_menu.dart'; -import 'package:furibase/components/topbar_container.dart'; -import 'package:furibase/screen/collection/collection_caracter_screen.dart'; -import 'package:furibase/screen/collection/collection_fragment_screen.dart'; -import 'package:furibase/screen/collection/collection_skin_screen.dart'; +import 'package:freekake/components/bottom_navbar.dart'; +import 'package:freekake/components/buildcard_info.dart'; +import 'package:freekake/components/main_menu.dart'; +import 'package:freekake/components/scan_button.dart'; +import 'package:freekake/components/tab_menu.dart'; +import 'package:freekake/components/topbar_container.dart'; +import 'package:freekake/screen/collection/collection_caracter_screen.dart'; +import 'package:freekake/screen/collection/collection_fragment_screen.dart'; +import 'package:freekake/screen/collection/collection_skin_screen.dart'; class KoleksiScreen extends StatefulWidget { const KoleksiScreen({super.key}); diff --git a/lib/screen/pustaka/list_education.dart b/lib/screen/pustaka/list_education.dart index 6b95557..16f6c1e 100644 --- a/lib/screen/pustaka/list_education.dart +++ b/lib/screen/pustaka/list_education.dart @@ -1,11 +1,11 @@ import 'package:flutter/material.dart'; -import 'package:furibase/components/buildcard_info.dart'; -import 'package:furibase/components/card_list.dart'; -import 'package:furibase/components/collection_container%20copy.dart'; -import 'package:furibase/components/main_menu.dart'; -import 'package:furibase/components/topbar_container.dart'; -import 'package:furibase/helpers/color_helper.dart'; -import 'package:furibase/screen/pustaka/pustaka_detail_screen.dart'; +import 'package:freekake/components/buildcard_info.dart'; +import 'package:freekake/components/card_list.dart'; +import 'package:freekake/components/collection_container%20copy.dart'; +import 'package:freekake/components/main_menu.dart'; +import 'package:freekake/components/topbar_container.dart'; +import 'package:freekake/screen/pustaka/pustaka_detail_screen.dart'; +import 'package:freekake/helpers/color_helper.dart'; class ListEducation extends StatefulWidget { const ListEducation({super.key}); diff --git a/lib/screen/pustaka/pustaka_detail_screen copy.dart b/lib/screen/pustaka/pustaka_detail_screen copy.dart index 4a7f622..6d8d9f9 100644 --- a/lib/screen/pustaka/pustaka_detail_screen copy.dart +++ b/lib/screen/pustaka/pustaka_detail_screen copy.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; -import 'package:furibase/components/buildcard_info.dart'; -import 'package:furibase/components/collection_container.dart'; +import 'package:freekakes/components/buildcard_info.dart'; +import 'package:freekake/components/collection_container.dart'; class DetailScreen extends StatefulWidget { final String title; diff --git a/lib/screen/pustaka_screen copy 2.dart b/lib/screen/pustaka_screen copy 2.dart index 0af1108..13261f9 100644 --- a/lib/screen/pustaka_screen copy 2.dart +++ b/lib/screen/pustaka_screen copy 2.dart @@ -108,7 +108,7 @@ class _PustakaScreenState extends State { children: [ CollectionContainer( label: "Luffy", - imagesrc: 'images/luffy.png', + imagesrc: 'assets/images/luffy.png', width: 100, height: 100, onTapAc: diff --git a/lib/screen/pustaka_screen copy.dart b/lib/screen/pustaka_screen copy.dart index 0af1108..13261f9 100644 --- a/lib/screen/pustaka_screen copy.dart +++ b/lib/screen/pustaka_screen copy.dart @@ -108,7 +108,7 @@ class _PustakaScreenState extends State { children: [ CollectionContainer( label: "Luffy", - imagesrc: 'images/luffy.png', + imagesrc: 'assets/images/luffy.png', width: 100, height: 100, onTapAc: diff --git a/lib/screen/pustaka_screen.dart b/lib/screen/pustaka_screen.dart index dbff797..73652ca 100644 --- a/lib/screen/pustaka_screen.dart +++ b/lib/screen/pustaka_screen.dart @@ -1,12 +1,12 @@ import 'package:flutter/material.dart'; -import 'package:furibase/components/bottom_navbar.dart'; -import 'package:furibase/components/buildcard_info.dart'; -import 'package:furibase/components/collection_container.dart'; -import 'package:furibase/components/main_menu.dart'; -import 'package:furibase/components/scan_button.dart'; -import 'package:furibase/components/topbar_container.dart'; -import 'package:furibase/helpers/color_helper.dart'; -import 'package:furibase/screen/pustaka/list_education.dart'; +import 'package:freekake/components/bottom_navbar.dart'; +import 'package:freekake/components/buildcard_info.dart'; +import 'package:freekake/components/collection_container.dart'; +import 'package:freekake/components/main_menu.dart'; +import 'package:freekake/components/scan_button.dart'; +import 'package:freekake/components/topbar_container.dart'; +import 'package:freekake/helpers/color_helper.dart'; +import 'package:freekake/screen/pustaka/list_education.dart'; class PustakaScreen extends StatefulWidget { const PustakaScreen({super.key}); @@ -147,7 +147,7 @@ class _PustakaScreenState extends State { ), decoration: const InputDecoration( border: InputBorder.none, - hintText: 'Search...', + hintText: 'Cari konten...', hintStyle: TextStyle(color: Colors.grey), ), ), @@ -177,6 +177,7 @@ class _PustakaScreenState extends State { final item = filteredCollections[index]; return CollectionContainer( label: item["label"]!, + lblSize: 11, imageSvg: item["image"]!, width: 30, height: 80, @@ -256,9 +257,10 @@ class _PustakaScreenState extends State { color: Colors.blueAccent, ), Text( - 'Topic ' + (index + 1).toString(), + 'Topik ' + (index + 1).toString(), style: const TextStyle( fontWeight: FontWeight.bold, + fontSize: 11, color: Color.fromARGB(255, 0, 0, 0), ), ), diff --git a/lib/screen/saya/akun_saya copy.dart b/lib/screen/saya/akun_saya copy.dart new file mode 100644 index 0000000..95388a0 --- /dev/null +++ b/lib/screen/saya/akun_saya copy.dart @@ -0,0 +1,211 @@ +import 'dart:typed_data'; + +import 'package:flutter/material.dart'; +import 'package:furibase/components/bottom_navbar.dart'; +import 'package:furibase/components/main_menu.dart'; +import 'package:furibase/components/scan_button.dart'; +import 'package:furibase/helpers/pick_image.dart'; +import 'package:flutter/foundation.dart' show kIsWeb; + +class AkunSaya extends StatefulWidget { + @override + _AkunSayaState createState() => _AkunSayaState(); +} + +class _AkunSayaState extends State { + dynamic _profileImage; + dynamic _headerImage; + //final ImagePicker _picker = ImagePicker(); + + Future _pickImage(bool isProfile) async { + final imagePicker = ImagePickerHelper(); + dynamic pic = await imagePicker.pickImage(); + + if (pic != null) { + setState(() { + if (isProfile) { + _profileImage = pic; + } else { + _headerImage = pic; + } + }); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text("Saya"), + backgroundColor: Color.fromARGB(225, 79, 76, 182), + ), + backgroundColor: const Color.fromARGB(255, 255, 255, 255), + body: Stack( + children: [ + Positioned( + bottom: 0, + left: 0, + right: 0, + child: Padding( + padding: const EdgeInsets.only(top: 20.0, left: 20, right: 20), + child: Container( + height: MediaQuery.of(context).size.height * 0.7, + width: MediaQuery.of(context).size.width, + decoration: BoxDecoration( + color: const Color.fromARGB(255, 205, 202, 189), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(20), + topRight: Radius.circular(20), + ), + ), + ), + ), + ), + Column( + children: [ + // Header image (bisa diubah) + SizedBox( + height: 80, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(40), + bottomRight: Radius.circular(40), + ), + color: Color.fromARGB(225, 79, 76, 182), + ), + ), + ), + SizedBox(height: 40), + Expanded( + child: Padding( + padding: EdgeInsets.all(20), + child: ListView( + padding: EdgeInsets.symmetric(horizontal: 20, vertical: 40), + children: [ + TextFormField( + initialValue: "Cepot", + decoration: const InputDecoration( + border: UnderlineInputBorder(), + labelText: 'Nama', + labelStyle: TextStyle(color: Colors.black), + ), + style: TextStyle(color: Colors.black), + ), + TextFormField( + initialValue: "cpt09", + decoration: const InputDecoration( + border: UnderlineInputBorder(), + labelText: 'Nama Pengguna', + labelStyle: TextStyle(color: Colors.black), + ), + style: TextStyle(color: Colors.black), + ), + + TextFormField( + initialValue: "Jl. Sentosa jaya", + decoration: const InputDecoration( + border: UnderlineInputBorder(), + labelText: 'Alamat', + labelStyle: TextStyle(color: Colors.black), + ), + style: TextStyle(color: Colors.black), + ), + + TextFormField( + initialValue: "******", + decoration: const InputDecoration( + border: UnderlineInputBorder(), + labelText: 'Kata Sandi', + labelStyle: TextStyle(color: Colors.black), + ), + style: TextStyle(color: Colors.black), + ), + TextFormField( + initialValue: "+62923", + decoration: const InputDecoration( + border: UnderlineInputBorder(), + labelText: 'No. HP', + labelStyle: TextStyle(color: Colors.black), + ), + style: TextStyle(color: Colors.black), + ), + ], + ), + ), + ), + ], + ), + // Profile Picture (bisa diubah) + Positioned( + top: 25, + left: MediaQuery.of(context).size.width / 2 - 50, + child: GestureDetector( + onTap: () => _pickImage(true), + child: Stack( + alignment: Alignment.bottomRight, + children: [ + CircleAvatar( + radius: 50, + backgroundColor: Colors.grey[300], + backgroundImage: + _profileImage != null + ? (kIsWeb + ? MemoryImage(_profileImage) as ImageProvider + : FileImage(_profileImage) as ImageProvider) + : null, + child: + _profileImage == null + ? Icon(Icons.person, size: 50, color: Colors.white) + : null, + ), + CircleAvatar( + radius: 15, + backgroundColor: Colors.blue, + child: Icon(Icons.edit, color: Colors.white, size: 15), + ), + ], + ), + ), + ), + + Positioned( + top: 130, + left: MediaQuery.of(context).size.width / 2 - 50, + child: GestureDetector( + onTap: () => _pickImage(true), + child: Stack( + alignment: Alignment.bottomRight, + children: [ + Text( + "Nama Akun", + style: TextStyle( + color: Colors.deepPurple, + fontSize: 18, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + ), + ], + ), + ); + } + + Widget _buildListItem(IconData icon, String label, {bool isLogout = false}) { + return ListTile( + leading: Icon( + icon, + color: + isLogout + ? const Color.fromARGB(255, 181, 47, 47) + : const Color.fromARGB(255, 255, 255, 255), + ), + title: Text(label, style: TextStyle(fontSize: 16, color: Colors.black)), + trailing: Icon(Icons.arrow_forward_ios, size: 16), + onTap: () {}, + ); + } +} diff --git a/lib/screen/saya/akun_saya.dart b/lib/screen/saya/akun_saya.dart index 908db96..e93d5b7 100644 --- a/lib/screen/saya/akun_saya.dart +++ b/lib/screen/saya/akun_saya.dart @@ -1,13 +1,12 @@ import 'dart:typed_data'; import 'package:flutter/material.dart'; -import 'package:furibase/components/bottom_navbar.dart'; -import 'package:furibase/components/main_menu.dart'; -import 'package:furibase/components/scan_button.dart'; +import 'package:freekake/components/bottom_navbar.dart'; +import 'package:freekake/components/main_menu.dart'; +import 'package:freekake/components/scan_button.dart'; import 'package:image_picker/image_picker.dart'; import 'dart:io'; -// import 'package:image_picker_web/image_picker_web.dart'; import 'package:flutter/foundation.dart' show kIsWeb; class AkunSaya extends StatefulWidget { diff --git a/lib/screen/saya/profile_screen.dart b/lib/screen/saya/profile_screen.dart index 3565895..258a1b0 100644 --- a/lib/screen/saya/profile_screen.dart +++ b/lib/screen/saya/profile_screen.dart @@ -1,16 +1,15 @@ import 'dart:typed_data'; import 'package:flutter/material.dart'; -// import 'package:flutter_html/flutter_html.dart'; -import 'package:furibase/components/bottom_navbar.dart'; -import 'package:furibase/components/main_menu.dart'; -import 'package:furibase/components/scan_button.dart'; -import 'package:furibase/components/topbar_container.dart'; -import 'package:furibase/screen/saya/akun_saya.dart'; +import 'package:flutter_html/flutter_html.dart'; +import 'package:freekake/components/bottom_navbar.dart'; +import 'package:freekake/components/main_menu.dart'; +import 'package:freekake/components/scan_button.dart'; +import 'package:freekake/components/topbar_container.dart'; +import 'package:freekake/screen/saya/akun_saya.dart'; import 'package:image_picker/image_picker.dart'; import 'dart:io'; -// import 'package:image_picker_web/image_picker_web.dart'; import 'package:flutter/foundation.dart' show kIsWeb; class ProfileScreen extends StatefulWidget { diff --git a/pubspec.yaml b/pubspec.yaml index 64f5578..508d163 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,4 +1,4 @@ -name: furibase +name: freekake description: "A new Flutter project." # The following line prevents the package from being accidentally published to # pub.dev using `flutter pub publish`. This is preferred for private packages. @@ -49,6 +49,11 @@ dependencies: # arcore_flutter_plugin: # git: # url: https://github.com/giandifra/arcore_flutter_plugin.git + flutter_unity_widget: ^2022.2.1 + # flutter_unity_widget: + # git: + # url: https://github.com/juicycleff/flutter-unity-view-widget.git + # ref: flutter_3.24_android_hotfix dev_dependencies: flutter_test: From 724b6d47e39f242aede21d472c91a6416b73f196 Mon Sep 17 00:00:00 2001 From: Irwan Cahyono Date: Wed, 16 Apr 2025 08:05:14 +0700 Subject: [PATCH 3/7] config gradle unity --- android/app/build.gradle.kts | 19 ++- .../com/example/furibase/MainActivity.kt | 5 +- android/build.gradle.kts | 39 ++++++ android/gradle.properties | 3 +- android/settings.gradle.kts | 24 +++- android/unityLibrary/build.gradle | 117 ++++++++++++++++++ pubspec.yaml | 10 +- 7 files changed, 203 insertions(+), 14 deletions(-) create mode 100644 android/unityLibrary/build.gradle diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 99bbf2b..0eb4432 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -9,26 +9,28 @@ android { namespace = "com.example.furibase" //compileSdk = flutter.compileSdkVersion compileSdk = 35 - ndkVersion = "27.0.12077973" + //ndkVersion = "27.0.12077973" //ndkVersion = flutter.ndkVersion + ndkVersion = "23.1.7779620" compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = JavaVersion.VERSION_11.toString() + jvmTarget = JavaVersion.VERSION_17.toString() } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId = "com.example.furibase" + applicationId = "com.paj.freekake" // You can update the following values to match your application needs. // For more information, see: https://flutter.dev/to/review-gradle-config. //minSdk = flutter.minSdkVersion //targetSdk = flutter.targetSdkVersion - minSdk = 24 // Set to 24 or higher + //minSdk = 24 // Set to 24 or higher + minSdk = 30 targetSdk = 35 versionCode = flutter.versionCode versionName = flutter.versionName @@ -46,3 +48,8 @@ android { flutter { source = "../.." } + +dependencies { + implementation(project(":unityLibrary")) + implementation(project(":flutter_unity_widget")) +} diff --git a/android/app/src/main/kotlin/com/example/furibase/MainActivity.kt b/android/app/src/main/kotlin/com/example/furibase/MainActivity.kt index d6d1431..e83dfee 100644 --- a/android/app/src/main/kotlin/com/example/furibase/MainActivity.kt +++ b/android/app/src/main/kotlin/com/example/furibase/MainActivity.kt @@ -1,5 +1,8 @@ package com.example.furibase import io.flutter.embedding.android.FlutterActivity +import io.flutter.embedding.android.FlutterFragmentActivity; -class MainActivity : FlutterActivity() +//class MainActivity : FlutterActivity() +class MainActivity: FlutterFragmentActivity() { +} diff --git a/android/build.gradle.kts b/android/build.gradle.kts index 89176ef..0585a9e 100644 --- a/android/build.gradle.kts +++ b/android/build.gradle.kts @@ -1,5 +1,11 @@ allprojects { repositories { + flatDir { + dirs( + file("${project(":unityLibrary").projectDir}/libs") + ) + } + google() mavenCentral() } @@ -12,6 +18,39 @@ subprojects { val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) project.layout.buildDirectory.value(newSubprojectBuildDir) } + +subprojects { + afterEvaluate { + if (project.extensions.findByName("android") != null) { + extensions.configure("android") { + if (namespace == null) { + namespace = project.group.toString() + } + } + } + + if (plugins.hasPlugin("com.android.application") || plugins.hasPlugin("com.android.library")) { + if (name == "flutter_unity_widget") { + extensions.configure("android") { + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + (this as ExtensionAware).extensions.configure("kotlinOptions") { + jvmTarget = "17" + } + + if (namespace == null) { + namespace = project.group.toString() + } + + compileSdkVersion(35) + } + } + } + } +} + subprojects { project.evaluationDependsOn(":app") } diff --git a/android/gradle.properties b/android/gradle.properties index f018a61..5f8c4d5 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,3 +1,4 @@ -org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError +# org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError +org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError android.useAndroidX=true android.enableJetifier=true diff --git a/android/settings.gradle.kts b/android/settings.gradle.kts index a439442..2efdf95 100644 --- a/android/settings.gradle.kts +++ b/android/settings.gradle.kts @@ -18,8 +18,30 @@ pluginManagement { plugins { id("dev.flutter.flutter-plugin-loader") version "1.0.0" - id("com.android.application") version "8.7.0" apply false + id("com.android.application") version "8.9.0" apply false id("org.jetbrains.kotlin.android") version "1.8.22" apply false } include(":app") + +include(":unityLibrary") +project(":unityLibrary").projectDir = file("./unityLibrary") + +include(":unityLibrary:xrmanifest.androidlib") +// project(":unityLibrary:xrmanifest.androidlib").projectDir = file("unityLibrary/xrmanifest.androidlib") + +// include(":unityLibrary:mobilenotifications.androidlib") +// project(":unityLibrary:mobilenotifications.androidlib").projectDir = file("unityLibrary/mobilenotifications.androidlib") + + + +include(":unityLibrary") +project(":unityLibrary").projectDir = file("./unityLibrary") + + +include(":unityLibrary") +project(":unityLibrary").projectDir = file("./unityLibrary") + + +include(":unityLibrary") +project(":unityLibrary").projectDir = file("./unityLibrary") diff --git a/android/unityLibrary/build.gradle b/android/unityLibrary/build.gradle new file mode 100644 index 0000000..9f032e0 --- /dev/null +++ b/android/unityLibrary/build.gradle @@ -0,0 +1,117 @@ +apply plugin: 'com.android.library' + + +dependencies { + implementation(name: 'unity-classes', ext:'jar') + implementation(name: 'arcore_client', ext:'aar') + implementation(name: 'ARPresto', ext:'aar') + implementation(name: 'UnityARCore', ext:'aar') + implementation(name: 'unityandroidpermissions', ext:'aar') + implementation project('xrmanifest.androidlib') + //implementation project('mobilenotifications.androidlib') + +} + +android { + namespace "com.unity3d.player" + // ndkPath "/Applications/Unity/Hub/Editor/2022.3.60f1/PlaybackEngines/AndroidPlayer/NDK" + compileSdkVersion 35 + buildToolsVersion '34.0.0' + ndkVersion "23.1.7779620" + + compileOptions { + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 + } + + defaultConfig { + minSdkVersion 30 + targetSdkVersion 35 + ndk { + abiFilters 'armeabi-v7a', 'arm64-v8a' + } + versionCode 1 + versionName '1.0.2' + consumerProguardFiles 'proguard-unity.txt' + } + + lintOptions { + abortOnError false + } + + aaptOptions { + noCompress = ['.unity3d', '.ress', '.resource', '.obb', '.bundle', '.unityexp'] + ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~" + } + + packagingOptions { + doNotStrip '*/armeabi-v7a/*.so' + doNotStrip '*/arm64-v8a/*.so' + jniLibs { + useLegacyPackaging true + } + } +} + +def getSdkDir() { + Properties local = new Properties() + local.load(new FileInputStream("${rootDir}/local.properties")) + return local.getProperty('sdk.dir') +} + +def BuildIl2Cpp(String workingDir, String configuration, String architecture, String abi, String[] staticLibraries) { + def commandLineArgs = [] + commandLineArgs.add("--compile-cpp") + commandLineArgs.add("--platform=Android") + commandLineArgs.add("--architecture=" + architecture) + commandLineArgs.add("--outputpath=" + workingDir + "/src/main/jniLibs/" + abi + "/libil2cpp.so") + commandLineArgs.add("--baselib-directory=" + workingDir + "/src/main/jniStaticLibs/" + abi) + commandLineArgs.add("--incremental-g-c-time-slice=3") + commandLineArgs.add("--dotnetprofile=unityaot-linux") + commandLineArgs.add("--enable-debugger") + commandLineArgs.add("--profiler-report") + commandLineArgs.add("--profiler-output-file=" + workingDir + "/build/il2cpp_"+ abi + "_" + configuration + "/il2cpp_conv.traceevents") + commandLineArgs.add("--print-command-line") + commandLineArgs.add("--data-folder=" + workingDir + "/src/main/Il2CppOutputProject/Source/il2cppOutput/data") + commandLineArgs.add("--generatedcppdir=" + workingDir + "/src/main/Il2CppOutputProject/Source/il2cppOutput") + commandLineArgs.add("--cachedirectory=" + workingDir + "/build/il2cpp_"+ abi + "_" + configuration + "/il2cpp_cache") + commandLineArgs.add("--tool-chain-path=" + android.ndkDirectory) + staticLibraries.eachWithIndex {fileName, i-> + commandLineArgs.add("--additional-libraries=" + workingDir + "/src/main/jniStaticLibs/" + abi + "/" + fileName) + } + def executableExtension = "" + if (org.gradle.internal.os.OperatingSystem.current().isWindows()) { + executableExtension = ".exe" + commandLineArgs = commandLineArgs*.replace('\"', '\\\"') + } + exec { + executable workingDir + "/src/main/Il2CppOutputProject/IL2CPP/build/deploy/il2cpp" + executableExtension + args commandLineArgs + environment "ANDROID_SDK_ROOT", getSdkDir() + } + delete workingDir + "/src/main/jniLibs/" + abi + "/libil2cpp.sym.so" + ant.move(file: workingDir + "/src/main/jniLibs/" + abi + "/libil2cpp.dbg.so", tofile: workingDir + "/symbols/" + abi + "/libil2cpp.so") +} + +android { + task BuildIl2CppTask { + doLast { + BuildIl2Cpp(projectDir.toString().replaceAll('\\\\', '/'), 'Debug', 'armv7', 'armeabi-v7a', [ ] as String[]); + BuildIl2Cpp(projectDir.toString().replaceAll('\\\\', '/'), 'Debug', 'arm64', 'arm64-v8a', [ ] as String[]); + } + } + afterEvaluate { + if (project(':unityLibrary').tasks.findByName('mergeDebugJniLibFolders')) + project(':unityLibrary').mergeDebugJniLibFolders.dependsOn BuildIl2CppTask + if (project(':unityLibrary').tasks.findByName('mergeReleaseJniLibFolders')) + project(':unityLibrary').mergeReleaseJniLibFolders.dependsOn BuildIl2CppTask + } + sourceSets { + main { + jni.srcDirs = ["src/main/Il2CppOutputProject"] + } + } +} + + + diff --git a/pubspec.yaml b/pubspec.yaml index 508d163..062e391 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -49,11 +49,11 @@ dependencies: # arcore_flutter_plugin: # git: # url: https://github.com/giandifra/arcore_flutter_plugin.git - flutter_unity_widget: ^2022.2.1 - # flutter_unity_widget: - # git: - # url: https://github.com/juicycleff/flutter-unity-view-widget.git - # ref: flutter_3.24_android_hotfix + # flutter_unity_widget: ^2022.2.1 + flutter_unity_widget: + git: + url: https://github.com/juicycleff/flutter-unity-view-widget.git + ref: flutter_3.24_android_hotfix dev_dependencies: flutter_test: From 26a3940365836c62431f425191aad6cf8ed133e8 Mon Sep 17 00:00:00 2001 From: Irwan Cahyono Date: Wed, 16 Apr 2025 08:12:45 +0700 Subject: [PATCH 4/7] gitignore dan beberapa yang terlewat --- .gitignore | 9 +++ README.md | 133 +++++++++++++++++++++++++++++++--- lib/components/main_menu.dart | 2 +- lib/screen/Home_screen.dart | 87 +++++++++++----------- 4 files changed, 178 insertions(+), 53 deletions(-) diff --git a/.gitignore b/.gitignore index 79c113f..c837fb1 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,12 @@ app.*.map.json /android/app/debug /android/app/profile /android/app/release + +# Place unity project here +/unity + +# flutter will place unity Library dependency here +/unityLibrary + +# unityLibrary will place build here +/android/unityLibrary \ No newline at end of file diff --git a/README.md b/README.md index b77fed4..c3b17fc 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,129 @@ -# furibase +# Furikake App + +Project ini adalah aplikasi mobile Furikake. + +## Konfigurasi UnityLibrary + +Gunakan konfigurasi ini pada file android/unityLibrary/build.gradle: + + +apply plugin: 'com.android.library' + + +dependencies { + implementation(name: 'unity-classes', ext:'jar') + implementation(name: 'arcore_client', ext:'aar') + implementation(name: 'ARPresto', ext:'aar') + implementation(name: 'UnityARCore', ext:'aar') + implementation(name: 'unityandroidpermissions', ext:'aar') + implementation project('xrmanifest.androidlib') + //implementation project('mobilenotifications.androidlib') + +} + +android { + namespace "com.unity3d.player" + // ndkPath "/Applications/Unity/Hub/Editor/2022.3.60f1/PlaybackEngines/AndroidPlayer/NDK" + compileSdkVersion 35 + buildToolsVersion '34.0.0' + ndkVersion "23.1.7779620" + + compileOptions { + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 + } + + defaultConfig { + minSdkVersion 30 + targetSdkVersion 35 + ndk { + abiFilters 'armeabi-v7a', 'arm64-v8a' + } + versionCode 1 + versionName '1.0.2' + consumerProguardFiles 'proguard-unity.txt' + } + + lintOptions { + abortOnError false + } + + aaptOptions { + noCompress = ['.unity3d', '.ress', '.resource', '.obb', '.bundle', '.unityexp'] + ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~" + } + + packagingOptions { + doNotStrip '*/armeabi-v7a/*.so' + doNotStrip '*/arm64-v8a/*.so' + jniLibs { + useLegacyPackaging true + } + } +} + +def getSdkDir() { + Properties local = new Properties() + local.load(new FileInputStream("${rootDir}/local.properties")) + return local.getProperty('sdk.dir') +} + +def BuildIl2Cpp(String workingDir, String configuration, String architecture, String abi, String[] staticLibraries) { + def commandLineArgs = [] + commandLineArgs.add("--compile-cpp") + commandLineArgs.add("--platform=Android") + commandLineArgs.add("--architecture=" + architecture) + commandLineArgs.add("--outputpath=" + workingDir + "/src/main/jniLibs/" + abi + "/libil2cpp.so") + commandLineArgs.add("--baselib-directory=" + workingDir + "/src/main/jniStaticLibs/" + abi) + commandLineArgs.add("--incremental-g-c-time-slice=3") + commandLineArgs.add("--dotnetprofile=unityaot-linux") + commandLineArgs.add("--enable-debugger") + commandLineArgs.add("--profiler-report") + commandLineArgs.add("--profiler-output-file=" + workingDir + "/build/il2cpp_"+ abi + "_" + configuration + "/il2cpp_conv.traceevents") + commandLineArgs.add("--print-command-line") + commandLineArgs.add("--data-folder=" + workingDir + "/src/main/Il2CppOutputProject/Source/il2cppOutput/data") + commandLineArgs.add("--generatedcppdir=" + workingDir + "/src/main/Il2CppOutputProject/Source/il2cppOutput") + commandLineArgs.add("--cachedirectory=" + workingDir + "/build/il2cpp_"+ abi + "_" + configuration + "/il2cpp_cache") + commandLineArgs.add("--tool-chain-path=" + android.ndkDirectory) + staticLibraries.eachWithIndex {fileName, i-> + commandLineArgs.add("--additional-libraries=" + workingDir + "/src/main/jniStaticLibs/" + abi + "/" + fileName) + } + def executableExtension = "" + if (org.gradle.internal.os.OperatingSystem.current().isWindows()) { + executableExtension = ".exe" + commandLineArgs = commandLineArgs*.replace('\"', '\\\"') + } + exec { + executable workingDir + "/src/main/Il2CppOutputProject/IL2CPP/build/deploy/il2cpp" + executableExtension + args commandLineArgs + environment "ANDROID_SDK_ROOT", getSdkDir() + } + delete workingDir + "/src/main/jniLibs/" + abi + "/libil2cpp.sym.so" + ant.move(file: workingDir + "/src/main/jniLibs/" + abi + "/libil2cpp.dbg.so", tofile: workingDir + "/symbols/" + abi + "/libil2cpp.so") +} + +android { + task BuildIl2CppTask { + doLast { + BuildIl2Cpp(projectDir.toString().replaceAll('\\\\', '/'), 'Debug', 'armv7', 'armeabi-v7a', [ ] as String[]); + BuildIl2Cpp(projectDir.toString().replaceAll('\\\\', '/'), 'Debug', 'arm64', 'arm64-v8a', [ ] as String[]); + } + } + afterEvaluate { + if (project(':unityLibrary').tasks.findByName('mergeDebugJniLibFolders')) + project(':unityLibrary').mergeDebugJniLibFolders.dependsOn BuildIl2CppTask + if (project(':unityLibrary').tasks.findByName('mergeReleaseJniLibFolders')) + project(':unityLibrary').mergeReleaseJniLibFolders.dependsOn BuildIl2CppTask + } + sourceSets { + main { + jni.srcDirs = ["src/main/Il2CppOutputProject"] + } + } +} -A new Flutter project. -## Getting Started -This project is a starting point for a Flutter application. -A few resources to get you started if this is your first Flutter project: -- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) -- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) -For help getting started with Flutter development, view the -[online documentation](https://docs.flutter.dev/), which offers tutorials, -samples, guidance on mobile development, and a full API reference. diff --git a/lib/components/main_menu.dart b/lib/components/main_menu.dart index 4c581e8..61d45d2 100644 --- a/lib/components/main_menu.dart +++ b/lib/components/main_menu.dart @@ -33,7 +33,7 @@ class MainMenu extends StatelessWidget { ), MenuButton( label: "Koleksi", - icon: 'assets/icons/koleksi.svg', + icon: 'assets/icons/Koleksi.svg', onPress: () => { Navigator.push( diff --git a/lib/screen/Home_screen.dart b/lib/screen/Home_screen.dart index bce7774..845fe5a 100644 --- a/lib/screen/Home_screen.dart +++ b/lib/screen/Home_screen.dart @@ -74,14 +74,17 @@ class _HomeScreenState extends State { children: [ Positioned.fill( child: RepaintBoundary( - child: Container( - decoration: const BoxDecoration( - image: const DecorationImage( - image: AssetImage("assets/images/background.jpeg"), - fit: BoxFit.cover, - ), - ), - ), + // child: Container( + // decoration: const BoxDecoration( + // image: const DecorationImage( + // image: AssetImage("assets/images/background.jpeg"), + // fit: BoxFit.cover, + // ), + // ), + // ), + child: UnityWidget( + onUnityCreated: onUnityCreated, + ) ), ), // Positioned( @@ -195,40 +198,40 @@ class _HomeScreenState extends State { ], ), ), - Positioned( - bottom: 150, - left: 0, - right: 0, - child: Column( - children: [ - Container( - padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10), - decoration: BoxDecoration( - color: Color.fromARGB(255, 247, 224, 236), - borderRadius: BorderRadius.circular(10), - boxShadow: [ - BoxShadow( - color: Color.fromARGB(255, 214, 213, 121), - blurRadius: 5, - spreadRadius: 2, - ), - ], - ), - child: Text( - "Halo....Jotaslim", - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - color: Color(0xFF000000), - ), - ), - ), - SizedBox(height: 10), - setHomeImage("assets/images/luffy.png", 300), - // Image.asset("images/luffy.png", width: 300), - ], - ), - ), + // Positioned( + // bottom: 150, + // left: 0, + // right: 0, + // child: Column( + // children: [ + // Container( + // padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10), + // decoration: BoxDecoration( + // color: Color.fromARGB(255, 247, 224, 236), + // borderRadius: BorderRadius.circular(10), + // boxShadow: [ + // BoxShadow( + // color: Color.fromARGB(255, 214, 213, 121), + // blurRadius: 5, + // spreadRadius: 2, + // ), + // ], + // ), + // child: Text( + // "Halo....Jotaslim", + // style: TextStyle( + // fontSize: 12, + // fontWeight: FontWeight.bold, + // color: Color(0xFF000000), + // ), + // ), + // ), + // SizedBox(height: 10), + // setHomeImage("images/luffy.png", 300), + // // Image.asset("images/luffy.png", width: 300), + // ], + // ), + // ), // BG MEnu Stack( children: [ From 0fb3e74cf7d371bd4aa8084ceab67dbba6a89b7f Mon Sep 17 00:00:00 2001 From: Irwan Cahyono Date: Wed, 16 Apr 2025 08:33:12 +0700 Subject: [PATCH 5/7] pubspec.lock --- pubspec.lock | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/pubspec.lock b/pubspec.lock index 5e3b2d7..9550bf1 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -187,6 +187,15 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_unity_widget: + dependency: "direct main" + description: + path: "." + ref: "flutter_3.24_android_hotfix" + resolved-ref: d2f6dc853d5b5054668ea9d79bb138d2d072696c + url: "https://github.com/juicycleff/flutter-unity-view-widget.git" + source: git + version: "2022.2.1" flutter_web_plugins: dependency: transitive description: flutter @@ -533,6 +542,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871 + url: "https://pub.dev" + source: hosted + version: "2.1.1" string_scanner: dependency: transitive description: @@ -701,6 +718,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.10.0" + webview_flutter_web: + dependency: transitive + description: + name: webview_flutter_web + sha256: "18a7ccc1c31dd9a5c759a1b7217a2a1e04bd8f65712714a4070bfac19a23ca9e" + url: "https://pub.dev" + source: hosted + version: "0.2.3+4" webview_flutter_wkwebview: dependency: transitive description: From 39514dc0f6d9f2e5f32089753848aa249903459b Mon Sep 17 00:00:00 2001 From: "irwan.l.cahyono" Date: Wed, 16 Apr 2025 09:02:15 +0000 Subject: [PATCH 6/7] Update README.md --- README.md | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c3b17fc..883b24c 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Project ini adalah aplikasi mobile Furikake. Gunakan konfigurasi ini pada file android/unityLibrary/build.gradle: - +``` apply plugin: 'com.android.library' @@ -121,9 +121,4 @@ android { } } } - - - - - - +``` \ No newline at end of file From e055ef5484013841337d438dbdfae0cf77611240 Mon Sep 17 00:00:00 2001 From: "irwan.l.cahyono" Date: Tue, 6 May 2025 15:30:47 +0000 Subject: [PATCH 7/7] Update README.md --- README.md | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) diff --git a/README.md b/README.md index 883b24c..71951f4 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,121 @@ Project ini adalah aplikasi mobile Furikake. +## Konfiguras dan perubahan android app + +Edit android/app/src/main/kotlin ... /MainActivity.kt + +``` +package com.paj.freekake + +import io.flutter.embedding.android.FlutterActivity +import io.flutter.embedding.android.FlutterFragmentActivity; + +//class MainActivity : FlutterActivity() +class MainActivity: FlutterFragmentActivity() { +} +``` + +Gunakan konfigurasi ini pada file android/settings.gradle.kts + +``` +pluginManagement { + val flutterSdkPath = run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.9.0" apply false + id("org.jetbrains.kotlin.android") version "1.8.22" apply false +} + +include(":app") + +include(":unityLibrary") +project(":unityLibrary").projectDir = file("./unityLibrary") + +include(":unityLibrary:xrmanifest.androidlib") +//project(":unityLibrary:xrmanifest.androidlib").projectDir = file("unityLibrary/xrmanifest.androidlib") + +//include(":unityLibrary:mobilenotifications.androidlib") +//project(":unityLibrary:mobilenotifications.androidlib").projectDir = file("unityLibrary/mobilenotifications.androidlib") + +``` + +Gunakan konfigurasi ini pada android/app/build.gradle.kts + +``` +plugins { + id("com.android.application") + id("kotlin-android") + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "com.paj.freekake" + //compileSdk = flutter.compileSdkVersion + compileSdk = 35 + //ndkVersion = "27.0.12077973" + //ndkVersion = flutter.ndkVersion + ndkVersion = "23.1.7779620" + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId = "com.paj.freekake" + // You can update the following values to match your application needs. + // For more information, see: https://flutter.dev/to/review-gradle-config. + //minSdk = flutter.minSdkVersion + //targetSdk = flutter.targetSdkVersion + //minSdk = 24 // Set to 24 or higher + minSdk = 30 + targetSdk = 35 + versionCode = flutter.versionCode + versionName = flutter.versionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig = signingConfigs.getByName("debug") + } + } +} + +flutter { + source = "../.." +} + +dependencies { + implementation(project(":unityLibrary")) + implementation(project(":flutter_unity_widget")) +} +``` + ## Konfigurasi UnityLibrary Gunakan konfigurasi ini pada file android/unityLibrary/build.gradle: