Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update on edit profile page #175

Merged
merged 3 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added app/assets/images/beaver.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,18 @@ class UserRegisterBloc extends Bloc<UserRegisterEvent, RegisterFormState> {
email: BlocFormItem(
value: value['email'].toString(),
),
// birthDate: BlocFormItem(
// value: value['birth_date'].toString(),
// ),
birthDate: BlocFormItem(
value: value['birth_date'].toString(),
),
school: BlocFormItem(
value: value['school'].toString(),
),
province: BlocFormItem(
value: value['province'].toString(),
),
// bebrasBiro: BlocFormItem(
// value: value['bebras_biro'].toString(),
// ),
bebrasBiro: BlocFormItem(
value: value['bebras_biro'].toString(),
),
),
),
},
Expand Down Expand Up @@ -199,10 +199,10 @@ class UserRegisterBloc extends Bloc<UserRegisterEvent, RegisterFormState> {
if (state.formKey!.currentState!.validate()) {
final email = state.email.value;
final name = state.name.value;
// final birthDate = state.birthDate.value;
final birthDate = state.birthDate.value;
final school = state.school.value;
final province = state.province.value;
// final bebrasBiro = state.bebrasBiro.value;
final bebrasBiro = state.bebrasBiro.value;

emit(UserRegisterLoadingState());

Expand All @@ -211,10 +211,10 @@ class UserRegisterBloc extends Bloc<UserRegisterEvent, RegisterFormState> {
userId: userId,
email: email,
name: name,
// birthDate: birthDate,
birthDate: birthDate,
school: school,
province: province,
// bebrasBiro: bebrasBiro,
bebrasBiro: bebrasBiro,
);
emit(UserRegisterSuccessState());
} catch (e) {
Expand All @@ -233,10 +233,10 @@ class UserRegisterBloc extends Bloc<UserRegisterEvent, RegisterFormState> {
if (state.formKey!.currentState!.validate()) {
final email = state.email.value;
final name = state.name.value;
// final birthDate = state.birthDate.value;
final birthDate = state.birthDate.value;
final school = state.school.value;
final province = state.province.value;
// final bebrasBiro = state.bebrasBiro.value;
final bebrasBiro = state.bebrasBiro.value;

emit(UserRegisterLoadingState());

Expand All @@ -245,10 +245,10 @@ class UserRegisterBloc extends Bloc<UserRegisterEvent, RegisterFormState> {
userId: userId,
email: email,
name: name,
// birthDate: birthDate,
birthDate: birthDate,
school: school,
province: province,
// bebrasBiro: bebrasBiro,
bebrasBiro: bebrasBiro,
);
emit(UserRegisterSuccessState());
} catch (e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';

import '../../../../../core/bases/widgets/atoms/button.dart';
import '../../../../../core/bases/widgets/layout/bebras_scaffold.dart';
import '../../../../../core/constants/assets.dart';
import '../../../../../core/theme/font_theme.dart';
Expand All @@ -13,5 +15,9 @@ import '../widgets/biro_bebras_dropdown.dart';
import '../widgets/custom_date_picker.dart';
import '../widgets/custom_text_field.dart';
import '../widgets/province_dropdown.dart';
import 'v2/widgets/biro_bebras_dropdownV2.dart';
import 'v2/widgets/custom_date_pickerV2.dart';
import 'v2/widgets/custom_text_fieldV2.dart';
import 'v2/widgets/province_dropdownV2.dart';

part 'register_page.dart';
Original file line number Diff line number Diff line change
Expand Up @@ -66,32 +66,62 @@ class _RegisterPageState extends State<RegisterPage> {
body: Padding(
padding: const EdgeInsets.only(
left: 16,
top: 30,
top: 20,
right: 16,
),
child: Form(
key: state.formKey,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Image.asset(
Assets.bebrasPandaiText,
height: 40,
Row(
children: [
GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: Container(
child: Icon(Icons.arrow_back),
),
),
Flexible(
child: Container(
child: Center(
child: const Text('Edit Profil',
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black,
)),
),
),
)
],
),
const SizedBox(
height: 40,
height: 10,
),
Container(
padding: const EdgeInsets.all(8),
child: Text(
'Data Diri',
style: FontTheme.blackSubtitleBold(),
Column(children: [
CircleAvatar(
maxRadius: 50,
backgroundColor: Colors.grey.shade200,
backgroundImage: const AssetImage(
'assets/images/beaver.png',
),
),
),
]),
const SizedBox(
height: 8,
height: 10,
),
CustomTextField(
Text(
'Email',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 12,
),
),
CustomTextFieldV2(
'Email',
(value) {
BlocProvider.of<UserRegisterBloc>(context).add(
Expand All @@ -103,7 +133,14 @@ class _RegisterPageState extends State<RegisterPage> {
},
state.email.value,
),
CustomTextField(
Text(
'Nama',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 10,
),
),
CustomTextFieldV2(
'Nama',
(value) {
BlocProvider.of<UserRegisterBloc>(context)
Expand All @@ -114,24 +151,56 @@ class _RegisterPageState extends State<RegisterPage> {
},
state.name.value,
),
// CustomDatePicker(
// 'Tanggal Lahir',
// Text(
// 'Tempat Lahir',
// style: TextStyle(
// fontWeight: FontWeight.bold,
// fontSize: 12,
// ),
// ),
// CustomTextFieldV2(
// 'Tempat Lahir',
// (value) {
// BlocProvider.of<UserRegisterBloc>(context).add(
// BirthDateEvent(
// birthDate: BlocFormItem(
// value: value,
// ),
// ),
// );
// BlocProvider.of<UserRegisterBloc>(context)
// .add(NameEvent(name: BlocFormItem(value: value)));
// },
// (val) {
// return state.birthDate.error;
// return state.name.error;
// },
// state.birthDate.value,
// state.name.value,
// ),
CustomTextField(
'Sekolah',
Text(
'Date',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 12,
),
),
CustomDatePickerV2(
'Date',
(value) {
BlocProvider.of<UserRegisterBloc>(context).add(
BirthDateEvent(
birthDate: BlocFormItem(
value: value,
),
),
);
},
(val) {
return state.birthDate.error;
},
state.birthDate.value,
),
Text(
'Asal Sekolah',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 12,
),
),
CustomTextFieldV2(
'Asal Sekolah',
(value) {
BlocProvider.of<UserRegisterBloc>(context).add(
SchoolEvent(
Expand All @@ -146,8 +215,14 @@ class _RegisterPageState extends State<RegisterPage> {
},
state.school.value,
),
ProvinceDropdown(
'Provinsi',
Text('Provinsi',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 12,
)),
const SizedBox(height: 3),
ProvinceDropdownV2(
// 'Provinsi',
(value) {
BlocProvider.of<UserRegisterBloc>(context).add(
ProvinceEvent(
Expand All @@ -164,25 +239,32 @@ class _RegisterPageState extends State<RegisterPage> {
? state.province.value
: 'Provinsi',
),
// BiroBebrasDropdown(
// 'Bebras Biro',
// (value) {
// BlocProvider.of<UserRegisterBloc>(context).add(
// BebrasBiroEvent(
// bebrasBiro: BlocFormItem(
// value: value,
// ),
// ),
// );
// },
// (val) {
// return state.bebrasBiro.error;
// },
// state.bebrasBiro.value.isNotEmpty
// ? state.bebrasBiro.value
// : 'Bebras Biro',
// ),
const SizedBox(height: 20),
Text(
'Biro Bebras',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 12,
),
),
BiroBebrasDropdownV2(
'Bebras Biro',
(value) {
BlocProvider.of<UserRegisterBloc>(context).add(
BebrasBiroEvent(
bebrasBiro: BlocFormItem(
value: value,
),
),
);
},
(val) {
return state.bebrasBiro.error;
},
state.bebrasBiro.value.isNotEmpty
? state.bebrasBiro.value
: 'Bebras Biro',
),
const SizedBox(height: 5),
BlocConsumer<UserRegisterBloc, RegisterFormState>(
bloc: _userRegisterBloc,
listener: (context, state) {
Expand Down Expand Up @@ -210,10 +292,10 @@ class _RegisterPageState extends State<RegisterPage> {
return ElevatedButton(
style: ElevatedButton.styleFrom(
fixedSize: Size(size.width, 45),
backgroundColor: Colors.black,
backgroundColor: Colors.lightBlue,
foregroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
borderRadius: BorderRadius.circular(5),
),
),
onPressed: () {
Expand All @@ -229,7 +311,7 @@ class _RegisterPageState extends State<RegisterPage> {
},
child: Text(
widget.isUpdateProfile == 'true'
? 'Perbarui'
? 'Simpan'
: 'Daftar',
style:
const TextStyle(fontWeight: FontWeight.w600),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ import 'widgets/custom_date_pickerV2.dart';
import 'widgets/custom_text_fieldV2.dart';
import 'widgets/province_dropdownV2.dart';

part 'register_page.dart';
// part 'register_page.dart';
Loading
Loading