push notification of tasks

This commit is contained in:
Vaibhav 2024-09-04 17:38:57 +05:30
parent b4bf13214a
commit b29af415a4
7 changed files with 233 additions and 229 deletions

View File

@ -104,6 +104,7 @@ class _UpdateInventoryTaskScreenState extends State<UpdateInventoryTaskScreen> {
MaterialPageRoute( MaterialPageRoute(
builder: (context) => AddProductsScreen( builder: (context) => AddProductsScreen(
distributorType: tasksList.addedFor!, distributorType: tasksList.addedFor!,
inventoryId: tasksList.sId!,
tradeName: tasksList.tradeName??'', tradeName: tasksList.tradeName??'',
pdRdId: tasksList.sId!))); pdRdId: tasksList.sId!)));
} }

View File

@ -96,10 +96,10 @@ class _DailyTasksScreenState extends State<DailyTasksScreen> {
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: _selectedTabIndex == index gradient: _selectedTabIndex == index
? const LinearGradient( ? const LinearGradient(
colors: [Color(0xff004791), Color(0xff1a73e8)], colors: [Color(0xff004791), Color(0xff1a73e8)],
begin: Alignment.topLeft, begin: Alignment.topLeft,
end: Alignment.bottomRight, end: Alignment.bottomRight,
) )
: null, : null,
color: _selectedTabIndex == index color: _selectedTabIndex == index
? Colors.transparent ? Colors.transparent
@ -158,33 +158,34 @@ class _DailyTasksScreenState extends State<DailyTasksScreen> {
} }
Widget _buildTaskList(int tabIndex) { Widget _buildTaskList(int tabIndex) {
return Consumer<DailyTaskProvider>( return Consumer<DailyTaskProvider>(
builder: (context, value, child) => value.isLoading builder: (context, value, child) => value.isLoading
? const Center(child: CircularProgressIndicator()) ? const Center(child: CircularProgressIndicator())
: ListView.separated( : ListView.separated(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
itemCount: _selectedTabIndex == 0 itemCount: _selectedTabIndex == 0
? value.newTasksList.length ? value.newTasksList.length
: _selectedTabIndex == 1 : _selectedTabIndex == 1
? value.pendingTasksList.length ? value.pendingTasksList.length
: value.completedTasksList.length, : value.completedTasksList.length,
separatorBuilder: (context, index) => const SizedBox(height: 8), separatorBuilder: (context, index) => const SizedBox(height: 8),
itemBuilder: (context, index) { itemBuilder: (context, index) {
final tasksList = tabIndex == 0 final tasksList = tabIndex == 0
? value.newTasksList ? value.newTasksList
: tabIndex == 1 : tabIndex == 1
? value.pendingTasksList ? value.pendingTasksList
: value.completedTasksList; : value.completedTasksList;
return _buildTaskCard(tasksList[index]); return _buildTaskCard(tasksList[index]);
}, },
), ),
); );
} }
Widget _buildTaskCard(Tasks tasksList) { Widget _buildTaskCard(Tasks tasksList) {
return InkWell( return InkWell(
onTap: () { onTap: _selectedTabIndex == 2
? null // Disable click when on the "COMPLETED" tab
: () {
if (tasksList.task == 'Collect KYC') { if (tasksList.task == 'Collect KYC') {
Navigator.push( Navigator.push(
context, context,
@ -203,8 +204,9 @@ class _DailyTasksScreenState extends State<DailyTasksScreen> {
MaterialPageRoute( MaterialPageRoute(
builder: (context) => AddProductsScreen( builder: (context) => AddProductsScreen(
distributorType: tasksList.addedFor!, distributorType: tasksList.addedFor!,
tradeName: tasksList.tradeName?? '', tradeName: tasksList.tradeName ?? '',
pdRdId: tasksList.addedForId!, inventoryId:tasksList.sId))); pdRdId: tasksList.addedForId!,
inventoryId: tasksList.sId)));
} else if (tasksList.task == 'Update Sales Data') { } else if (tasksList.task == 'Update Sales Data') {
Navigator.push( Navigator.push(
context, context,
@ -215,7 +217,8 @@ class _DailyTasksScreenState extends State<DailyTasksScreen> {
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => VisitDealersScreen( builder: (context) => VisitDealersScreen(
tradeName: tasksList.tradeName??'', tradeName: tasksList.tradeName ?? '',
id: tasksList.sId,
))); )));
} }
}, },
@ -226,29 +229,32 @@ class _DailyTasksScreenState extends State<DailyTasksScreen> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
ListTile( ListTile(
leading: const Icon(Icons.task, color: Colors.blueAccent), leading: const Icon(Icons.task, color: Colors.blueAccent),
title: Text(tasksList.task ?? '', title: Text(tasksList.task ?? '',
style: const TextStyle( style: const TextStyle(
color: Colors.black87, color: Colors.black87,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 16, fontSize: 16,
fontFamily: 'Anek')), fontFamily: 'Anek')),
trailing: trailing: _selectedTabIndex == 2
const Icon(Icons.arrow_forward_ios, color: Colors.black87)), ? null // Remove arrow icon in "COMPLETED" tab
: const Icon(Icons.arrow_forward_ios, color: Colors.black87),
),
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
if (tasksList.note != null) if (tasksList.note != null) Text('Note: ${tasksList.note}'),
Text('Note: ${tasksList.note}'), if (tasksList.addedFor != null)
if(tasksList.addedFor != null)
Text('Distributor: ${tasksList.addedFor ?? ""}'), Text('Distributor: ${tasksList.addedFor ?? ""}'),
if(tasksList.tradeName != null) Text('Trade Name: ${tasksList.tradeName ?? ""}'), if (tasksList.tradeName != null)
if(tasksList.taskDueDate != null) Text('Due Date: ${DateFormat('dd/MM/yyyy').format(DateTime.parse(tasksList.taskDueDate!))}'), Text('Trade Name: ${tasksList.tradeName ?? ""}'),
if( if (tasksList.taskDueDate != null)
tasksList.taskPriority != null Text(
)Text('Priority: ${tasksList.taskPriority}'), 'Due Date: ${DateFormat('dd/MM/yyyy').format(DateTime.parse(tasksList.taskDueDate!))}'),
if (tasksList.taskPriority != null)
Text('Priority: ${tasksList.taskPriority}'),
], ],
), ),
), ),
@ -258,4 +264,3 @@ class _DailyTasksScreenState extends State<DailyTasksScreen> {
); );
} }
} }

