Compare commits

...

8 Commits

Author SHA1 Message Date
bab3893f8a Merge branch 'unity_embed' of https://git.probindo.com/Probindo/FreekakeApp into unity_embed 2025-05-06 22:39:54 +07:00
0564cab301 pubspec.lock 2025-04-16 08:55:05 +07:00
b5943099ff gitignore dan beberapa yang terlewat 2025-04-16 08:55:05 +07:00
929f2ce729 config gradle unity 2025-04-16 08:54:05 +07:00
75210e29bc mobile 2025-04-16 08:54:05 +07:00
cb1c0a8e05 mobile 2025-04-16 08:45:45 +07:00
='fauz
21c03f72d6 main menu action 2025-04-15 14:56:16 +07:00
='fauz
831bf02a5c tab menu color 2025-04-15 13:38:24 +07:00
12 changed files with 224 additions and 89 deletions

View File

@ -0,0 +1,67 @@
import 'package:flutter/material.dart';
class CurvedBottomBorderTab extends StatelessWidget {
final bool isSelected;
final String label;
final VoidCallback tap;
const CurvedBottomBorderTab({
required this.isSelected,
required this.label,
required this.tap,
});
@override
Widget build(BuildContext context) {
return CustomPaint(
painter: isSelected ? CurvedBottomPainter() : null,
child: GestureDetector(
child: Container(
width: 110,
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
color: Colors.transparent,
child: Center(
child: Text(
label,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color:
isSelected
? const Color.fromARGB(255, 255, 255, 255)
: const Color.fromARGB(255, 197, 194, 194),
),
),
),
),
onTap: tap,
),
);
}
}
class CurvedBottomPainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
final paint =
Paint()
..color = Colors.white
..strokeWidth = 2
..style = PaintingStyle.stroke;
final path =
Path()
..moveTo(0, size.height)
..quadraticBezierTo(
size.width / 2,
size.height - 8,
size.width,
size.height,
);
canvas.drawPath(path, paint);
}
@override
bool shouldRepaint(CustomPainter oldDelegate) => false;
}

View File

@ -6,13 +6,42 @@ import 'package:freekake/screen/Home_screen.dart';
import 'package:freekake/screen/koleksi_screen.dart'; import 'package:freekake/screen/koleksi_screen.dart';
import 'package:freekake/screen/pustaka_screen.dart'; import 'package:freekake/screen/pustaka_screen.dart';
import 'package:freekake/screen/saya/profile_screen.dart'; import 'package:freekake/screen/saya/profile_screen.dart';
import 'package:freekake/providers/menu_selection_provider.dart';
import 'package:provider/provider.dart';
class MainMenu extends StatelessWidget { class MainMenu extends StatefulWidget {
const MainMenu({super.key}); const MainMenu({super.key});
_MainMenuState createState() => _MainMenuState();
}
class _MainMenuState extends State<MainMenu> {
int selectedIndex = 0;
final List<Widget> _screens = [
HomeScreen(),
KoleksiScreen(),
PustakaScreen(),
ProfileScreen(),
];
// void _onItemTapped(int index) {
// Future.delayed(Duration(milliseconds: 100), () {
// Navigator.pushReplacement(
// context,
// MaterialPageRoute(builder: (context) => _screens[index]),
// );
// });
// setState(() {
// selectedIndex = index;
// });
// }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final Size size = MediaQuery.of(context).size; final Size size = MediaQuery.of(context).size;
final selectedIndex =
Provider.of<MenuSelectionProvider>(context).selectedIndex;
return Container( return Container(
color: Colors.transparent, color: Colors.transparent,
padding: const EdgeInsets.symmetric(vertical: 10), padding: const EdgeInsets.symmetric(vertical: 10),
@ -23,50 +52,64 @@ class MainMenu extends StatelessWidget {
MenuButton( MenuButton(
label: "E-furibuddy", label: "E-furibuddy",
icon: 'assets/icons/furrybuddy.svg', icon: 'assets/icons/furrybuddy.svg',
onPress: onPress: () => _onItemTapped(context, 0),
() => { isSelected: selectedIndex == 0,
Navigator.push(
context,
MaterialPageRoute(builder: (context) => HomeScreen()),
),
},
), ),
MenuButton( MenuButton(
label: "Koleksi", label: "Koleksi",
icon: 'assets/icons/Koleksi.svg', icon: 'assets/icons/Koleksi.svg',
onPress: onPress: () => _onItemTapped(context, 1),
() => { isSelected: selectedIndex == 1,
Navigator.push(
context,
MaterialPageRoute(builder: (context) => KoleksiScreen()),
), ),
}, SizedBox(width: 100),
),
SizedBox(width: 120),
MenuButton( MenuButton(
label: "Pustaka", label: "Pustaka",
icon: 'assets/icons/Pustaka.svg', icon: 'assets/icons/Pustaka.svg',
onPress: onPress: () => _onItemTapped(context, 2),
() => { isSelected: selectedIndex == 2,
Navigator.push(
context,
MaterialPageRoute(builder: (context) => PustakaScreen()),
),
},
), ),
MenuButton( MenuButton(
label: "Saya", label: "Saya",
icon: 'assets/icons/Saya.svg', icon: 'assets/icons/Saya.svg',
onPress: onPress: () => _onItemTapped(context, 3),
() => { isSelected: selectedIndex == 3,
Navigator.push(
context,
MaterialPageRoute(builder: (context) => ProfileScreen()),
),
},
), ),
], ],
), ),
); );
} }
void _onItemTapped(BuildContext context, int index) {
// Mengubah selectedIndex di MenuSelectionProvider
Provider.of<MenuSelectionProvider>(context, listen: false).selectedIndex =
index;
// Pindah halaman sesuai index yang dipilih
switch (index) {
case 0:
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => HomeScreen()),
);
break;
case 1:
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => KoleksiScreen()),
);
break;
case 2:
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => PustakaScreen()),
);
break;
case 3:
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => ProfileScreen()),
);
break;
}
}
} }

