This commit is contained in:
='fauz
2025-04-09 16:28:42 +07:00
commit 64e1abb8db
199 changed files with 10265 additions and 0 deletions
+225
View File
@@ -0,0 +1,225 @@
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:image_picker/image_picker.dart';
import 'dart:io';
import 'package:image_picker_web/image_picker_web.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 {
if (kIsWeb) {
Uint8List? bytesFromPicker = await ImagePickerWeb.getImageAsBytes();
if (bytesFromPicker != null) {
setState(() {
if (isProfile) {
_profileImage = bytesFromPicker;
} else {
_headerImage = bytesFromPicker;
}
});
}
} else {
final pickedFile = await _picker.pickImage(source: ImageSource.gallery);
if (pickedFile != null) {
setState(() {
if (isProfile) {
_profileImage = File(pickedFile.path);
} else {
_headerImage = File(pickedFile.path);
}
});
}
}
}
@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: () {},
);
}
}
+209
View File
@@ -0,0 +1,209 @@
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.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/screen/saya/akun_saya.dart';
import 'package:image_picker/image_picker.dart';
import 'dart:io';
import 'package:image_picker_web/image_picker_web.dart';
import 'package:flutter/foundation.dart' show kIsWeb;
class ProfileScreenCopy extends StatefulWidget {
@override
_ProfileScreenState createState() => _ProfileScreenState();
}
class _ProfileScreenState extends State<ProfileScreenCopy> {
// File? _profileImage;
// File? _headerImage;
// final ImagePicker _picker = ImagePicker();
dynamic _profileImage;
dynamic _headerImage;
final ImagePicker _picker = ImagePicker();
Future<void> _pickImage(bool isProfile) async {
if (kIsWeb) {
Uint8List? bytesFromPicker = await ImagePickerWeb.getImageAsBytes();
if (bytesFromPicker != null) {
setState(() {
if (isProfile) {
_profileImage = bytesFromPicker;
} else {
_headerImage = bytesFromPicker;
}
});
}
} else {
final pickedFile = await _picker.pickImage(source: ImageSource.gallery);
if (pickedFile != null) {
setState(() {
if (isProfile) {
_profileImage = File(pickedFile.path);
} else {
_headerImage = File(pickedFile.path);
}
});
}
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color.fromARGB(255, 159, 156, 156),
body: Stack(
children: [
Stack(
children: [
Positioned(
bottom: 0,
left: 0,
right: 0,
child: SizedBox(height: 85, child: BottomNavbar()),
),
],
),
Column(
children: [
// Header image (bisa diubah)
GestureDetector(
onTap: () => _pickImage(false),
child: Stack(
children: [
Container(
height: 200,
width: double.infinity,
decoration: BoxDecoration(
image: DecorationImage(
image:
_headerImage != null
? (kIsWeb
? MemoryImage(_headerImage)
as ImageProvider
: FileImage(_headerImage)
as ImageProvider)
: AssetImage('images/background.jpeg'),
fit: BoxFit.cover,
),
),
),
],
),
),
SizedBox(height: 80),
Expanded(
child: ListView(
padding: EdgeInsets.symmetric(horizontal: 20),
children: [
_buildListItem(Icons.person, "Akun", () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => AkunSaya()),
);
}),
_buildListItem(Icons.person, "Data Diri", () => {}),
_buildListItem(
Icons.lock,
"Kata Sandi",
() => {},
), // bisa diubah disini
_buildListItem(Icons.language, "Bahasa", () => {}),
_buildListItem(
Icons.logout,
"Keluar",
isLogout: true,
() => {},
),
],
),
),
],
),
// Profile Picture (bisa diubah)
Positioned(
top: 140,
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
// ? FileImage(_profileImage!)
// : 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),
// ),
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),
),
],
),
),
),
// Bottom Navigation Bar
Positioned(bottom: 0, left: 0, right: 0, child: MainMenu()),
Positioned(
bottom: 1,
left: MediaQuery.of(context).size.width / 2 - 48,
child: Transform.translate(
offset: Offset(0, -20),
child: ScanButton(),
),
),
],
),
);
}
Widget _buildListItem(
IconData icon,
String label,
VoidCallback onTap, {
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: onTap,
);
}
}
+375
View File
@@ -0,0 +1,375 @@
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.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/components/topbar_container.dart';
import 'package:furibase/screen/saya/akun_saya.dart';
import 'package:image_picker/image_picker.dart';
import 'dart:io';
import 'package:image_picker_web/image_picker_web.dart';
import 'package:flutter/foundation.dart' show kIsWeb;
class ProfileScreen extends StatefulWidget {
@override
_ProfileScreenState createState() => _ProfileScreenState();
}
class _ProfileScreenState extends State<ProfileScreen> {
// File? _profileImage;
// File? _headerImage;
// final ImagePicker _picker = ImagePicker();
dynamic _profileImage;
dynamic _headerImage;
final ImagePicker _picker = ImagePicker();
Future<void> _pickImage(bool isProfile) async {
if (kIsWeb) {
Uint8List? bytesFromPicker = await ImagePickerWeb.getImageAsBytes();
if (bytesFromPicker != null) {
setState(() {
if (isProfile) {
_profileImage = bytesFromPicker;
} else {
_headerImage = bytesFromPicker;
}
});
}
} else {
final pickedFile = await _picker.pickImage(source: ImageSource.gallery);
if (pickedFile != null) {
setState(() {
if (isProfile) {
_profileImage = File(pickedFile.path);
} else {
_headerImage = File(pickedFile.path);
}
});
}
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color.fromARGB(255, 255, 255, 255),
body: Stack(
children: [
//Top Bar
Positioned(
top: 0,
left: 0,
right: 0,
child: SizedBox(height: 70, child: TopbarContainer()),
),
SingleChildScrollView(
child: Column(
children: [
// Header image (bisa diubah)
SizedBox(height: 80),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20.0,
vertical: 5,
),
child: Container(
decoration: BoxDecoration(
color: const Color.fromARGB(255, 241, 238, 238),
borderRadius: BorderRadius.vertical(
top: Radius.circular(20),
bottom: Radius.circular(20),
),
boxShadow: [
BoxShadow(
color: Colors.grey.withValues(alpha: 0.8),
spreadRadius: 1,
blurRadius: 1,
offset: Offset(0, 3), // changes position of shadow
),
],
),
child: ListView(
shrinkWrap: true,
padding: EdgeInsets.symmetric(horizontal: 0),
children: [
Padding(
padding: const EdgeInsets.all(0.0),
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 0,
vertical: 15,
),
height: 100,
width: 60,
color: Color.fromARGB(0, 1, 10, 225),
child: // Profile Picture (bisa diubah)
Row(
children: [
Positioned(
top: 0,
child: GestureDetector(
onTap: () => _pickImage(true),
child: Stack(
alignment: Alignment.centerLeft,
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: 20,
// backgroundColor: Colors.blue,
// child: Icon(
// Icons.edit,
// color: Colors.white,
// size: 15,
// ),
// ),
],
),
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 15),
Row(
children: [
Text(
"Name",
style: TextStyle(
color: Colors.blueAccent,
),
),
],
),
Row(
children: [
Text(
"Edit Profile",
style: TextStyle(
color: Colors.blueAccent,
),
),
],
),
],
),
],
),
),
),
_buildListItem(Icons.person, "Akun", () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => AkunSaya()),
);
}),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 25.0),
child: Divider(height: 0),
),
_buildListItem(Icons.person, "Data Diri", () => {}),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 25.0),
child: Divider(height: 0),
),
_buildListItem(Icons.person, "Point Saya", () => {}),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 25.0,
vertical: 0,
),
child: Divider(height: 0),
),
SizedBox(height: 20),
],
),
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 5),
child: Container(
decoration: BoxDecoration(
color: const Color.fromARGB(255, 241, 238, 238),
borderRadius: BorderRadius.vertical(
top: Radius.circular(20),
bottom: Radius.circular(20),
),
boxShadow: [
BoxShadow(
color: Colors.grey.withValues(alpha: 0.8),
spreadRadius: 1,
blurRadius: 1,
offset: Offset(0, 3), // changes position of shadow
),
],
),
child: Column(
children: [
_buildListItem(
Icons.lock,
"FAQ",
() => {},
), // bisa diubah disini
],
),
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 5),
child: Container(
decoration: BoxDecoration(
color: const Color.fromARGB(255, 241, 238, 238),
borderRadius: BorderRadius.vertical(
top: Radius.circular(20),
bottom: Radius.circular(20),
),
boxShadow: [
BoxShadow(
color: Colors.grey.withValues(alpha: 0.8),
spreadRadius: 1,
blurRadius: 1,
offset: Offset(0, 3), // changes position of shadow
),
],
),
child: Column(
children: [
_buildListItem(
Icons.language,
"Kebijakan & Privasi",
() => {},
),
],
),
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 5),
child: Container(
decoration: BoxDecoration(
color: const Color.fromARGB(255, 241, 238, 238),
borderRadius: BorderRadius.vertical(
top: Radius.circular(20),
bottom: Radius.circular(20),
),
boxShadow: [
BoxShadow(
color: Colors.grey.withValues(alpha: 0.8),
spreadRadius: 1,
blurRadius: 1,
offset: Offset(0, 3), // changes position of shadow
),
],
),
child: Column(
children: [
_buildListItem(Icons.language, "Bantuan", () => {}),
],
),
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 5),
child: Container(
decoration: BoxDecoration(
color: const Color.fromARGB(255, 241, 238, 238),
borderRadius: BorderRadius.vertical(
top: Radius.circular(20),
bottom: Radius.circular(20),
),
boxShadow: [
BoxShadow(
color: Colors.grey.withValues(alpha: 0.8),
spreadRadius: 1,
blurRadius: 1,
offset: Offset(0, 3), // changes position of shadow
),
],
),
child: Column(
children: [
_buildListItem(
Icons.logout,
"Keluar",
isLogout: true,
() => {},
),
],
),
),
),
],
),
),
// Bottom Navigation Bar
Stack(
children: [
Positioned(
bottom: 0,
left: 0,
right: 0,
child: SizedBox(height: 85, child: BottomNavbar()),
),
],
),
Positioned(bottom: 0, left: 0, right: 0, child: MainMenu()),
Positioned(
bottom: 1,
left: MediaQuery.of(context).size.width / 2 - 48,
child: Transform.translate(
offset: Offset(0, -20),
child: ScanButton(),
),
),
],
),
);
}
Widget _buildListItem(
IconData icon,
String label,
VoidCallback onTap, {
bool isLogout = false,
}) {
return ListTile(
leading: Icon(
icon,
color:
isLogout
? const Color.fromARGB(255, 181, 47, 47)
: const Color.fromARGB(255, 54, 52, 52),
),
title: Text(label, style: TextStyle(fontSize: 16, color: Colors.black)),
trailing: Icon(Icons.arrow_forward_ios, size: 16),
onTap: onTap,
);
}
}