98 lines
3.3 KiB
Dart
98 lines
3.3 KiB
Dart
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';
|
|
|
|
class GeneralDrawer extends StatefulWidget {
|
|
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);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
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',
|
|
// ),
|
|
// )
|
|
// ],
|
|
// ),
|
|
// )
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|