TIF_E41202429/Mobile/patrolin/skripsi/lib/view/edit_profile_page.dart

132 lines
4.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:skripsi/config/theme.dart';
class EditProfilePage extends StatefulWidget {
const EditProfilePage({super.key});
@override
State<EditProfilePage> createState() => _EditProfilePageState();
}
class _EditProfilePageState extends State<EditProfilePage> {
final formKey = GlobalKey<FormState>();
final namaController = TextEditingController();
final numberController = TextEditingController();
final sektorController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: const Color(0xffffffff),
appBar: AppBar(
elevation: 0,
backgroundColor: const Color(0xffffffff),
leadingWidth: 70,
leading: TextButton(
onPressed: () {
Navigator.pop(context);
},
child: Text('Batal', style: robotoSedangHitam),
),
centerTitle: true,
title: Text('Edit', style: robotoSedangHitam),
actions: [
Text('Simpan', style: robotoSedangHitam),
],
),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Form(
key: formKey,
child: Column(
children: [
TextFormField(
keyboardType: TextInputType.emailAddress,
controller: namaController,
autofocus: true,
decoration: InputDecoration(
labelText: 'Nama',
labelStyle: robotoSedangHitam.copyWith(
fontWeight: FontWeight.bold,
),
hintText: 'Update Nama Anda',
enabledBorder: const UnderlineInputBorder(
borderSide: BorderSide(
color: Color(0xffC6C6C6),
),
),
focusedBorder: const UnderlineInputBorder(
borderSide: BorderSide(
color: Color(0xffC6C6C6),
),
),
),
),
SizedBox(height: 20.h),
TextFormField(
validator: (value) {
if (value == null || value.isEmpty) {
return 'Isi No. Telp';
} else if (value.length < 10 || value.length > 12) {
return 'Nomor Tidak Valid';
}
return null;
},
keyboardType: TextInputType.number,
controller: numberController,
autofocus: true,
decoration: InputDecoration(
labelText: 'No. Telp',
labelStyle:
robotoSedangHitam.copyWith(fontWeight: FontWeight.bold),
hintText: 'Update No. Telp',
enabledBorder: const UnderlineInputBorder(
borderSide: BorderSide(
color: Color(0xffC6C6C6),
),
),
focusedBorder: const UnderlineInputBorder(
borderSide: BorderSide(
color: Color(0xffC6C6C6),
),
),
),
),
SizedBox(height: 20.h),
TextFormField(
validator: (value) {
if (value == null || value.isEmpty) {
return 'Isi Sektor Anda';
}
return null;
},
keyboardType: TextInputType.streetAddress,
controller: sektorController,
autofocus: true,
decoration: InputDecoration(
labelText: 'Alamat',
labelStyle:
robotoSedangHitam.copyWith(fontWeight: FontWeight.bold),
hintText: 'Update Sektor',
enabledBorder: const UnderlineInputBorder(
borderSide: BorderSide(
color: Color(0xffC6C6C6),
),
),
focusedBorder: const UnderlineInputBorder(
borderSide: BorderSide(
color: Color(0xffC6C6C6),
),
),
),
),
],
),
),
),
);
}
}