Compare commits

..

No commits in common. "bab3893f8a3cfa08406e06ad6ae433b2658fc7a2" and "e055ef5484013841337d438dbdfae0cf77611240" have entirely different histories.

12 changed files with 89 additions and 224 deletions

View File

@ -1,67 +0,0 @@
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,42 +6,13 @@ 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 StatefulWidget { class MainMenu extends StatelessWidget {
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),
@ -52,64 +23,50 @@ class _MainMenuState extends State<MainMenu> {
MenuButton( MenuButton(
label: "E-furibuddy", label: "E-furibuddy",
icon: 'assets/icons/furrybuddy.svg', icon: 'assets/icons/furrybuddy.svg',
onPress: () => _onItemTapped(context, 0), onPress:
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: () => _onItemTapped(context, 1), onPress:
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: () => _onItemTapped(context, 2), onPress:
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: () => _onItemTapped(context, 3), onPress:
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,9 +32,7 @@ class MenuButton extends StatelessWidget {
height: h ?? 24, height: h ?? 24,
// allowDrawingOutsideViewBox: true, // allowDrawingOutsideViewBox: true,
colorFilter: ColorFilter.mode( colorFilter: ColorFilter.mode(
(isSelected ?? false) Color.fromARGB(255, 255, 255, 255),
? Color.fromARGB(255, 216, 182, 10)
: Color.fromARGB(255, 255, 255, 255),
BlendMode.srcIn, BlendMode.srcIn,
), ),
), ),
@ -43,10 +41,7 @@ class MenuButton extends StatelessWidget {
Text( Text(
label ?? '', label ?? '',
style: TextStyle( style: TextStyle(
color: color: Color.fromARGB(255, 239, 224, 232),
(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: 76, width: 86,
height: 76, height: 86,
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, 10, 144, 16) ? const Color.fromARGB(255, 106, 24, 207)
: Colors.white, : Colors.white,
BlendMode.srcIn, BlendMode.srcIn,
), ),
@ -43,16 +43,13 @@ class TabMenuButton extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: color:
isSelected isSelected
? const Color.fromARGB(255, 10, 144, 16).withOpacity(0) ? const Color.fromARGB(255, 199, 204, 212).withOpacity(0)
: const Color.fromARGB(0, 0, 0, 0), : Colors.transparent,
border: border:
isSelected isSelected
? const Border( ? const Border(
bottom: BorderSide( top: BorderSide(color: Colors.white, width: 2),
color: Color.fromARGB(255, 255, 255, 255),
width: 2,
),
) )
: null, : null,
// borderRadius: BorderRadius.circular(20), // borderRadius: BorderRadius.circular(20),
@ -66,7 +63,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, 197, 194, 194), : const Color.fromARGB(255, 0, 0, 0),
), ),
), ),
), ),

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,11 +18,8 @@ class MyApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MultiProvider( return ChangeNotifierProvider(
providers: [ create: (context) => CharacterProvider(),
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

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

View File

@ -1,7 +1,6 @@
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';
@ -129,20 +128,20 @@ class _KoleksiScreenState extends State<KoleksiScreen> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
CurvedBottomBorderTab( TabMenuButton(
label: "Karakter", label: "Karakter",
isSelected: _selectedIndex == 0, isSelected: _selectedIndex == 0,
tap: () => _onMenuTapped(0), onPress: () => _onMenuTapped(0),
), ),
CurvedBottomBorderTab( TabMenuButton(
label: "Skin", label: "Skin",
isSelected: _selectedIndex == 1, isSelected: _selectedIndex == 1,
tap: () => _onMenuTapped(1), onPress: () => _onMenuTapped(1),
), ),
CurvedBottomBorderTab( TabMenuButton(
label: "Fragment", label: "Fragment",
isSelected: _selectedIndex == 2, isSelected: _selectedIndex == 2,
tap: () => _onMenuTapped(2), onPress: () => _onMenuTapped(2),
), ),
], ],
), ),
@ -150,8 +149,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: 8, bottom: 5,
left: MediaQuery.of(context).size.width / 2 - 38, left: MediaQuery.of(context).size.width / 2 - 43,
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: 40, // horizontal: 5,
vertical: 1, // vertical: 1,
), // ),
child: Column( // child: Column(
crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
children: [ // children: [
Text("Daftar Topik", style: TextStyle(color: Colors.black)), // Text("List Topic", 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: 8, bottom: 5,
left: MediaQuery.of(context).size.width / 2 - 38, left: MediaQuery.of(context).size.width / 2 - 43,
child: Transform.translate( child: Transform.translate(
offset: Offset(0, -20), offset: Offset(0, -20),
child: ScanButton(), child: ScanButton(),

View File

@ -52,14 +52,15 @@ 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: [
Align( Positioned(
alignment: Alignment.bottomCenter, bottom: 0,
left: 0,
right: 0,
child: Padding( child: Padding(
padding: const EdgeInsets.only(top: 0.0, left: 20, right: 20), padding: const EdgeInsets.only(top: 20.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,
@ -88,7 +89,7 @@ class _AkunSayaState extends State<AkunSaya> {
), ),
), ),
), ),
SizedBox(height: 70), SizedBox(height: 40),
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: 8, bottom: 5,
left: MediaQuery.of(context).size.width / 2 - 38, left: MediaQuery.of(context).size.width / 2 - 43,
child: Transform.translate( child: Transform.translate(
offset: Offset(0, -20), offset: Offset(0, -20),
child: ScanButton(), child: ScanButton(),