baseproject
This commit is contained in:
69
base_project/lib/commans/widgets/custom_textform_field.dart
Normal file
69
base_project/lib/commans/widgets/custom_textform_field.dart
Normal file
@@ -0,0 +1,69 @@
|
||||
import 'package:base_project/resources/app_colors.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class MyCustomTextFormField extends StatelessWidget {
|
||||
final String label;
|
||||
final Widget? prefixIcon;
|
||||
final Widget? suffixIcon;
|
||||
final String? initialValue;
|
||||
final bool? obscureText;
|
||||
final TextEditingController controller;
|
||||
final String? Function(String?)? validator;
|
||||
final void Function(String)? onChanged;
|
||||
final TextInputType? keyboardType;
|
||||
final List<TextInputFormatter>? inputFormatters;
|
||||
final int? maxLines;
|
||||
final void Function()? onSuffixIconPressed;
|
||||
|
||||
|
||||
const MyCustomTextFormField({
|
||||
super.key,
|
||||
required this.label,
|
||||
this.prefixIcon,
|
||||
this.suffixIcon,
|
||||
|
||||
this.initialValue,
|
||||
required this.controller,
|
||||
this.validator,
|
||||
this.onChanged,
|
||||
this.keyboardType,
|
||||
this.inputFormatters,
|
||||
this.maxLines = 1, this.obscureText, this.onSuffixIconPressed,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextFormField(
|
||||
controller: controller,
|
||||
initialValue: initialValue,
|
||||
validator: validator,
|
||||
onChanged: onChanged,
|
||||
cursorColor: AppColors.primary,
|
||||
keyboardType: keyboardType,
|
||||
inputFormatters: inputFormatters,
|
||||
maxLines: maxLines,
|
||||
obscureText: obscureText ?? false,
|
||||
decoration: InputDecoration(
|
||||
labelText: label,
|
||||
labelStyle: const TextStyle(color: AppColors.primary),
|
||||
prefixIcon: prefixIcon,
|
||||
suffixIcon: suffixIcon,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
border: InputBorder.none, // No border
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(vertical: 15.0, horizontal: 12.0),
|
||||
// For rounded corners
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
25
base_project/lib/commans/widgets/custome_drawe_item.dart
Normal file
25
base_project/lib/commans/widgets/custome_drawe_item.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DrawerItem extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final String title;
|
||||
final VoidCallback onTap;
|
||||
final Color color;
|
||||
|
||||
const DrawerItem({
|
||||
super.key,
|
||||
required this.icon,
|
||||
required this.title,
|
||||
required this.onTap,
|
||||
this.color = Colors.blue, // Default color if none is provided
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
leading: Icon(icon, color: color),
|
||||
title: Text(title),
|
||||
onTap: onTap,
|
||||
);
|
||||
}
|
||||
}
|
||||
327
base_project/lib/commans/widgets/custome_drawer.dart
Normal file
327
base_project/lib/commans/widgets/custome_drawer.dart
Normal file
@@ -0,0 +1,327 @@
|
||||
import '../../Entity/angulardata/Test_visa/Test_visaView/Test_visa_entity_list_screen.dart';
|
||||
import '../../Entity/angulardata/Test_visa/Test_visa_viewModel/Test_visa_view_model_screen.dart';
|
||||
|
||||
import '../../Entity/angulardata/Basicp/BasicpView/Basicp_entity_list_screen.dart';
|
||||
import '../../Entity/angulardata/Basicp/Basicp_viewModel/Basicp_view_model_screen.dart';
|
||||
|
||||
import '../../Entity/angulardatatype/Ad8/Ad8View/Ad8_entity_list_screen.dart';
|
||||
import '../../Entity/angulardatatype/Ad8/Ad8_viewModel/Ad8_view_model_screen.dart';
|
||||
|
||||
import '../../Entity/angulardatatype/Ad7/Ad7View/Ad7_entity_list_screen.dart';
|
||||
import '../../Entity/angulardatatype/Ad7/Ad7_viewModel/Ad7_view_model_screen.dart';
|
||||
|
||||
import '../../Entity/angulardatatype/Adv5/Adv5View/Adv5_entity_list_screen.dart';
|
||||
import '../../Entity/angulardatatype/Adv5/Adv5_viewModel/Adv5_view_model_screen.dart';
|
||||
|
||||
import '../../Entity/angulardatatype/Adv4/Adv4View/Adv4_entity_list_screen.dart';
|
||||
import '../../Entity/angulardatatype/Adv4/Adv4_viewModel/Adv4_view_model_screen.dart';
|
||||
|
||||
import '../../Entity/angulardatatype/Adv3/Adv3View/Adv3_entity_list_screen.dart';
|
||||
import '../../Entity/angulardatatype/Adv3/Adv3_viewModel/Adv3_view_model_screen.dart';
|
||||
|
||||
import '../../Entity/angulardatatype/Dv2/Dv2View/Dv2_entity_list_screen.dart';
|
||||
import '../../Entity/angulardatatype/Dv2/Dv2_viewModel/Dv2_view_model_screen.dart';
|
||||
|
||||
import '../../Entity/angulardatatype/Adv1/Adv1View/Adv1_entity_list_screen.dart';
|
||||
import '../../Entity/angulardatatype/Adv1/Adv1_viewModel/Adv1_view_model_screen.dart';
|
||||
|
||||
import '../../Entity/angulardatatype/Basicp3/Basicp3View/Basicp3_entity_list_screen.dart';
|
||||
import '../../Entity/angulardatatype/Basicp3/Basicp3_viewModel/Basicp3_view_model_screen.dart';
|
||||
|
||||
import '../../Entity/angulardatatype/Basicp2/Basicp2View/Basicp2_entity_list_screen.dart';
|
||||
import '../../Entity/angulardatatype/Basicp2/Basicp2_viewModel/Basicp2_view_model_screen.dart';
|
||||
|
||||
import '../../Entity/angulardatatype/Basicp1/Basicp1View/Basicp1_entity_list_screen.dart';
|
||||
import '../../Entity/angulardatatype/Basicp1/Basicp1_viewModel/Basicp1_view_model_screen.dart';
|
||||
|
||||
import 'package:base_project/utils/image_constant.dart';
|
||||
import 'package:base_project/commans/widgets/custome_drawe_item.dart';
|
||||
import 'package:base_project/resources/app_colors.dart';
|
||||
import 'package:base_project/routes/route_names.dart';
|
||||
import 'package:base_project/utils/managers/user_manager.dart';
|
||||
import 'package:base_project/view_model/profile/profile_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class MyCustomDrawer extends StatelessWidget {
|
||||
const MyCustomDrawer({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final email = UserManager().email;
|
||||
final userName = UserManager().userName;
|
||||
final provider = Provider.of<ProfileViewModel>(context, listen: false);
|
||||
return Drawer(
|
||||
child: ListView(
|
||||
padding: EdgeInsets.zero,
|
||||
children: <Widget>[
|
||||
UserAccountsDrawerHeader(
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColors.primary,
|
||||
),
|
||||
currentAccountPicture: CircleAvatar(
|
||||
radius: 60,
|
||||
backgroundColor: AppColors.primary.withOpacity(0.3),
|
||||
backgroundImage: provider.profileImageBytes != null
|
||||
? MemoryImage(provider.profileImageBytes!)
|
||||
: null,
|
||||
child: provider.profileImageBytes != null
|
||||
? null // Use backgroundImage for the actual image, so child should be null
|
||||
: SvgPicture.asset(
|
||||
ImageConstant.userProfileImg, // Placeholder SVG asset
|
||||
|
||||
// AppImages.userProfileImg, // Placeholder SVG asset
|
||||
width: 60, // Adjust to fit the CircleAvatar
|
||||
height: 60,
|
||||
),
|
||||
),
|
||||
accountName: Text("Hello, $userName"),
|
||||
accountEmail: Text(email.toString()),
|
||||
),
|
||||
DrawerItem(
|
||||
color: AppColors.primary,
|
||||
icon: Icons.person,
|
||||
title: 'Profile',
|
||||
onTap: () {
|
||||
Navigator.pushNamed(context, RouteNames.profileView);
|
||||
},
|
||||
),
|
||||
DrawerItem(
|
||||
color: AppColors.primary,
|
||||
icon: Icons.system_security_update,
|
||||
title: 'System Parameters',
|
||||
onTap: () {
|
||||
// Add navigation or other logic here
|
||||
Navigator.pushNamed(context, RouteNames.systemParamsView);
|
||||
},
|
||||
),
|
||||
DrawerItem(
|
||||
color: AppColors.primary,
|
||||
icon: Icons.password,
|
||||
title: 'change password',
|
||||
onTap: () {
|
||||
Navigator.pushNamed(context, RouteNames.changePasswordView);
|
||||
},
|
||||
),
|
||||
|
||||
// NEW MENU
|
||||
|
||||
DrawerItem(
|
||||
color: AppColors.primary,
|
||||
icon: Icons.chat_bubble,
|
||||
title: 'Test_visa',
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ChangeNotifierProvider(
|
||||
create: (context) => Test_visaViewModelScreen(),
|
||||
child: test_visa_entity_list_screen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
DrawerItem(
|
||||
color: AppColors.primary,
|
||||
icon: Icons.chat_bubble,
|
||||
title: 'Basicp',
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ChangeNotifierProvider(
|
||||
create: (context) => BasicpViewModelScreen(),
|
||||
child: basicp_entity_list_screen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
DrawerItem(
|
||||
color: AppColors.primary,
|
||||
icon: Icons.chat_bubble,
|
||||
title: 'Ad8',
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ChangeNotifierProvider(
|
||||
create: (context) => Ad8ViewModelScreen(),
|
||||
child: ad8_entity_list_screen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
DrawerItem(
|
||||
color: AppColors.primary,
|
||||
icon: Icons.chat_bubble,
|
||||
title: 'Ad7',
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ChangeNotifierProvider(
|
||||
create: (context) => Ad7ViewModelScreen(),
|
||||
child: ad7_entity_list_screen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
DrawerItem(
|
||||
color: AppColors.primary,
|
||||
icon: Icons.chat_bubble,
|
||||
title: 'Adv5',
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ChangeNotifierProvider(
|
||||
create: (context) => Adv5ViewModelScreen(),
|
||||
child: adv5_entity_list_screen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
DrawerItem(
|
||||
color: AppColors.primary,
|
||||
icon: Icons.chat_bubble,
|
||||
title: 'Adv4',
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ChangeNotifierProvider(
|
||||
create: (context) => Adv4ViewModelScreen(),
|
||||
child: adv4_entity_list_screen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
DrawerItem(
|
||||
color: AppColors.primary,
|
||||
icon: Icons.chat_bubble,
|
||||
title: 'Adv3',
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ChangeNotifierProvider(
|
||||
create: (context) => Adv3ViewModelScreen(),
|
||||
child: adv3_entity_list_screen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
DrawerItem(
|
||||
color: AppColors.primary,
|
||||
icon: Icons.chat_bubble,
|
||||
title: 'Dv2',
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ChangeNotifierProvider(
|
||||
create: (context) => Dv2ViewModelScreen(),
|
||||
child: dv2_entity_list_screen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
DrawerItem(
|
||||
color: AppColors.primary,
|
||||
icon: Icons.chat_bubble,
|
||||
title: 'Adv1',
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ChangeNotifierProvider(
|
||||
create: (context) => Adv1ViewModelScreen(),
|
||||
child: adv1_entity_list_screen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
DrawerItem(
|
||||
color: AppColors.primary,
|
||||
icon: Icons.chat_bubble,
|
||||
title: 'Basicp3',
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ChangeNotifierProvider(
|
||||
create: (context) => Basicp3ViewModelScreen(),
|
||||
child: basicp3_entity_list_screen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
DrawerItem(
|
||||
color: AppColors.primary,
|
||||
icon: Icons.chat_bubble,
|
||||
title: 'Basicp2',
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ChangeNotifierProvider(
|
||||
create: (context) => Basicp2ViewModelScreen(),
|
||||
child: basicp2_entity_list_screen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
DrawerItem(
|
||||
color: AppColors.primary,
|
||||
icon: Icons.chat_bubble,
|
||||
title: 'Basicp1',
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ChangeNotifierProvider(
|
||||
create: (context) => Basicp1ViewModelScreen(),
|
||||
child: basicp_entity_list_screen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
DrawerItem(
|
||||
icon: Icons.logout,
|
||||
color: Colors.red,
|
||||
title: 'Logout',
|
||||
onTap: () async {
|
||||
await UserManager().clearUser();
|
||||
Navigator.pushReplacementNamed(context, RouteNames.splashView);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import 'package:base_project/resources/app_colors.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MyCustomElevatedButton extends StatelessWidget {
|
||||
final Color? backgroundColor;
|
||||
final Widget child;
|
||||
final bool isLoading;
|
||||
final VoidCallback onPressed;
|
||||
|
||||
const MyCustomElevatedButton({
|
||||
super.key,
|
||||
this.backgroundColor = AppColors.primary,
|
||||
required this.child,
|
||||
required this.onPressed,
|
||||
this.isLoading = false,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ElevatedButton(
|
||||
onPressed: isLoading ? null : onPressed,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: backgroundColor,
|
||||
minimumSize: const Size(double.infinity, 50), // Full width, height of 50
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8), // Rounded corners
|
||||
),
|
||||
),
|
||||
child: isLoading
|
||||
? const Center(
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2.0, // Adjust thickness if needed
|
||||
),
|
||||
)
|
||||
: child,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user