68 lines
2.1 KiB
Dart
68 lines
2.1 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/screens/profile/profile_screen.dart';
|
|
|
|
class GeneralDrawerHeader extends StatelessWidget {
|
|
const GeneralDrawerHeader({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ListTile(
|
|
onTap: () {
|
|
Navigator.pop(context);
|
|
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 ??
|
|
context.read<MyUserBloc>().state.user!.phone ??
|
|
'',
|
|
style: const TextStyle(fontSize: 12),
|
|
),
|
|
leading: context.read<MyUserBloc>().state.user!.picture == "" ||
|
|
context.read<MyUserBloc>().state.user!.picture == null
|
|
? 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),
|
|
);
|
|
}
|
|
}
|