updated
This commit is contained in:
parent
1fdcc3773d
commit
c4c6097828
@ -1,12 +1,12 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:furibase/components/bottom_navbar.dart';
|
import 'package:freekake/components/bottom_navbar.dart';
|
||||||
import 'package:furibase/components/menu_button.dart';
|
import 'package:freekake/components/menu_button.dart';
|
||||||
import 'package:furibase/components/scan_button.dart';
|
import 'package:freekake/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/providers/menu_selection_provider.dart';
|
import 'package:freekake/providers/menu_selection_provider.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';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class MainMenu extends StatefulWidget {
|
class MainMenu extends StatefulWidget {
|
||||||
@ -51,48 +51,28 @@ class _MainMenuState extends State<MainMenu> {
|
|||||||
children: [
|
children: [
|
||||||
MenuButton(
|
MenuButton(
|
||||||
label: "E-furibuddy",
|
label: "E-furibuddy",
|
||||||
icon: '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: '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: 100),
|
||||||
MenuButton(
|
MenuButton(
|
||||||
label: "Pustaka",
|
label: "Pustaka",
|
||||||
icon: '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: 'icons/Saya.svg',
|
icon: 'assets/icons/Saya.svg',
|
||||||
onPress:
|
onPress: () => _onItemTapped(context, 3),
|
||||||
() => {
|
isSelected: selectedIndex == 3,
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(builder: (context) => ProfileScreen()),
|
|
||||||
),
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
|
import 'package:freekake/screen/camera_screen.dart';
|
||||||
|
|
||||||
class ScanButton extends StatelessWidget {
|
class ScanButton extends StatelessWidget {
|
||||||
const ScanButton({super.key});
|
const ScanButton({super.key});
|
||||||
@ -7,26 +8,40 @@ class ScanButton extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Expanded(
|
final screenWidth = MediaQuery.of(context).size.width;
|
||||||
child: Container(
|
|
||||||
decoration: BoxDecoration(
|
// Skala berdasarkan lebar layar
|
||||||
shape: BoxShape.circle,
|
final buttonSize = screenWidth * 0.20; // Adjust as needed
|
||||||
color: const Color.fromARGB(223, 67, 63, 179),
|
final iconSize = buttonSize * 0.7;
|
||||||
),
|
final padding = buttonSize * 0.15;
|
||||||
padding: EdgeInsets.all(10),
|
|
||||||
child: IconButton(
|
return Container(
|
||||||
icon: SvgPicture.asset(
|
width: buttonSize,
|
||||||
'assets/icons/Scan.svg',
|
height: buttonSize,
|
||||||
width: 60,
|
// width: 76,
|
||||||
height: 60,
|
// height: 76,
|
||||||
colorFilter: ColorFilter.mode(
|
decoration: BoxDecoration(
|
||||||
Color.fromARGB(255, 217, 219, 227),
|
shape: BoxShape.circle,
|
||||||
BlendMode.srcIn,
|
color: const Color.fromARGB(223, 67, 63, 179),
|
||||||
),
|
),
|
||||||
|
padding: EdgeInsets.all(padding),
|
||||||
|
child: IconButton(
|
||||||
|
icon: SvgPicture.asset(
|
||||||
|
'assets/icons/Scan.svg',
|
||||||
|
width: iconSize,
|
||||||
|
height: iconSize,
|
||||||
|
colorFilter: ColorFilter.mode(
|
||||||
|
Color.fromARGB(255, 217, 219, 227),
|
||||||
|
BlendMode.srcIn,
|
||||||
),
|
),
|
||||||
onPressed: () {},
|
|
||||||
),
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) => CameraScreen()),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,16 +1,20 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.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/drraw_screen.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
import 'package:freekake/providers/menu_selection_provider.dart';
|
import 'package:freekake/providers/menu_selection_provider.dart';
|
||||||
|
import 'package:freekake/screen/Home_screen.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
void main() {
|
void main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
|
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
|
||||||
|
|
||||||
|
await SystemChrome.setPreferredOrientations([
|
||||||
|
DeviceOrientation.portraitUp,
|
||||||
|
DeviceOrientation.portraitDown, // bisa dihapus jika hanya ingin satu arah
|
||||||
|
]);
|
||||||
|
|
||||||
runApp(const MyApp());
|
runApp(const MyApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +30,7 @@ class MyApp extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
title: 'AR Character App',
|
title: 'Freekake',
|
||||||
theme: ThemeData.dark(),
|
theme: ThemeData.dark(),
|
||||||
home:
|
home:
|
||||||
// DrawScreen(),
|
// DrawScreen(),
|
||||||
|
|||||||
@ -4,7 +4,6 @@ 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/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/topbar_container.dart';
|
|
||||||
import 'package:flutter_unity_widget/flutter_unity_widget.dart';
|
import 'package:flutter_unity_widget/flutter_unity_widget.dart';
|
||||||
|
|
||||||
class HomeScreen extends StatefulWidget {
|
class HomeScreen extends StatefulWidget {
|
||||||
@ -24,6 +23,16 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
@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 isLandscape = size.width > size.height;
|
||||||
|
final screenWidth = MediaQuery.of(context).size.width;
|
||||||
|
final buttonScanSize = screenWidth * 0.20;
|
||||||
|
final double bottomPadding = (9000 / screenWidth).clamp(0, 0.2);
|
||||||
|
double bottomOffset = -(screenWidth * 0.25) + 180;
|
||||||
|
double sunRiseCurve(double width) {
|
||||||
|
// kamu bisa mainin fungsi ini sesuka hati
|
||||||
|
return -((400 / width) * 100); // semakin kecil width, hasil makin negatif
|
||||||
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
// appBar: AppBar(
|
// appBar: AppBar(
|
||||||
// elevation: 0,
|
// elevation: 0,
|
||||||
@ -95,89 +104,89 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
// right: 0,
|
// right: 0,
|
||||||
// child: SizedBox(height: 120, child: TopbarContainer()),
|
// child: SizedBox(height: 120, child: TopbarContainer()),
|
||||||
// ),
|
// ),
|
||||||
Positioned(
|
// Positioned(
|
||||||
right: 0,
|
// right: 0,
|
||||||
top: 100,
|
// top: 100,
|
||||||
child: Padding(
|
// child: Padding(
|
||||||
padding: EdgeInsets.only(right: 20),
|
// padding: EdgeInsets.only(right: 20),
|
||||||
child: Container(
|
// child: Container(
|
||||||
width: 40,
|
// width: 40,
|
||||||
height: 40,
|
// height: 40,
|
||||||
decoration: BoxDecoration(
|
// decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(1),
|
// borderRadius: BorderRadius.circular(1),
|
||||||
color: Color.fromARGB(1, 209, 174, 174).withAlpha(0),
|
// color: Color.fromARGB(1, 209, 174, 174).withAlpha(0),
|
||||||
),
|
// ),
|
||||||
child: Center(
|
// child: Center(
|
||||||
child: DropdownButtonHideUnderline(
|
// child: DropdownButtonHideUnderline(
|
||||||
child: DropdownButton2(
|
// child: DropdownButton2(
|
||||||
customButton: Container(
|
// customButton: Container(
|
||||||
height: 50,
|
// height: 50,
|
||||||
width: 50,
|
// width: 50,
|
||||||
decoration: BoxDecoration(
|
// decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(10),
|
// borderRadius: BorderRadius.circular(10),
|
||||||
image: const DecorationImage(
|
// image: const DecorationImage(
|
||||||
image: AssetImage('assets/images/luffy-u.png'),
|
// image: AssetImage('assets/images/luffy-u.png'),
|
||||||
fit: BoxFit.cover,
|
// fit: BoxFit.cover,
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
openWithLongPress: false,
|
// openWithLongPress: false,
|
||||||
items: [
|
// items: [
|
||||||
..._MenuItems.firstItems.map(
|
// ..._MenuItems.firstItems.map(
|
||||||
(item) => DropdownMenuItem<_MenuItem>(
|
// (item) => DropdownMenuItem<_MenuItem>(
|
||||||
value: item,
|
// value: item,
|
||||||
child: _MenuItems.buildItem(item),
|
// child: _MenuItems.buildItem(item),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
// const DropdownMenuItem<Divider>(
|
// // const DropdownMenuItem<Divider>(
|
||||||
// enabled: false,
|
// // enabled: false,
|
||||||
// // height: 8,
|
// // // height: 8,
|
||||||
// child: Divider(),
|
// // child: Divider(),
|
||||||
// ),
|
// // ),
|
||||||
// ..._MenuItems.secondItems.map(
|
// // ..._MenuItems.secondItems.map(
|
||||||
// (item) => DropdownMenuItem<_MenuItem>(
|
// // (item) => DropdownMenuItem<_MenuItem>(
|
||||||
// value: item,
|
// // value: item,
|
||||||
// // height: 48,
|
// // // height: 48,
|
||||||
// child: _MenuItems.buildItem(item),
|
// // child: _MenuItems.buildItem(item),
|
||||||
// ),
|
// // ),
|
||||||
// ),
|
// // ),
|
||||||
],
|
// ],
|
||||||
onChanged: (value) {
|
// onChanged: (value) {
|
||||||
if (value != null) {
|
// if (value != null) {
|
||||||
_MenuItems.onChanged(context, value);
|
// _MenuItems.onChanged(context, value);
|
||||||
} else {
|
// } else {
|
||||||
print("null");
|
// print("null");
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
buttonStyleData: ButtonStyleData(
|
// buttonStyleData: ButtonStyleData(
|
||||||
decoration: BoxDecoration(
|
// decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(40),
|
// borderRadius: BorderRadius.circular(40),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
dropdownStyleData: DropdownStyleData(
|
// dropdownStyleData: DropdownStyleData(
|
||||||
width: 140,
|
// width: 140,
|
||||||
padding: EdgeInsets.zero,
|
// padding: EdgeInsets.zero,
|
||||||
maxHeight: 150,
|
// maxHeight: 150,
|
||||||
// padding: const EdgeInsets.symmetric(vertical: 6),
|
// // padding: const EdgeInsets.symmetric(vertical: 6),
|
||||||
decoration: BoxDecoration(
|
// decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(4),
|
// borderRadius: BorderRadius.circular(4),
|
||||||
color: Color.fromRGBO(2, 104, 17, 1).withAlpha(50),
|
// color: Color.fromRGBO(2, 104, 17, 1).withAlpha(50),
|
||||||
),
|
// ),
|
||||||
offset: const Offset(40, -4),
|
// offset: const Offset(40, -4),
|
||||||
),
|
// ),
|
||||||
menuItemStyleData: MenuItemStyleData(
|
// menuItemStyleData: MenuItemStyleData(
|
||||||
height: 35,
|
// height: 35,
|
||||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
// padding: EdgeInsets.symmetric(horizontal: 10),
|
||||||
),
|
// ),
|
||||||
// menuItemStyleData: const MenuItemStyleData(
|
// // menuItemStyleData: const MenuItemStyleData(
|
||||||
// padding: EdgeInsets.only(left: 16, right: 16),
|
// // padding: EdgeInsets.only(left: 16, right: 16),
|
||||||
// ),
|
// // ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
Positioned(
|
Positioned(
|
||||||
top: 10,
|
top: 10,
|
||||||
left: 10,
|
left: 10,
|
||||||
@ -247,10 +256,17 @@ 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: -150, //bottomPadding * 32,
|
||||||
left: MediaQuery.of(context).size.width / 2 - 38,
|
// bottom: sunRiseCurve(
|
||||||
|
// screenWidth,
|
||||||
|
// ),
|
||||||
|
bottom:
|
||||||
|
isLandscape
|
||||||
|
? bottomOffset.clamp(-200.0, -50.0)
|
||||||
|
: bottomPadding * 10,
|
||||||
|
left: (screenWidth - buttonScanSize) / 2 - 5,
|
||||||
child: Transform.translate(
|
child: Transform.translate(
|
||||||
offset: Offset(0, -20),
|
offset: Offset(0, -30),
|
||||||
child: ScanButton(),
|
child: ScanButton(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user