Update UI of Daily Task screen & kyc
This commit is contained in:
parent
d734bbb6ee
commit
f9a96d881a
@ -14,13 +14,14 @@ class CollectKycProvider extends ChangeNotifier {
|
|||||||
CollectKycProvider() {
|
CollectKycProvider() {
|
||||||
getPd();
|
getPd();
|
||||||
}
|
}
|
||||||
|
String? selectedTask;
|
||||||
TextEditingController country = TextEditingController(text: "India");
|
TextEditingController country = TextEditingController(text: "India");
|
||||||
TextEditingController state = TextEditingController();
|
TextEditingController state = TextEditingController();
|
||||||
TextEditingController city = TextEditingController();
|
TextEditingController city = TextEditingController();
|
||||||
|
|
||||||
late TabController tabController;
|
late TabController tabController;
|
||||||
final _apiClient = ApiClient();
|
final _apiClient = ApiClient();
|
||||||
|
final selectTaskController= TextEditingController();
|
||||||
final tradeNameController = TextEditingController();
|
final tradeNameController = TextEditingController();
|
||||||
final nameController = TextEditingController();
|
final nameController = TextEditingController();
|
||||||
final addressController = TextEditingController();
|
final addressController = TextEditingController();
|
||||||
@ -119,6 +120,8 @@ class CollectKycProvider extends ChangeNotifier {
|
|||||||
bool get isLoading => _isLoading;
|
bool get isLoading => _isLoading;
|
||||||
List<GetPdResponse> pdList = [];
|
List<GetPdResponse> pdList = [];
|
||||||
|
|
||||||
|
get taskList => ('Task 1','Task 2');
|
||||||
|
|
||||||
void setLoading(bool loading) {
|
void setLoading(bool loading) {
|
||||||
_isLoading = loading;
|
_isLoading = loading;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
@ -278,4 +281,9 @@ class CollectKycProvider extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setTask(String s) {
|
||||||
|
selectedTask = s;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,8 @@ class VisitDealersScreenState extends State<VisitDealersScreen> {
|
|||||||
final followUpActionsController = TextEditingController();
|
final followUpActionsController = TextEditingController();
|
||||||
final nextVisitDateController = TextEditingController();
|
final nextVisitDateController = TextEditingController();
|
||||||
|
|
||||||
String selectedPurpose = 'Sales/Liquidation';
|
String selectedPurpose = 'Sales';
|
||||||
List<String> purposeOptions = ['Sales/Liquidation', 'Dues collection', 'Others'];
|
List<String> purposeOptions = ['Sales', 'Dues collection', 'Others'];
|
||||||
|
|
||||||
Future<void> _pickImage() async {
|
Future<void> _pickImage() async {
|
||||||
final ImagePicker picker = ImagePicker();
|
final ImagePicker picker = ImagePicker();
|
||||||
|
@ -1,114 +1,251 @@
|
|||||||
import 'package:cheminova/screens/collect_kyc_screen.dart';
|
|
||||||
import 'package:cheminova/screens/update_inventory_screen.dart';
|
|
||||||
import 'package:cheminova/screens/display_sales_screen.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:cheminova/screens/Visit_Dealers_screen.dart';
|
import 'package:cheminova/screens/visit_dealers_screen.dart';
|
||||||
|
import 'package:cheminova/screens/display_sales_screen.dart';
|
||||||
|
import 'package:cheminova/screens/update_inventory_screen.dart';
|
||||||
|
import 'package:cheminova/screens/collect_kyc_screen.dart';
|
||||||
import 'package:cheminova/widgets/common_app_bar.dart';
|
import 'package:cheminova/widgets/common_app_bar.dart';
|
||||||
import 'package:cheminova/widgets/common_drawer.dart';
|
import 'package:cheminova/widgets/common_drawer.dart';
|
||||||
import 'package:cheminova/widgets/common_background.dart';
|
import 'package:cheminova/widgets/common_background.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
class DailyTasksScreen extends StatelessWidget {
|
class DailyTasksScreen extends StatefulWidget {
|
||||||
const DailyTasksScreen({super.key});
|
const DailyTasksScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<DailyTasksScreen> createState() => _DailyTasksScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DailyTasksScreenState extends State<DailyTasksScreen> {
|
||||||
|
final List<String> _tabTitles = ['NEW', 'PENDING', 'COMPLETED'];
|
||||||
|
int _selectedTabIndex = 0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
appBar: CommonAppBar(
|
appBar: _buildAppBar(),
|
||||||
backgroundColor: Colors.transparent,
|
|
||||||
elevation: 0,
|
|
||||||
actions: [
|
|
||||||
IconButton(
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
icon: Image.asset('assets/Back_attendance.png'),
|
|
||||||
padding: const EdgeInsets.only(right: 20),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
title: const Center(
|
|
||||||
child: Text(
|
|
||||||
'Daily Tasks',
|
|
||||||
style: TextStyle(color: Colors.black87, fontSize: 20),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
drawer: const CommonDrawer(),
|
drawer: const CommonDrawer(),
|
||||||
body: CommonBackground(
|
body: CommonBackground(
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(16.0),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
_buildCustomTabBar(),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ListView(
|
child: _buildTaskList(_selectedTabIndex),
|
||||||
children: [
|
|
||||||
_buildCustomCard(
|
|
||||||
'Visit Dealers/Retailers',
|
|
||||||
'',
|
|
||||||
onTap: () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => const VisitDealersScreen(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(height: 5),
|
|
||||||
_buildCustomCard(
|
|
||||||
'Update Sales Data',
|
|
||||||
'',
|
|
||||||
onTap: () {
|
|
||||||
Navigator.push(context,MaterialPageRoute(builder: (context) => const DisplaySalesScreen(),));
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(height: 5),
|
|
||||||
_buildCustomCard('Update Inventory Data', '',onTap: () {
|
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => const UpdateInventoryScreen(),));
|
|
||||||
},),
|
|
||||||
const SizedBox(height: 5),
|
|
||||||
_buildCustomCard('Collect KYC Documents', '',onTap:() {
|
|
||||||
Navigator.push(context, MaterialPageRoute(
|
|
||||||
builder: (context) => const CollectKycScreen(),));
|
|
||||||
}, ),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildCustomCard(String title, String subtitle, {void Function()? onTap}) {
|
PreferredSizeWidget _buildAppBar() {
|
||||||
|
return CommonAppBar(
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
elevation: 0,
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
icon: Image.asset('assets/Back_attendance.png'),
|
||||||
|
padding: const EdgeInsets.only(right: 20),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
title: const Text(
|
||||||
|
'Daily Tasks',
|
||||||
|
style: TextStyle(color: Colors.black87, fontSize: 20),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildCustomTabBar() {
|
||||||
return Container(
|
return Container(
|
||||||
margin: const EdgeInsets.only(bottom: 10),
|
height: 60,
|
||||||
|
margin: const EdgeInsets.symmetric(vertical: 16, horizontal: 8),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: List.generate(_tabTitles.length, (index) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () => setState(() => _selectedTabIndex = index),
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.indigo,
|
gradient: _selectedTabIndex == index
|
||||||
border: Border.all(color: Colors.white),
|
? const LinearGradient(
|
||||||
borderRadius: BorderRadius.circular(10),
|
colors: [Color(0xff004791), Color(0xff1a73e8)],
|
||||||
),
|
begin: Alignment.topLeft,
|
||||||
child: ListTile(
|
end: Alignment.bottomRight,
|
||||||
title: Text(
|
|
||||||
title,
|
|
||||||
style: const TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
fontWeight: FontWeight.w800,
|
|
||||||
fontSize: 18,
|
|
||||||
fontFamily: 'Anek'),
|
|
||||||
),
|
|
||||||
subtitle: subtitle.isNotEmpty
|
|
||||||
? Text(
|
|
||||||
subtitle,
|
|
||||||
style: const TextStyle(color: Colors.white70, fontSize: 13),
|
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
onTap: onTap,
|
color: _selectedTabIndex == index
|
||||||
|
? Colors.transparent
|
||||||
|
: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
border: Border.all(color: Colors.black),
|
||||||
|
boxShadow: [
|
||||||
|
if (_selectedTabIndex == index)
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black.withOpacity(0.1),
|
||||||
|
blurRadius: 6,
|
||||||
|
offset: const Offset(0, 4),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
_getTabIcon(index),
|
||||||
|
color: _selectedTabIndex == index
|
||||||
|
? Colors.white
|
||||||
|
: Colors.black,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Text(
|
||||||
|
_tabTitles[index],
|
||||||
|
style: TextStyle(
|
||||||
|
color: _selectedTabIndex == index
|
||||||
|
? Colors.white
|
||||||
|
: Colors.black,
|
||||||
|
fontWeight: _selectedTabIndex == index
|
||||||
|
? FontWeight.bold
|
||||||
|
: FontWeight.normal,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
IconData _getTabIcon(int index) {
|
||||||
|
switch (index) {
|
||||||
|
case 0:
|
||||||
|
return Icons.new_releases;
|
||||||
|
case 1:
|
||||||
|
return Icons.pending;
|
||||||
|
case 2:
|
||||||
|
return Icons.check_circle;
|
||||||
|
default:
|
||||||
|
return Icons.new_releases;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildTaskList(int tabIndex) {
|
||||||
|
List<TaskItem> tasks;
|
||||||
|
switch (tabIndex) {
|
||||||
|
case 0:
|
||||||
|
tasks = _newTasks;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
tasks = _pendingTasks;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
tasks = _completedTasks;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
tasks = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return ListView.separated(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
itemCount: tasks.length,
|
||||||
|
separatorBuilder: (context, index) => const SizedBox(height: 8),
|
||||||
|
itemBuilder: (context, index) => _buildTaskCard(tasks[index]),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildTaskCard(TaskItem task) {
|
||||||
|
if (task is KycTaskItem) {
|
||||||
|
return Card(
|
||||||
|
color: Colors.white,
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
ListTile(
|
||||||
|
leading: const Icon(Icons.task, color: Colors.blueAccent),
|
||||||
|
title: Text(
|
||||||
|
task.title,
|
||||||
|
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) => task.screen)),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text('Note: ${task.note}'),
|
||||||
|
Text('Date: ${task.date.toString().split(' ')[0]}'),
|
||||||
|
Text('Priority: ${task.Low}'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return Card(
|
||||||
|
color: Colors.white,
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||||
|
child: ListTile(
|
||||||
|
leading: const Icon(Icons.task, color: Colors.blueAccent),
|
||||||
|
title: Text(
|
||||||
|
task.title,
|
||||||
|
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) => task.screen)),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final List<TaskItem> _newTasks = [
|
||||||
|
KycTaskItem('Collect KYC Documents', const CollectKycScreen(),
|
||||||
|
'Collect KYC documents from ABC Trader', DateFormat('dd/MM/yyyy').format(DateTime.now()).toString(), 'Priority'),
|
||||||
|
TaskItem('Update Inventory Data', const UpdateInventoryScreen()),
|
||||||
|
];
|
||||||
|
|
||||||
|
final List<TaskItem> _pendingTasks = [
|
||||||
|
TaskItem('Update Sales Data', const DisplaySalesScreen()),
|
||||||
|
TaskItem('Visit Dealers/Retailers', const VisitDealersScreen()),
|
||||||
|
];
|
||||||
|
|
||||||
|
final List<TaskItem> _completedTasks = [
|
||||||
|
TaskItem('Completed Task 1', const Placeholder()),
|
||||||
|
TaskItem('Completed Task 2', const Placeholder()),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class TaskItem {
|
||||||
|
final String title;
|
||||||
|
final Widget screen;
|
||||||
|
|
||||||
|
TaskItem(this.title, this.screen);
|
||||||
|
}
|
||||||
|
|
||||||
|
class KycTaskItem extends TaskItem {
|
||||||
|
final String note;
|
||||||
|
final String date;
|
||||||
|
final String Low;
|
||||||
|
|
||||||
|
KycTaskItem(super.title, super.screen, this.note, this.date, this.Low);
|
||||||
|
}
|
||||||
|
@ -43,6 +43,30 @@ class RetailerDetailsScreenState extends State<RetailerDetailsScreen> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
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(
|
CommonTextFormField(
|
||||||
title: 'Trade Name',
|
title: 'Trade Name',
|
||||||
fillColor: Colors.white,
|
fillColor: Colors.white,
|
||||||
@ -78,7 +102,6 @@ class RetailerDetailsScreenState extends State<RetailerDetailsScreen> {
|
|||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
CSCPicker(
|
CSCPicker(
|
||||||
defaultCountry: CscCountry.India,
|
defaultCountry: CscCountry.India,
|
||||||
|
|
||||||
disableCountry: true,
|
disableCountry: true,
|
||||||
onCountryChanged: (val) {
|
onCountryChanged: (val) {
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -228,6 +251,9 @@ class RetailerDetailsScreenState extends State<RetailerDetailsScreen> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -235,53 +261,3 @@ class RetailerDetailsScreenState extends State<RetailerDetailsScreen> {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CustomCountryStateCityPicker extends StatelessWidget {
|
|
||||||
final TextEditingController country;
|
|
||||||
final TextEditingController state;
|
|
||||||
final TextEditingController city;
|
|
||||||
final Color dialogColor;
|
|
||||||
final InputDecoration textFieldDecoration;
|
|
||||||
|
|
||||||
const CustomCountryStateCityPicker({
|
|
||||||
Key? key,
|
|
||||||
required this.country,
|
|
||||||
required this.state,
|
|
||||||
required this.city,
|
|
||||||
required this.dialogColor,
|
|
||||||
required this.textFieldDecoration,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
TextFormField(
|
|
||||||
controller: country,
|
|
||||||
decoration: textFieldDecoration.copyWith(
|
|
||||||
labelText: 'Country',
|
|
||||||
enabled: false,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
TextFormField(
|
|
||||||
controller: state,
|
|
||||||
decoration: textFieldDecoration.copyWith(labelText: 'State'),
|
|
||||||
readOnly: true,
|
|
||||||
onTap: () {
|
|
||||||
// Implement state selection logic for India
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
TextFormField(
|
|
||||||
controller: city,
|
|
||||||
decoration: textFieldDecoration.copyWith(labelText: 'City'),
|
|
||||||
readOnly: true,
|
|
||||||
onTap: () {
|
|
||||||
// Implement city selection logic based on selected state
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -82,7 +82,6 @@ class _UpdateInventoryScreenState extends State<UpdateInventoryScreen> {
|
|||||||
}).toList(),
|
}).toList(),
|
||||||
onChanged: (val) =>
|
onChanged: (val) =>
|
||||||
value.updatePdRdValue(val),
|
value.updatePdRdValue(val),
|
||||||
// Disable the dropdown if no distributor type is selected
|
|
||||||
isExpanded: true,
|
isExpanded: true,
|
||||||
isDense: true,
|
isDense: true,
|
||||||
iconSize: 24,
|
iconSize: 24,
|
||||||
|
Loading…
Reference in New Issue
Block a user