This commit is contained in:
Felipe
2024-02-19 18:16:51 -05:00
parent 9e6f76e309
commit 997c6047bb
34 changed files with 1235 additions and 594 deletions
+75 -80
View File
@@ -1,96 +1,91 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:prosappco/blocs/my_user_bloc/my_user_bloc.dart';
import 'package:prosappco/blocs/update_user_info_bloc/update_user_info_bloc.dart';
import 'package:prosappco/components/general_drawer_header.dart';
import 'package:prosappco/components/general_drawer_item.dart';
import 'package:prosappco/screens/configuration/configuration_screen.dart';
class GeneralDrawer extends StatefulWidget {
class GeneralDrawer extends StatelessWidget {
const GeneralDrawer({super.key});
@override
State<GeneralDrawer> createState() => _GeneralDrawerState();
}
class _GeneralDrawerState extends State<GeneralDrawer> {
@override
Widget build(BuildContext context) {
return BlocListener<UpdateUserInfoBloc, UpdateUserInfoState>(
listener: (context, state) {
if (state is UploadPictureSuccess) {
setState(() {
context.read<MyUserBloc>().state.user!.picture = state.userImage;
});
}
},
child: Drawer(
backgroundColor: Theme.of(context).colorScheme.background,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const GeneralDrawerHeader(),
Divider(
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.1),
thickness: 0.5,
height: 1,
),
Expanded(
child: SingleChildScrollView(
child: Column(
children: [
GeneralDrawerItem(
icon: Icons.person_outline,
label: 'Mi Perfil',
onTap: () {
Navigator.pop(context);
},
),
],
),
return Drawer(
backgroundColor: Theme.of(context).colorScheme.background,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const GeneralDrawerHeader(),
Divider(
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.1),
thickness: 0.5,
height: 1,
),
Expanded(
child: SingleChildScrollView(
child: Column(
children: [
GeneralDrawerItem(
leading: Icons.history,
label: 'Mis servicios',
onTap: () {
Navigator.pop(context);
},
),
GeneralDrawerItem(
leading: Icons.settings_outlined,
label: 'Configuración',
onTap: () {
Navigator.pop(context);
Navigator.push(
context,
CupertinoPageRoute(
builder: (context) => const ConfigurationScreen(),
),
);
},
),
GeneralDrawerItem(
leading: Icons.help_outline,
label: 'Soporte',
onTap: () {
Navigator.pop(context);
},
),
GeneralDrawerItem(
leading: Icons.campaign_outlined,
label: 'Sugerencias',
onTap: () {
Navigator.pop(context);
},
),
],
),
),
Divider(
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.1),
thickness: 0.5,
height: 1,
),
const SizedBox(height: 15),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
backgroundColor: Theme.of(context).colorScheme.primary,
padding: const EdgeInsets.symmetric(vertical: 15),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
)),
child: const Text(
'Modo Profesional',
style: TextStyle(color: Colors.white, fontSize: 18),
),
),
Divider(
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.1),
thickness: 0.5,
height: 1,
),
const SizedBox(height: 15),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
backgroundColor: Theme.of(context).colorScheme.primary,
padding: const EdgeInsets.symmetric(vertical: 15),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
)),
child: const Text(
'Modo Profesional',
style: TextStyle(color: Colors.white, fontSize: 18),
),
),
const SizedBox(height: 15),
// Container(
// height: MediaQuery.of(context).size.height,
// color: Theme.of(context).colorScheme.background,
// child: ListView(
// children: [
// ListTile(
// onTap: () {
// context.read<SignInBloc>().add(const SignOutRequired());
// },
// title: const Text(
// 'Cerrar Sesión',
// ),
// )
// ],
// ),
// )
],
),
),
const SizedBox(height: 15),
],
),
);
}
+47 -62
View File
@@ -2,78 +2,63 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:prosappco/blocs/my_user_bloc/my_user_bloc.dart';
import 'package:prosappco/blocs/update_user_info_bloc/update_user_info_bloc.dart';
import 'package:prosappco/screens/profile/profile_screen.dart';
class GeneralDrawerHeader extends StatefulWidget {
class GeneralDrawerHeader extends StatelessWidget {
const GeneralDrawerHeader({super.key});
@override
State<GeneralDrawerHeader> createState() => _GeneralDrawerHeaderState();
}
class _GeneralDrawerHeaderState extends State<GeneralDrawerHeader> {
@override
Widget build(BuildContext context) {
return BlocListener<UpdateUserInfoBloc, UpdateUserInfoState>(
listener: (context, state) {
if (state is UploadPictureSuccess) {
setState(() {
context.read<MyUserBloc>().state.user!.picture = state.userImage;
});
}
return ListTile(
onTap: () {
Navigator.pop(context);
Navigator.push(
context,
CupertinoPageRoute(
builder: (BuildContext context) {
return const ProfileScreen();
},
),
);
},
child: ListTile(
onTap: () {
Navigator.push(
context,
CupertinoPageRoute(
builder: (BuildContext context) {
return const ProfileScreen();
},
),
);
},
title: Text(
context.read<MyUserBloc>().state.user!.name,
style: const TextStyle(fontWeight: FontWeight.bold),
),
subtitle: Text(
context.read<MyUserBloc>().state.user!.email,
style: const TextStyle(fontSize: 12),
),
leading: context.read<MyUserBloc>().state.user!.picture == ""
? Container(
width: 80,
height: 80,
decoration: BoxDecoration(
color: Colors.grey.shade300,
shape: BoxShape.circle,
),
child: Icon(
CupertinoIcons.person,
color: Colors.grey.shade400,
size: 35,
),
)
: Container(
width: 60,
height: 60,
decoration: BoxDecoration(
color: Colors.grey,
shape: BoxShape.circle,
image: DecorationImage(
image: NetworkImage(
context.read<MyUserBloc>().state.user!.picture!,
),
fit: BoxFit.cover,
title: Text(
context.read<MyUserBloc>().state.user!.name,
style: const TextStyle(fontWeight: FontWeight.bold),
),
subtitle: Text(
context.read<MyUserBloc>().state.user!.email,
style: const TextStyle(fontSize: 12),
),
leading: context.read<MyUserBloc>().state.user!.picture == ""
? Container(
width: 80,
height: 80,
decoration: BoxDecoration(
color: Colors.grey.shade300,
shape: BoxShape.circle,
),
child: Icon(
CupertinoIcons.person,
color: Colors.grey.shade400,
size: 35,
),
)
: Container(
width: 60,
height: 60,
decoration: BoxDecoration(
color: Colors.grey,
shape: BoxShape.circle,
image: DecorationImage(
image: NetworkImage(
context.read<MyUserBloc>().state.user!.picture!,
),
fit: BoxFit.cover,
),
),
trailing: const Icon(Icons.keyboard_arrow_right, color: Colors.black),
contentPadding:
const EdgeInsets.symmetric(vertical: 10, horizontal: 15),
),
),
trailing: const Icon(Icons.keyboard_arrow_right, color: Colors.black),
contentPadding: const EdgeInsets.symmetric(vertical: 10, horizontal: 15),
);
}
}
+19 -7
View File
@@ -2,13 +2,17 @@ import 'package:flutter/material.dart';
class GeneralDrawerItem extends StatelessWidget {
final String label;
final IconData icon;
final IconData? leading;
final bool trailing;
final Color? color;
final VoidCallback onTap;
const GeneralDrawerItem({
super.key,
required this.label,
required this.icon,
this.leading,
this.trailing = false,
this.color,
required this.onTap,
});
@@ -16,13 +20,21 @@ class GeneralDrawerItem extends StatelessWidget {
Widget build(BuildContext context) {
return ListTile(
onTap: onTap,
leading: Icon(
icon,
color: Colors.black,
),
leading: leading == null
? null
: Icon(
leading,
color: Colors.black,
),
trailing: trailing
? const Icon(
Icons.keyboard_arrow_right,
color: Colors.black,
)
: null,
title: Text(
label,
style: const TextStyle(fontSize: 15),
style: TextStyle(fontSize: 15, color: color),
),
);
}
@@ -0,0 +1,10 @@
import 'package:flutter/material.dart';
class GeneralPrimaryButton extends StatelessWidget {
const GeneralPrimaryButton({super.key});
@override
Widget build(BuildContext context) {
return Container();
}
}