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