View File

@ -32,7 +32,9 @@ class MenuButton extends StatelessWidget {
height: h ?? 24, height: h ?? 24,
// allowDrawingOutsideViewBox: true, // allowDrawingOutsideViewBox: true,
colorFilter: ColorFilter.mode( colorFilter: ColorFilter.mode(
Color.fromARGB(255, 255, 255, 255), (isSelected ?? false)
? Color.fromARGB(255, 216, 182, 10)
: Color.fromARGB(255, 255, 255, 255),
BlendMode.srcIn, BlendMode.srcIn,
), ),
), ),
@ -41,7 +43,10 @@ class MenuButton extends StatelessWidget {
Text( Text(
label ?? '', label ?? '',
style: TextStyle( style: TextStyle(
color: Color.fromARGB(255, 239, 224, 232), color:
(isSelected ?? false)
? Color.fromARGB(255, 216, 182, 10)
: Color.fromARGB(255, 239, 224, 232),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 10, fontSize: 10,
), ),

View File

@ -8,8 +8,8 @@ class ScanButton extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
width: 86, width: 76,
height: 86, height: 76,
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: const Color.fromARGB(223, 67, 63, 179), color: const Color.fromARGB(223, 67, 63, 179),

View File

@ -28,7 +28,7 @@ class TabMenuButton extends StatelessWidget {
height: 20, height: 20,
colorFilter: ColorFilter.mode( colorFilter: ColorFilter.mode(
isSelected isSelected
? const Color.fromARGB(255, 106, 24, 207) ? const Color.fromARGB(255, 10, 144, 16)
: Colors.white, : Colors.white,
BlendMode.srcIn, BlendMode.srcIn,
), ),
@ -43,13 +43,16 @@ class TabMenuButton extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: color:
isSelected isSelected
? const Color.fromARGB(255, 199, 204, 212).withOpacity(0) ? const Color.fromARGB(255, 10, 144, 16).withOpacity(0)
: Colors.transparent, : const Color.fromARGB(0, 0, 0, 0),
border: border:
isSelected isSelected
? const Border( ? const Border(
top: BorderSide(color: Colors.white, width: 2), bottom: BorderSide(
color: Color.fromARGB(255, 255, 255, 255),
width: 2,
),
) )
: null, : null,
// borderRadius: BorderRadius.circular(20), // borderRadius: BorderRadius.circular(20),
@ -63,7 +66,7 @@ class TabMenuButton extends StatelessWidget {
color: color:
isSelected isSelected
? const Color.fromARGB(255, 255, 255, 255) ? const Color.fromARGB(255, 255, 255, 255)
: const Color.fromARGB(255, 0, 0, 0), : const Color.fromARGB(255, 197, 194, 194),
), ),
), ),
), ),

