-- kyc api and change password api has been integrated
This commit is contained in:
parent
bf492cbac2
commit
c30a9b7661
@ -1,4 +1,5 @@
|
|||||||
import 'package:cheminova/provider/collect_kyc_provider.dart';
|
import 'package:cheminova/provider/collect_kyc_provider.dart';
|
||||||
|
import 'package:cheminova/provider/home_provider.dart';
|
||||||
import 'package:cheminova/screens/Attendance_success.dart';
|
import 'package:cheminova/screens/Attendance_success.dart';
|
||||||
import 'package:cheminova/screens/forgot_password_screen.dart';
|
import 'package:cheminova/screens/forgot_password_screen.dart';
|
||||||
import 'package:cheminova/screens/login_screen.dart';
|
import 'package:cheminova/screens/login_screen.dart';
|
||||||
@ -10,9 +11,11 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
runApp(MultiProvider(providers: [
|
runApp(MultiProvider(
|
||||||
ChangeNotifierProvider(create: (context) => CollectKycProvider())
|
providers: [
|
||||||
], child: const MyApp()));
|
ChangeNotifierProvider(create: (context) => HomeProvider()),
|
||||||
|
],
|
||||||
|
child: const MyApp()));
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
|
74
lib/models/get_pd_response.dart
Normal file
74
lib/models/get_pd_response.dart
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
class GetPdResponse {
|
||||||
|
Avatar? avatar;
|
||||||
|
String? sId;
|
||||||
|
String? name;
|
||||||
|
String? email;
|
||||||
|
String? phone;
|
||||||
|
String? role;
|
||||||
|
String? uniqueId;
|
||||||
|
String? createdAt;
|
||||||
|
String? updatedAt;
|
||||||
|
int? iV;
|
||||||
|
|
||||||
|
GetPdResponse(
|
||||||
|
{this.avatar,
|
||||||
|
this.sId,
|
||||||
|
this.name,
|
||||||
|
this.email,
|
||||||
|
this.phone,
|
||||||
|
this.role,
|
||||||
|
this.uniqueId,
|
||||||
|
this.createdAt,
|
||||||
|
this.updatedAt,
|
||||||
|
this.iV});
|
||||||
|
|
||||||
|
GetPdResponse.fromJson(Map<String, dynamic> json) {
|
||||||
|
avatar =
|
||||||
|
json['avatar'] != null ? Avatar.fromJson(json['avatar']) : null;
|
||||||
|
sId = json['_id'];
|
||||||
|
name = json['name'];
|
||||||
|
email = json['email'];
|
||||||
|
phone = json['phone'];
|
||||||
|
role = json['role'];
|
||||||
|
uniqueId = json['uniqueId'];
|
||||||
|
createdAt = json['createdAt'];
|
||||||
|
updatedAt = json['updatedAt'];
|
||||||
|
iV = json['__v'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
if (avatar != null) {
|
||||||
|
data['avatar'] = avatar!.toJson();
|
||||||
|
}
|
||||||
|
data['_id'] = sId;
|
||||||
|
data['name'] = name;
|
||||||
|
data['email'] = email;
|
||||||
|
data['phone'] = phone;
|
||||||
|
data['role'] = role;
|
||||||
|
data['uniqueId'] = uniqueId;
|
||||||
|
data['createdAt'] = createdAt;
|
||||||
|
data['updatedAt'] = updatedAt;
|
||||||
|
data['__v'] = iV;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Avatar {
|
||||||
|
String? publicId;
|
||||||
|
String? url;
|
||||||
|
|
||||||
|
Avatar({this.publicId, this.url});
|
||||||
|
|
||||||
|
Avatar.fromJson(Map<String, dynamic> json) {
|
||||||
|
publicId = json['public_id'];
|
||||||
|
url = json['url'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['public_id'] = publicId;
|
||||||
|
data['url'] = url;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
@ -34,8 +34,19 @@ class AttendanceProvider extends ChangeNotifier {
|
|||||||
} else {
|
} else {
|
||||||
return (false, response.data['message'].toString());
|
return (false, response.data['message'].toString());
|
||||||
}
|
}
|
||||||
} catch (e) {
|
}on DioException catch (e) {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
if (e.response != null && e.response?.data != null) {
|
||||||
|
// Extracting the error message from the Dio response
|
||||||
|
return (false, e.response!.data['message'].toString());
|
||||||
|
} else {
|
||||||
|
// When no response or response data is available
|
||||||
|
return (false, 'Something went wrong');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
setLoading(false);
|
||||||
|
final message = e as DioException;
|
||||||
return (false, 'Something want wrong');
|
return (false, 'Something want wrong');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
51
lib/provider/change_password_provider.dart
Normal file
51
lib/provider/change_password_provider.dart
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
import 'package:cheminova/services/api_client.dart';
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../services/api_urls.dart';
|
||||||
|
|
||||||
|
class ChangePasswordProvider extends ChangeNotifier {
|
||||||
|
bool _isLoading = false;
|
||||||
|
|
||||||
|
final oldPasswordController = TextEditingController();
|
||||||
|
final newPasswordController = TextEditingController();
|
||||||
|
final confirmPasswordController = TextEditingController();
|
||||||
|
|
||||||
|
bool get isLoading => _isLoading;
|
||||||
|
final _apiClient = ApiClient();
|
||||||
|
|
||||||
|
void setLoading(bool loading) {
|
||||||
|
_isLoading = loading;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
Future<(bool, String)> changePassword() async {
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
Response response = await _apiClient.put(ApiUrls.changePasswordUrl,
|
||||||
|
data: {'oldPassword': oldPasswordController.text.trim(),
|
||||||
|
'confirmPassword': confirmPasswordController.text.trim(),
|
||||||
|
'newPassword': newPasswordController.text.trim()});
|
||||||
|
setLoading(false);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
return (true, response.data['message'].toString());
|
||||||
|
} else {
|
||||||
|
return (false, response.data['message'].toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
on DioException catch (e) {
|
||||||
|
setLoading(false);
|
||||||
|
if (e.response != null && e.response?.data != null) {
|
||||||
|
// Extracting the error message from the Dio response
|
||||||
|
return (false, e.response!.data['message'].toString());
|
||||||
|
} else {
|
||||||
|
// When no response or response data is available
|
||||||
|
return (false, 'Something went wrong');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
setLoading(false);
|
||||||
|
return (false, 'Something want wrong');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,80 +1,281 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:cheminova/models/get_pd_response.dart';
|
||||||
|
import 'package:cheminova/screens/data_submit_successfull.dart';
|
||||||
|
import 'package:cheminova/services/api_client.dart';
|
||||||
|
import 'package:cheminova/services/secure__storage_service.dart';
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:image_picker/image_picker.dart';
|
||||||
|
|
||||||
|
import '../services/api_urls.dart';
|
||||||
|
|
||||||
class CollectKycProvider extends ChangeNotifier {
|
class CollectKycProvider extends ChangeNotifier {
|
||||||
late TabController tabController;
|
CollectKycProvider() {
|
||||||
|
getPd();
|
||||||
|
}
|
||||||
|
|
||||||
|
TextEditingController country = TextEditingController(text: "India");
|
||||||
|
TextEditingController state = TextEditingController();
|
||||||
|
TextEditingController city = TextEditingController();
|
||||||
|
|
||||||
|
late TabController tabController;
|
||||||
|
final _apiClient = ApiClient();
|
||||||
final tradeNameController = TextEditingController();
|
final tradeNameController = TextEditingController();
|
||||||
final nameController = TextEditingController();
|
final nameController = TextEditingController();
|
||||||
final addressController = TextEditingController();
|
final addressController = TextEditingController();
|
||||||
final townCityController = TextEditingController();
|
final townCityController = TextEditingController();
|
||||||
final districtController = TextEditingController();
|
final districtController = TextEditingController();
|
||||||
final stateController = TextEditingController();
|
|
||||||
final pinCodeController = TextEditingController();
|
final pinCodeController = TextEditingController();
|
||||||
final mobileNumberController = TextEditingController();
|
final mobileNumberController = TextEditingController();
|
||||||
final aadharNumberController = TextEditingController();
|
final aadharNumberController = TextEditingController();
|
||||||
final panNumberController = TextEditingController();
|
final panNumberController = TextEditingController();
|
||||||
final gstNumberController = TextEditingController();
|
final gstNumberController = TextEditingController();
|
||||||
|
|
||||||
String? selectedDistributor;
|
String? selectedDistributor;
|
||||||
final List<String> distributors = [
|
|
||||||
'Distributor 1',
|
|
||||||
'Distributor 2',
|
|
||||||
'Distributor 3',
|
|
||||||
'Distributor 4',
|
|
||||||
];
|
|
||||||
final List<String> distributorIds = [
|
|
||||||
'Distributor 1',
|
|
||||||
'Distributor 2',
|
|
||||||
'Distributor 3',
|
|
||||||
'Distributor 4',
|
|
||||||
];
|
|
||||||
final List<String> distributorNames = [
|
|
||||||
'Distributor 1',
|
|
||||||
'Distributor 2',
|
|
||||||
'Distributor 3',
|
|
||||||
'Distributor 4',
|
|
||||||
];
|
|
||||||
final List<String> distributorAddresses = [
|
|
||||||
'Distributor 1',
|
|
||||||
'Distributor 2',
|
|
||||||
'Distributor 3',
|
|
||||||
'Distributor 4',
|
|
||||||
];
|
|
||||||
final List<String> distributorMobileNumbers = [
|
|
||||||
'Distributor 1',
|
|
||||||
'Distributor 2',
|
|
||||||
'Distributor 3',
|
|
||||||
'Distributor 4',
|
|
||||||
];
|
|
||||||
final List<String> distributorEmails = [
|
|
||||||
'Distributor 1',
|
|
||||||
'Distributor 2',
|
|
||||||
'Distributor 3',
|
|
||||||
'Distributor 4',
|
|
||||||
];
|
|
||||||
final List<String> distributorGstNumbers = [
|
|
||||||
'Distributor 1',
|
|
||||||
'Distributor 2',
|
|
||||||
'Distributor 3',
|
|
||||||
'Distributor 4',
|
|
||||||
];
|
|
||||||
final List<String> distributorPanNumbers = [
|
|
||||||
'Distributor 1',
|
|
||||||
'Distributor 2',
|
|
||||||
'Distributor 3',
|
|
||||||
'Distributor 4',
|
|
||||||
];
|
|
||||||
final List<String> distributorAadharNumbers = [
|
|
||||||
'Distributor 1',
|
|
||||||
'Distributor 2',
|
|
||||||
'Distributor 3',
|
|
||||||
'Distributor 4',
|
|
||||||
];
|
|
||||||
final List<String> distributorPinCodes = [
|
|
||||||
'Distributor 1',
|
|
||||||
'Distributor 2',
|
|
||||||
'Distributor 3',
|
|
||||||
'Distributor 4',
|
|
||||||
];
|
|
||||||
|
|
||||||
final retailerDetailsFormKey = GlobalKey<FormState>();
|
final retailerDetailsFormKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
|
File? panCard;
|
||||||
|
File? aadharCard;
|
||||||
|
File? gstRegistration;
|
||||||
|
File? pesticideLicense;
|
||||||
|
File? fertilizerLicense;
|
||||||
|
File? selfieEntranceBoard;
|
||||||
|
|
||||||
|
final ImagePicker _picker = ImagePicker();
|
||||||
|
|
||||||
|
Future<void> pickImage(ImageSource source, String documentType) async {
|
||||||
|
final pickedFile = await _picker.pickImage(source: source);
|
||||||
|
|
||||||
|
if (pickedFile != null) {
|
||||||
|
switch (documentType) {
|
||||||
|
case 'PAN Card':
|
||||||
|
panCard = File(pickedFile.path);
|
||||||
|
break;
|
||||||
|
case 'Aadhar Card':
|
||||||
|
aadharCard = File(pickedFile.path);
|
||||||
|
break;
|
||||||
|
case 'GST Registration':
|
||||||
|
gstRegistration = File(pickedFile.path);
|
||||||
|
break;
|
||||||
|
case 'Pesticide License':
|
||||||
|
pesticideLicense = File(pickedFile.path);
|
||||||
|
break;
|
||||||
|
case 'Fertilizer License':
|
||||||
|
fertilizerLicense = File(pickedFile.path);
|
||||||
|
break;
|
||||||
|
case 'Selfie of Entrance Board':
|
||||||
|
selfieEntranceBoard = File(pickedFile.path);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
void showPicker(BuildContext context, String documentType) {
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext bc) {
|
||||||
|
return SafeArea(
|
||||||
|
child: Wrap(
|
||||||
|
children: <Widget>[
|
||||||
|
if (documentType != 'Selfie of Entrance Board')
|
||||||
|
ListTile(
|
||||||
|
leading: const Icon(Icons.photo_library),
|
||||||
|
title: const Text('Photo Library'),
|
||||||
|
onTap: () {
|
||||||
|
pickImage(ImageSource.gallery, documentType);
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
leading: const Icon(Icons.photo_camera),
|
||||||
|
title: const Text('Camera'),
|
||||||
|
onTap: () {
|
||||||
|
pickImage(ImageSource.camera, documentType);
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add methods for state and city selection if needed
|
||||||
|
void selectState(String selectedState) {
|
||||||
|
state.text = selectedState;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectCity(String selectedCity) {
|
||||||
|
city.text = selectedCity;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool _isLoading = false;
|
||||||
|
|
||||||
|
bool get isLoading => _isLoading;
|
||||||
|
List<GetPdResponse> pdList = [];
|
||||||
|
|
||||||
|
void setLoading(bool loading) {
|
||||||
|
_isLoading = loading;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> getPd() async {
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
Response response = await _apiClient.get(ApiUrls.getPdUrl);
|
||||||
|
setLoading(false);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
pdList = (response.data as List)
|
||||||
|
.map((e) => GetPdResponse.fromJson(e))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
print('pd list length: ${pdList.length}');
|
||||||
|
} else {}
|
||||||
|
} catch (e) {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void validateFields(BuildContext context) {
|
||||||
|
if (tradeNameController.text.trim().isEmpty) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('Trade Name is required')),
|
||||||
|
);
|
||||||
|
} else if (nameController.text.trim().isEmpty) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('Name is required')),
|
||||||
|
);
|
||||||
|
} else if (addressController.text.trim().isEmpty) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('Address is required')),
|
||||||
|
);
|
||||||
|
} else if (city.text.trim().isEmpty) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('Town/City is required')),
|
||||||
|
);
|
||||||
|
} else if (districtController.text.trim().isEmpty) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('District is required')),
|
||||||
|
);
|
||||||
|
} else if (state.text.trim().isEmpty) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('State is required')),
|
||||||
|
);
|
||||||
|
} else if (pinCodeController.text.trim().isEmpty) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('Pincode is required')),
|
||||||
|
);
|
||||||
|
} else if (mobileNumberController.text.trim().isEmpty) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('Mobile Number is required')),
|
||||||
|
);
|
||||||
|
} else if (aadharNumberController.text.trim().isEmpty) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('Aadhar Number is required')),
|
||||||
|
);
|
||||||
|
} else if (panNumberController.text.trim().isEmpty) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('PAN Number is required')),
|
||||||
|
);
|
||||||
|
} else if (gstNumberController.text.trim().isEmpty) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('GST Number is required')),
|
||||||
|
);
|
||||||
|
} else if ((selectedDistributor ?? '').isEmpty) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(
|
||||||
|
content: Text('Mapped Principal Distributor is required')),
|
||||||
|
);
|
||||||
|
} else if (panCard == null) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('PAN Card is required')),
|
||||||
|
);
|
||||||
|
} else if (aadharCard == null) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('Aadhar Card is required')),
|
||||||
|
);
|
||||||
|
} else if (gstRegistration == null) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('GST Registration is required')),
|
||||||
|
);
|
||||||
|
} else if (pesticideLicense == null) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('Pesticide License is required')),
|
||||||
|
);
|
||||||
|
} else if (selfieEntranceBoard == null) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('Selfie of Entrance Board is required')),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
submitCollectKycForm(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> submitCollectKycForm(BuildContext context) async {
|
||||||
|
final dio = Dio();
|
||||||
|
final token = await SecureStorageService().read(key: 'access_token');
|
||||||
|
final headers = {'Authorization': 'Bearer $token'};
|
||||||
|
|
||||||
|
// Construct the FormData
|
||||||
|
final data = FormData.fromMap({
|
||||||
|
'name': nameController.text.trim(),
|
||||||
|
'trade_name': tradeNameController.text.trim(),
|
||||||
|
'address': addressController.text.trim(),
|
||||||
|
'state': state.text.trim(),
|
||||||
|
'city': city.text.trim(),
|
||||||
|
'district': districtController.text.trim(),
|
||||||
|
'pincode': pinCodeController.text.trim(),
|
||||||
|
'mobile_number': mobileNumberController.text.trim(),
|
||||||
|
'principal_distributer': selectedDistributor,
|
||||||
|
'pan_number': panNumberController.text.trim(),
|
||||||
|
'aadhar_number': aadharNumberController.text.trim(),
|
||||||
|
'gst_number': gstNumberController.text.trim(),
|
||||||
|
if (panCard != null)
|
||||||
|
'pan_img': await MultipartFile.fromFile(panCard!.path, filename: 'pan_card.jpg'),
|
||||||
|
if (aadharCard != null)
|
||||||
|
'aadhar_img': await MultipartFile.fromFile(aadharCard!.path, filename: 'aadhar_card.jpg'),
|
||||||
|
if (gstRegistration != null)
|
||||||
|
'gst_img': await MultipartFile.fromFile(gstRegistration!.path, filename: 'gst_registration.jpg'),
|
||||||
|
if (pesticideLicense != null)
|
||||||
|
'pesticide_license_img': await MultipartFile.fromFile(pesticideLicense!.path, filename: 'pesticide_license.jpg'),
|
||||||
|
if (selfieEntranceBoard != null)
|
||||||
|
'selfie_entrance_img': await MultipartFile.fromFile(selfieEntranceBoard!.path, filename: 'selfie_entrance_board.jpg'),
|
||||||
|
});
|
||||||
|
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
|
||||||
|
Response response = await _apiClient.post(ApiUrls.createCollectKycUrl,
|
||||||
|
data: data);
|
||||||
|
|
||||||
|
setLoading(false);
|
||||||
|
|
||||||
|
if (response.data['success'] == true) {
|
||||||
|
if (context.mounted) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(content: Text(response.data['message'].toString())));
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const DataSubmitSuccessfull()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (context.mounted) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||||
|
content: Text('Submission failed: ${response.statusMessage}')));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
setLoading(false);
|
||||||
|
if (context.mounted) {
|
||||||
|
ScaffoldMessenger.of(context)
|
||||||
|
.showSnackBar(SnackBar(content: Text('An error occurred: $e')));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
33
lib/provider/home_provider.dart
Normal file
33
lib/provider/home_provider.dart
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import 'package:cheminova/models/profile_response.dart';
|
||||||
|
import 'package:cheminova/services/api_client.dart';
|
||||||
|
import 'package:cheminova/services/api_urls.dart';
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
|
import '../models/get_pd_response.dart';
|
||||||
|
|
||||||
|
class HomeProvider extends ChangeNotifier {
|
||||||
|
final _apiClient = ApiClient();
|
||||||
|
ProfileResponse? profileResponse;
|
||||||
|
bool _isLoading = false;
|
||||||
|
|
||||||
|
bool get isLoading => _isLoading;
|
||||||
|
|
||||||
|
void setLoading(bool loading) {
|
||||||
|
_isLoading = loading;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> getProfile() async {
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
Response response = await _apiClient.get(ApiUrls.getProfileUrl);
|
||||||
|
setLoading(false);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
profileResponse = ProfileResponse.fromJson(response.data);
|
||||||
|
} else {}
|
||||||
|
} catch (e) {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:cheminova/provider/change_password_provider.dart';
|
||||||
import 'package:cheminova/provider/login_provider.dart';
|
import 'package:cheminova/provider/login_provider.dart';
|
||||||
import 'package:cheminova/screens/password_change_screen.dart';
|
import 'package:cheminova/screens/password_change_screen.dart';
|
||||||
import 'package:cheminova/widgets/common_app_bar.dart';
|
import 'package:cheminova/widgets/common_app_bar.dart';
|
||||||
@ -8,6 +9,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import '../widgets/common_drawer.dart';
|
import '../widgets/common_drawer.dart';
|
||||||
|
import 'home_screen.dart';
|
||||||
|
|
||||||
class ChangePasswordPage extends StatefulWidget {
|
class ChangePasswordPage extends StatefulWidget {
|
||||||
const ChangePasswordPage({super.key});
|
const ChangePasswordPage({super.key});
|
||||||
@ -17,132 +19,166 @@ class ChangePasswordPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _ChangePasswordPageState extends State<ChangePasswordPage> {
|
class _ChangePasswordPageState extends State<ChangePasswordPage> {
|
||||||
|
late ChangePasswordProvider changePasswordProvider;
|
||||||
final _formKey = GlobalKey<FormState>();
|
final _formKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
changePasswordProvider = ChangePasswordProvider();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return CommonBackground(
|
return ChangeNotifierProvider<ChangePasswordProvider>(
|
||||||
isFullWidth: true,
|
create: (_) => changePasswordProvider,
|
||||||
child: Scaffold(
|
builder: (context, child) {
|
||||||
drawer: const CommonDrawer(),
|
return Stack(
|
||||||
|
children: [
|
||||||
backgroundColor: Colors.transparent,
|
CommonBackground(
|
||||||
|
isFullWidth: true,
|
||||||
appBar: CommonAppBar(
|
child: Scaffold(
|
||||||
|
drawer: const CommonDrawer(),
|
||||||
title: const Text(''),
|
backgroundColor: Colors.transparent,
|
||||||
backgroundColor: Colors.transparent,
|
appBar: CommonAppBar(
|
||||||
elevation: 0,
|
title: const Text(''),
|
||||||
actions: [
|
backgroundColor: Colors.transparent,
|
||||||
IconButton(
|
elevation: 0,
|
||||||
onPressed: () {
|
actions: [
|
||||||
Navigator.pop(context);
|
IconButton(
|
||||||
},
|
onPressed: () {
|
||||||
icon: Image.asset('assets/Back_attendance.png'),
|
Navigator.pop(context);
|
||||||
padding: const EdgeInsets.only(right: 20),
|
},
|
||||||
),
|
icon: Image.asset('assets/Back_attendance.png'),
|
||||||
],
|
padding: const EdgeInsets.only(right: 20),
|
||||||
),
|
),
|
||||||
body: SingleChildScrollView(
|
],
|
||||||
child: Column(
|
),
|
||||||
children: [
|
body: SingleChildScrollView(
|
||||||
// const SizedBox(height: 50),
|
|
||||||
// const SizedBox(height: 60),
|
|
||||||
Container(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.all(20.0).copyWith(top: 15, bottom: 30),
|
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 30.0),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border.all(color: Colors.white),
|
|
||||||
color: const Color(0xffB4D1E5).withOpacity(0.9),
|
|
||||||
borderRadius: BorderRadius.circular(26.0)),
|
|
||||||
child: Form(
|
|
||||||
key: _formKey,
|
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
children: [
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
// const SizedBox(height: 50),
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
// const SizedBox(height: 60),
|
||||||
children: <Widget>[
|
Container(
|
||||||
const SizedBox(height: 20),
|
padding: const EdgeInsets.all(20.0)
|
||||||
const Text('Change Password',
|
.copyWith(top: 15, bottom: 30),
|
||||||
style: TextStyle(
|
margin: const EdgeInsets.symmetric(horizontal: 30.0),
|
||||||
fontSize: 30,
|
decoration: BoxDecoration(
|
||||||
color: Colors.black,
|
border: Border.all(color: Colors.white),
|
||||||
fontWeight: FontWeight.w500,
|
color: const Color(0xffB4D1E5).withOpacity(0.9),
|
||||||
fontFamily: 'Roboto')),
|
borderRadius: BorderRadius.circular(26.0)),
|
||||||
const SizedBox(height: 20),
|
child: Form(
|
||||||
CommonTextFormField(
|
key: _formKey,
|
||||||
// controller: value.emailController,
|
child: Column(
|
||||||
validator: (value) {
|
mainAxisSize: MainAxisSize.min,
|
||||||
if (value == null || value.isEmpty) {
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
return 'Please enter your email id';
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
}
|
children: <Widget>[
|
||||||
if (!RegExp(r'^[^@\s]+@[^@\s]+\.[^@\s]+$')
|
const SizedBox(height: 20),
|
||||||
.hasMatch(value)) {
|
const Text('Change Password',
|
||||||
return 'Please enter a valid email id';
|
style: TextStyle(
|
||||||
}
|
fontSize: 30,
|
||||||
return null;
|
color: Colors.black,
|
||||||
},
|
fontWeight: FontWeight.w500,
|
||||||
title: 'Current Password'),
|
fontFamily: 'Roboto')),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
CommonTextFormField(
|
Consumer<ChangePasswordProvider>(
|
||||||
// controller: value.passwordController,
|
builder: (context, value, child) =>
|
||||||
validator: (value) {
|
CommonTextFormField(
|
||||||
if (value == null || value.isEmpty) {
|
controller: value.oldPasswordController,
|
||||||
return 'Please enter your password';
|
validator: (val) {
|
||||||
}
|
if (val == null || val.isEmpty) {
|
||||||
return null;
|
return 'Please enter your password';
|
||||||
},
|
}
|
||||||
title: 'New Password'), const SizedBox(height: 20),
|
return null;
|
||||||
CommonTextFormField(
|
},
|
||||||
// controller: value.passwordController,
|
title: 'Old Password'),
|
||||||
validator: (value) {
|
),
|
||||||
if (value == null || value.isEmpty) {
|
const SizedBox(height: 20),
|
||||||
return 'Please enter your password';
|
Consumer<ChangePasswordProvider>(
|
||||||
}
|
builder: (context, value, child) =>
|
||||||
return null;
|
CommonTextFormField(
|
||||||
},
|
controller: value.newPasswordController,
|
||||||
title: 'Confirm Password'),
|
validator: (val) {
|
||||||
const SizedBox(height: 15),
|
if (val == null || val.isEmpty) {
|
||||||
Align(
|
return 'Please enter your password';
|
||||||
alignment: Alignment.center,
|
}
|
||||||
child: CommonElevatedButton(
|
return null;
|
||||||
backgroundColor: const Color(0xff004791),
|
},
|
||||||
borderRadius: 30,
|
title: 'New Password'),
|
||||||
width: double.infinity,
|
),
|
||||||
height: kToolbarHeight - 10,
|
const SizedBox(height: 20),
|
||||||
text: 'SIGN IN',
|
Consumer<ChangePasswordProvider>(
|
||||||
isLoading: false,
|
builder: (context, value, child) =>
|
||||||
onPressed: () {
|
CommonTextFormField(
|
||||||
Navigator.push(context, MaterialPageRoute(builder:(context) => const PasswordChangeScreen()));
|
controller:
|
||||||
},
|
value.confirmPasswordController,
|
||||||
// onPressed: value.isLoading
|
validator: (val) {
|
||||||
// ? null
|
if (val == null || val.isEmpty) {
|
||||||
// : () async {
|
return 'Please enter your password';
|
||||||
// if (_formKey.currentState!.validate()) {
|
} else if (val !=
|
||||||
// value.login().then((result) {
|
value
|
||||||
// var (status, message) = result;
|
.newPasswordController.text) {
|
||||||
// ScaffoldMessenger.of(context)
|
return 'Password does not match';
|
||||||
// .showSnackBar(SnackBar(
|
}
|
||||||
// content: Text(message)));
|
return null;
|
||||||
// if (status) {
|
},
|
||||||
// Navigator.pushReplacement(
|
title: 'Confirm Password'),
|
||||||
// context,
|
),
|
||||||
// MaterialPageRoute(
|
const SizedBox(height: 15),
|
||||||
// builder: (context) =>
|
Align(
|
||||||
// const HomePage()));
|
alignment: Alignment.center,
|
||||||
// }
|
child: Consumer<ChangePasswordProvider>(
|
||||||
// });
|
builder: (context, value, child) =>
|
||||||
// }
|
CommonElevatedButton(
|
||||||
// },
|
backgroundColor: const Color(0xff004791),
|
||||||
))
|
borderRadius: 30,
|
||||||
|
width: double.infinity,
|
||||||
|
height: kToolbarHeight - 10,
|
||||||
|
text: 'SIGN IN',
|
||||||
|
isLoading: false,
|
||||||
|
onPressed: value.isLoading
|
||||||
|
? null
|
||||||
|
: () async {
|
||||||
|
if (_formKey.currentState!
|
||||||
|
.validate()) {
|
||||||
|
value
|
||||||
|
.changePassword()
|
||||||
|
.then((result) {
|
||||||
|
var (status, message) =
|
||||||
|
result;
|
||||||
|
ScaffoldMessenger.of(context)
|
||||||
|
.showSnackBar(SnackBar(
|
||||||
|
content:
|
||||||
|
Text(message)));
|
||||||
|
if (status) {
|
||||||
|
Navigator.pushReplacement(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) =>
|
||||||
|
const HomePage()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
)),
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
)),
|
Consumer<ChangePasswordProvider>(
|
||||||
);
|
builder: (context, value, child) => value.isLoading?
|
||||||
|
Container(
|
||||||
|
color: Colors.black.withOpacity(0.5),
|
||||||
|
child: const Center(child: CircularProgressIndicator())):Container(),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,10 @@ class CollectKycScreen extends StatefulWidget {
|
|||||||
State<CollectKycScreen> createState() => CollectKycScreenState();
|
State<CollectKycScreen> createState() => CollectKycScreenState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class CollectKycScreenState extends State<CollectKycScreen> with SingleTickerProviderStateMixin{
|
class CollectKycScreenState extends State<CollectKycScreen>
|
||||||
|
with SingleTickerProviderStateMixin {
|
||||||
|
late CollectKycProvider collectKycProvider;
|
||||||
|
|
||||||
final _pages = [
|
final _pages = [
|
||||||
const RetailerDetailsScreen(),
|
const RetailerDetailsScreen(),
|
||||||
const UploadDocumentScreen(),
|
const UploadDocumentScreen(),
|
||||||
@ -26,7 +29,8 @@ class CollectKycScreenState extends State<CollectKycScreen> with SingleTickerPro
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
Provider.of<CollectKycProvider>(context,listen: false).tabController = TabController(length: 3, vsync: this);
|
collectKycProvider = CollectKycProvider();
|
||||||
|
collectKycProvider.tabController = TabController(length: 3, vsync: this);
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,57 +136,65 @@ class CollectKycScreenState extends State<CollectKycScreen> with SingleTickerPro
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Consumer<CollectKycProvider>(
|
return ChangeNotifierProvider(
|
||||||
builder: (BuildContext context, value, Widget? child) => CommonBackground(
|
create: (context) => collectKycProvider,
|
||||||
child: DefaultTabController(
|
child: Consumer<CollectKycProvider>(
|
||||||
length: 3,
|
builder: (BuildContext context, value, Widget? child) =>
|
||||||
child: Scaffold(
|
Stack(children: [
|
||||||
backgroundColor: Colors.transparent,
|
CommonBackground(
|
||||||
appBar: PreferredSize(
|
child: DefaultTabController(
|
||||||
preferredSize: const Size.fromHeight(100),
|
length: 3,
|
||||||
child: CommonAppBar(
|
child: Scaffold(
|
||||||
actions: [
|
backgroundColor: Colors.transparent,
|
||||||
IconButton(
|
appBar: PreferredSize(
|
||||||
onPressed: () {
|
preferredSize: const Size.fromHeight(100),
|
||||||
Navigator.pop(context);
|
child: CommonAppBar(
|
||||||
},
|
actions: [
|
||||||
icon: Image.asset('assets/Back_attendance.png'),
|
IconButton(
|
||||||
padding: const EdgeInsets.only(right: 20),
|
onPressed: () {
|
||||||
),
|
Navigator.pop(context);
|
||||||
],
|
},
|
||||||
title: const Text('Collect KYC Data',
|
icon:
|
||||||
style: TextStyle(
|
Image.asset('assets/Back_attendance.png'),
|
||||||
fontSize: 20,
|
padding: const EdgeInsets.only(right: 20),
|
||||||
color: Colors.black,
|
),
|
||||||
fontWeight: FontWeight.w400,
|
],
|
||||||
fontFamily: 'Anek')),
|
title: const Text('Collect KYC Data',
|
||||||
backgroundColor: Colors.transparent,
|
style: TextStyle(
|
||||||
elevation: 0,
|
fontSize: 20,
|
||||||
bottom: TabBar(
|
color: Colors.black,
|
||||||
controller: value.tabController,
|
fontWeight: FontWeight.w400,
|
||||||
|
fontFamily: 'Anek')),
|
||||||
padding:
|
backgroundColor: Colors.transparent,
|
||||||
const EdgeInsets.symmetric(horizontal: 10),
|
elevation: 0,
|
||||||
dividerColor: Colors.transparent,
|
bottom: TabBar(
|
||||||
indicatorColor: Colors.yellow,
|
controller: value.tabController,
|
||||||
labelColor: Colors.white,
|
padding: const EdgeInsets.symmetric(
|
||||||
unselectedLabelColor: Colors.black,
|
horizontal: 10),
|
||||||
indicatorSize: TabBarIndicatorSize.tab,
|
dividerColor: Colors.transparent,
|
||||||
indicator: BoxDecoration(
|
indicatorColor: Colors.yellow,
|
||||||
color: Colors.blue,
|
labelColor: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(10)),
|
unselectedLabelColor: Colors.black,
|
||||||
tabs: const [
|
indicatorSize: TabBarIndicatorSize.tab,
|
||||||
Tab(text: 'Details'),
|
indicator: BoxDecoration(
|
||||||
Tab(text: 'Documents'),
|
color: Colors.blue,
|
||||||
Tab(text: 'Verify')
|
borderRadius: BorderRadius.circular(10)),
|
||||||
]))),
|
tabs: const [
|
||||||
drawer: const CommonDrawer(),
|
Tab(text: 'Details'),
|
||||||
body: TabBarView(
|
Tab(text: 'Documents'),
|
||||||
controller: value.tabController,
|
Tab(text: 'Verify')
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
]))),
|
||||||
children: _pages)))
|
drawer: const CommonDrawer(),
|
||||||
|
body: TabBarView(
|
||||||
),
|
controller: value.tabController,
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
children: _pages)))),
|
||||||
|
if (value.isLoading)
|
||||||
|
Container(
|
||||||
|
color: Colors.black.withOpacity(0.5),
|
||||||
|
child: const Center(child: CircularProgressIndicator()))
|
||||||
|
]),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
|
import 'package:cheminova/provider/change_password_provider.dart';
|
||||||
import 'package:cheminova/screens/verify_phone_screen.dart';
|
import 'package:cheminova/screens/verify_phone_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';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import 'home_screen.dart';
|
||||||
|
|
||||||
class ForgotPasswordScreen extends StatefulWidget {
|
class ForgotPasswordScreen extends StatefulWidget {
|
||||||
const ForgotPasswordScreen({super.key});
|
const ForgotPasswordScreen({super.key});
|
||||||
@ -12,6 +16,8 @@ class ForgotPasswordScreen extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> {
|
class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> {
|
||||||
|
final _formKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return CommonBackground(
|
return CommonBackground(
|
||||||
@ -31,74 +37,98 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> {
|
|||||||
color: const Color(0xffB4D1E5).withOpacity(0.9),
|
color: const Color(0xffB4D1E5).withOpacity(0.9),
|
||||||
borderRadius: BorderRadius.circular(26.0),
|
borderRadius: BorderRadius.circular(26.0),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Form(
|
||||||
mainAxisSize: MainAxisSize.min,
|
key: _formKey,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
Align(
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
alignment: Alignment.topLeft,
|
children: <Widget>[
|
||||||
child: Image.asset(
|
Align(
|
||||||
'assets/lock_logo2.png',
|
alignment: Alignment.topLeft,
|
||||||
height: 50.0, // Adjust the height as needed
|
child: Image.asset(
|
||||||
width: 50.0, // Adjust the width as needed
|
'assets/lock_logo2.png',
|
||||||
|
height: 50.0, // Adjust the height as needed
|
||||||
|
width: 50.0, // Adjust the width as needed
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Text(
|
||||||
|
'Forgot Password',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 30,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
fontFamily: 'Anek',
|
||||||
),
|
),
|
||||||
),
|
|
||||||
const Text(
|
|
||||||
'Forgot Password',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 30,
|
|
||||||
color: Colors.black,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
fontFamily: 'Anek',
|
|
||||||
),
|
),
|
||||||
),
|
const Text(
|
||||||
const Text(
|
'Enter Registered Email ID to generate new password',
|
||||||
'Enter Registered Email ID to generate new password',
|
style: TextStyle(
|
||||||
style: TextStyle(
|
fontSize: 14,
|
||||||
fontSize: 14,
|
color: Colors.black,
|
||||||
color: Colors.black,
|
fontWeight: FontWeight.w300,
|
||||||
fontWeight: FontWeight.w300,
|
fontFamily: 'Roboto',
|
||||||
fontFamily: 'Roboto',
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 20),
|
||||||
const SizedBox(height: 20),
|
const CommonTextFormField(title: ' Enter Your Email ID'),
|
||||||
const CommonTextFormField(title: ' Enter Your Email ID'),
|
const SizedBox(height: 20),
|
||||||
const SizedBox(height: 20),
|
Align(
|
||||||
Align(
|
alignment: Alignment.center,
|
||||||
alignment: Alignment.center,
|
child: TextButton(
|
||||||
child: TextButton(
|
onPressed: () {
|
||||||
onPressed: () {
|
Navigator.pop(context);
|
||||||
Navigator.pop(context);
|
},
|
||||||
},
|
child: const Text('Back to Login',
|
||||||
child: const Text('Back to Login',
|
style: TextStyle(
|
||||||
style: TextStyle(
|
fontSize: 20,
|
||||||
fontSize: 20,
|
color: Colors.black,
|
||||||
color: Colors.black,
|
fontWeight: FontWeight.w400,
|
||||||
fontWeight: FontWeight.w400,
|
fontFamily: 'Roboto')),
|
||||||
fontFamily: 'Roboto')),
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 15),
|
||||||
const SizedBox(height: 15),
|
Align(
|
||||||
Align(
|
alignment: Alignment.center,
|
||||||
alignment: Alignment.center,
|
child: Consumer<ChangePasswordProvider>(
|
||||||
child: CommonElevatedButton(
|
builder: (context, value, child) => CommonElevatedButton(
|
||||||
backgroundColor: const Color(0xff004791),
|
backgroundColor: const Color(0xff004791),
|
||||||
borderRadius: 30,
|
borderRadius: 30,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: kToolbarHeight - 10,
|
height: kToolbarHeight - 10,
|
||||||
text: 'SEND',
|
text: 'SEND',
|
||||||
onPressed: () {
|
onPressed: value.isLoading
|
||||||
Navigator.push(
|
? null
|
||||||
context,
|
: () async {
|
||||||
MaterialPageRoute(
|
if (_formKey.currentState!.validate()) {
|
||||||
builder: (context) => const VerifyPhoneScreen(),
|
value.changePassword().then((result) {
|
||||||
),
|
var (status, message) = result;
|
||||||
);
|
ScaffoldMessenger.of(context)
|
||||||
},
|
.showSnackBar(SnackBar(
|
||||||
|
content: Text(message)));
|
||||||
|
if (status) {
|
||||||
|
Navigator.pushReplacement(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) =>
|
||||||
|
const HomePage()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// onPressed: () {
|
||||||
|
// Navigator.push(
|
||||||
|
// context,
|
||||||
|
// MaterialPageRoute(
|
||||||
|
// builder: (context) => const VerifyPhoneScreen(),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -1,49 +1,65 @@
|
|||||||
|
import 'package:cheminova/provider/home_provider.dart';
|
||||||
import 'package:cheminova/screens/calendar_screen.dart';
|
import 'package:cheminova/screens/calendar_screen.dart';
|
||||||
import 'package:cheminova/screens/collect_kyc_screen.dart';
|
import 'package:cheminova/screens/collect_kyc_screen.dart';
|
||||||
|
import 'package:cheminova/screens/daily_tasks_screen.dart';
|
||||||
|
import 'package:cheminova/screens/display_sales_screen.dart';
|
||||||
import 'package:cheminova/screens/mark_attendence_screen.dart';
|
import 'package:cheminova/screens/mark_attendence_screen.dart';
|
||||||
import 'package:cheminova/screens/notification_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/products_manual_screen.dart';
|
||||||
import 'package:cheminova/screens/summary_screen.dart';
|
import 'package:cheminova/screens/summary_screen.dart';
|
||||||
import 'package:cheminova/screens/product_sales_data.dart';
|
|
||||||
import 'package:cheminova/screens/update_inventory_screen.dart';
|
import 'package:cheminova/screens/update_inventory_screen.dart';
|
||||||
import 'package:cheminova/screens/display_sales_screen.dart';
|
|
||||||
import 'package:cheminova/widgets/common_app_bar.dart';
|
import 'package:cheminova/widgets/common_app_bar.dart';
|
||||||
|
import 'package:cheminova/widgets/common_background.dart';
|
||||||
import 'package:cheminova/widgets/common_drawer.dart';
|
import 'package:cheminova/widgets/common_drawer.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:cheminova/widgets/common_background.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:cheminova/screens/daily_tasks_screen.dart';
|
|
||||||
|
|
||||||
class HomePage extends StatelessWidget {
|
class HomePage extends StatefulWidget {
|
||||||
const HomePage({super.key});
|
const HomePage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<HomePage> createState() => _HomePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _HomePageState extends State<HomePage> {
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
Provider.of<HomeProvider>(context, listen: false).getProfile();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return CommonBackground(
|
return CommonBackground(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
appBar: const CommonAppBar(
|
appBar: CommonAppBar(
|
||||||
title: Row(
|
title: Row(children: [
|
||||||
children: [
|
// CircleAvatar(
|
||||||
// CircleAvatar(
|
// backgroundImage: AssetImage(
|
||||||
// backgroundImage: AssetImage(
|
// 'assets/profile.png'), // Replace with actual user image
|
||||||
// 'assets/profile.png'), // Replace with actual user image
|
// ),
|
||||||
// ),
|
const SizedBox(width: 10),
|
||||||
SizedBox(width: 10),
|
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||||
Column(
|
const Text('Welcome',
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
style: TextStyle(
|
||||||
children: [
|
color: Colors.black87,
|
||||||
Text('Welcome',
|
fontSize: 14,
|
||||||
style: TextStyle(
|
fontWeight: FontWeight.w400)),
|
||||||
color: Colors.black87,
|
Consumer<HomeProvider>(
|
||||||
fontSize: 14,
|
builder: (context, value, child) =>
|
||||||
fontWeight: FontWeight.w400)),
|
(value.profileResponse == null ||
|
||||||
Text('User Name',
|
value.profileResponse!.myData == null ||
|
||||||
style: TextStyle(
|
value.profileResponse!.myData!.name == null)
|
||||||
color: Colors.black87, fontSize: 20)),
|
? const SizedBox()
|
||||||
],
|
: Text(value.profileResponse!.myData!.name ?? '',
|
||||||
),
|
style: const TextStyle(
|
||||||
],
|
color: Colors.black87, fontSize: 20)))
|
||||||
), backgroundColor: Colors.transparent, elevation: 0,
|
])
|
||||||
|
]),
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
elevation: 0,
|
||||||
),
|
),
|
||||||
drawer: const CommonDrawer(),
|
drawer: const CommonDrawer(),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
@ -62,7 +78,8 @@ class HomePage extends StatelessWidget {
|
|||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => const MarkAttendanceScreen(),
|
builder: (context) =>
|
||||||
|
const MarkAttendanceScreen(),
|
||||||
));
|
));
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -82,14 +99,16 @@ class HomePage extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: _buildCustomCard('Display\nSales data',
|
child: _buildCustomCard(
|
||||||
'Quickly display Sales', onTap: () {
|
'Display\nSales data', 'Quickly display Sales',
|
||||||
Navigator.push(
|
onTap: () {
|
||||||
context,
|
Navigator.push(
|
||||||
MaterialPageRoute(
|
context,
|
||||||
builder: (context) => const DisplaySalesScreen(),
|
MaterialPageRoute(
|
||||||
));
|
builder: (context) =>
|
||||||
}),
|
const DisplaySalesScreen(),
|
||||||
|
));
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 12,
|
width: 12,
|
||||||
@ -97,12 +116,13 @@ class HomePage extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: _buildCustomCard('Update Inventory Data',
|
child: _buildCustomCard('Update Inventory Data',
|
||||||
'Quickly Inventory Data', onTap: () {
|
'Quickly Inventory Data', onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => const UpdateInventoryScreen(),
|
builder: (context) =>
|
||||||
));
|
const UpdateInventoryScreen(),
|
||||||
}),
|
));
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -112,7 +132,8 @@ class HomePage extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: _buildCustomCard('Summary', '\n\n', onTap: () {
|
child:
|
||||||
|
_buildCustomCard('Summary', '\n\n', onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
@ -125,11 +146,13 @@ class HomePage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: _buildCustomCard(
|
child: _buildCustomCard(
|
||||||
'Product\nSales Data Visibility', '', onTap: () {
|
'Product\nSales Data Visibility', '',
|
||||||
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => const ProductSalesData(),
|
builder: (context) =>
|
||||||
|
const ProductSalesData(),
|
||||||
));
|
));
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
@ -143,12 +166,13 @@ class HomePage extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: _buildCustomCard('Collect \nKYC Data',
|
child: _buildCustomCard('Collect \nKYC Data',
|
||||||
'Scan and upload KYC Documents', onTap: () {
|
'Scan and upload KYC Documents', onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => const CollectKycScreen(),
|
builder: (context) =>
|
||||||
));
|
const CollectKycScreen(),
|
||||||
}),
|
));
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -156,23 +180,33 @@ class HomePage extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: _buildCustomCard('Notifications',
|
child: _buildCustomCard(
|
||||||
'Tasks & Alerts\n\n', onTap: () {
|
'Notifications', 'Tasks & Alerts\n\n',
|
||||||
Navigator.push(
|
onTap: () {
|
||||||
context,
|
Navigator.push(
|
||||||
MaterialPageRoute(
|
context,
|
||||||
builder: (context) => const NotificationScreen(),
|
MaterialPageRoute(
|
||||||
));
|
builder: (context) =>
|
||||||
}),
|
const NotificationScreen(),
|
||||||
|
));
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 15,
|
width: 15,
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: _buildCustomCard('Calendar',
|
child: _buildCustomCard(
|
||||||
' Upcoming Appointments & Deadlines',onTap: () {
|
'Calendar',
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => const CalendarScreen(),));
|
' Upcoming Appointments & Deadlines',
|
||||||
},),
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) =>
|
||||||
|
const CalendarScreen(),
|
||||||
|
));
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -180,14 +214,16 @@ class HomePage extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: _buildCustomCard('Products Manual',
|
child: _buildCustomCard(
|
||||||
'details of products', onTap: () {
|
'Products Manual', 'details of products',
|
||||||
Navigator.push(
|
onTap: () {
|
||||||
context,
|
Navigator.push(
|
||||||
MaterialPageRoute(
|
context,
|
||||||
builder: (context) => const ProductsManualScreen(),
|
MaterialPageRoute(
|
||||||
));
|
builder: (context) =>
|
||||||
}),
|
const ProductsManualScreen(),
|
||||||
|
));
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -202,7 +238,8 @@ class HomePage extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildCustomCard(String title, String subtitle, {void Function()? onTap}) {
|
Widget _buildCustomCard(String title, String subtitle,
|
||||||
|
{void Function()? onTap}) {
|
||||||
return Container(
|
return Container(
|
||||||
margin: const EdgeInsets.only(bottom: 10),
|
margin: const EdgeInsets.only(bottom: 10),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -222,9 +259,9 @@ class HomePage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
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,
|
||||||
),
|
),
|
||||||
|
@ -7,6 +7,8 @@ import 'package:cheminova/widgets/common_text_form_field.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import 'home_screen.dart';
|
||||||
|
|
||||||
class LoginPage extends StatefulWidget {
|
class LoginPage extends StatefulWidget {
|
||||||
const LoginPage({super.key});
|
const LoginPage({super.key});
|
||||||
|
|
||||||
@ -139,28 +141,28 @@ class _LoginPageState extends State<LoginPage> {
|
|||||||
height: kToolbarHeight - 10,
|
height: kToolbarHeight - 10,
|
||||||
text: 'SIGN IN',
|
text: 'SIGN IN',
|
||||||
isLoading: value.isLoading,
|
isLoading: value.isLoading,
|
||||||
onPressed: () {
|
// onPressed: () {
|
||||||
Navigator.push(context, MaterialPageRoute(builder:(context) => const VerifyPhoneScreen()));
|
// Navigator.push(context, MaterialPageRoute(builder:(context) => const VerifyPhoneScreen()));
|
||||||
},
|
// },
|
||||||
// onPressed: value.isLoading
|
onPressed: value.isLoading
|
||||||
// ? null
|
? null
|
||||||
// : () async {
|
: () async {
|
||||||
// if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
// value.login().then((result) {
|
value.login().then((result) {
|
||||||
// var (status, message) = result;
|
var (status, message) = result;
|
||||||
// ScaffoldMessenger.of(context)
|
ScaffoldMessenger.of(context)
|
||||||
// .showSnackBar(SnackBar(
|
.showSnackBar(SnackBar(
|
||||||
// content: Text(message)));
|
content: Text(message)));
|
||||||
// if (status) {
|
if (status) {
|
||||||
// Navigator.pushReplacement(
|
Navigator.pushReplacement(
|
||||||
// context,
|
context,
|
||||||
// MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
// builder: (context) =>
|
builder: (context) =>
|
||||||
// const HomePage()));
|
const HomePage()));
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
// },
|
},
|
||||||
),
|
),
|
||||||
))
|
))
|
||||||
],
|
],
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
|
import 'package:cheminova/models/get_pd_response.dart';
|
||||||
import 'package:cheminova/provider/collect_kyc_provider.dart';
|
import 'package:cheminova/provider/collect_kyc_provider.dart';
|
||||||
|
import 'package:csc_picker/csc_picker.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import '../widgets/common_elevated_button.dart';
|
import '../widgets/common_elevated_button.dart';
|
||||||
@ -72,16 +75,26 @@ class RetailerDetailsScreenState extends State<RetailerDetailsScreen> {
|
|||||||
},
|
},
|
||||||
controller: value.addressController),
|
controller: value.addressController),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
CommonTextFormField(
|
CSCPicker(
|
||||||
title: 'Town/City',
|
defaultCountry: CscCountry.India,
|
||||||
fillColor: Colors.white,
|
|
||||||
validator: (String? value) {
|
disableCountry: true,
|
||||||
if (value!.isEmpty) {
|
onCountryChanged: (val) {
|
||||||
return 'Town/City cannot be empty';
|
setState(() {
|
||||||
}
|
value.country.text = val;
|
||||||
return null;
|
});
|
||||||
},
|
},
|
||||||
controller: value.townCityController),
|
onStateChanged: (val) {
|
||||||
|
setState(() {
|
||||||
|
value.state.text = val ?? '';
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onCityChanged: (val) {
|
||||||
|
setState(() {
|
||||||
|
value.city.text = val ?? '';
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
CommonTextFormField(
|
CommonTextFormField(
|
||||||
title: 'District',
|
title: 'District',
|
||||||
@ -95,20 +108,12 @@ class RetailerDetailsScreenState extends State<RetailerDetailsScreen> {
|
|||||||
controller: value.districtController),
|
controller: value.districtController),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
CommonTextFormField(
|
CommonTextFormField(
|
||||||
title: 'State',
|
maxLength: 6,
|
||||||
fillColor: Colors.white,
|
|
||||||
validator: (String? value) {
|
|
||||||
if (value!.isEmpty) {
|
|
||||||
return 'State cannot be empty';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
controller: value.stateController),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
CommonTextFormField(
|
|
||||||
maxLength: 6,
|
|
||||||
title: 'Pincode',
|
title: 'Pincode',
|
||||||
fillColor: Colors.white,
|
fillColor: Colors.white,
|
||||||
|
inputFormatters: [
|
||||||
|
FilteringTextInputFormatter.digitsOnly
|
||||||
|
],
|
||||||
validator: (String? value) {
|
validator: (String? value) {
|
||||||
if (value!.isEmpty) {
|
if (value!.isEmpty) {
|
||||||
return 'Pincode cannot be empty';
|
return 'Pincode cannot be empty';
|
||||||
@ -118,9 +123,12 @@ class RetailerDetailsScreenState extends State<RetailerDetailsScreen> {
|
|||||||
controller: value.pinCodeController),
|
controller: value.pinCodeController),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
CommonTextFormField(
|
CommonTextFormField(
|
||||||
maxLength: 10,
|
maxLength: 10,
|
||||||
title: 'Mobile Number',
|
title: 'Mobile Number',
|
||||||
fillColor: Colors.white,
|
fillColor: Colors.white,
|
||||||
|
inputFormatters: [
|
||||||
|
FilteringTextInputFormatter.digitsOnly
|
||||||
|
],
|
||||||
validator: (String? value) {
|
validator: (String? value) {
|
||||||
if (value!.isEmpty) {
|
if (value!.isEmpty) {
|
||||||
return 'Mobile Number cannot be empty';
|
return 'Mobile Number cannot be empty';
|
||||||
@ -130,8 +138,11 @@ class RetailerDetailsScreenState extends State<RetailerDetailsScreen> {
|
|||||||
controller: value.mobileNumberController),
|
controller: value.mobileNumberController),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
CommonTextFormField(
|
CommonTextFormField(
|
||||||
maxLength: 12,
|
maxLength: 12,
|
||||||
title: 'Aadhar Number',
|
title: 'Aadhar Number',
|
||||||
|
inputFormatters: [
|
||||||
|
FilteringTextInputFormatter.digitsOnly
|
||||||
|
],
|
||||||
fillColor: Colors.white,
|
fillColor: Colors.white,
|
||||||
validator: (String? value) {
|
validator: (String? value) {
|
||||||
if (value!.isEmpty) {
|
if (value!.isEmpty) {
|
||||||
@ -142,7 +153,7 @@ class RetailerDetailsScreenState extends State<RetailerDetailsScreen> {
|
|||||||
controller: value.aadharNumberController),
|
controller: value.aadharNumberController),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
CommonTextFormField(
|
CommonTextFormField(
|
||||||
maxLength: 10,
|
maxLength: 10,
|
||||||
title: 'PAN Number',
|
title: 'PAN Number',
|
||||||
fillColor: Colors.white,
|
fillColor: Colors.white,
|
||||||
validator: (String? value) {
|
validator: (String? value) {
|
||||||
@ -154,7 +165,7 @@ class RetailerDetailsScreenState extends State<RetailerDetailsScreen> {
|
|||||||
controller: value.panNumberController),
|
controller: value.panNumberController),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
CommonTextFormField(
|
CommonTextFormField(
|
||||||
maxLength: 15,
|
maxLength: 15,
|
||||||
title: 'GST Number',
|
title: 'GST Number',
|
||||||
fillColor: Colors.white,
|
fillColor: Colors.white,
|
||||||
validator: (String? value) {
|
validator: (String? value) {
|
||||||
@ -167,20 +178,16 @@ class RetailerDetailsScreenState extends State<RetailerDetailsScreen> {
|
|||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
DropdownButtonFormField<String>(
|
DropdownButtonFormField<String>(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
fillColor: Colors.white,
|
fillColor: Colors.white,
|
||||||
filled: true,
|
filled: true,
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(8.0),
|
borderRadius: BorderRadius.circular(8),
|
||||||
),
|
borderSide: BorderSide.none),
|
||||||
labelText: 'Mapped Principal Distributor',
|
hintText: 'Mapped Principal Distributor'),
|
||||||
),
|
|
||||||
value: value.selectedDistributor,
|
value: value.selectedDistributor,
|
||||||
items:
|
items: value.pdList.map((GetPdResponse pd) {
|
||||||
value.distributors.map((String distributor) {
|
|
||||||
return DropdownMenuItem<String>(
|
return DropdownMenuItem<String>(
|
||||||
value: distributor,
|
value: pd.sId, child: Text(pd.name ?? ''));
|
||||||
child: Text(distributor),
|
|
||||||
);
|
|
||||||
}).toList(),
|
}).toList(),
|
||||||
onChanged: (String? newValue) {
|
onChanged: (String? newValue) {
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -188,7 +195,7 @@ class RetailerDetailsScreenState extends State<RetailerDetailsScreen> {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
validator: (String? value) {
|
validator: (String? value) {
|
||||||
if (value!.isEmpty) {
|
if (value == null || value.isEmpty) {
|
||||||
return 'Mapped Principal Distributor cannot be empty';
|
return 'Mapped Principal Distributor cannot be empty';
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -204,10 +211,10 @@ class RetailerDetailsScreenState extends State<RetailerDetailsScreen> {
|
|||||||
text: 'CONTINUE',
|
text: 'CONTINUE',
|
||||||
backgroundColor: const Color(0xff004791),
|
backgroundColor: const Color(0xff004791),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// if (value.retailerDetailsFormKey.currentState!
|
if (value.retailerDetailsFormKey.currentState!
|
||||||
// .validate()) {
|
.validate()) {
|
||||||
value.tabController.animateTo(1);
|
value.tabController.animateTo(1);
|
||||||
// }
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -221,3 +228,53 @@ 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
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
import 'package:cheminova/constants/constant.dart';
|
import 'package:cheminova/constants/constant.dart';
|
||||||
import 'package:cheminova/screens/login_screen.dart';
|
import 'package:cheminova/screens/login_screen.dart';
|
||||||
|
import 'package:cheminova/services/secure__storage_service.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'home_screen.dart';
|
||||||
|
|
||||||
class SplashScreen extends StatefulWidget {
|
class SplashScreen extends StatefulWidget {
|
||||||
const SplashScreen({super.key});
|
const SplashScreen({super.key});
|
||||||
|
|
||||||
@ -14,8 +17,16 @@ class _SplashScreenState extends State<SplashScreen> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
Future.delayed(const Duration(seconds: 3), () {
|
Future.delayed(const Duration(seconds: 3), () {
|
||||||
Navigator.pushReplacement(
|
SecureStorageService().read(
|
||||||
context, MaterialPageRoute(builder: (context) => const LoginPage()));
|
key: 'access_token').then((value){
|
||||||
|
if(value != null){
|
||||||
|
Navigator.pushReplacement(
|
||||||
|
context, MaterialPageRoute(builder: (context) => const HomePage()));
|
||||||
|
}else{
|
||||||
|
Navigator.pushReplacement(
|
||||||
|
context, MaterialPageRoute(builder: (context) => const LoginPage()));
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,74 +17,6 @@ class UploadDocumentScreen extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class UploadDocumentScreenState extends State<UploadDocumentScreen> {
|
class UploadDocumentScreenState extends State<UploadDocumentScreen> {
|
||||||
File? _panCard;
|
|
||||||
File? _aadharCard;
|
|
||||||
File? _gstRegistration;
|
|
||||||
File? _pesticideLicense;
|
|
||||||
File? _fertilizerLicense;
|
|
||||||
File? _selfieEntranceBoard;
|
|
||||||
|
|
||||||
final ImagePicker _picker = ImagePicker();
|
|
||||||
|
|
||||||
Future<void> _pickImage(ImageSource source, String documentType) async {
|
|
||||||
final pickedFile = await _picker.pickImage(source: source);
|
|
||||||
|
|
||||||
setState(() {
|
|
||||||
if (pickedFile != null) {
|
|
||||||
switch (documentType) {
|
|
||||||
case 'PAN Card':
|
|
||||||
_panCard = File(pickedFile.path);
|
|
||||||
break;
|
|
||||||
case 'Aadhar Card':
|
|
||||||
_aadharCard = File(pickedFile.path);
|
|
||||||
break;
|
|
||||||
case 'GST Registration':
|
|
||||||
_gstRegistration = File(pickedFile.path);
|
|
||||||
break;
|
|
||||||
case 'Pesticide License':
|
|
||||||
_pesticideLicense = File(pickedFile.path);
|
|
||||||
break;
|
|
||||||
case 'Fertilizer License':
|
|
||||||
_fertilizerLicense = File(pickedFile.path);
|
|
||||||
break;
|
|
||||||
case 'Selfie of Entrance Board':
|
|
||||||
_selfieEntranceBoard = File(pickedFile.path);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void _showPicker(BuildContext context, String documentType) {
|
|
||||||
showModalBottomSheet(
|
|
||||||
context: context,
|
|
||||||
builder: (BuildContext bc) {
|
|
||||||
return SafeArea(
|
|
||||||
child: Wrap(
|
|
||||||
children: <Widget>[
|
|
||||||
if (documentType != 'Selfie of Entrance Board')
|
|
||||||
ListTile(
|
|
||||||
leading: const Icon(Icons.photo_library),
|
|
||||||
title: const Text('Photo Library'),
|
|
||||||
onTap: () {
|
|
||||||
_pickImage(ImageSource.gallery, documentType);
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
leading: const Icon(Icons.photo_camera),
|
|
||||||
title: const Text('Camera'),
|
|
||||||
onTap: () {
|
|
||||||
_pickImage(ImageSource.camera, documentType);
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildUploadButton(String title, File? file, bool isOptional) {
|
Widget _buildUploadButton(String title, File? file, bool isOptional) {
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@ -94,19 +26,42 @@ class UploadDocumentScreenState extends State<UploadDocumentScreen> {
|
|||||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
CommonElevatedButton(
|
|
||||||
borderRadius: 30,
|
/// Create a view for the selected file
|
||||||
width: double.infinity,
|
if (file != null)
|
||||||
height: kToolbarHeight - 10,
|
Container(
|
||||||
text: file == null ? 'Upload $title' : 'Change $title',
|
height: 100,
|
||||||
backgroundColor: const Color(0xff004791),
|
width: 100,
|
||||||
onPressed: () => _showPicker(context, title),
|
decoration: BoxDecoration(
|
||||||
),
|
border: Border.all(color: Colors.grey),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: file.path.endsWith('.jpg') || file.path.endsWith('.png')
|
||||||
|
? Image.file(file, fit: BoxFit.cover)
|
||||||
|
: Center(
|
||||||
|
child: Text(file.path.split('/').last,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 12, fontWeight: FontWeight.bold),
|
||||||
|
textAlign: TextAlign.center)))
|
||||||
|
else
|
||||||
|
const Text('No file selected', style: TextStyle(color: Colors.red)),
|
||||||
|
|
||||||
if (file != null)
|
if (file != null)
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 8.0),
|
padding: const EdgeInsets.only(top: 8.0),
|
||||||
child: Text('File uploaded: ${file.path.split('/').last}'),
|
child: Text('File uploaded: ${file.path.split('/').last}')),
|
||||||
|
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Consumer<CollectKycProvider>(
|
||||||
|
builder: (context, value, child) => CommonElevatedButton(
|
||||||
|
borderRadius: 30,
|
||||||
|
width: double.infinity,
|
||||||
|
height: kToolbarHeight - 10,
|
||||||
|
text: file == null ? 'Upload $title' : 'Change $title',
|
||||||
|
backgroundColor: const Color(0xff004791),
|
||||||
|
onPressed: () => value.showPicker(context, title),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -115,7 +70,7 @@ class UploadDocumentScreenState extends State<UploadDocumentScreen> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Consumer<CollectKycProvider>(
|
return Consumer<CollectKycProvider>(
|
||||||
builder: (context, value, child) => Padding(
|
builder: (context, value, child) => Padding(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
physics: const BouncingScrollPhysics(),
|
physics: const BouncingScrollPhysics(),
|
||||||
@ -125,35 +80,44 @@ class UploadDocumentScreenState extends State<UploadDocumentScreen> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.all(20.0).copyWith(top: 30, bottom: 30),
|
padding:
|
||||||
|
const EdgeInsets.all(20.0).copyWith(top: 30, bottom: 30),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(color: Colors.white),
|
border: Border.all(color: Colors.white),
|
||||||
color: const Color(0xffB4D1E5).withOpacity(0.9),
|
color: const Color(0xffB4D1E5).withOpacity(0.9),
|
||||||
borderRadius: BorderRadius.circular(26.0)),
|
borderRadius: BorderRadius.circular(26.0)),
|
||||||
child: Column(
|
child: Consumer<CollectKycProvider>(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
builder: (context, value, child) => Column(
|
||||||
children: <Widget>[
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
_buildUploadButton('PAN Card', _panCard, false),
|
children: <Widget>[
|
||||||
_buildUploadButton('Aadhar Card', _aadharCard, false),
|
_buildUploadButton('PAN Card', value.panCard, false),
|
||||||
_buildUploadButton('GST Registration', _gstRegistration, false),
|
_buildUploadButton(
|
||||||
_buildUploadButton('Pesticide License', _pesticideLicense, false),
|
'Aadhar Card', value.aadharCard, false),
|
||||||
_buildUploadButton('Fertilizer License', _fertilizerLicense, true),
|
_buildUploadButton(
|
||||||
_buildUploadButton('Selfie of Entrance Board', _selfieEntranceBoard, false),
|
'GST Registration', value.gstRegistration, false),
|
||||||
const SizedBox(height: 30),
|
_buildUploadButton(
|
||||||
Align(
|
'Pesticide License', value.pesticideLicense, false),
|
||||||
alignment: Alignment.center,
|
_buildUploadButton(
|
||||||
child: CommonElevatedButton(
|
'Fertilizer License', value.fertilizerLicense, true),
|
||||||
borderRadius: 30,
|
_buildUploadButton('Selfie of Entrance Board',
|
||||||
width: double.infinity,
|
value.selfieEntranceBoard, false),
|
||||||
height: kToolbarHeight - 10,
|
const SizedBox(height: 30),
|
||||||
text: 'SUBMIT',
|
Align(
|
||||||
backgroundColor: const Color(0xff004791),
|
alignment: Alignment.center,
|
||||||
onPressed: () {
|
child: CommonElevatedButton(
|
||||||
// Handle form submission
|
borderRadius: 30,
|
||||||
value.tabController.animateTo(2); },
|
width: double.infinity,
|
||||||
|
height: kToolbarHeight - 10,
|
||||||
|
text: 'SUBMIT',
|
||||||
|
backgroundColor: const Color(0xff004791),
|
||||||
|
onPressed: () {
|
||||||
|
// Handle form submission
|
||||||
|
value.tabController.animateTo(2);
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import 'package:cheminova/provider/collect_kyc_provider.dart';
|
import 'package:cheminova/provider/collect_kyc_provider.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:cheminova/screens/data_submit_successfull.dart';
|
||||||
import 'package:cheminova/widgets/common_background.dart';
|
import 'package:cheminova/widgets/common_background.dart';
|
||||||
import 'package:cheminova/widgets/common_drawer.dart';
|
import 'package:cheminova/widgets/common_drawer.dart';
|
||||||
import 'package:cheminova/widgets/common_elevated_button.dart';
|
import 'package:cheminova/widgets/common_elevated_button.dart';
|
||||||
import 'package:cheminova/screens/data_submit_successfull.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class VerifyDocumentsScreen extends StatelessWidget {
|
class VerifyDocumentsScreen extends StatelessWidget {
|
||||||
@ -22,21 +22,24 @@ class VerifyDocumentsScreen extends StatelessWidget {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Consumer<CollectKycProvider>(
|
Consumer<CollectKycProvider>(
|
||||||
builder: (BuildContext context, CollectKycProvider value, Widget? child) => _buildSection(
|
builder: (BuildContext context, CollectKycProvider value,
|
||||||
|
Widget? child) =>
|
||||||
|
_buildSection(
|
||||||
'Retailer Details',
|
'Retailer Details',
|
||||||
{
|
{
|
||||||
'Trade Name': value.tradeNameController.text,
|
'Trade Name': value.tradeNameController.text,
|
||||||
'Name': value.nameController.text,
|
'Name': value.nameController.text,
|
||||||
'Address': value.addressController.text,
|
'Address': value.addressController.text,
|
||||||
'Town/City': value.townCityController.text,
|
'Town/City': value.city.text,
|
||||||
'District': value.districtController.text,
|
'District': value.districtController.text,
|
||||||
'State': value.stateController.text,
|
'State': value.state.text,
|
||||||
'Pincode': value.pinCodeController.text,
|
'Pincode': value.pinCodeController.text,
|
||||||
'Mobile Number': value.mobileNumberController.text,
|
'Mobile Number': value.mobileNumberController.text,
|
||||||
'Aadhar Number': value.aadharNumberController.text,
|
'Aadhar Number': value.aadharNumberController.text,
|
||||||
'PAN Number': value.panNumberController.text,
|
'PAN Number': value.panNumberController.text,
|
||||||
'GST Number': value.gstNumberController.text,
|
'GST Number': value.gstNumberController.text,
|
||||||
'Mapped Principal Distributor': value.selectedDistributor ?? '',
|
'Mapped Principal Distributor':
|
||||||
|
value.selectedDistributor ?? '',
|
||||||
},
|
},
|
||||||
onEdit: () {
|
onEdit: () {
|
||||||
value.tabController.animateTo(0);
|
value.tabController.animateTo(0);
|
||||||
@ -47,15 +50,27 @@ class VerifyDocumentsScreen extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Consumer<CollectKycProvider>(
|
Consumer<CollectKycProvider>(
|
||||||
builder: (BuildContext context, CollectKycProvider value, Widget? child) => _buildSection(
|
builder: (BuildContext context, CollectKycProvider value,
|
||||||
|
Widget? child) =>
|
||||||
|
_buildSection(
|
||||||
'Uploaded Documents',
|
'Uploaded Documents',
|
||||||
{
|
{
|
||||||
'PAN Card': 'pan_card.pdf',
|
'PAN Card':
|
||||||
'Aadhar Card': 'aadhar_card.pdf',
|
value.panCard?.path.split('/').last ?? 'Not uploaded',
|
||||||
'GST Registration': 'gst_registration.pdf',
|
'Aadhar Card': value.aadharCard?.path.split('/').last ??
|
||||||
'Pesticide License': 'pesticide_license.pdf',
|
'Not uploaded',
|
||||||
'Fertilizer License': 'fertilizer_license.pdf (Optional)',
|
'GST Registration':
|
||||||
'Selfie of Entrance Board': 'entrance_board_selfie.jpg',
|
value.gstRegistration?.path.split('/').last ??
|
||||||
|
'Not uploaded',
|
||||||
|
'Pesticide License':
|
||||||
|
value.pesticideLicense?.path.split('/').last ??
|
||||||
|
'Not uploaded',
|
||||||
|
'Fertilizer License':
|
||||||
|
value.fertilizerLicense?.path.split('/').last ??
|
||||||
|
'Not uploaded',
|
||||||
|
'Selfie of Entrance Board':
|
||||||
|
value.selfieEntranceBoard?.path.split('/').last ??
|
||||||
|
'Not uploaded',
|
||||||
},
|
},
|
||||||
onEdit: () {
|
onEdit: () {
|
||||||
value.tabController.animateTo(1);
|
value.tabController.animateTo(1);
|
||||||
@ -68,21 +83,21 @@ class VerifyDocumentsScreen extends StatelessWidget {
|
|||||||
const SizedBox(height: 30),
|
const SizedBox(height: 30),
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: CommonElevatedButton(
|
child: Consumer<CollectKycProvider>(
|
||||||
borderRadius: 30,
|
builder: (context, value, child) => CommonElevatedButton(
|
||||||
width: double.infinity,
|
borderRadius: 30,
|
||||||
height: kToolbarHeight - 10,
|
width: double.infinity,
|
||||||
text: ('SAVE AND CONFIRM'),
|
height: kToolbarHeight - 10,
|
||||||
backgroundColor: const Color(0xff004791),
|
text: ('SAVE AND CONFIRM'),
|
||||||
onPressed: () {
|
backgroundColor: const Color(0xff004791),
|
||||||
// Handle final submission
|
onPressed: () {
|
||||||
Navigator.push(
|
// Handle final submission
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
value.validateFields(context);
|
||||||
builder: (context) => const DataSubmitSuccessfull(),
|
|
||||||
),
|
|
||||||
);
|
},
|
||||||
},
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -93,7 +108,8 @@ class VerifyDocumentsScreen extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildSection(String title, Map<String, String> details, {required VoidCallback onEdit}) {
|
Widget _buildSection(String title, Map<String, String> details,
|
||||||
|
{required VoidCallback onEdit}) {
|
||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.all(20.0),
|
padding: const EdgeInsets.all(20.0),
|
||||||
// margin: const EdgeInsets.symmetric(horizontal: 30.0),
|
// margin: const EdgeInsets.symmetric(horizontal: 30.0),
|
||||||
@ -110,7 +126,8 @@ class VerifyDocumentsScreen extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
title,
|
title,
|
||||||
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
style:
|
||||||
|
const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: onEdit,
|
onPressed: onEdit,
|
||||||
@ -126,7 +143,8 @@ class VerifyDocumentsScreen extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
...details.entries.map((entry) => _buildDetailRow(entry.key, entry.value)),
|
...details.entries
|
||||||
|
.map((entry) => _buildDetailRow(entry.key, entry.value)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -146,9 +164,12 @@ class VerifyDocumentsScreen extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 3,
|
flex: 3,
|
||||||
child: Text(value),
|
child: Text(
|
||||||
),
|
value,
|
||||||
|
style: TextStyle(
|
||||||
|
color: value == 'Not uploaded' ? Colors.red : Colors.black),
|
||||||
|
)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -29,11 +29,11 @@ class ApiClient {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Response> get(String path, {Map<String, dynamic>? queryParameters}) {
|
Future<dynamic> get(String path, {Map<String, dynamic>? queryParameters}) {
|
||||||
return _dio.get(path, queryParameters: queryParameters);
|
return _dio.get(path, queryParameters: queryParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Response> post(String path, {Map<String, dynamic>? data}) {
|
Future<Response> post(String path, {dynamic data}) {
|
||||||
return _dio.post(path, data: data);
|
return _dio.post(path, data: data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
class ApiUrls {
|
class ApiUrls {
|
||||||
static const String baseUrl =
|
static const String baseUrl = 'https://cheminova-api-2.onrender.com/api/';
|
||||||
'https://cheminova-api-2.onrender.com/api/';
|
|
||||||
static const String loginUrl = 'salescoordinator/login';
|
static const String loginUrl = 'salescoordinator/login';
|
||||||
static const String profileUrl = 'my-profile';
|
static const String profileUrl = 'my-profile';
|
||||||
static const String markAttendanceUrl = 'v1/markattendance/salescoordinator';
|
static const String markAttendanceUrl = 'v1/markattendance/salescoordinator';
|
||||||
|
static const String getPdUrl = 'kyc/get-pd';
|
||||||
|
static const String createCollectKycUrl = '${baseUrl}kyc/create';
|
||||||
|
static const String getProfileUrl = '${baseUrl}salescoordinator/my-profile';
|
||||||
|
static const String changePasswordUrl = '${baseUrl}salescoordinator/password/update';
|
||||||
}
|
}
|
@ -1,7 +1,9 @@
|
|||||||
|
import 'package:cheminova/provider/home_provider.dart';
|
||||||
import 'package:cheminova/screens/change_password_screen.dart';
|
import 'package:cheminova/screens/change_password_screen.dart';
|
||||||
import 'package:cheminova/screens/home_screen.dart';
|
import 'package:cheminova/screens/home_screen.dart';
|
||||||
import 'package:cheminova/screens/login_screen.dart';
|
import 'package:cheminova/screens/login_screen.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class CommonDrawer extends StatelessWidget {
|
class CommonDrawer extends StatelessWidget {
|
||||||
const CommonDrawer({super.key});
|
const CommonDrawer({super.key});
|
||||||
@ -12,50 +14,36 @@ class CommonDrawer extends StatelessWidget {
|
|||||||
child: ListView(
|
child: ListView(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
SizedBox(
|
||||||
height: 150,
|
height: 150,
|
||||||
child: const DrawerHeader(
|
child: DrawerHeader(
|
||||||
decoration: BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'Username',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
fontSize: 18,
|
|
||||||
),
|
|
||||||
),Text(
|
|
||||||
'Employee ID',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
fontSize: 20,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
child: Consumer<HomeProvider>(
|
||||||
),
|
builder: (context, value, child) =>
|
||||||
),
|
(value.profileResponse == null ||
|
||||||
),
|
value.profileResponse!.myData == null ||
|
||||||
// const UserAccountsDrawerHeader(
|
value.profileResponse!.myData!.name == null)
|
||||||
// accountName: Text("Name"),
|
? const SizedBox()
|
||||||
// accountEmail: Text("Employee ID"),
|
: Column(
|
||||||
// // currentAccountPicture: CircleAvatar(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
// // backgroundImage: AssetImage(
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
// // 'assets/profile.png'), // Replace with actual user image
|
children: [
|
||||||
// // ),
|
Text(value.profileResponse!.myData!.name!,
|
||||||
// decoration: BoxDecoration(
|
style: const TextStyle(
|
||||||
// color: Colors.black87,
|
color: Colors.white,
|
||||||
// ),
|
fontSize: 18)),
|
||||||
// ),
|
Text(value.profileResponse!.myData!.sId!,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 15))
|
||||||
|
])))),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.home),
|
leading: const Icon(Icons.home),
|
||||||
title: const Text('Home'),
|
title: const Text('Home'),
|
||||||
onTap: () {
|
onTap: () => Navigator.push(context,
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => const HomePage(),));
|
MaterialPageRoute(builder: (context) => const HomePage()))),
|
||||||
},
|
|
||||||
),
|
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.account_circle),
|
leading: const Icon(Icons.account_circle),
|
||||||
title: const Text('Profile'),
|
title: const Text('Profile'),
|
||||||
@ -67,7 +55,11 @@ class CommonDrawer extends StatelessWidget {
|
|||||||
leading: const Icon(Icons.settings),
|
leading: const Icon(Icons.settings),
|
||||||
title: const Text('Change Password'),
|
title: const Text('Change Password'),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => const ChangePasswordPage(),));
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const ChangePasswordPage(),
|
||||||
|
));
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
|
@ -39,13 +39,14 @@ const CommonTextFormField(
|
|||||||
TextFormField(
|
TextFormField(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
readOnly: readOnly ?? false,
|
readOnly: readOnly ?? false,
|
||||||
maxLines: maxLines,
|
maxLines: maxLines??1,
|
||||||
maxLength: maxLength,
|
maxLength: maxLength,
|
||||||
onTapOutside: (event) => FocusScope.of(context).unfocus(),
|
onTapOutside: (event) => FocusScope.of(context).unfocus(),
|
||||||
validator: validator,
|
validator: validator,
|
||||||
keyboardType: keyboardType,
|
keyboardType: keyboardType,
|
||||||
inputFormatters: inputFormatters,
|
inputFormatters: inputFormatters,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
|
counterText: "",
|
||||||
hintText: title,
|
hintText: title,
|
||||||
contentPadding: const EdgeInsets.only(bottom: 10, left: 10),
|
contentPadding: const EdgeInsets.only(bottom: 10, left: 10),
|
||||||
filled: true,
|
filled: true,
|
||||||
|
20
pubspec.lock
20
pubspec.lock
@ -177,6 +177,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.3"
|
version: "3.0.3"
|
||||||
|
csc_picker:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: csc_picker
|
||||||
|
sha256: "7e5d6023a81f53b89a7fb0369953fd4dc676f7ea20e9a0c0707973a5f0aedf14"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.2.7"
|
||||||
cupertino_icons:
|
cupertino_icons:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -444,10 +452,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: geolocator_android
|
name: geolocator_android
|
||||||
sha256: "00c7177a95823dd3ee35ef42fd8666cd27d219ae14cea472ac76a21dff43000b"
|
sha256: "7aefc530db47d90d0580b552df3242440a10fe60814496a979aa67aa98b1fd47"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.6.0"
|
version: "4.6.1"
|
||||||
geolocator_apple:
|
geolocator_apple:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -540,10 +548,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: image_picker_android
|
name: image_picker_android
|
||||||
sha256: "8c3168469b005a6dbf5ba01f795917ae4f4e71077d3d7f2049a0d25a4760393e"
|
sha256: "3fe99e3a459b969f657565a853353bdea7e3d3cae34f7dd124836267d426ec87"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.8.12+8"
|
version: "0.8.12+10"
|
||||||
image_picker_for_web:
|
image_picker_for_web:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -748,10 +756,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_android
|
name: path_provider_android
|
||||||
sha256: e84c8a53fe1510ef4582f118c7b4bdf15b03002b51d7c2b66983c65843d61193
|
sha256: "490539678396d4c3c0b06efdaab75ae60675c3e0c66f72bc04c2e2c1e0e2abeb"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.8"
|
version: "2.2.9"
|
||||||
path_provider_foundation:
|
path_provider_foundation:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -44,6 +44,7 @@ dependencies:
|
|||||||
permission_handler: ^11.3.1
|
permission_handler: ^11.3.1
|
||||||
geocoding: ^3.0.0
|
geocoding: ^3.0.0
|
||||||
pretty_dio_logger: ^1.3.1
|
pretty_dio_logger: ^1.3.1
|
||||||
|
csc_picker: ^0.2.7
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
Loading…
Reference in New Issue
Block a user