mobile
This commit is contained in:
parent
a3c27a23b9
commit
85a2655457
9
.gitignore
vendored
9
.gitignore
vendored
@ -43,3 +43,12 @@ app.*.map.json
|
|||||||
/android/app/debug
|
/android/app/debug
|
||||||
/android/app/profile
|
/android/app/profile
|
||||||
/android/app/release
|
/android/app/release
|
||||||
|
|
||||||
|
# Place unity project here
|
||||||
|
/unity
|
||||||
|
|
||||||
|
# flutter will place unity Library dependency here
|
||||||
|
/unityLibrary
|
||||||
|
|
||||||
|
# unityLibrary will place build here
|
||||||
|
/android/unityLibrary
|
||||||
@ -28,8 +28,8 @@ class MenuButton extends StatelessWidget {
|
|||||||
IconButton(
|
IconButton(
|
||||||
icon: SvgPicture.asset(
|
icon: SvgPicture.asset(
|
||||||
icon ?? '',
|
icon ?? '',
|
||||||
width: w ?? 28,
|
width: w ?? 24,
|
||||||
height: h ?? 28,
|
height: h ?? 24,
|
||||||
// allowDrawingOutsideViewBox: true,
|
// allowDrawingOutsideViewBox: true,
|
||||||
colorFilter: ColorFilter.mode(
|
colorFilter: ColorFilter.mode(
|
||||||
(isSelected ?? false)
|
(isSelected ?? false)
|
||||||
@ -48,6 +48,7 @@ class MenuButton extends StatelessWidget {
|
|||||||
? Color.fromARGB(255, 216, 182, 10)
|
? Color.fromARGB(255, 216, 182, 10)
|
||||||
: Color.fromARGB(255, 239, 224, 232),
|
: Color.fromARGB(255, 239, 224, 232),
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 10,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
14
lib/helpers/image_picker_mobile.dart
Normal file
14
lib/helpers/image_picker_mobile.dart
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
import 'package:image_picker/image_picker.dart';
|
||||||
|
|
||||||
|
class ImagePickerHelper {
|
||||||
|
Future<dynamic> pickImage() async {
|
||||||
|
final ImagePicker picker = ImagePicker();
|
||||||
|
final XFile? pickedFile = await picker.pickImage(source: ImageSource.gallery);
|
||||||
|
|
||||||
|
if (pickedFile != null) {
|
||||||
|
File imageFile = File(pickedFile.path);
|
||||||
|
return imageFile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
5
lib/helpers/image_picker_stub.dart
Normal file
5
lib/helpers/image_picker_stub.dart
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
class ImagePickerHelper {
|
||||||
|
Future<void> pickImage() async {
|
||||||
|
throw UnsupportedError('pickImage is not supported on this platform');
|
||||||
|
}
|
||||||
|
}
|
||||||
35
lib/helpers/image_picker_web.dart
Normal file
35
lib/helpers/image_picker_web.dart
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// import 'package:image_picker_web/image_picker_web.dart';
|
||||||
|
// import 'dart:typed_data';
|
||||||
|
|
||||||
|
// class ImagePickerHelper {
|
||||||
|
// Future<dynamic> pickImage() async {
|
||||||
|
// Uint8List? bytesFromPicker = await ImagePickerWeb.getImageAsBytes();
|
||||||
|
// if (bytesFromPicker != null) {
|
||||||
|
// return bytesFromPicker;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
import 'dart:typed_data';
|
||||||
|
import 'dart:html' as html;
|
||||||
|
|
||||||
|
class ImagePickerHelper {
|
||||||
|
Future<void> pickImage() async {
|
||||||
|
html.FileUploadInputElement uploadInput = html.FileUploadInputElement();
|
||||||
|
uploadInput.accept = 'image/*';
|
||||||
|
uploadInput.click();
|
||||||
|
|
||||||
|
uploadInput.onChange.listen((event) async {
|
||||||
|
final file = uploadInput.files!.first;
|
||||||
|
final reader = html.FileReader();
|
||||||
|
|
||||||
|
reader.readAsArrayBuffer(file);
|
||||||
|
reader.onLoadEnd.listen((event) {
|
||||||
|
Uint8List imageBytes = reader.result as Uint8List;
|
||||||
|
if (imageBytes != null) {
|
||||||
|
return imageBytes;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
3
lib/helpers/pick_image.dart
Normal file
3
lib/helpers/pick_image.dart
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export 'image_picker_stub.dart'
|
||||||
|
if (dart.library.html) 'image_picker_web.dart'
|
||||||
|
if (dart.library.io) 'image_picker_mobile.dart';
|
||||||
@ -1,5 +1,6 @@
|
|||||||
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/providers/menu_selection_provider.dart';
|
import 'package:freekake/providers/menu_selection_provider.dart';
|
||||||
import 'package:freekake/providers/point_provider.dart';
|
import 'package:freekake/providers/point_provider.dart';
|
||||||
|
|||||||
@ -16,6 +16,7 @@ class HomeScreen extends StatefulWidget {
|
|||||||
class _HomeScreenState extends State<HomeScreen> {
|
class _HomeScreenState extends State<HomeScreen> {
|
||||||
final String username = "luffy01";
|
final String username = "luffy01";
|
||||||
// Image image
|
// Image image
|
||||||
|
late UnityWidgetController _unityWidgetController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -215,8 +216,55 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Widget _menuButton(String label, Widget icon) {
|
||||||
|
// return Expanded(
|
||||||
|
// child: Column(
|
||||||
|
// children: [
|
||||||
|
// IconButton(
|
||||||
|
// // icon: Icon(icon, color: Color.fromARGB(255, 179, 161, 170)),
|
||||||
|
// icon: icon,
|
||||||
|
// onPressed: () {},
|
||||||
|
// ),
|
||||||
|
// Text(
|
||||||
|
// label,
|
||||||
|
// style: TextStyle(
|
||||||
|
// color: Color.fromARGB(255, 239, 224, 232),
|
||||||
|
// fontWeight: FontWeight.bold,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Widget _scanButton() {
|
||||||
|
// return Expanded(
|
||||||
|
// child: Container(
|
||||||
|
// decoration: BoxDecoration(shape: BoxShape.circle, color: transparent),
|
||||||
|
// padding: EdgeInsets.all(10),
|
||||||
|
// child: IconButton(
|
||||||
|
// icon: SvgPicture.asset(
|
||||||
|
// 'icons/Scan.svg',
|
||||||
|
// width: 60,
|
||||||
|
// height: 60,
|
||||||
|
// colorFilter: ColorFilter.mode(Color(0xFFFFFFFF), BlendMode.srcIn),
|
||||||
|
// ),
|
||||||
|
// onPressed: () {},
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
Widget setHomeImage(String src, double size) {
|
Widget setHomeImage(String src, double size) {
|
||||||
return Image.asset(src, width: size);
|
return Image.asset("assets/" + src, width: size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onUnityCreated(controller) {
|
||||||
|
_unityWidgetController = controller;
|
||||||
|
}
|
||||||
|
|
||||||
|
void onUnityMessage(message) {
|
||||||
|
print('Received message from unity: ${message.toString()}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -108,7 +108,7 @@ class _PustakaScreenState extends State<PustakaScreen> {
|
|||||||
children: [
|
children: [
|
||||||
CollectionContainer(
|
CollectionContainer(
|
||||||
label: "Luffy",
|
label: "Luffy",
|
||||||
imagesrc: 'images/luffy.png',
|
imagesrc: 'assets/images/luffy.png',
|
||||||
width: 100,
|
width: 100,
|
||||||
height: 100,
|
height: 100,
|
||||||
onTapAc:
|
onTapAc:
|
||||||
|
|||||||
@ -108,7 +108,7 @@ class _PustakaScreenState extends State<PustakaScreen> {
|
|||||||
children: [
|
children: [
|
||||||
CollectionContainer(
|
CollectionContainer(
|
||||||
label: "Luffy",
|
label: "Luffy",
|
||||||
imagesrc: 'images/luffy.png',
|
imagesrc: 'assets/images/luffy.png',
|
||||||
width: 100,
|
width: 100,
|
||||||
height: 100,
|
height: 100,
|
||||||
onTapAc:
|
onTapAc:
|
||||||
|
|||||||
@ -159,7 +159,7 @@ class _PustakaScreenState extends State<PustakaScreen> {
|
|||||||
),
|
),
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
hintText: 'Search...',
|
hintText: 'Cari konten...',
|
||||||
hintStyle: TextStyle(color: Colors.grey),
|
hintStyle: TextStyle(color: Colors.grey),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -188,6 +188,7 @@ class _PustakaScreenState extends State<PustakaScreen> {
|
|||||||
final item = filteredCollections[index];
|
final item = filteredCollections[index];
|
||||||
return CollectionContainer(
|
return CollectionContainer(
|
||||||
label: item["label"]!,
|
label: item["label"]!,
|
||||||
|
lblSize: 11,
|
||||||
imageSvg: item["image"]!,
|
imageSvg: item["image"]!,
|
||||||
width: 30,
|
width: 30,
|
||||||
height: 80,
|
height: 80,
|
||||||
@ -267,9 +268,10 @@ class _PustakaScreenState extends State<PustakaScreen> {
|
|||||||
color: Colors.blueAccent,
|
color: Colors.blueAccent,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'Topic ${index + 1}',
|
'Topik ${index + 1}',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 11,
|
||||||
color: Color.fromARGB(255, 0, 0, 0),
|
color: Color.fromARGB(255, 0, 0, 0),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
211
lib/screen/saya/akun_saya copy.dart
Normal file
211
lib/screen/saya/akun_saya copy.dart
Normal file
@ -0,0 +1,211 @@
|
|||||||
|
import 'dart:typed_data';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:furibase/components/bottom_navbar.dart';
|
||||||
|
import 'package:furibase/components/main_menu.dart';
|
||||||
|
import 'package:furibase/components/scan_button.dart';
|
||||||
|
import 'package:furibase/helpers/pick_image.dart';
|
||||||
|
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||||
|
|
||||||
|
class AkunSaya extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_AkunSayaState createState() => _AkunSayaState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AkunSayaState extends State<AkunSaya> {
|
||||||
|
dynamic _profileImage;
|
||||||
|
dynamic _headerImage;
|
||||||
|
//final ImagePicker _picker = ImagePicker();
|
||||||
|
|
||||||
|
Future<void> _pickImage(bool isProfile) async {
|
||||||
|
final imagePicker = ImagePickerHelper();
|
||||||
|
dynamic pic = await imagePicker.pickImage();
|
||||||
|
|
||||||
|
if (pic != null) {
|
||||||
|
setState(() {
|
||||||
|
if (isProfile) {
|
||||||
|
_profileImage = pic;
|
||||||
|
} else {
|
||||||
|
_headerImage = pic;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text("Saya"),
|
||||||
|
backgroundColor: Color.fromARGB(225, 79, 76, 182),
|
||||||
|
),
|
||||||
|
backgroundColor: const Color.fromARGB(255, 255, 255, 255),
|
||||||
|
body: Stack(
|
||||||
|
children: [
|
||||||
|
Positioned(
|
||||||
|
bottom: 0,
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 20.0, left: 20, right: 20),
|
||||||
|
child: Container(
|
||||||
|
height: MediaQuery.of(context).size.height * 0.7,
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: const Color.fromARGB(255, 205, 202, 189),
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(20),
|
||||||
|
topRight: Radius.circular(20),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
// Header image (bisa diubah)
|
||||||
|
SizedBox(
|
||||||
|
height: 80,
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
bottomLeft: Radius.circular(40),
|
||||||
|
bottomRight: Radius.circular(40),
|
||||||
|
),
|
||||||
|
color: Color.fromARGB(225, 79, 76, 182),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 40),
|
||||||
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(20),
|
||||||
|
child: ListView(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 40),
|
||||||
|
children: [
|
||||||
|
TextFormField(
|
||||||
|
initialValue: "Cepot",
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
border: UnderlineInputBorder(),
|
||||||
|
labelText: 'Nama',
|
||||||
|
labelStyle: TextStyle(color: Colors.black),
|
||||||
|
),
|
||||||
|
style: TextStyle(color: Colors.black),
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
initialValue: "cpt09",
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
border: UnderlineInputBorder(),
|
||||||
|
labelText: 'Nama Pengguna',
|
||||||
|
labelStyle: TextStyle(color: Colors.black),
|
||||||
|
),
|
||||||
|
style: TextStyle(color: Colors.black),
|
||||||
|
),
|
||||||
|
|
||||||
|
TextFormField(
|
||||||
|
initialValue: "Jl. Sentosa jaya",
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
border: UnderlineInputBorder(),
|
||||||
|
labelText: 'Alamat',
|
||||||
|
labelStyle: TextStyle(color: Colors.black),
|
||||||
|
),
|
||||||
|
style: TextStyle(color: Colors.black),
|
||||||
|
),
|
||||||
|
|
||||||
|
TextFormField(
|
||||||
|
initialValue: "******",
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
border: UnderlineInputBorder(),
|
||||||
|
labelText: 'Kata Sandi',
|
||||||
|
labelStyle: TextStyle(color: Colors.black),
|
||||||
|
),
|
||||||
|
style: TextStyle(color: Colors.black),
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
initialValue: "+62923",
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
border: UnderlineInputBorder(),
|
||||||
|
labelText: 'No. HP',
|
||||||
|
labelStyle: TextStyle(color: Colors.black),
|
||||||
|
),
|
||||||
|
style: TextStyle(color: Colors.black),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
// Profile Picture (bisa diubah)
|
||||||
|
Positioned(
|
||||||
|
top: 25,
|
||||||
|
left: MediaQuery.of(context).size.width / 2 - 50,
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () => _pickImage(true),
|
||||||
|
child: Stack(
|
||||||
|
alignment: Alignment.bottomRight,
|
||||||
|
children: [
|
||||||
|
CircleAvatar(
|
||||||
|
radius: 50,
|
||||||
|
backgroundColor: Colors.grey[300],
|
||||||
|
backgroundImage:
|
||||||
|
_profileImage != null
|
||||||
|
? (kIsWeb
|
||||||
|
? MemoryImage(_profileImage) as ImageProvider
|
||||||
|
: FileImage(_profileImage) as ImageProvider)
|
||||||
|
: null,
|
||||||
|
child:
|
||||||
|
_profileImage == null
|
||||||
|
? Icon(Icons.person, size: 50, color: Colors.white)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
CircleAvatar(
|
||||||
|
radius: 15,
|
||||||
|
backgroundColor: Colors.blue,
|
||||||
|
child: Icon(Icons.edit, color: Colors.white, size: 15),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
Positioned(
|
||||||
|
top: 130,
|
||||||
|
left: MediaQuery.of(context).size.width / 2 - 50,
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () => _pickImage(true),
|
||||||
|
child: Stack(
|
||||||
|
alignment: Alignment.bottomRight,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Nama Akun",
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.deepPurple,
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildListItem(IconData icon, String label, {bool isLogout = false}) {
|
||||||
|
return ListTile(
|
||||||
|
leading: Icon(
|
||||||
|
icon,
|
||||||
|
color:
|
||||||
|
isLogout
|
||||||
|
? const Color.fromARGB(255, 181, 47, 47)
|
||||||
|
: const Color.fromARGB(255, 255, 255, 255),
|
||||||
|
),
|
||||||
|
title: Text(label, style: TextStyle(fontSize: 16, color: Colors.black)),
|
||||||
|
trailing: Icon(Icons.arrow_forward_ios, size: 16),
|
||||||
|
onTap: () {},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -7,7 +7,6 @@ import 'package:freekake/components/scan_button.dart';
|
|||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
// import 'package:image_picker_web/image_picker_web.dart';
|
|
||||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||||
|
|
||||||
class AkunSaya extends StatefulWidget {
|
class AkunSaya extends StatefulWidget {
|
||||||
|
|||||||
@ -12,7 +12,6 @@ import 'package:freekake/screen/saya/point_saya.dart';
|
|||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
// import 'package:image_picker_web/image_picker_web.dart';
|
|
||||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||||
|
|
||||||
class ProfileScreen extends StatefulWidget {
|
class ProfileScreen extends StatefulWidget {
|
||||||
|
|||||||
@ -59,6 +59,11 @@ dependencies:
|
|||||||
# arcore_flutter_plugin:
|
# arcore_flutter_plugin:
|
||||||
# git:
|
# git:
|
||||||
# url: https://github.com/giandifra/arcore_flutter_plugin.git
|
# url: https://github.com/giandifra/arcore_flutter_plugin.git
|
||||||
|
flutter_unity_widget: ^2022.2.1
|
||||||
|
# flutter_unity_widget:
|
||||||
|
# git:
|
||||||
|
# url: https://github.com/juicycleff/flutter-unity-view-widget.git
|
||||||
|
# ref: flutter_3.24_android_hotfix
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user