View File

@ -3,8 +3,8 @@ import 'package:flutter/services.dart';
import 'package:freekake/components/navbar_container.dart'; import 'package:freekake/components/navbar_container.dart';
import 'package:freekake/providers/character_provider.dart'; import 'package:freekake/providers/character_provider.dart';
import 'package:freekake/screen/Home_screen.dart'; import 'package:freekake/screen/Home_screen.dart';
import 'package:freekake/screen/drraw_screen.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:freekake/providers/menu_selection_provider.dart';
void main() { void main() {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
@ -18,8 +18,11 @@ class MyApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ChangeNotifierProvider( return MultiProvider(
create: (context) => CharacterProvider(), providers: [
ChangeNotifierProvider(create: (context) => CharacterProvider()),
ChangeNotifierProvider(create: (context) => MenuSelectionProvider()),
],
child: MaterialApp( child: MaterialApp(
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
title: 'AR Character App', title: 'AR Character App',

View File

@ -0,0 +1,12 @@
import 'package:flutter/material.dart';
class MenuSelectionProvider with ChangeNotifier {
int _selectedIndex = 0;
int get selectedIndex => _selectedIndex;
set selectedIndex(int index) {
_selectedIndex = index;
notifyListeners();
}
}

View File

@ -73,19 +73,21 @@ class _HomeScreenState extends State<HomeScreen> {
body: Stack( body: Stack(
children: <Widget>[ children: <Widget>[
Positioned.fill( Positioned.fill(
child: RepaintBoundary( child: UnityWidget(
onUnityCreated: onUnityCreated,
//isARScene: true,
onUnityMessage: onUnityMessage,
//onUnitySceneLoaded: onUnitySceneLoaded,
fullscreen: false,
),
// child: Container( // child: Container(
// decoration: const BoxDecoration( // decoration: BoxDecoration(
// image: const DecorationImage( // image: DecorationImage(
// image: AssetImage("assets/images/background.jpeg"), // image: AssetImage("assets/images/background.jpeg"),
// fit: BoxFit.cover, // fit: BoxFit.cover,
// ), // ),
// ), // ),
// ), // ),
child: UnityWidget(
onUnityCreated: onUnityCreated,
)
),
), ),
// Positioned( // Positioned(
// top: 0, // top: 0,
@ -245,8 +247,8 @@ class _HomeScreenState extends State<HomeScreen> {
), ),
Positioned(bottom: 0, left: 0, right: 0, child: MainMenu()), Positioned(bottom: 0, left: 0, right: 0, child: MainMenu()),
Positioned( Positioned(
bottom: 5, bottom: 8,
left: MediaQuery.of(context).size.width / 2 - 43, left: MediaQuery.of(context).size.width / 2 - 38,
child: Transform.translate( child: Transform.translate(
offset: Offset(0, -20), offset: Offset(0, -20),
child: ScanButton(), child: ScanButton(),

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:freekake/components/bottom_navbar.dart'; import 'package:freekake/components/bottom_navbar.dart';
import 'package:freekake/components/buildcard_info.dart'; import 'package:freekake/components/buildcard_info.dart';
import 'package:freekake/components/curve_bottom_border_tab.dart';
import 'package:freekake/components/main_menu.dart'; import 'package:freekake/components/main_menu.dart';
import 'package:freekake/components/scan_button.dart'; import 'package:freekake/components/scan_button.dart';
import 'package:freekake/components/tab_menu.dart'; import 'package:freekake/components/tab_menu.dart';
@ -128,20 +129,20 @@ class _KoleksiScreenState extends State<KoleksiScreen> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
TabMenuButton( CurvedBottomBorderTab(
label: "Karakter", label: "Karakter",
isSelected: _selectedIndex == 0, isSelected: _selectedIndex == 0,
onPress: () => _onMenuTapped(0), tap: () => _onMenuTapped(0),
), ),
TabMenuButton( CurvedBottomBorderTab(
label: "Skin", label: "Skin",
isSelected: _selectedIndex == 1, isSelected: _selectedIndex == 1,
onPress: () => _onMenuTapped(1), tap: () => _onMenuTapped(1),
), ),
TabMenuButton( CurvedBottomBorderTab(
label: "Fragment", label: "Fragment",
isSelected: _selectedIndex == 2, isSelected: _selectedIndex == 2,
onPress: () => _onMenuTapped(2), tap: () => _onMenuTapped(2),
), ),
], ],
), ),
@ -149,8 +150,8 @@ class _KoleksiScreenState extends State<KoleksiScreen> {
), ),
Positioned(bottom: 0, left: 0, right: 0, child: MainMenu()), Positioned(bottom: 0, left: 0, right: 0, child: MainMenu()),
Positioned( Positioned(
bottom: 5, bottom: 8,
left: MediaQuery.of(context).size.width / 2 - 43, left: MediaQuery.of(context).size.width / 2 - 38,
child: Transform.translate( child: Transform.translate(
offset: Offset(0, -20), offset: Offset(0, -20),
child: ScanButton(), child: ScanButton(),

View File

@ -197,21 +197,21 @@ class _PustakaScreenState extends State<PustakaScreen> {
), ),
), ),
), ),
// SizedBox( SizedBox(
// child: Padding( child: Padding(
// padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
// horizontal: 5, horizontal: 40,
// vertical: 1, vertical: 1,
// ), ),
// child: Column( child: Column(
// crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
// children: [ children: [
// Text("List Topic", style: TextStyle(color: Colors.black)), Text("Daftar Topik", style: TextStyle(color: Colors.black)),
// Divider(color: Colors.transparent), Divider(color: Colors.transparent),
// ], ],
// ), ),
// ), ),
// ), ),
// Horizontal Scroll List // Horizontal Scroll List
Padding( Padding(
padding: EdgeInsets.symmetric(horizontal: 5, vertical: 5), padding: EdgeInsets.symmetric(horizontal: 5, vertical: 5),
@ -292,8 +292,8 @@ class _PustakaScreenState extends State<PustakaScreen> {
], ],
), ),
Positioned( Positioned(
bottom: 5, bottom: 8,
left: MediaQuery.of(context).size.width / 2 - 43, left: MediaQuery.of(context).size.width / 2 - 38,
child: Transform.translate( child: Transform.translate(
offset: Offset(0, -20), offset: Offset(0, -20),
child: ScanButton(), child: ScanButton(),

View File

@ -52,15 +52,14 @@ class _AkunSayaState extends State<AkunSaya> {
title: Text("Saya"), title: Text("Saya"),
backgroundColor: Color.fromARGB(225, 79, 76, 182), backgroundColor: Color.fromARGB(225, 79, 76, 182),
), ),
resizeToAvoidBottomInset: false,
backgroundColor: const Color.fromARGB(255, 255, 255, 255), backgroundColor: const Color.fromARGB(255, 255, 255, 255),
body: Stack( body: Stack(
children: [ children: [
Positioned( Align(
bottom: 0, alignment: Alignment.bottomCenter,
left: 0,
right: 0,
child: Padding( child: Padding(
padding: const EdgeInsets.only(top: 20.0, left: 20, right: 20), padding: const EdgeInsets.only(top: 0.0, left: 20, right: 20),
child: Container( child: Container(
height: MediaQuery.of(context).size.height * 0.7, height: MediaQuery.of(context).size.height * 0.7,
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
@ -89,7 +88,7 @@ class _AkunSayaState extends State<AkunSaya> {
), ),
), ),
), ),
SizedBox(height: 40), SizedBox(height: 70),
Expanded( Expanded(
child: Padding( child: Padding(
padding: EdgeInsets.all(20), padding: EdgeInsets.all(20),

View File

@ -340,8 +340,8 @@ class _ProfileScreenState extends State<ProfileScreen> {
), ),
Positioned(bottom: 0, left: 0, right: 0, child: MainMenu()), Positioned(bottom: 0, left: 0, right: 0, child: MainMenu()),
Positioned( Positioned(
bottom: 5, bottom: 8,
left: MediaQuery.of(context).size.width / 2 - 43, left: MediaQuery.of(context).size.width / 2 - 38,
child: Transform.translate( child: Transform.translate(
offset: Offset(0, -20), offset: Offset(0, -20),
child: ScanButton(), child: ScanButton(),