info pro
This commit is contained in:
@@ -4,14 +4,14 @@ import 'package:injector/injector.dart';
|
||||
import 'package:intl_phone_field/helpers.dart';
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
|
||||
class CityScreen extends StatefulWidget {
|
||||
const CityScreen({Key? key}) : super(key: key);
|
||||
class CityListScreen extends StatefulWidget {
|
||||
const CityListScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<CityScreen> createState() => _CityScreenState();
|
||||
State<CityListScreen> createState() => _CityListScreenState();
|
||||
}
|
||||
|
||||
class _CityScreenState extends State<CityScreen> {
|
||||
class _CityListScreenState extends State<CityListScreen> {
|
||||
final _searchController = TextEditingController();
|
||||
final cityRepository = Injector.appInstance.get<CityRepository>();
|
||||
List<CityUi>? _cities;
|
||||
+4
-6
@@ -1,19 +1,17 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:injector/injector.dart';
|
||||
import 'package:intl_phone_field/helpers.dart';
|
||||
import 'package:profession_repository/profession_repository.dart';
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
|
||||
class ProfessionScreen extends StatefulWidget {
|
||||
const ProfessionScreen({super.key});
|
||||
class ProfessionListScreen extends StatefulWidget {
|
||||
const ProfessionListScreen({super.key});
|
||||
|
||||
@override
|
||||
State<ProfessionScreen> createState() => _ProfessionScreenState();
|
||||
State<ProfessionListScreen> createState() => _ProfessionListScreenState();
|
||||
}
|
||||
|
||||
class _ProfessionScreenState extends State<ProfessionScreen> {
|
||||
class _ProfessionListScreenState extends State<ProfessionListScreen> {
|
||||
final _searchController = TextEditingController();
|
||||
final professionRepository = Injector.appInstance.get<ProfessionRepository>();
|
||||
List<String>? _professions;
|
||||
@@ -0,0 +1,244 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:injector/injector.dart';
|
||||
import 'package:intl_phone_field/helpers.dart';
|
||||
import 'package:professional_repository/professional_repository.dart';
|
||||
import 'package:prosappco/blocs/professional_list_bloc/professional_list_bloc.dart';
|
||||
import 'package:prosappco/screens/user/user_view_profile_screen.dart';
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
|
||||
class ProfessionalListScreen extends StatefulWidget {
|
||||
const ProfessionalListScreen({super.key});
|
||||
|
||||
@override
|
||||
State<ProfessionalListScreen> createState() => _ProfessionalListScreenState();
|
||||
}
|
||||
|
||||
class _ProfessionalListScreenState extends State<ProfessionalListScreen> {
|
||||
final _searchController = TextEditingController();
|
||||
late final ProfessionalListBloc bloc;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
bloc = Injector.appInstance.get<ProfessionalListBloc>();
|
||||
bloc.add(const ProfessionalListFetch());
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider<ProfessionalListBloc>(
|
||||
create: (context) => bloc,
|
||||
child: BlocBuilder<ProfessionalListBloc, ProfessionalListState>(
|
||||
builder: (context, state) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Selecciona un profesional'),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
TextField(
|
||||
controller: _searchController,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_searchController.text = value;
|
||||
});
|
||||
},
|
||||
decoration: const InputDecoration(
|
||||
hintText: 'Busca un profesional',
|
||||
prefixIcon: Icon(Icons.search),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey),
|
||||
),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: _body(state),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_body(ProfessionalListState state) {
|
||||
if (state is ProfessionalListSuccess) {
|
||||
final List<UserProfessional> filteredUsers;
|
||||
// filtrar por nombre
|
||||
if (_searchController.text.isNotEmpty) {
|
||||
filteredUsers = state.users
|
||||
.where((element) => removeDiacritics(element.myUser.name!)
|
||||
.toLowerCase()
|
||||
.contains(
|
||||
removeDiacritics(_searchController.text.toLowerCase())))
|
||||
.toList();
|
||||
} else {
|
||||
filteredUsers = state.users;
|
||||
}
|
||||
|
||||
if (filteredUsers.isEmpty) {
|
||||
return const Center(
|
||||
child: Text('No hay profesionales'),
|
||||
);
|
||||
}
|
||||
|
||||
return ListView.builder(
|
||||
itemCount: filteredUsers.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(color: Colors.grey.withOpacity(0.2)),
|
||||
),
|
||||
),
|
||||
child: ListTile(
|
||||
onTap: () {},
|
||||
trailing: GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (context) => UserViewProfileScreen(
|
||||
userProfessional: filteredUsers[index],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: filteredUsers[index].professionalInfo.rate.isEmpty
|
||||
? const Icon(
|
||||
Icons.keyboard_arrow_right,
|
||||
color: Colors.black,
|
||||
)
|
||||
: Column(
|
||||
children: [
|
||||
const SizedBox(height: 5),
|
||||
const Icon(
|
||||
Icons.keyboard_arrow_right,
|
||||
color: Colors.black,
|
||||
),
|
||||
Container(
|
||||
//fondo azul
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.blue[200],
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 6, vertical: 2),
|
||||
child: Text(
|
||||
'\$${filteredUsers[index].professionalInfo.rate}',
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
leading: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.shade300,
|
||||
shape: BoxShape.circle,
|
||||
image: filteredUsers[index].myUser.picture == null
|
||||
? null
|
||||
: DecorationImage(
|
||||
image: NetworkImage(
|
||||
filteredUsers[index].myUser.picture ?? ''),
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
child: filteredUsers[index].myUser.picture == null
|
||||
? Icon(
|
||||
CupertinoIcons.person,
|
||||
color: Colors.grey.shade400,
|
||||
size: 40,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
title: Text(
|
||||
'${filteredUsers[index].myUser.name ?? ''}, ${filteredUsers[index].professionalInfo.profession}',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
_disponibilidad(filteredUsers[index].professionalInfo),
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
color: Colors.blue,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
return Shimmer.fromColors(
|
||||
baseColor: Colors.grey[300]!,
|
||||
highlightColor: Colors.grey[100]!,
|
||||
child: ListView.builder(
|
||||
itemCount: 8,
|
||||
itemBuilder: (_, __) => Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(color: Colors.grey.withOpacity(0.4)),
|
||||
),
|
||||
),
|
||||
child: ListTile(
|
||||
trailing: const Icon(
|
||||
Icons.keyboard_arrow_right,
|
||||
color: Colors.black,
|
||||
),
|
||||
leading: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.shade300,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
title: Container(
|
||||
width: MediaQuery.of(context).size.width * 0.8,
|
||||
height: 20.0,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
subtitle: Container(
|
||||
width: MediaQuery.of(context).size.width * 0.3,
|
||||
height: 15.0,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String _disponibilidad(ProfessionalEntity professionalInfo) {
|
||||
if (professionalInfo.locationPreferences == LocationPreferences.office) {
|
||||
return 'Disponibilidad: en sitio.';
|
||||
}
|
||||
|
||||
if (professionalInfo.locationPreferences == LocationPreferences.delivery) {
|
||||
return 'Disponibilidad: domicilio.';
|
||||
}
|
||||
|
||||
return 'Disponibilidad: domicilio, en sitio.';
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import 'package:prosappco/blocs/auth_bloc/auth_bloc.dart';
|
||||
import 'package:prosappco/blocs/my_user_bloc/my_user_bloc.dart';
|
||||
import 'package:prosappco/blocs/professional_bloc/professional_bloc.dart';
|
||||
import 'package:prosappco/blocs/profile_bloc/profile_bloc.dart';
|
||||
import 'package:prosappco/screens/profession/profession_screen.dart';
|
||||
import 'package:prosappco/screens/lists/profession_list_screen.dart';
|
||||
import 'package:user_repository/user_repository.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
|
||||
@@ -111,7 +111,7 @@ class _ProfessionalFormScreenState extends State<ProfessionalFormScreen> {
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return const ProfessionScreen();
|
||||
return const ProfessionListScreen();
|
||||
},
|
||||
),
|
||||
);
|
||||
@@ -123,7 +123,7 @@ class _ProfessionalFormScreenState extends State<ProfessionalFormScreen> {
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Profesión',
|
||||
prefixIcon: Icon(Icons.work_rounded),
|
||||
hintText: 'Elige tu profesión',
|
||||
hintText: 'Selecciona tu profesión',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(10.0),
|
||||
@@ -303,7 +303,8 @@ class _ProfessionalFormScreenState extends State<ProfessionalFormScreen> {
|
||||
// elevation: 0,
|
||||
),
|
||||
child: Container(
|
||||
constraints: const BoxConstraints(maxWidth: 300.0, minHeight: 50.0),
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: 300.0, minHeight: 50.0),
|
||||
alignment: Alignment.center,
|
||||
child: const Text(
|
||||
'Enviar a revisión',
|
||||
|
||||
@@ -10,7 +10,7 @@ import 'package:prosappco/blocs/my_user_bloc/my_user_bloc.dart';
|
||||
import 'package:prosappco/blocs/profile_bloc/profile_bloc.dart';
|
||||
import 'package:prosappco/components/birthday_picker.dart';
|
||||
import 'package:prosappco/components/gender_dropdown.dart';
|
||||
import 'package:prosappco/screens/city/city_screen.dart';
|
||||
import 'package:prosappco/screens/lists/city_list_screen.dart';
|
||||
import 'package:prosappco/screens/profile/components/profile_item.dart';
|
||||
import 'package:prosappco/screens/profile/profile_register_email_screen.dart';
|
||||
import 'package:prosappco/screens/profile/profile_register_phone_screen.dart';
|
||||
@@ -141,7 +141,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return const CityScreen();
|
||||
return const CityListScreen();
|
||||
},
|
||||
),
|
||||
);
|
||||
@@ -153,7 +153,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Ciudad',
|
||||
prefixIcon: Icon(Icons.near_me_rounded),
|
||||
hintText: 'Elige tu ciudad',
|
||||
hintText: 'Selecciona tu ciudad',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(10.0),
|
||||
|
||||
@@ -0,0 +1,217 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:prosappco/blocs/professional_list_bloc/professional_list_bloc.dart';
|
||||
|
||||
class UserViewProfileScreen extends StatelessWidget {
|
||||
UserProfessional userProfessional;
|
||||
|
||||
UserViewProfileScreen({
|
||||
super.key,
|
||||
required this.userProfessional,
|
||||
});
|
||||
|
||||
final double bannerHeight = 200;
|
||||
final double profileHeight = 160;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Perfil Profesional'),
|
||||
),
|
||||
body: ListView(
|
||||
padding: EdgeInsets.zero,
|
||||
children: [
|
||||
buildTop(),
|
||||
buildContent(),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
// Container(
|
||||
// decoration: BoxDecoration(
|
||||
// gradient: LinearGradient(
|
||||
// colors: [
|
||||
// Colors.blue.withOpacity(1),
|
||||
// Colors.blue.withOpacity(0),
|
||||
// Colors.blue.withOpacity(0),
|
||||
// ],
|
||||
// begin: Alignment.bottomCenter,
|
||||
// end: Alignment.topCenter,
|
||||
// ),
|
||||
// ),
|
||||
}
|
||||
|
||||
Stack buildTop() {
|
||||
final top = bannerHeight - profileHeight / 2;
|
||||
final bottom = profileHeight / 2;
|
||||
return Stack(
|
||||
clipBehavior: Clip.none,
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(bottom: bottom),
|
||||
child: buildBannerImage(),
|
||||
),
|
||||
Positioned(
|
||||
top: top,
|
||||
child: buildProfileImage(),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
buildContent() {
|
||||
return Column(
|
||||
children: [
|
||||
Text(
|
||||
userProfessional.myUser.name ?? '',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontSize: 22, fontWeight: FontWeight.bold),
|
||||
),
|
||||
Text(
|
||||
'${userProfessional.professionalInfo.profession}, ${userProfessional.myUser.city ?? ''}',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontSize: 18, color: Colors.black54),
|
||||
),
|
||||
const Divider(),
|
||||
const Text(
|
||||
'Especialidades:',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
userProfessional.professionalInfo.specializations.isEmpty
|
||||
? const Text(
|
||||
'No posee especialidades',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 15, color: Colors.black45),
|
||||
)
|
||||
: Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
alignment: WrapAlignment.center,
|
||||
children: userProfessional.professionalInfo.specializations
|
||||
.map((specialization) {
|
||||
return Chip(
|
||||
label: Text(specialization),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
Visibility(
|
||||
visible: userProfessional.professionalInfo.rate.isNotEmpty,
|
||||
child: const Divider(),
|
||||
),
|
||||
Visibility(
|
||||
visible: userProfessional.professionalInfo.rate.isNotEmpty,
|
||||
child: const Text(
|
||||
'Tarifa:',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: userProfessional.professionalInfo.rate.isNotEmpty,
|
||||
child: Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
alignment: WrapAlignment.center,
|
||||
children: [
|
||||
Chip(label: Text('\$${userProfessional.professionalInfo.rate}')),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Divider(),
|
||||
const Text(
|
||||
'Metodos de pago recibidos:',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
userProfessional.professionalInfo.paymentMethods.datafono ||
|
||||
userProfessional.professionalInfo.paymentMethods.nequi ||
|
||||
userProfessional.professionalInfo.paymentMethods.transferencia
|
||||
? Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
alignment: WrapAlignment.center,
|
||||
children: [
|
||||
Visibility(
|
||||
visible: userProfessional
|
||||
.professionalInfo.paymentMethods.datafono,
|
||||
child: const Chip(label: Text('Datafono')),
|
||||
),
|
||||
Visibility(
|
||||
visible:
|
||||
userProfessional.professionalInfo.paymentMethods.nequi,
|
||||
child: const Chip(label: Text('Nequi')),
|
||||
),
|
||||
Visibility(
|
||||
visible: userProfessional
|
||||
.professionalInfo.paymentMethods.transferencia,
|
||||
child: const Chip(label: Text('Transferencia Bancaria')),
|
||||
),
|
||||
],
|
||||
)
|
||||
: const Text(
|
||||
'No hay metodos de pago registrados',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 15, color: Colors.black45),
|
||||
),
|
||||
const Divider(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Container buildProfileImage() {
|
||||
return Container(
|
||||
width: 155,
|
||||
height: 155,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color: Colors.white,
|
||||
width: 5,
|
||||
),
|
||||
),
|
||||
child: Container(
|
||||
width: 150,
|
||||
height: 150,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.shade300,
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(width: 0),
|
||||
image: userProfessional.myUser.picture == null
|
||||
? null
|
||||
: DecorationImage(
|
||||
image: NetworkImage(userProfessional.myUser.picture ?? ''),
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
child: userProfessional.myUser.picture == null
|
||||
? Icon(
|
||||
CupertinoIcons.person,
|
||||
color: Colors.grey.shade400,
|
||||
size: 40,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Container buildBannerImage() {
|
||||
return Container(
|
||||
color: Colors.grey,
|
||||
child: Image.network(
|
||||
userProfessional.professionalInfo.bannerPicture,
|
||||
fit: BoxFit.cover,
|
||||
width: double.infinity,
|
||||
height: bannerHeight,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user