hero
This commit is contained in:
@@ -12,7 +12,7 @@ class GeneralDrawerHeader extends StatelessWidget {
|
||||
final user = context.read<MyUserBloc>().state.user!;
|
||||
return ListTile(
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
// Navigator.pop(context);
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
@@ -43,7 +43,12 @@ class GeneralDrawerHeader extends StatelessWidget {
|
||||
imageProvider = NetworkImage(pictureUrl);
|
||||
}
|
||||
|
||||
return pictureContainerWidget(imageProvider);
|
||||
return Hero(
|
||||
tag: 'picture-profile',
|
||||
child: pictureContainerWidget(
|
||||
imageProvider,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget pictureContainerWidget(ImageProvider<Object>? imageProvider) {
|
||||
|
||||
@@ -68,114 +68,116 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
},
|
||||
label: 'Perfil',
|
||||
),
|
||||
body: BlocBuilder<MyUserBloc, MyUserState>(builder: (context, state) {
|
||||
if (state.status == MyUserStatus.success) {
|
||||
_nameController.text = state.user!.name ?? '';
|
||||
_emailController.text = state.user!.email ?? '';
|
||||
_phoneController.text = state.user!.phone ?? '';
|
||||
_birthdayController.text = state.user!.birthday ?? '';
|
||||
_genderController.text = state.user!.gender ?? '';
|
||||
body: BlocBuilder<MyUserBloc, MyUserState>(
|
||||
builder: (context, state) {
|
||||
if (state.status == MyUserStatus.success) {
|
||||
_nameController.text = state.user!.name ?? '';
|
||||
_emailController.text = state.user!.email ?? '';
|
||||
_phoneController.text = state.user!.phone ?? '';
|
||||
_birthdayController.text = state.user!.birthday ?? '';
|
||||
_genderController.text = state.user!.gender ?? '';
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 40, vertical: 20),
|
||||
child: Stack(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
pictureWidget(state, context),
|
||||
const SizedBox(height: 20.0),
|
||||
TextFormField(
|
||||
controller: _nameController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Nombre',
|
||||
prefixIcon: Icon(Icons.person),
|
||||
hintText: 'Nombre (obligatorio)',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(10.0),
|
||||
)),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.red),
|
||||
return SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 40, vertical: 20),
|
||||
child: Stack(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
pictureWidget(state, context),
|
||||
const SizedBox(height: 20.0),
|
||||
TextFormField(
|
||||
controller: _nameController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Nombre',
|
||||
prefixIcon: Icon(Icons.person),
|
||||
hintText: 'Nombre (obligatorio)',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(10.0),
|
||||
)),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.red),
|
||||
),
|
||||
focusedErrorBorder: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.red, width: 2.0),
|
||||
),
|
||||
),
|
||||
focusedErrorBorder: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.red, width: 2.0),
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Por favor, ingrese su nombre';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 20.0),
|
||||
TextFormField(
|
||||
controller: _emailController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Email',
|
||||
prefixIcon: Icon(Icons.email_rounded),
|
||||
hintText: 'Email',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(10.0),
|
||||
)),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.red),
|
||||
),
|
||||
focusedErrorBorder: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.red, width: 2.0),
|
||||
),
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Por favor, ingrese su nombre';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 20.0),
|
||||
TextFormField(
|
||||
controller: _emailController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Email',
|
||||
prefixIcon: Icon(Icons.email_rounded),
|
||||
hintText: 'Email',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(10.0),
|
||||
)),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.red),
|
||||
),
|
||||
focusedErrorBorder: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.red, width: 2.0),
|
||||
const SizedBox(height: 20.0),
|
||||
TextFormField(
|
||||
controller: _phoneController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Número de Teléfono',
|
||||
prefixIcon: Icon(Icons.phone_android_rounded),
|
||||
hintText: '+57',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(10.0),
|
||||
)),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.red),
|
||||
),
|
||||
focusedErrorBorder: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.red, width: 2.0),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20.0),
|
||||
TextFormField(
|
||||
controller: _phoneController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Número de Teléfono',
|
||||
prefixIcon: Icon(Icons.phone_android_rounded),
|
||||
hintText: '+57',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(10.0),
|
||||
)),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.red),
|
||||
),
|
||||
focusedErrorBorder: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.red, width: 2.0),
|
||||
),
|
||||
const SizedBox(height: 20.0),
|
||||
BirthdayPicker(
|
||||
onDateSelected: (birthDay) {
|
||||
_birthdayController.text =
|
||||
DateFormat('dd/MM/yyyy').format(birthDay);
|
||||
},
|
||||
controller: _birthdayController,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20.0),
|
||||
BirthdayPicker(
|
||||
onDateSelected: (birthDay) {
|
||||
_birthdayController.text =
|
||||
DateFormat('dd/MM/yyyy').format(birthDay);
|
||||
},
|
||||
controller: _birthdayController,
|
||||
),
|
||||
const SizedBox(height: 20.0),
|
||||
GenderDropdown(
|
||||
controller: _genderController,
|
||||
),
|
||||
const SizedBox(height: 60.0),
|
||||
saveButton(state, context),
|
||||
],
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 20.0),
|
||||
GenderDropdown(
|
||||
controller: _genderController,
|
||||
),
|
||||
const SizedBox(height: 60.0),
|
||||
saveButton(state, context),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -261,7 +263,10 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
});
|
||||
}
|
||||
},
|
||||
child: pictureContainerWidget(imageProvider),
|
||||
child: Hero(
|
||||
tag: 'picture-profile',
|
||||
child: pictureContainerWidget(imageProvider),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user