NEW SCREEN SELECT TASK
This commit is contained in:
parent
f9a96d881a
commit
24570b8ae3
86
lib/models/select_task_response.dart
Normal file
86
lib/models/select_task_response.dart
Normal file
@ -0,0 +1,86 @@
|
||||
class SelectTaskKycResponse {
|
||||
bool? success;
|
||||
List<Tasks>? tasks;
|
||||
|
||||
SelectTaskKycResponse({this.success, this.tasks});
|
||||
|
||||
SelectTaskKycResponse.fromJson(Map<String, dynamic> json) {
|
||||
success = json['success'];
|
||||
if (json['tasks'] != null) {
|
||||
tasks = <Tasks>[];
|
||||
json['tasks'].forEach((v) {
|
||||
tasks!.add(new Tasks.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['success'] = this.success;
|
||||
if (this.tasks != null) {
|
||||
data['tasks'] = this.tasks!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Tasks {
|
||||
String? sId;
|
||||
String? taskId;
|
||||
String? task;
|
||||
String? note;
|
||||
String? taskStatus;
|
||||
String? taskPriority;
|
||||
String? taskDueDate;
|
||||
String? taskAssignedTo;
|
||||
String? taskAssignedBy;
|
||||
String? createdAt;
|
||||
String? updatedAt;
|
||||
int? iV;
|
||||
|
||||
Tasks(
|
||||
{this.sId,
|
||||
this.taskId,
|
||||
this.task,
|
||||
this.note,
|
||||
this.taskStatus,
|
||||
this.taskPriority,
|
||||
this.taskDueDate,
|
||||
this.taskAssignedTo,
|
||||
this.taskAssignedBy,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
this.iV});
|
||||
|
||||
Tasks.fromJson(Map<String, dynamic> json) {
|
||||
sId = json['_id'];
|
||||
taskId = json['taskId'];
|
||||
task = json['task'];
|
||||
note = json['note'];
|
||||
taskStatus = json['taskStatus'];
|
||||
taskPriority = json['taskPriority'];
|
||||
taskDueDate = json['taskDueDate'];
|
||||
taskAssignedTo = json['taskAssignedTo'];
|
||||
taskAssignedBy = json['taskAssignedBy'];
|
||||
createdAt = json['createdAt'];
|
||||
updatedAt = json['updatedAt'];
|
||||
iV = json['__v'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['_id'] = this.sId;
|
||||
data['taskId'] = this.taskId;
|
||||
data['task'] = this.task;
|
||||
data['note'] = this.note;
|
||||
data['taskStatus'] = this.taskStatus;
|
||||
data['taskPriority'] = this.taskPriority;
|
||||
data['taskDueDate'] = this.taskDueDate;
|
||||
data['taskAssignedTo'] = this.taskAssignedTo;
|
||||
data['taskAssignedBy'] = this.taskAssignedBy;
|
||||
data['createdAt'] = this.createdAt;
|
||||
data['updatedAt'] = this.updatedAt;
|
||||
data['__v'] = this.iV;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -14,7 +14,6 @@ class RejectedProvider extends ChangeNotifier {
|
||||
List<RejectedApplicationResponse> rejectedApplicationList = [];
|
||||
|
||||
bool _isLoading = false;
|
||||
|
||||
bool get isLoading => _isLoading;
|
||||
|
||||
void setLoading(bool loading) {
|
||||
|
43
lib/provider/select_task_provider.dart
Normal file
43
lib/provider/select_task_provider.dart
Normal file
@ -0,0 +1,43 @@
|
||||
import 'package:cheminova/models/select_task_response.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../services/api_client.dart';
|
||||
import '../services/api_urls.dart';
|
||||
|
||||
class SelectTaskProvider extends ChangeNotifier {
|
||||
SelectTaskProvider() {
|
||||
getTask();
|
||||
}
|
||||
|
||||
final _apiClient = ApiClient();
|
||||
List<Tasks> tasksList=[];
|
||||
|
||||
bool _isLoading = false;
|
||||
|
||||
bool get isLoading => _isLoading;
|
||||
|
||||
void setLoading(bool loading) {
|
||||
_isLoading = loading;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> getTask() async {
|
||||
setLoading(true);
|
||||
try {
|
||||
Response response = await _apiClient.get(ApiUrls.selectTaskUrl);
|
||||
setLoading(false);
|
||||
if (response.statusCode == 200) {
|
||||
final data = SelectTaskKycResponse.fromJson(response.data);
|
||||
tasksList = data.tasks ?? [];
|
||||
notifyListeners();
|
||||
}
|
||||
} catch (e) {
|
||||
setLoading(false);
|
||||
if (kDebugMode) {
|
||||
print("Error occurred while fetching notifications: $e");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -11,7 +11,8 @@ import 'package:provider/provider.dart';
|
||||
import '../widgets/common_app_bar.dart';
|
||||
|
||||
class CollectKycScreen extends StatefulWidget {
|
||||
const CollectKycScreen({super.key});
|
||||
final String id;
|
||||
const CollectKycScreen({super.key, required this.id});
|
||||
|
||||
@override
|
||||
State<CollectKycScreen> createState() => CollectKycScreenState();
|
||||
|
@ -41,7 +41,7 @@ class _DailyTasksScreenState extends State<DailyTasksScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
PreferredSizeWidget _buildAppBar() {
|
||||
CommonAppBar _buildAppBar() {
|
||||
return CommonAppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
@ -219,9 +219,13 @@ class _DailyTasksScreenState extends State<DailyTasksScreen> {
|
||||
}
|
||||
|
||||
final List<TaskItem> _newTasks = [
|
||||
KycTaskItem('Collect KYC Documents', const CollectKycScreen(),
|
||||
KycTaskItem('Collect KYC Documents', const CollectKycScreen(id: '',),
|
||||
'Collect KYC documents from ABC Trader', DateFormat('dd/MM/yyyy').format(DateTime.now()).toString(), 'Priority'),
|
||||
TaskItem('Update Inventory Data', const UpdateInventoryScreen()),
|
||||
KycTaskItem('REUPLOAD', const CollectKycScreen(id: '',),
|
||||
'Reupload Pan Car From Shiv Traders', DateFormat('dd/MM/yyyy').format(DateTime.now()).toString(), 'Priority'),
|
||||
KycTaskItem('REUPLOAD', const CollectKycScreen(id: '',),
|
||||
'Reupload Pan Car From Shiv Traders', DateFormat('dd/MM/yyyy').format(DateTime.now()).toString(), 'Priority'),
|
||||
// TaskItem('Update Inventory Data', const UpdateInventoryScreen()),
|
||||
];
|
||||
|
||||
final List<TaskItem> _pendingTasks = [
|
||||
|
@ -9,6 +9,7 @@ import 'package:cheminova/screens/mark_attendence_screen.dart';
|
||||
import 'package:cheminova/screens/notification_screen.dart';
|
||||
import 'package:cheminova/screens/product_sales_data.dart';
|
||||
import 'package:cheminova/screens/products_manual_screen.dart';
|
||||
import 'package:cheminova/screens/select_taskkyc_screen.dart';
|
||||
import 'package:cheminova/screens/summary_screen.dart';
|
||||
import 'package:cheminova/screens/update_inventory_screen.dart';
|
||||
import 'package:cheminova/widgets/common_app_bar.dart';
|
||||
@ -181,7 +182,7 @@ class _HomePageState extends State<HomePage> {
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
const CollectKycScreen(),
|
||||
const SelectTaskkycScreen(),
|
||||
));
|
||||
}),
|
||||
),
|
||||
|
@ -72,7 +72,6 @@ Widget buildProductButton(String productName) {
|
||||
text: productName,
|
||||
backgroundColor: const Color(0xff004791),
|
||||
onPressed: () {
|
||||
// Handle product button press
|
||||
debugPrint('$productName pressed');
|
||||
},
|
||||
),
|
||||
@ -86,7 +85,6 @@ class MyListView extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Group notifications by date
|
||||
Map<String, List<Notifications>> groupedNotifications = {};
|
||||
|
||||
for (var notification in value.notificationList) {
|
||||
@ -117,7 +115,6 @@ class MyListView extends StatelessWidget {
|
||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
// Display notifications for the date
|
||||
...notificationsForDate.map((item) => Padding(
|
||||
padding: const EdgeInsets.only(bottom: 10),
|
||||
child: ExpansionTile(
|
||||
|
@ -104,7 +104,7 @@ class MyListView extends StatelessWidget {
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text((DateFormat("dd/MMMM/yyyy")
|
||||
Text((DateFormat("dd/MMMM /yyyy")
|
||||
.format(DateTime.parse(item.createdAt ?? '')))),
|
||||
Text(item.sId ?? ''),
|
||||
for (var note in item.notes!) Text(note.message ?? ''),
|
||||
|
@ -43,213 +43,191 @@ class RetailerDetailsScreenState extends State<RetailerDetailsScreen> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
DropdownButtonFormField<String>(
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
filled: true,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide.none)),
|
||||
hint: Text("Select a task"),
|
||||
value: value.selectedTask,
|
||||
onChanged: (String? newValue) {
|
||||
value.setTask(newValue!);
|
||||
},
|
||||
items:["task1", "task2", "task3"].map((String task) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: task,
|
||||
child: Text(task),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
IgnorePointer(
|
||||
ignoring: value.selectedTask == null,
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 15),
|
||||
CommonTextFormField(
|
||||
title: 'Trade Name',
|
||||
fillColor: Colors.white,
|
||||
validator: (String? value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Trade Name cannot be empty';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: value.tradeNameController),
|
||||
const SizedBox(height: 15),
|
||||
CommonTextFormField(
|
||||
title: 'Name',
|
||||
fillColor: Colors.white,
|
||||
validator: (String? value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Name cannot be empty';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: value.nameController),
|
||||
const SizedBox(height: 15),
|
||||
CommonTextFormField(
|
||||
title: 'Address',
|
||||
fillColor: Colors.white,
|
||||
validator: (String? value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Address cannot be empty';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: value.addressController),
|
||||
const SizedBox(height: 15),
|
||||
CSCPicker(
|
||||
defaultCountry: CscCountry.India,
|
||||
disableCountry: true,
|
||||
onCountryChanged: (val) {
|
||||
setState(() {
|
||||
value.country.text = val;
|
||||
});
|
||||
},
|
||||
onStateChanged: (val) {
|
||||
setState(() {
|
||||
value.state.text = val ?? '';
|
||||
});
|
||||
},
|
||||
onCityChanged: (val) {
|
||||
setState(() {
|
||||
value.city.text = val ?? '';
|
||||
});
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
CommonTextFormField(
|
||||
title: 'District',
|
||||
fillColor: Colors.white,
|
||||
validator: (String? value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'District cannot be empty';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: value.districtController),
|
||||
const SizedBox(height: 15),
|
||||
CommonTextFormField(
|
||||
maxLength: 6,
|
||||
title: 'Pincode',
|
||||
fillColor: Colors.white,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.digitsOnly
|
||||
],
|
||||
validator: (String? value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Pincode cannot be empty';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: value.pinCodeController),
|
||||
const SizedBox(height: 15),
|
||||
CommonTextFormField(
|
||||
maxLength: 10,
|
||||
title: 'Mobile Number',
|
||||
fillColor: Colors.white,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.digitsOnly
|
||||
],
|
||||
validator: (String? value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Mobile Number cannot be empty';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: value.mobileNumberController),
|
||||
const SizedBox(height: 15),
|
||||
CommonTextFormField(
|
||||
maxLength: 12,
|
||||
title: 'Aadhar Number',
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.digitsOnly
|
||||
],
|
||||
fillColor: Colors.white,
|
||||
validator: (String? value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Aadhar Number cannot be empty';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: value.aadharNumberController),
|
||||
const SizedBox(height: 15),
|
||||
CommonTextFormField(
|
||||
inputFormatters: [
|
||||
UpperCaseTextFormatter(),
|
||||
],
|
||||
maxLength: 10,
|
||||
title: 'PAN Number',
|
||||
fillColor: Colors.white,
|
||||
validator: (String? value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'PAN Number cannot be empty';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: value.panNumberController),
|
||||
const SizedBox(height: 15),
|
||||
CommonTextFormField(
|
||||
inputFormatters: [
|
||||
UpperCaseTextFormatter(),
|
||||
],
|
||||
maxLength: 15,
|
||||
title: 'GST Number',
|
||||
fillColor: Colors.white,
|
||||
validator: (String? value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'GST Number cannot be empty';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: value.gstNumberController),
|
||||
const SizedBox(height: 15),
|
||||
DropdownButtonFormField<String>(
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
filled: true,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide.none),
|
||||
hintText: 'Mapped Principal Distributor'),
|
||||
value: value.selectedDistributor,
|
||||
items: value.pdList.map((GetPdResponse pd) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: pd.sId, child: Text(pd.name ?? ''));
|
||||
}).toList(),
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
value.selectedDistributor = newValue;
|
||||
});
|
||||
},
|
||||
Column(
|
||||
children: [
|
||||
const SizedBox(height: 15),
|
||||
CommonTextFormField(
|
||||
title: 'Trade Name',
|
||||
fillColor: Colors.white,
|
||||
validator: (String? value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Mapped Principal Distributor cannot be empty';
|
||||
if (value!.isEmpty) {
|
||||
return 'Trade Name cannot be empty';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: value.tradeNameController),
|
||||
const SizedBox(height: 15),
|
||||
CommonTextFormField(
|
||||
title: 'Name',
|
||||
fillColor: Colors.white,
|
||||
validator: (String? value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Name cannot be empty';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: value.nameController),
|
||||
const SizedBox(height: 15),
|
||||
CommonTextFormField(
|
||||
title: 'Address',
|
||||
fillColor: Colors.white,
|
||||
validator: (String? value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Address cannot be empty';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: value.addressController),
|
||||
const SizedBox(height: 15),
|
||||
CSCPicker(
|
||||
defaultCountry: CscCountry.India,
|
||||
disableCountry: true,
|
||||
onCountryChanged: (val) {
|
||||
setState(() {
|
||||
value.country.text = val;
|
||||
});
|
||||
},
|
||||
onStateChanged: (val) {
|
||||
setState(() {
|
||||
value.state.text = val ?? '';
|
||||
});
|
||||
},
|
||||
onCityChanged: (val) {
|
||||
setState(() {
|
||||
value.city.text = val ?? '';
|
||||
});
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
CommonTextFormField(
|
||||
title: 'District',
|
||||
fillColor: Colors.white,
|
||||
validator: (String? value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'District cannot be empty';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: value.districtController),
|
||||
const SizedBox(height: 15),
|
||||
CommonTextFormField(
|
||||
maxLength: 6,
|
||||
title: 'Pincode',
|
||||
fillColor: Colors.white,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.digitsOnly
|
||||
],
|
||||
validator: (String? value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Pincode cannot be empty';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: value.pinCodeController),
|
||||
const SizedBox(height: 15),
|
||||
CommonTextFormField(
|
||||
maxLength: 10,
|
||||
title: 'Mobile Number',
|
||||
fillColor: Colors.white,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.digitsOnly
|
||||
],
|
||||
validator: (String? value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Mobile Number cannot be empty';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: value.mobileNumberController),
|
||||
const SizedBox(height: 15),
|
||||
CommonTextFormField(
|
||||
maxLength: 12,
|
||||
title: 'Aadhar Number',
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.digitsOnly
|
||||
],
|
||||
fillColor: Colors.white,
|
||||
validator: (String? value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Aadhar Number cannot be empty';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: value.aadharNumberController),
|
||||
const SizedBox(height: 15),
|
||||
CommonTextFormField(
|
||||
inputFormatters: [
|
||||
UpperCaseTextFormatter(),
|
||||
],
|
||||
maxLength: 10,
|
||||
title: 'PAN Number',
|
||||
fillColor: Colors.white,
|
||||
validator: (String? value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'PAN Number cannot be empty';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: value.panNumberController),
|
||||
const SizedBox(height: 15),
|
||||
CommonTextFormField(
|
||||
inputFormatters: [
|
||||
UpperCaseTextFormatter(),
|
||||
],
|
||||
maxLength: 15,
|
||||
title: 'GST Number',
|
||||
fillColor: Colors.white,
|
||||
validator: (String? value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'GST Number cannot be empty';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: value.gstNumberController),
|
||||
const SizedBox(height: 15),
|
||||
DropdownButtonFormField<String>(
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
filled: true,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide.none),
|
||||
hintText: 'Mapped Principal Distributor'),
|
||||
value: value.selectedDistributor,
|
||||
items: value.pdList.map((GetPdResponse pd) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: pd.sId, child: Text(pd.name ?? ''));
|
||||
}).toList(),
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
value.selectedDistributor = newValue;
|
||||
});
|
||||
},
|
||||
validator: (String? value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Mapped Principal Distributor cannot be empty';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: CommonElevatedButton(
|
||||
borderRadius: 30,
|
||||
width: double.infinity,
|
||||
height: kToolbarHeight - 10,
|
||||
text: 'CONTINUE',
|
||||
backgroundColor: const Color(0xff004791),
|
||||
onPressed: () {
|
||||
if (value.retailerDetailsFormKey.currentState!
|
||||
.validate()) {
|
||||
value.tabController.animateTo(1);
|
||||
}
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: CommonElevatedButton(
|
||||
borderRadius: 30,
|
||||
width: double.infinity,
|
||||
height: kToolbarHeight - 10,
|
||||
text: 'CONTINUE',
|
||||
backgroundColor: const Color(0xff004791),
|
||||
onPressed: () {
|
||||
if (value.retailerDetailsFormKey.currentState!
|
||||
.validate()) {
|
||||
value.tabController.animateTo(1);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
127
lib/screens/select_taskkyc_screen.dart
Normal file
127
lib/screens/select_taskkyc_screen.dart
Normal file
@ -0,0 +1,127 @@
|
||||
import 'package:cheminova/models/select_task_response.dart';
|
||||
import 'package:cheminova/provider/select_task_provider.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cheminova/screens/collect_kyc_screen.dart';
|
||||
import 'package:cheminova/widgets/common_app_bar.dart';
|
||||
import 'package:cheminova/widgets/common_drawer.dart';
|
||||
import 'package:cheminova/widgets/common_background.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class SelectTaskkycScreen extends StatefulWidget {
|
||||
const SelectTaskkycScreen({super.key});
|
||||
|
||||
@override
|
||||
State<SelectTaskkycScreen> createState() => SelectTaskkycScreenState();
|
||||
}
|
||||
|
||||
class SelectTaskkycScreenState extends State<SelectTaskkycScreen> {
|
||||
late SelectTaskProvider _selectTaskProvider;
|
||||
@override
|
||||
void initState() {
|
||||
_selectTaskProvider = SelectTaskProvider();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return ChangeNotifierProvider(
|
||||
create: (context) => _selectTaskProvider,
|
||||
child: CommonBackground(
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: CommonAppBar(title:const Text('Select Task'),
|
||||
backgroundColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
actions: [IconButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
icon: Image.asset('assets/Back_attendance.png'),
|
||||
padding: const EdgeInsets.only(right: 20),
|
||||
),
|
||||
]),
|
||||
drawer: const CommonDrawer(),
|
||||
body: Consumer<SelectTaskProvider>(
|
||||
builder: (context, value, child) => value.isLoading
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: _buildTaskList(),
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
Widget _buildTaskList() {
|
||||
return Consumer<SelectTaskProvider>(
|
||||
builder: (context, value, child) {
|
||||
if (value.tasksList.isEmpty) {
|
||||
return const Center(child: Text('No tasks available'));
|
||||
}
|
||||
return ListView.builder(
|
||||
itemCount: value.tasksList.length,
|
||||
itemBuilder: (context, index) =>
|
||||
_buildTaskCard(value.tasksList[index]),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Widget _buildTaskCard(Tasks task) {
|
||||
return Card(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
color: Colors.white,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.task, color: Colors.blueAccent),
|
||||
title: Text(
|
||||
task.task??'',
|
||||
style: const TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 16,
|
||||
fontFamily: 'Anek',
|
||||
),
|
||||
),
|
||||
trailing:
|
||||
const Icon(Icons.arrow_forward_ios, color: Colors.black87),
|
||||
onTap: () => Navigator.push(context,
|
||||
MaterialPageRoute(builder: (context) => CollectKycScreen(id:task.taskId??''))),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Note: ${task.note}'),
|
||||
Text('Date: ${task.taskDueDate}'),
|
||||
Text('Priority: ${task.taskPriority}'),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class TaskItem {
|
||||
final String title;
|
||||
final Widget screen;
|
||||
|
||||
TaskItem({required this.title, required this.screen});
|
||||
}
|
||||
|
||||
class KycTaskItem extends TaskItem {
|
||||
final String note;
|
||||
final String date;
|
||||
final String priority;
|
||||
|
||||
KycTaskItem({
|
||||
required String title,
|
||||
required Widget screen,
|
||||
required this.note,
|
||||
required this.date,
|
||||
required this.priority,
|
||||
}) : super(title: title, screen: screen);
|
||||
}
|
@ -16,4 +16,5 @@ class ApiUrls {
|
||||
static const String getProducts = '${baseUrl}product/getAll/user';
|
||||
static const String getPdRdUrl = '${baseUrl}inventory/distributors-SC/';
|
||||
static const String submitProductUrl = '${baseUrl}inventory/add-SC';
|
||||
static const String selectTaskUrl = '${baseUrl}task/tasks';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user