update profile and html content
This commit is contained in:
@@ -18,6 +18,8 @@ class AkunSaya extends StatefulWidget {
|
||||
class _AkunSayaState extends State<AkunSaya> {
|
||||
dynamic _profileImage;
|
||||
dynamic _headerImage;
|
||||
ImageProvider? imageProvider;
|
||||
|
||||
final ImagePicker _picker = ImagePicker();
|
||||
|
||||
Future<void> _pickImage(bool isProfile) async {
|
||||
@@ -35,13 +37,19 @@ class _AkunSayaState extends State<AkunSaya> {
|
||||
} else {
|
||||
final pickedFile = await _picker.pickImage(source: ImageSource.gallery);
|
||||
if (pickedFile != null) {
|
||||
final imageFile = File(pickedFile.path);
|
||||
setState(() {
|
||||
if (isProfile) {
|
||||
_profileImage = File(pickedFile.path);
|
||||
_profileImage = imageFile;
|
||||
} else {
|
||||
_headerImage = File(pickedFile.path);
|
||||
_headerImage = imageFile;
|
||||
}
|
||||
|
||||
imageProvider =
|
||||
kIsWeb ? MemoryImage(_profileImage) : FileImage(_profileImage);
|
||||
});
|
||||
} else {
|
||||
imageProvider = AssetImage("assets/images/luffy.png");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,7 +105,7 @@ class _AkunSayaState extends State<AkunSaya> {
|
||||
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 40),
|
||||
children: [
|
||||
TextFormField(
|
||||
initialValue: "Cepot",
|
||||
initialValue: "Luffy Kun",
|
||||
decoration: const InputDecoration(
|
||||
border: UnderlineInputBorder(),
|
||||
labelText: 'Nama',
|
||||
@@ -106,7 +114,7 @@ class _AkunSayaState extends State<AkunSaya> {
|
||||
style: TextStyle(color: Colors.black),
|
||||
),
|
||||
TextFormField(
|
||||
initialValue: "cpt09",
|
||||
initialValue: "luffy01",
|
||||
decoration: const InputDecoration(
|
||||
border: UnderlineInputBorder(),
|
||||
labelText: 'Nama Pengguna',
|
||||
@@ -169,7 +177,7 @@ class _AkunSayaState extends State<AkunSaya> {
|
||||
: null,
|
||||
child:
|
||||
_profileImage == null
|
||||
? Icon(Icons.person, size: 50, color: Colors.white)
|
||||
? Image.asset("assets/images/luffy.png")
|
||||
: null,
|
||||
),
|
||||
CircleAvatar(
|
||||
@@ -184,14 +192,14 @@ class _AkunSayaState extends State<AkunSaya> {
|
||||
|
||||
Positioned(
|
||||
top: 130,
|
||||
left: MediaQuery.of(context).size.width / 2 - 50,
|
||||
left: MediaQuery.of(context).size.width / 2 - 30,
|
||||
child: GestureDetector(
|
||||
onTap: () => _pickImage(true),
|
||||
child: Stack(
|
||||
alignment: Alignment.bottomRight,
|
||||
children: [
|
||||
Text(
|
||||
"Nama Akun",
|
||||
"Luffy kun",
|
||||
style: TextStyle(
|
||||
color: Colors.deepPurple,
|
||||
fontSize: 18,
|
||||
|
||||
@@ -24,6 +24,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
// final ImagePicker _picker = ImagePicker();
|
||||
dynamic _profileImage;
|
||||
dynamic _headerImage;
|
||||
ImageProvider? imageProvider;
|
||||
final ImagePicker _picker = ImagePicker();
|
||||
|
||||
Future<void> _pickImage(bool isProfile) async {
|
||||
@@ -41,13 +42,19 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
} else {
|
||||
final pickedFile = await _picker.pickImage(source: ImageSource.gallery);
|
||||
if (pickedFile != null) {
|
||||
final imageFile = File(pickedFile.path);
|
||||
setState(() {
|
||||
if (isProfile) {
|
||||
_profileImage = File(pickedFile.path);
|
||||
_profileImage = imageFile;
|
||||
} else {
|
||||
_headerImage = File(pickedFile.path);
|
||||
_headerImage = imageFile;
|
||||
}
|
||||
|
||||
imageProvider =
|
||||
kIsWeb ? MemoryImage(_profileImage) : FileImage(_profileImage);
|
||||
});
|
||||
} else {
|
||||
imageProvider = AssetImage("assets/images/luffy.png");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -135,10 +142,8 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
: null,
|
||||
child:
|
||||
_profileImage == null
|
||||
? Icon(
|
||||
Icons.person,
|
||||
size: 50,
|
||||
color: Colors.white,
|
||||
? Image.asset(
|
||||
"assets/images/luffy.png",
|
||||
)
|
||||
: null,
|
||||
),
|
||||
@@ -162,9 +167,16 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
"Name",
|
||||
"Luffy",
|
||||
style: TextStyle(
|
||||
color: Colors.blueAccent,
|
||||
color: const Color.fromARGB(
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -172,9 +184,15 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
"Edit Profile",
|
||||
"Luffy Kun",
|
||||
style: TextStyle(
|
||||
color: Colors.blueAccent,
|
||||
color: const Color.fromARGB(
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
),
|
||||
fontWeight: FontWeight.normal,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user