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