This commit is contained in:
Felipe
2024-02-16 11:14:01 -05:00
parent 9ca2b62be3
commit d9d6b50d78
15 changed files with 452 additions and 294 deletions
+101 -97
View File
@@ -1,7 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:image_picker/image_picker.dart';
import 'package:prosappco/blocs/my_user_bloc/my_user_bloc.dart';
import 'package:prosappco/blocs/sing_in_bloc/sign_in_bloc.dart';
import 'package:prosappco/blocs/update_user_info_bloc/update_user_info_bloc.dart';
@@ -26,114 +25,119 @@ class _HomeScreenState extends State<HomeScreen> {
}
},
child: Scaffold(
backgroundColor: Theme.of(context).colorScheme.background,
drawer: BlocBuilder<MyUserBloc, MyUserState>(builder: (context, state) {
if (state.status == MyUserStatus.success) {
return Drawer(
backgroundColor: Theme.of(context).colorScheme.background,
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Material(
color: Theme.of(context).colorScheme.primary,
child: InkWell(
onTap: () {
Navigator.push(
context,
CupertinoPageRoute(
builder: (context) => const ProfileScreen(),
backgroundColor: Theme.of(context).colorScheme.background,
drawer:
BlocBuilder<MyUserBloc, MyUserState>(builder: (context, state) {
if (state.status == MyUserStatus.success) {
return Drawer(
backgroundColor: Theme.of(context).colorScheme.background,
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Material(
color: Theme.of(context).colorScheme.primary,
child: InkWell(
onTap: () {
Navigator.push(
context,
CupertinoPageRoute(
builder: (context) => const ProfileScreen(),
),
);
},
child: Container(
padding: EdgeInsets.only(
top: 20 + MediaQuery.of(context).padding.top,
bottom: 20,
),
);
},
child: Container(
padding: EdgeInsets.only(
top: 20 + MediaQuery.of(context).padding.top,
bottom: 20,
),
child: Column(
children: [
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: 80,
height: 80,
decoration: BoxDecoration(
color: Colors.grey,
shape: BoxShape.circle,
image: DecorationImage(
image: NetworkImage(
state.user!.picture!,
child: Column(
children: [
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: 80,
height: 80,
decoration: BoxDecoration(
color: Colors.grey,
shape: BoxShape.circle,
image: DecorationImage(
image: NetworkImage(
state.user!.picture!,
),
fit: BoxFit.cover,
),
fit: BoxFit.cover,
),
),
),
const SizedBox(height: 12),
Text(
context.read<MyUserBloc>().state.user!.name,
style: const TextStyle(
fontSize: 24,
color: Colors.white,
const SizedBox(height: 12),
Text(
state.user!.name,
style: const TextStyle(
fontSize: 24,
color: Colors.white,
),
),
),
Text(
state.user!.email,
style: const TextStyle(
fontSize: 15,
color: Colors.white,
),
)
],
Text(
state.user!.email,
style: const TextStyle(
fontSize: 15,
color: Colors.white,
),
)
],
),
),
),
),
),
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',
),
)
],
),
)
],
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',
),
)
],
),
)
],
),
),
),
);
} else {
return Drawer(
);
} else {
return Drawer(
backgroundColor: Theme.of(context).colorScheme.background,
child: const Center(
child: CircularProgressIndicator(),
));
}
}),
appBar: AppBar(),
body: const Placeholder(),
),
),
);
}
}),
appBar: AppBar(),
body: Center(
child: Text(
context.read<MyUserBloc>().state.user?.name ?? 'null',
),
)),
);
}
}