after rediense
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class BirthDatePicker extends StatefulWidget {
|
||||
class BirthdayPicker extends StatefulWidget {
|
||||
final Function(DateTime) onDateSelected;
|
||||
final TextEditingController controller;
|
||||
|
||||
const BirthDatePicker(
|
||||
const BirthdayPicker(
|
||||
{super.key, required this.onDateSelected, required this.controller});
|
||||
|
||||
@override
|
||||
State<BirthDatePicker> createState() => _BirthDatePickerState();
|
||||
State<BirthdayPicker> createState() => _BirthdayPickerState();
|
||||
}
|
||||
|
||||
class _BirthDatePickerState extends State<BirthDatePicker> {
|
||||
class _BirthdayPickerState extends State<BirthdayPicker> {
|
||||
DateTime selectedDate =
|
||||
DateTime.now().subtract(const Duration(days: 365 * 20));
|
||||
|
||||
@@ -9,6 +9,7 @@ class GeneralDrawerHeader extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final user = context.read<MyUserBloc>().state.user!;
|
||||
return ListTile(
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
@@ -22,46 +23,54 @@ class GeneralDrawerHeader extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
title: Text(
|
||||
context.read<MyUserBloc>().state.user!.name ?? '',
|
||||
user.name ?? '',
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
subtitle: Text(
|
||||
context.read<MyUserBloc>().state.user!.email ??
|
||||
context.read<MyUserBloc>().state.user!.phone ??
|
||||
'',
|
||||
user.drawerLabel,
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
leading: pictureWidget(user.picture, context),
|
||||
trailing: const Icon(Icons.keyboard_arrow_right, color: Colors.black),
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 10, horizontal: 15),
|
||||
);
|
||||
}
|
||||
|
||||
Widget pictureWidget(String? pictureUrl, BuildContext context) {
|
||||
ImageProvider<Object>? imageProvider;
|
||||
|
||||
if (pictureUrl != null && pictureUrl.isNotEmpty) {
|
||||
imageProvider = NetworkImage(pictureUrl);
|
||||
}
|
||||
|
||||
return pictureContainerWidget(imageProvider);
|
||||
}
|
||||
|
||||
Widget pictureContainerWidget(ImageProvider<Object>? imageProvider) {
|
||||
final image = imageProvider == null
|
||||
? null
|
||||
: DecorationImage(
|
||||
image: imageProvider,
|
||||
fit: BoxFit.contain,
|
||||
);
|
||||
|
||||
final widget = image == null
|
||||
? Icon(
|
||||
CupertinoIcons.person,
|
||||
color: Colors.grey.shade400,
|
||||
size: 40,
|
||||
)
|
||||
: null;
|
||||
|
||||
return Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.shade300,
|
||||
shape: BoxShape.circle,
|
||||
image: image,
|
||||
),
|
||||
child: widget,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user