Compare commits
8 Commits
e055ef5484
...
bab3893f8a
| Author | SHA1 | Date | |
|---|---|---|---|
| bab3893f8a | |||
| 0564cab301 | |||
| b5943099ff | |||
| 929f2ce729 | |||
| 75210e29bc | |||
| cb1c0a8e05 | |||
|
|
21c03f72d6 | ||
|
|
831bf02a5c |
67
lib/components/curve_bottom_border_tab.dart
Normal file
67
lib/components/curve_bottom_border_tab.dart
Normal 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;
|
||||
}
|
||||
@ -6,13 +6,42 @@ 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';
|
||||
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});
|
||||
_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
|
||||
Widget build(BuildContext context) {
|
||||
final Size size = MediaQuery.of(context).size;
|
||||
final selectedIndex =
|
||||
Provider.of<MenuSelectionProvider>(context).selectedIndex;
|
||||
return Container(
|
||||
color: Colors.transparent,
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
@ -23,50 +52,64 @@ class MainMenu extends StatelessWidget {
|
||||
MenuButton(
|
||||
label: "E-furibuddy",
|
||||
icon: 'assets/icons/furrybuddy.svg',
|
||||
onPress:
|
||||
() => {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => HomeScreen()),
|
||||
),
|
||||
},
|
||||
onPress: () => _onItemTapped(context, 0),
|
||||
isSelected: selectedIndex == 0,
|
||||
),
|
||||
MenuButton(
|
||||
label: "Koleksi",
|
||||
icon: 'assets/icons/Koleksi.svg',
|
||||
onPress:
|
||||
() => {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => KoleksiScreen()),
|
||||
),
|
||||
},
|
||||
onPress: () => _onItemTapped(context, 1),
|
||||
isSelected: selectedIndex == 1,
|
||||
),
|
||||
SizedBox(width: 120),
|
||||
SizedBox(width: 100),
|
||||
MenuButton(
|
||||
label: "Pustaka",
|
||||
icon: 'assets/icons/Pustaka.svg',
|
||||
onPress:
|
||||
() => {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => PustakaScreen()),
|
||||
),
|
||||
},
|
||||
onPress: () => _onItemTapped(context, 2),
|
||||
isSelected: selectedIndex == 2,
|
||||
),
|
||||
MenuButton(
|
||||
label: "Saya",
|
||||
icon: 'assets/icons/Saya.svg',
|
||||
onPress:
|
||||
() => {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => ProfileScreen()),
|
||||
),
|
||||
},
|
||||
onPress: () => _onItemTapped(context, 3),
|
||||
isSelected: selectedIndex == 3,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,7 +32,9 @@ class MenuButton extends StatelessWidget {
|
||||
height: h ?? 24,
|
||||
// allowDrawingOutsideViewBox: true,
|
||||
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,
|
||||
),
|
||||
),
|
||||
@ -41,7 +43,10 @@ class MenuButton extends StatelessWidget {
|
||||
Text(
|
||||
label ?? '',
|
||||
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,
|
||||
fontSize: 10,
|
||||
),
|
||||
|
||||
@ -8,8 +8,8 @@ class ScanButton extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: 86,
|
||||
height: 86,
|
||||
width: 76,
|
||||
height: 76,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: const Color.fromARGB(223, 67, 63, 179),
|
||||
|
||||
@ -28,7 +28,7 @@ class TabMenuButton extends StatelessWidget {
|
||||
height: 20,
|
||||
colorFilter: ColorFilter.mode(
|
||||
isSelected
|
||||
? const Color.fromARGB(255, 106, 24, 207)
|
||||
? const Color.fromARGB(255, 10, 144, 16)
|
||||
: Colors.white,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
@ -43,13 +43,16 @@ class TabMenuButton extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
isSelected
|
||||
? const Color.fromARGB(255, 199, 204, 212).withOpacity(0)
|
||||
: Colors.transparent,
|
||||
? const Color.fromARGB(255, 10, 144, 16).withOpacity(0)
|
||||
: const Color.fromARGB(0, 0, 0, 0),
|
||||
|
||||
border:
|
||||
isSelected
|
||||
? const Border(
|
||||
top: BorderSide(color: Colors.white, width: 2),
|
||||
bottom: BorderSide(
|
||||
color: Color.fromARGB(255, 255, 255, 255),
|
||||
width: 2,
|
||||
),
|
||||
)
|
||||
: null,
|
||||
// borderRadius: BorderRadius.circular(20),
|
||||
@ -63,7 +66,7 @@ class TabMenuButton extends StatelessWidget {
|
||||
color:
|
||||
isSelected
|
||||
? const Color.fromARGB(255, 255, 255, 255)
|
||||
: const Color.fromARGB(255, 0, 0, 0),
|
||||
: const Color.fromARGB(255, 197, 194, 194),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@ -3,8 +3,8 @@ import 'package:flutter/services.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';
|
||||
import 'package:freekake/providers/menu_selection_provider.dart';
|
||||
|
||||
void main() {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
@ -18,8 +18,11 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ChangeNotifierProvider(
|
||||
create: (context) => CharacterProvider(),
|
||||
return MultiProvider(
|
||||
providers: [
|
||||
ChangeNotifierProvider(create: (context) => CharacterProvider()),
|
||||
ChangeNotifierProvider(create: (context) => MenuSelectionProvider()),
|
||||
],
|
||||
child: MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
title: 'AR Character App',
|
||||
|
||||
12
lib/providers/menu_selection_provider.dart
Normal file
12
lib/providers/menu_selection_provider.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
@ -73,19 +73,21 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
body: Stack(
|
||||
children: <Widget>[
|
||||
Positioned.fill(
|
||||
child: RepaintBoundary(
|
||||
// child: Container(
|
||||
// decoration: const BoxDecoration(
|
||||
// image: const DecorationImage(
|
||||
// image: AssetImage("assets/images/background.jpeg"),
|
||||
// fit: BoxFit.cover,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
child: UnityWidget(
|
||||
onUnityCreated: onUnityCreated,
|
||||
)
|
||||
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,
|
||||
@ -245,8 +247,8 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
),
|
||||
Positioned(bottom: 0, left: 0, right: 0, child: MainMenu()),
|
||||
Positioned(
|
||||
bottom: 5,
|
||||
left: MediaQuery.of(context).size.width / 2 - 43,
|
||||
bottom: 8,
|
||||
left: MediaQuery.of(context).size.width / 2 - 38,
|
||||
child: Transform.translate(
|
||||
offset: Offset(0, -20),
|
||||
child: ScanButton(),
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:freekake/components/bottom_navbar.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/scan_button.dart';
|
||||
import 'package:freekake/components/tab_menu.dart';
|
||||
@ -128,20 +129,20 @@ class _KoleksiScreenState extends State<KoleksiScreen> {
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
TabMenuButton(
|
||||
CurvedBottomBorderTab(
|
||||
label: "Karakter",
|
||||
isSelected: _selectedIndex == 0,
|
||||
onPress: () => _onMenuTapped(0),
|
||||
tap: () => _onMenuTapped(0),
|
||||
),
|
||||
TabMenuButton(
|
||||
CurvedBottomBorderTab(
|
||||
label: "Skin",
|
||||
isSelected: _selectedIndex == 1,
|
||||
onPress: () => _onMenuTapped(1),
|
||||
tap: () => _onMenuTapped(1),
|
||||
),
|
||||
TabMenuButton(
|
||||
CurvedBottomBorderTab(
|
||||
label: "Fragment",
|
||||
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: 5,
|
||||
left: MediaQuery.of(context).size.width / 2 - 43,
|
||||
bottom: 8,
|
||||
left: MediaQuery.of(context).size.width / 2 - 38,
|
||||
child: Transform.translate(
|
||||
offset: Offset(0, -20),
|
||||
child: ScanButton(),
|
||||
|
||||
@ -197,21 +197,21 @@ class _PustakaScreenState extends State<PustakaScreen> {
|
||||
),
|
||||
),
|
||||
),
|
||||
// SizedBox(
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.symmetric(
|
||||
// horizontal: 5,
|
||||
// vertical: 1,
|
||||
// ),
|
||||
// child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Text("List Topic", style: TextStyle(color: Colors.black)),
|
||||
// Divider(color: Colors.transparent),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
SizedBox(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 40,
|
||||
vertical: 1,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("Daftar Topik", style: TextStyle(color: Colors.black)),
|
||||
Divider(color: Colors.transparent),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
// Horizontal Scroll List
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 5, vertical: 5),
|
||||
@ -292,8 +292,8 @@ class _PustakaScreenState extends State<PustakaScreen> {
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
bottom: 5,
|
||||
left: MediaQuery.of(context).size.width / 2 - 43,
|
||||
bottom: 8,
|
||||
left: MediaQuery.of(context).size.width / 2 - 38,
|
||||
child: Transform.translate(
|
||||
offset: Offset(0, -20),
|
||||
child: ScanButton(),
|
||||
|
||||
@ -52,15 +52,14 @@ class _AkunSayaState extends State<AkunSaya> {
|
||||
title: Text("Saya"),
|
||||
backgroundColor: Color.fromARGB(225, 79, 76, 182),
|
||||
),
|
||||
resizeToAvoidBottomInset: false,
|
||||
backgroundColor: const Color.fromARGB(255, 255, 255, 255),
|
||||
body: Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
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(
|
||||
height: MediaQuery.of(context).size.height * 0.7,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
@ -89,7 +88,7 @@ class _AkunSayaState extends State<AkunSaya> {
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 40),
|
||||
SizedBox(height: 70),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
|
||||
@ -340,8 +340,8 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
),
|
||||
Positioned(bottom: 0, left: 0, right: 0, child: MainMenu()),
|
||||
Positioned(
|
||||
bottom: 5,
|
||||
left: MediaQuery.of(context).size.width / 2 - 43,
|
||||
bottom: 8,
|
||||
left: MediaQuery.of(context).size.width / 2 - 38,
|
||||
child: Transform.translate(
|
||||
offset: Offset(0, -20),
|
||||
child: ScanButton(),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user