getPresentationWidgetsCustomSideDrawerTemplate function
String
getPresentationWidgetsCustomSideDrawerTemplate(
- String projectName
)
Implementation
String getPresentationWidgetsCustomSideDrawerTemplate(String projectName) {
return '''
import 'package:flutter/material.dart';
import 'package:${projectName}/core/constants/app_assets.dart';
import 'package:${projectName}/core/constants/app_strings.dart';
import 'package:${projectName}/presentation/widgets/common_cached_image.dart';
import 'package:${projectName}/presentation/widgets/common_svg_widget.dart';
import '../../core/theme/app_colors.dart';
import '../../core/utils/responsive_size.dart';
import 'text_widget.dart';
class CustomSideDrawer extends StatelessWidget {
final String userName;
final String userEmail;
final String profileImage;
final List<Map<String, dynamic>> drawerItems;
final Function(String) onItemTap;
const CustomSideDrawer({
super.key,
required this.userName,
required this.userEmail,
required this.profileImage,
required this.drawerItems,
required this.onItemTap,
});
@override
Widget build(BuildContext context) {
return Drawer(
width: 80.sw,
backgroundColor: AppColors.primary,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.zero,
),
child: SafeArea(
child: Column(
children: [
// Header
Padding(
padding: EdgeInsets.all(20.sp),
child: Column(
children: [
Align(
alignment: Alignment.topRight,
child: GestureDetector(
onTap: () => Navigator.pop(context),
child: Icon(Icons.close, color: Colors.white, size: 28.sp),
),
),
SizedBox(height: 10.sp),
Container(
width: 100.sp,
height: 100.sp,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(color: Colors.white.withOpacity(0.2), width: 2.sp),
),
child: Padding(
padding: EdgeInsets.all(4.sp),
child: CircleAvatar(
radius: 46.sp,
backgroundColor: Colors.white.withOpacity(0.1),
child: Icon(Icons.person, color: Colors.white, size: 50.sp),
),
),
),
SizedBox(height: 15.sp),
TextWidget(
text: userName,
color: Colors.white,
textSize: 22.sp,
fontWeight: FontWeight.w600,
),
],
),
),
SizedBox(height: 10.sp),
Divider(color: Colors.white.withOpacity(0.1), height: 1),
SizedBox(height: 20.sp),
// Drawer Items
Expanded(
child: ListView.builder(
padding: EdgeInsets.symmetric(horizontal: 20.sp),
itemCount: drawerItems.length,
itemBuilder: (context, index) {
final item = drawerItems[index];
return Padding(
padding: EdgeInsets.only(bottom: 12.sp),
child: ListTile(
onTap: () => onItemTap(item['name'] ?? ""),
contentPadding: EdgeInsets.zero,
leading: Container(
padding: EdgeInsets.all(10.sp),
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.1),
borderRadius: BorderRadius.circular(12.sp),
),
child: Icon(
item['icon'] as IconData? ?? Icons.settings,
color: Colors.white,
size: 22.sp,
),
),
title: TextWidget(
text: item['name'] ?? "",
color: Colors.white,
textSize: 16.sp,
fontWeight: FontWeight.w500,
),
),
);
},
),
),
// Footer
Padding(
padding: EdgeInsets.all(20.sp),
child: Column(
children: [
TextWidget(
text: "Privacy Policy | Terms and Conditions",
color: Colors.white.withOpacity(0.7),
textSize: 13.sp,
),
SizedBox(height: 8.sp),
TextWidget(
text: "Version 1.1",
color: Colors.white.withOpacity(0.5),
textSize: 12.sp,
),
],
),
),
],
),
),
);
}
}
''';
}