fix city
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:prosappco/blocs/auth_bloc/auth_bloc.dart';
|
|
||||||
import 'package:user_repository/user_repository.dart';
|
import 'package:user_repository/user_repository.dart';
|
||||||
|
|
||||||
part 'profile_event.dart';
|
part 'profile_event.dart';
|
||||||
|
|||||||
@@ -48,9 +48,7 @@ class _CityScreenState extends State<CityScreen> {
|
|||||||
),
|
),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
TextField(
|
||||||
padding: const EdgeInsets.only(left: 15, right: 15, bottom: 15),
|
|
||||||
child: TextField(
|
|
||||||
controller: _searchController,
|
controller: _searchController,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
_filterCities(value);
|
_filterCities(value);
|
||||||
@@ -58,6 +56,11 @@ class _CityScreenState extends State<CityScreen> {
|
|||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
hintText: 'Busca una ciudad',
|
hintText: 'Busca una ciudad',
|
||||||
prefixIcon: Icon(Icons.search),
|
prefixIcon: Icon(Icons.search),
|
||||||
|
enabledBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Colors.grey),
|
||||||
|
),
|
||||||
|
focusedBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Colors.grey),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -69,7 +72,14 @@ class _CityScreenState extends State<CityScreen> {
|
|||||||
? ListView.builder(
|
? ListView.builder(
|
||||||
itemCount: _filteredCities!.length,
|
itemCount: _filteredCities!.length,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
return ListTile(
|
return Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border(
|
||||||
|
bottom: BorderSide(
|
||||||
|
color: Colors.grey.withOpacity(0.2)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: ListTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
_filteredCities![index].cityName,
|
_filteredCities![index].cityName,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
@@ -79,12 +89,14 @@ class _CityScreenState extends State<CityScreen> {
|
|||||||
),
|
),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
"${_filteredCities![index].stateOfCity}, ${_filteredCities![index].countryOfCity}",
|
"${_filteredCities![index].stateOfCity}, ${_filteredCities![index].countryOfCity}",
|
||||||
style: const TextStyle(color: Colors.black54),
|
style:
|
||||||
|
const TextStyle(color: Colors.black54),
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pop(context,
|
Navigator.pop(context,
|
||||||
_filteredCities![index].cityName);
|
_filteredCities![index].cityName);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@@ -128,12 +140,18 @@ class ListTileShimmer extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ListTile(
|
return Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border(
|
||||||
|
bottom: BorderSide(color: Colors.grey.withOpacity(0.4)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: ListTile(
|
||||||
title: Row(
|
title: Row(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
width: MediaQuery.of(context).size.width * 0.8,
|
width: MediaQuery.of(context).size.width * 0.8,
|
||||||
height: 18.0,
|
height: 20.0,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
@@ -162,6 +180,7 @@ class ListTileShimmer extends StatelessWidget {
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
if (state.status == MyUserStatus.success) {
|
if (state.status == MyUserStatus.success) {
|
||||||
_nameController.text = state.user!.name ?? '';
|
_nameController.text = state.user!.name ?? '';
|
||||||
|
_cityController.text = state.user!.city ?? '';
|
||||||
_emailController.text = state.user!.email ?? '';
|
_emailController.text = state.user!.email ?? '';
|
||||||
_phoneController.text = state.user!.phone ?? '';
|
_phoneController.text = state.user!.phone ?? '';
|
||||||
_birthdayController.text = state.user!.birthday ?? '';
|
_birthdayController.text = state.user!.birthday ?? '';
|
||||||
@@ -291,14 +292,16 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
|
|
||||||
if (_nameController.text.isEmpty) {
|
if (_nameController.text.isEmpty) {
|
||||||
ScaffoldMessenger.of(context).clearSnackBars();
|
ScaffoldMessenger.of(context).clearSnackBars();
|
||||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Por favor, ingrese su nombre')));
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('Por favor, ingrese su nombre')));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_cityController.text.isEmpty) {
|
if (_cityController.text.isEmpty) {
|
||||||
ScaffoldMessenger.of(context).clearSnackBars();
|
ScaffoldMessenger.of(context).clearSnackBars();
|
||||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Por favor, ingrese su ciudad')));
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('Por favor, ingrese su ciudad')));
|
||||||
}
|
}
|
||||||
|
|
||||||
final myUser = state.user!.copyWith(
|
final myUser = state.user!.copyWith(
|
||||||
@@ -311,7 +314,14 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
gender: _genderController.text,
|
gender: _genderController.text,
|
||||||
);
|
);
|
||||||
|
|
||||||
context.read<ProfileBloc>().add(UpdateUserInfo(myUser: myUser, filePicture: _imageFile?.path));
|
context
|
||||||
|
.read<ProfileBloc>()
|
||||||
|
.add(UpdateUserInfo(myUser: myUser, filePicture: _imageFile?.path));
|
||||||
|
|
||||||
|
ScaffoldMessenger.of(context).clearSnackBars();
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('Información actualizada...')),
|
||||||
|
);
|
||||||
|
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user