UiDrawer.standard constructor

UiDrawer.standard({
  1. Key? key,
  2. required String title,
  3. String? subtitle,
  4. Widget? avatar,
  5. Color? headerBackground,
  6. required List<Widget> items,
  7. Widget? footer,
})

Ready-made variant with a professional header (user info style)

Implementation

factory UiDrawer.standard({
  Key? key,
  required String title,
  String? subtitle,
  Widget? avatar,
  Color? headerBackground,
  required List<Widget> items,
  Widget? footer,
}) {
  return UiDrawer(
    key: key,
    items: items,
    footer: footer,
    header: Container(
      width: double.infinity,
      padding: const EdgeInsets.all(16),
      decoration: BoxDecoration(color: headerBackground ?? Colors.blue),
      child: Row(
        children: [
          avatar ??
              const CircleAvatar(
                radius: 28,
                child: Icon(Icons.person, size: 32, color: Colors.white),
              ),
          const SizedBox(width: 12),
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(
                  title,
                  style: const TextStyle(
                    fontSize: 18,
                    fontWeight: FontWeight.bold,
                    color: Colors.white,
                  ),
                ),
                if (subtitle != null)
                  Text(
                    subtitle,
                    style: TextStyle(
                      fontSize: 14,
                      color: Colors.white.withValues(alpha: 0.85),
                    ),
                  ),
              ],
            ),
          ),
        ],
      ),
    ),
  );
}