EssenceDailyCore/lib/widgets/elegant_header.dart

103 lines
3.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
class ElegantHeader extends StatelessWidget {
const ElegantHeader({super.key});
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(vertical: 10),
color: const Color(0xFFFAFAFA),
child: Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 28),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
border: Border.all(color: Colors.grey.shade200),
),
child: Text(
DateFormat('MMMM d').format(DateTime.now()),
style: const TextStyle(fontWeight: FontWeight.w600, fontSize: 13),
),
),
Container(
width: 36,
height: 36,
decoration: BoxDecoration(
color: Colors.grey.shade200,
shape: BoxShape.circle,
image: const DecorationImage(
image: NetworkImage(
"https://ui-avatars.com/api/?name=User&background=000000&color=fff",
),
),
),
),
],
),
),
const SizedBox(height: 20),
SizedBox(
height: 60,
child: ListView.builder(
scrollDirection: Axis.horizontal,
padding: const EdgeInsets.symmetric(horizontal: 24),
itemCount: 7,
itemBuilder: (context, index) {
final date = DateTime.now().add(Duration(days: index));
final isSelected = index == 0;
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 6),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
DateFormat('E').format(date).toUpperCase(),
style: TextStyle(
fontSize: 10,
fontWeight: FontWeight.w600,
color: isSelected
? const Color(0xFFFF7F50)
: Colors.grey.shade400,
),
),
const SizedBox(height: 6),
Container(
width: 32,
height: 32,
alignment: Alignment.center,
decoration: BoxDecoration(
color: isSelected
? const Color(0xFFFF7F50)
: Colors.transparent,
shape: BoxShape.circle,
),
child: Text(
"${date.day}",
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
color: isSelected ? Colors.white : Colors.black,
),
),
),
],
),
);
},
),
),
],
),
);
}
}