View File

@ -43,7 +43,7 @@ class DisplaySalesScreenState extends State<DisplaySalesScreen> {
icon: Image.asset('assets/Back_attendance.png'), padding: const EdgeInsets.only(right: 20), icon: Image.asset('assets/Back_attendance.png'), padding: const EdgeInsets.only(right: 20),
), ),
], ],
title: const Text('Display Sales', title: const Text('Update Sales Data',
style: TextStyle( style: TextStyle(
fontSize: 20, fontSize: 20,
color: Colors.black, color: Colors.black,

View File

@ -1,5 +1,8 @@
import 'package:cheminova/provider/forgot_password_provider.dart'; import 'package:cheminova/provider/forgot_password_provider.dart';
import 'package:cheminova/screens/change_password_screen.dart';
import 'package:cheminova/screens/login_screen.dart'; import 'package:cheminova/screens/login_screen.dart';
import 'package:cheminova/screens/password_change_screen.dart';
import 'package:cheminova/screens/verify_code_screen.dart';
import 'package:cheminova/widgets/common_background.dart'; import 'package:cheminova/widgets/common_background.dart';
import 'package:cheminova/widgets/common_elevated_button.dart'; import 'package:cheminova/widgets/common_elevated_button.dart';
import 'package:cheminova/widgets/common_text_form_field.dart'; import 'package:cheminova/widgets/common_text_form_field.dart';

View File

@ -52,10 +52,6 @@ class _HomePageState extends State<HomePage> {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
appBar: CommonAppBar( appBar: CommonAppBar(
title: Row(children: [ title: Row(children: [
// CircleAvatar(
// backgroundImage: AssetImage(
// 'assets/profile.png'), // Replace with actual user image
// ),
const SizedBox(width: 10), const SizedBox(width: 10),
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
const Text('Welcome', const Text('Welcome',
@ -65,13 +61,13 @@ class _HomePageState extends State<HomePage> {
fontWeight: FontWeight.w400)), fontWeight: FontWeight.w400)),
Consumer<HomeProvider>( Consumer<HomeProvider>(
builder: (context, value, child) => builder: (context, value, child) =>
(value.profileResponse == null || (value.profileResponse == null ||
value.profileResponse!.myData == null || value.profileResponse!.myData == null ||
value.profileResponse!.myData!.name == null) value.profileResponse!.myData!.name == null)
? const SizedBox() ? const SizedBox()
: Text(value.profileResponse!.myData!.name ?? '', : Text(value.profileResponse!.myData!.name ?? '',
style: const TextStyle( style: const TextStyle(
color: Colors.black87, fontSize: 20))) color: Colors.black87, fontSize: 20)))
]) ])
]), ]),
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
@ -81,186 +77,185 @@ class _HomePageState extends State<HomePage> {
body: SafeArea( body: SafeArea(
child: Padding( child: Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: Column( child: LayoutBuilder(
crossAxisAlignment: CrossAxisAlignment.start, builder: (context, constraints) {
children: [ double screenWidth = constraints.maxWidth;
Expanded( double buttonWidth = screenWidth / 2 - 18; // Adjust button width
child: ListView(
children: [ return ListView(
_buildCustomCard( children: [
'Mark Attendance', _buildCustomCard(
'Mark Attendance / On Leave', 'Mark Attendance',
onTap: () { 'Mark Attendance / On Leave',
Navigator.push( screenWidth,
context, onTap: () {
MaterialPageRoute(
builder: (context) =>
const MarkAttendanceScreen(),
));
},
),
const SizedBox(
height: 5,
),
_buildCustomCard('Daily Tasks', 'Dashboard', onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => const DailyTasksScreen(), builder: (context) => const MarkAttendanceScreen(),
)); ),
}), );
const SizedBox( },
height: 5, ),
), const SizedBox(height: 5),
Row( _buildCustomCard(
children: [ 'Daily Tasks',
Expanded( 'Dashboard',
child: _buildCustomCard( screenWidth,
'Display\nSales data', 'Quickly display Sales', onTap: () {
onTap: () { Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const DailyTasksScreen(),
),
);
},
),
const SizedBox(height: 5),
Row(
children: [
Expanded(
child: _buildCustomCard(
'Update\nSales data',
'Quickly display Sales',
buttonWidth,
onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => builder: (context) =>
const DisplaySalesScreen(), const DisplaySalesScreen(),
)); ),
}), );
},
), ),
const SizedBox( ),
width: 12, const SizedBox(width: 12),
), Expanded(
Expanded( child: _buildCustomCard(
child: _buildCustomCard('Update Inventory Data', 'Update Inventory Data',
'Quickly Inventory Data', onTap: () { 'Quickly Inventory Data',
buttonWidth,
onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => builder: (context) =>
const UpdateInventoryTaskScreen(), const UpdateInventoryTaskScreen(),
)); ),
}), );
},
), ),
], ),
), ],
const SizedBox( ),
height: 5, const SizedBox(height: 5),
), Row(
Row( children: [
children: [ Expanded(
Expanded( child: _buildCustomCard(
child: 'Notifications',
_buildCustomCard('Summary', '\n\n', onTap: () { 'Tasks & Alerts\n\n',
buttonWidth,
onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => const SummaryScreen(), builder: (context) =>
)); const NotificationScreen(),
}), ),
);
},
), ),
const SizedBox( ),
width: 12, const SizedBox(width: 12),
), Expanded(
Expanded( child: _buildCustomCard(
child: _buildCustomCard( 'Product\nSales Data Visibility',
'Product\nSales Data Visibility', '', '',
onTap: () { buttonWidth,
onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => builder: (context) =>
const ProductSalesData(), const ProductSalesData(),
)); ),
}), );
},
), ),
], ),
), ],
const SizedBox(height: 5), ),
Row( const SizedBox(height: 5),
children: [ _buildCustomCard(
Expanded( 'Collect \nKYC Data',
child: _buildCustomCard('Collect \nKYC Data', 'Scan and upload KYC Documents',
'Scan and upload KYC Documents', onTap: () { screenWidth,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const SelectTaskkycScreen(),
),
);
},
),
const SizedBox(height: 5),
_buildCustomCard(
'Rejected Applications',
'Re-upload Rejected Documents',
screenWidth,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
const RejectedApplicationScreen(),
),
);
},
),
const SizedBox(height: 5),
Row(
children: [
Expanded(
child: _buildCustomCard(
'Calendar',
'Appointments & Deadlines',
buttonWidth,
onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => builder: (context) => const CalendarScreen(),
const SelectTaskkycScreen(), ),
)); );
}), },
), ),
], ),
), const SizedBox(width: 12),
const SizedBox(height: 5), Expanded(
Row( child: _buildCustomCard(
children: [ 'Products Manual',
Expanded( 'Details of products',
child: _buildCustomCard('Rejected Applications', buttonWidth,
'Re-upload Rejected Documents', onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => builder: (context) =>
const RejectedApplicationScreen(), const ProductsManualScreen(),
)); ),
}), );
},
), ),
], ),
), ],
const SizedBox(height: 5), ),
Row( ],
children: [ );
Expanded( },
child: _buildCustomCard(
'Notifications', 'Tasks & Alerts\n\n',
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
const NotificationScreen(),
));
}),
),
const SizedBox(
width: 15,
),
Expanded(
child: _buildCustomCard(
'Calendar',
' Upcoming Appointments & Deadlines',
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
const CalendarScreen(),
));
},
),
),
],
),
const SizedBox(height: 5),
Row(
children: [
Expanded(
child: _buildCustomCard(
'Products Manual', 'details of products',
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
const ProductsManualScreen(),
));
}),
),
],
),
],
),
),
],
), ),
), ),
), ),
@ -268,9 +263,10 @@ class _HomePageState extends State<HomePage> {
); );
} }
Widget _buildCustomCard(String title, String subtitle, Widget _buildCustomCard(String title, String subtitle, double width,
{void Function()? onTap}) { {void Function()? onTap}) {
return Container( return Container(
width: width,
margin: const EdgeInsets.only(bottom: 10), margin: const EdgeInsets.only(bottom: 10),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.indigo, color: Colors.indigo,
@ -278,7 +274,6 @@ class _HomePageState extends State<HomePage> {
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
), ),
child: ListTile( child: ListTile(
// trailing: Image.asset('assets/forward_icon.png'),
title: Text( title: Text(
title, title,
style: const TextStyle( style: const TextStyle(
@ -289,9 +284,9 @@ class _HomePageState extends State<HomePage> {
), ),
subtitle: subtitle.isNotEmpty subtitle: subtitle.isNotEmpty
? Text( ? Text(
subtitle, subtitle,
style: const TextStyle(color: Colors.white70, fontSize: 13), style: const TextStyle(color: Colors.white70, fontSize: 13),
) )
: null, : null,
onTap: onTap, onTap: onTap,
), ),

View File

@ -49,7 +49,7 @@ class ProfileScreen extends StatelessWidget {
children: [ children: [
SizedBox(height: 20), SizedBox(height: 20),
_buildProfileItem('Name', profileData?.name ?? ''), _buildProfileItem('Name', profileData?.name ?? ''),
_buildProfileItem('ID', profileData?.sId ?? ''), _buildProfileItem('ID', profileData?.uniqueId ?? ''),
_buildProfileItem('Email ID', profileData?.email ?? ''), _buildProfileItem('Email ID', profileData?.email ?? ''),
_buildProfileItem('Mobile Number', profileData?.mobileNumber ?? ''), _buildProfileItem('Mobile Number', profileData?.mobileNumber ?? ''),
_buildProfileItem('Designation', profileData?.designation ?? ''), _buildProfileItem('Designation', profileData?.designation ?? ''),

View File

@ -36,7 +36,7 @@ class CommonDrawer extends StatelessWidget {
style: const TextStyle( style: const TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 18)), fontSize: 18)),
Text(value.profileResponse!.myData!.sId!, Text(value.profileResponse!.myData!.uniqueId!,
style: const TextStyle( style: const TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 15)) fontSize: 15))