"lib/Notifiers/git@183.82.99.133:saisrinivas/gen_erp_2025.git" did not exist on "a433e173b18893f88d9dd650a36235620a5ac74e"
Commit 7210793a authored by Sai Srinivas's avatar Sai Srinivas
Browse files

17-09

parent 185e0896
......@@ -53,7 +53,6 @@ class SplashVersionNotifier extends ChangeNotifier {
final data = await ApiCalling.checkAppVersionApi();
if (data != null) {
if (kDebugMode) {
print("Current Build: $currentBuild");
print("Server Response: $data");
......@@ -99,22 +98,28 @@ class SplashVersionNotifier extends ChangeNotifier {
if (data.updatePasswordRequired == 0) {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => MyHomePage(),
settings: RouteSettings(name: "MyHomePage")),
MaterialPageRoute(
builder: (context) => MyHomePage(),
settings: RouteSettings(name: "MyHomePage"),
),
);
} else if (data.updatePasswordRequired == 1) {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => UpdatePassword(),
settings: RouteSettings(name: "UpdatePassword")),
MaterialPageRoute(
builder: (context) => UpdatePassword(),
settings: RouteSettings(name: "UpdatePassword"),
),
);
}
} else {
// print("goes here");
Navigator.push(
context,
MaterialPageRoute(builder: (context) => LoginScreen(),
settings: RouteSettings(name: "LoginScreen")),
MaterialPageRoute(
builder: (context) => LoginScreen(),
settings: RouteSettings(name: "LoginScreen"),
),
);
// toast(context,
// "Your Session has been expired, Please Login Again");
......@@ -142,8 +147,8 @@ class SplashVersionNotifier extends ChangeNotifier {
const SizedBox(height: 16),
TextButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.white),
overlayColor: MaterialStateProperty.all(Colors.white70),
backgroundColor: WidgetStateProperty.all(Colors.white),
overlayColor: WidgetStateProperty.all(Colors.white70),
),
onPressed: () async {
if (await canLaunchUrl(Uri.parse(apkurl))) {
......
......@@ -226,7 +226,9 @@ class MyApp extends StatelessWidget {
ChangeNotifierProvider(create: (_) => Dispatchorderprovider()),
ChangeNotifierProvider(create: (_) => followUpUpdateProvider()),
ChangeNotifierProvider(create: (_) => Appointmentcalendarprovider()),
ChangeNotifierProvider(create: (_) => Addnewleadsandprospectsprovider()),
ChangeNotifierProvider(
create: (_) => Addnewleadsandprospectsprovider(),
),
ChangeNotifierProvider(create: (_) => HrmAccessiblePagesProvider()),
ChangeNotifierProvider(create: (_) => Attendancelistprovider()),
ChangeNotifierProvider(create: (_) => AttendanceDetailsProvider()),
......@@ -240,7 +242,7 @@ class MyApp extends StatelessWidget {
builder: (BuildContext context) {
return MaterialApp(
scrollBehavior: const MaterialScrollBehavior().copyWith(
dragDevices: {PointerDeviceKind.touch,PointerDeviceKind.mouse},
dragDevices: {PointerDeviceKind.touch, PointerDeviceKind.mouse},
),
navigatorObservers: [MyNavigatorObserver()],
......@@ -259,7 +261,6 @@ class MyApp extends StatelessWidget {
highlightColor: Colors.transparent,
hoverColor: Colors.transparent,
scaffoldBackgroundColor: Colors.white,
dialogBackgroundColor: Colors.white,
cardColor: Colors.white,
shadowColor: Colors.white54,
searchBarTheme: const SearchBarThemeData(),
......@@ -303,8 +304,8 @@ class MyApp extends StatelessWidget {
dragHandleSize: Size(60.0, 6.0),
),
colorScheme: const ColorScheme.light(
background: Colors.white,
).copyWith(background: Colors.white),
surface: Colors.white,
).copyWith(surface: Colors.white),
scrollbarTheme: ScrollbarThemeData(
minThumbLength: 20,
interactive: true,
......@@ -315,10 +316,8 @@ class MyApp extends StatelessWidget {
),
),
checkboxTheme: CheckboxThemeData(
side: BorderSide(width: 0.5),
checkColor: WidgetStatePropertyAll(AppColors.white),
),
useMaterial3: true,
// inputDecorationTheme: InputDecorationTheme(
......
......@@ -20,7 +20,6 @@ class AttendanceScreen extends StatefulWidget {
}
class _AttendanceScreenState extends State<AttendanceScreen> {
// var homeProvider;
Map _source = {ConnectivityResult.mobile: true};
final MyConnectivity _connectivity = MyConnectivity.instance;
......@@ -32,11 +31,17 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
_connectivity.myStream.listen((source) {
setState(() => _source = source);
});
final homeProvider = Provider.of<HomescreenNotifier>(context, listen: false);
final homeProvider = Provider.of<HomescreenNotifier>(
context,
listen: false,
);
WidgetsBinding.instance.addPostFrameCallback((_) {
final att_provider = Provider.of<AttendanceNotifier>(context, listen: false);
att_provider.getAttendanceList(context);
att_provider.init(context);
final attProvider = Provider.of<AttendanceNotifier>(
context,
listen: false,
);
attProvider.getAttendanceList(context);
attProvider.init(context);
});
}
......@@ -146,7 +151,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
resizeToAvoidBottomInset: true,
backgroundColor: AppColors.scaffold_bg_color,
appBar: appbarNew(context, "Attendance", 0xFFFFFFFF),
body:SingleChildScrollView(
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
......@@ -189,12 +194,20 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
final times = [formattedTime, formattedTime2];
final periods = [period, period2];
final locations = [
attendance.attendanceHistory.isNotEmpty? attendance
.attendanceHistory
.first['check_in_location'].toString()??"-":"-",
attendance.attendanceHistory.isNotEmpty? attendance
.attendanceHistory
.first['check_out_location'].toString()??"-":"-",
attendance.attendanceHistory.isNotEmpty
? attendance
.attendanceHistory
.first['check_in_location']
.toString() ??
"-"
: "-",
attendance.attendanceHistory.isNotEmpty
? attendance
.attendanceHistory
.first['check_out_location']
.toString() ??
"-"
: "-",
];
return Expanded(
child: Container(
......@@ -325,8 +338,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
borderRadius: BorderRadius.circular(20),
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
......@@ -372,10 +384,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
///calendar
Container(
// padding: EdgeInsets.symmetric(horizontal: 10,vertical: 5),
margin: EdgeInsets.symmetric(
horizontal: 15,
vertical: 10,
),
margin: EdgeInsets.symmetric(horizontal: 15, vertical: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
color: Colors.white,
......@@ -386,16 +395,14 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
padding: const EdgeInsets.fromLTRB(30, 10, 30, 0),
child: Container(
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
child: Row(
children: [
GestureDetector(
onTap: () {
attendance.setPreviousMonth(
context, );
attendance.setPreviousMonth(context);
},
child: Padding(
padding: const EdgeInsets.all(4.0),
......@@ -405,7 +412,9 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 5.0),
padding: const EdgeInsets.symmetric(
horizontal: 5.0,
),
child: Text(
monthLabel,
style: TextStyle(
......@@ -417,11 +426,9 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
),
GestureDetector(
onTap: () {
attendance.setNextMonth(
context,
);
attendance.setNextMonth(context);
},
child: Padding(
child: Padding(
padding: const EdgeInsets.all(4.0),
child: SvgPicture.asset(
"assets/svg/crm/calendar_right.svg",
......@@ -568,9 +575,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
}
attendance.selectedDate =
currentDay.toString();
_showAttDetailsBottomSheet(
context,
);
_showAttDetailsBottomSheet(context);
},
child: Card(
elevation: 0,
......@@ -635,8 +640,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
fontWeight: FontWeight.w400,
color:
isFutureDate
? AppColors
.semi_black
? AppColors.semi_black
: (isCurrentDay ||
(selectedIndex ==
index))
......@@ -651,8 +655,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
? Color(0xFF6B3A02)
: dateColor == 'y'
? Color(0xFF605C00)
: Colors
.transparent,
: Colors.transparent,
),
),
),
......@@ -695,14 +698,9 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
),
);
if (res == true) {
attendance.getAttendanceList(
context,
);
attendance.init( context);
attendance.loadAttendanceDetails(
context,
);
attendance.getAttendanceList(context);
attendance.init(context);
attendance.loadAttendanceDetails(context);
}
var f = FocusScope.of(context);
......@@ -806,14 +804,14 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
Color(0xFFFFE8D0),
Color(0xFFFFF9B2),
];
final text_colors = [
final textColors = [
Color(0xFF493272),
Color(0xFF0D9C00),
Color(0xFFFF0000),
Color(0xFF6B3A02),
Color(0xFF605C00),
];
final text_subs = ["24", "7", "13", "17", "2"];
final textSubs = ["24", "7", "13", "17", "2"];
final text = [
"Holiday",
"Present",
......@@ -835,9 +833,9 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
),
child: Center(
child: Text(
text_subs[index],
textSubs[index],
style: TextStyle(
color: text_colors[index],
color: textColors[index],
fontSize: 10,
),
),
......
......@@ -6,7 +6,6 @@ import 'package:flutter_image_compress/flutter_image_compress.dart';
import 'package:generp/Utils/app_colors.dart';
import 'package:generp/Utils/commonWidgets.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:image_picker/image_picker.dart';
import 'package:provider/provider.dart';
import '../Notifiers/CheckInProvider.dart';
......@@ -15,7 +14,7 @@ import 'FrontCameraCapture.dart';
class CheckInOutScreen extends StatefulWidget {
final int getAttendanceStatus;
const CheckInOutScreen({super.key,required this.getAttendanceStatus});
const CheckInOutScreen({super.key, required this.getAttendanceStatus});
@override
State<CheckInOutScreen> createState() => _CheckInOutScreenState();
......@@ -31,7 +30,7 @@ class _CheckInOutScreenState extends State<CheckInOutScreen> {
_connectivity.initialise();
_connectivity.myStream.listen((source) {
setState(() => _source = source);
},);
});
WidgetsBinding.instance.addPostFrameCallback((_) {
var prov = Provider.of<CheckInOutProvider>(context, listen: false);
prov.getLocationPermission(context);
......@@ -46,8 +45,6 @@ class _CheckInOutScreenState extends State<CheckInOutScreen> {
_connectivity.disposeStream();
}
@override
Widget build(BuildContext context) {
switch (_source.keys.toList()[0]) {
......@@ -64,244 +61,271 @@ class _CheckInOutScreenState extends State<CheckInOutScreen> {
Size size = MediaQuery.of(context).size;
double screenWidth = MediaQuery.of(context).size.width;
return (connection=='Online')?Consumer<CheckInOutProvider>(
builder: (context, provider, child) {
return WillPopScope(
onWillPop: () {
provider.dispose();
return onBackPressed(context);},
child: SafeArea(
top: false,
bottom: Platform.isIOS?false:true,
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar2(context, widget.getAttendanceStatus==0? "Check In":"Check Out", provider.dispose,SizedBox(width: 0,)),
body:Container(
child: SafeArea(
child: Column(
children: [
Expanded(
child: Stack(
children: [
GoogleMap(
myLocationEnabled: true,
zoomGesturesEnabled: true,
scrollGesturesEnabled: false,
initialCameraPosition: CameraPosition(
target: provider.currentLocationLatLng ??
provider.startLocation,
zoom: 20.0,
),
markers: provider.markers.toSet(),
myLocationButtonEnabled: true,
mapType: MapType.normal,
onMapCreated: (controller) {
provider.mapController = controller;
provider.getCurrentLocation();
provider.getLocationPermission(context);
},
onCameraMove: (position) {
provider.onCameraMove(position,context);
},
),
Positioned(
left: 0,
right: 0,
bottom: 0,
child: Container(
height: size.height * 0.3,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30.0),
topRight: Radius.circular(30.0),
return (connection == 'Online')
? Consumer<CheckInOutProvider>(
builder: (context, provider, child) {
return WillPopScope(
onWillPop: () {
provider.dispose();
return onBackPressed(context);
},
child: SafeArea(
top: false,
bottom: Platform.isIOS ? false : true,
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar2(
context,
widget.getAttendanceStatus == 0 ? "Check In" : "Check Out",
provider.dispose,
SizedBox(width: 0),
),
body: Container(
child: SafeArea(
child: Column(
children: [
Expanded(
child: Stack(
children: [
GoogleMap(
myLocationEnabled: true,
zoomGesturesEnabled: true,
scrollGesturesEnabled: false,
initialCameraPosition: CameraPosition(
target:
provider.currentLocationLatLng ??
provider.startLocation,
zoom: 20.0,
),
markers: provider.markers.toSet(),
myLocationButtonEnabled: true,
mapType: MapType.normal,
onMapCreated: (controller) {
provider.mapController = controller;
provider.getCurrentLocation();
provider.getLocationPermission(context);
},
onCameraMove: (position) {
provider.onCameraMove(position, context);
},
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
SizedBox(height: 25),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Share Your Details",
style: TextStyle(
color: AppColors.app_blue,
fontFamily: "JakartaSemiBold"
),
),
SizedBox(height: 10,),
Text(
"Location",
style: TextStyle(
fontFamily: "JakartaMedium",
color: AppColors.semi_black,
),
),
],
Positioned(
left: 0,
right: 0,
bottom: 0,
child: Container(
height: size.height * 0.3,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30.0),
topRight: Radius.circular(30.0),
),
),
SizedBox(height: 5),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20.0),
child: Container(
height: 50,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
SizedBox(height: 25),
alignment: Alignment.center,
decoration: BoxDecoration(
color: AppColors.text_field_color,
borderRadius:
BorderRadius.circular(14),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20.0,
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
"Share Your Details",
style: TextStyle(
color: AppColors.app_blue,
fontFamily: "JakartaSemiBold",
),
),
SizedBox(height: 10),
Text(
"Location",
style: TextStyle(
fontFamily: "JakartaMedium",
color: AppColors.semi_black,
),
),
],
),
),
child: Padding(
padding:
const EdgeInsets.fromLTRB(
10.0, 0.0, 10, 0),
child: TextFormField(
controller:
provider.locationController,
keyboardType:
TextInputType.text,
onChanged: (value) {
provider.validateLocation = "";
provider.notifyListeners();
},
decoration: InputDecoration(
SizedBox(height: 5),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20.0,
),
child: Container(
height: 50,
hintText:
"Enter Check ${widget.getAttendanceStatus==0?"In":"Out"} Location",
hintStyle: TextStyle(
fontWeight: FontWeight.w400,
fontSize: 14,
color: Color(0xFF818181)
alignment: Alignment.center,
decoration: BoxDecoration(
color: AppColors.text_field_color,
borderRadius:
BorderRadius.circular(14),
),
child: Padding(
padding:
const EdgeInsets.fromLTRB(
10.0,
0.0,
10,
0,
),
child: TextFormField(
controller:
provider.locationController,
keyboardType:
TextInputType.text,
onChanged: (value) {
provider.validateLocation =
"";
provider.notifyListeners();
},
decoration: InputDecoration(
hintText:
"Enter Check ${widget.getAttendanceStatus == 0 ? "In" : "Out"} Location",
hintStyle: TextStyle(
fontWeight: FontWeight.w400,
fontSize: 14,
color: Color(0xFF818181),
),
enabledBorder:
InputBorder.none,
focusedBorder:
InputBorder.none,
),
),
enabledBorder:
InputBorder.none,
focusedBorder:
InputBorder.none,
),
),
),
),
),
if (provider.validateLocation != null)
Padding(
padding:
const EdgeInsets.symmetric(
horizontal: 20.0),
child: Container(
alignment: Alignment.topLeft,
margin: EdgeInsets.only(
top: 2.5,
bottom: 2.5,
left: 25),
child: Text(
provider.validateLocation!,
textAlign: TextAlign.start,
style: TextStyle(
color: Colors.red,
if (provider.validateLocation != null)
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20.0,
),
child: Container(
alignment: Alignment.topLeft,
margin: EdgeInsets.only(
top: 2.5,
bottom: 2.5,
left: 25,
),
child: Text(
provider.validateLocation!,
textAlign: TextAlign.start,
style: TextStyle(
color: Colors.red,
),
),
),
)
else
SizedBox(height: 5.0),
SizedBox(height: 20),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20.0,
),
),
)
else
SizedBox(height: 5.0),
SizedBox(height: 20),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20.0),
child: InkWell(
onTap: () async {
if (provider
.locationController
.text
.isEmpty) {
provider.validateLocation =
"Please Enter location";
provider.notifyListeners();
} else {
provider.validateLocation = "";
if (Platform.isAndroid) {
provider.image = await Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
FrontCameraCapture()));
print("${provider.image}");
if(provider.image!=null){
provider.imagePicked = 1;
}
var file = await FlutterImageCompress.compressWithFile(
provider.image!.path,
);
if (file != null) {
if (widget.getAttendanceStatus == 0) {
provider.checkIn(context);
} else if (widget.getAttendanceStatus == 1) {
provider.checkOut(context);
child: InkWell(
onTap: () async {
if (provider
.locationController
.text
.isEmpty) {
provider.validateLocation =
"Please Enter location";
provider.notifyListeners();
} else {
provider.validateLocation = "";
if (Platform.isAndroid) {
provider
.image = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
FrontCameraCapture(),
),
);
print("${provider.image}");
if (provider.image != null) {
provider.imagePicked = 1;
}
var file =
await FlutterImageCompress.compressWithFile(
provider.image!.path,
);
if (file != null) {
if (widget
.getAttendanceStatus ==
0) {
provider.checkIn(context);
} else if (widget
.getAttendanceStatus ==
1) {
provider.checkOut(
context,
);
}
}
} else if (Platform.isIOS) {
// BackgroundLocation.stopLocationService();
provider.imgFromCamera(
context,
widget.getAttendanceStatus,
);
// setState(() {
// isLoading = true;
// image_picked = 0;
// CheckIn();
// });
}
}
},
child: Container(
alignment: Alignment.center,
height: 45,
width: screenWidth,
} else if (Platform.isIOS) {
// BackgroundLocation.stopLocationService();
provider.imgFromCamera(
context,widget.getAttendanceStatus);
// setState(() {
// isLoading = true;
// image_picked = 0;
// CheckIn();
// });
}
}
},
child: Container(
alignment: Alignment.center,
height: 45,
width: screenWidth,
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius:
BorderRadius.circular(15.0),
),
child: Text(
widget.getAttendanceStatus==0? "Check In":"Check Out",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 16,
color: Colors.white
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius:
BorderRadius.circular(15.0),
),
child: Text(
widget.getAttendanceStatus == 0
? "Check In"
: "Check Out",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 16,
color: Colors.white,
),
),
),
),
),
),
],
),
],
),
),
),
],
),
],
),
),
],
),
],
),
),
),
),
),
),
);
},
):NoNetwork(context);
);
},
)
: NoNetwork(context);
}
}
......@@ -75,15 +75,14 @@ class CommonFilter2 {
// Get formatted date range as a list of strings
List<String> getFormattedDateRange(DateTimeRange? dateRange) {
if (dateRange != null) {
return [
formatDate(dateRange.start),
formatDate(dateRange.end),
];
return [formatDate(dateRange.start), formatDate(dateRange.end)];
}
return [];
}
Future<Map<String, dynamic>?> showFilterBottomSheet(BuildContext context) async {
Future<Map<String, dynamic>?> showFilterBottomSheet(
BuildContext context,
) async {
String? tempSelectedValue = selectedValue;
DateTimeRange? tempSelectedDateRange = selectedDateRange;
DateTime? tempStartDate;
......@@ -93,8 +92,16 @@ class CommonFilter2 {
String? tempSelectedType = selectedType ?? "All";
Widget buildCalendar(StateSetter setState) {
final firstDayOfMonth = DateTime(displayedMonth.year, displayedMonth.month, 1);
final lastDayOfMonth = DateTime(displayedMonth.year, displayedMonth.month + 1, 0);
final firstDayOfMonth = DateTime(
displayedMonth.year,
displayedMonth.month,
1,
);
final lastDayOfMonth = DateTime(
displayedMonth.year,
displayedMonth.month + 1,
0,
);
final firstDayOfWeek = firstDayOfMonth.weekday;
final daysInMonth = lastDayOfMonth.day;
final daysBefore = (firstDayOfWeek - 1) % 7;
......@@ -102,32 +109,43 @@ class CommonFilter2 {
List<Widget> dayWidgets = [];
final weekdays = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
dayWidgets.addAll(weekdays.map((day) => Center(
child: Text(
day,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: Colors.grey[700],
dayWidgets.addAll(
weekdays.map(
(day) => Center(
child: Text(
day,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: Colors.grey[700],
),
),
),
),
)));
);
for (int i = 0; i < daysBefore; i++) {
dayWidgets.add(Container());
}
for (int day = 1; day <= daysInMonth; day++) {
final currentDate = DateTime(displayedMonth.year, displayedMonth.month, day);
final currentDate = DateTime(
displayedMonth.year,
displayedMonth.month,
day,
);
bool isSelected = false;
bool isInRange = false;
bool isOutsideRange =
currentDate.isBefore(DateTime(2020)) || currentDate.isAfter(DateTime(2100));
currentDate.isBefore(DateTime(2020)) ||
currentDate.isAfter(DateTime(2100));
if (tempStartDate != null && tempEndDate != null) {
isSelected = currentDate.isAtSameMomentAs(tempStartDate!) ||
isSelected =
currentDate.isAtSameMomentAs(tempStartDate!) ||
currentDate.isAtSameMomentAs(tempEndDate!);
isInRange = currentDate.isAfter(tempStartDate!) &&
isInRange =
currentDate.isAfter(tempStartDate!) &&
currentDate.isBefore(tempEndDate!) &&
!isSelected;
} else if (tempStartDate != null) {
......@@ -136,49 +154,55 @@ class CommonFilter2 {
dayWidgets.add(
GestureDetector(
onTap: isOutsideRange
? null
: () {
setState(() {
if (tempStartDate == null) {
tempStartDate = currentDate;
tempSelectedDateRange = null;
} else if (tempEndDate == null) {
if (currentDate.isBefore(tempStartDate!)) {
tempEndDate = tempStartDate;
tempStartDate = currentDate;
} else {
tempEndDate = currentDate;
}
tempSelectedDateRange =
DateTimeRange(start: tempStartDate!, end: tempEndDate!);
} else {
tempStartDate = currentDate;
tempEndDate = null;
tempSelectedDateRange = null;
}
});
},
onTap:
isOutsideRange
? null
: () {
setState(() {
if (tempStartDate == null) {
tempStartDate = currentDate;
tempSelectedDateRange = null;
} else if (tempEndDate == null) {
if (currentDate.isBefore(tempStartDate!)) {
tempEndDate = tempStartDate;
tempStartDate = currentDate;
} else {
tempEndDate = currentDate;
}
tempSelectedDateRange = DateTimeRange(
start: tempStartDate!,
end: tempEndDate!,
);
} else {
tempStartDate = currentDate;
tempEndDate = null;
tempSelectedDateRange = null;
}
});
},
child: Container(
margin: const EdgeInsets.all(2),
decoration: BoxDecoration(
color: isSelected
? Colors.blue[600]
: isInRange
? Colors.blue[100]
: null,
color:
isSelected
? Colors.blue[600]
: isInRange
? Colors.blue[100]
: null,
shape: BoxShape.circle,
),
child: Center(
child: Text(
'$day',
style: TextStyle(
color: isOutsideRange
? Colors.grey[400]
: isSelected
? Colors.white
: Colors.black,
fontWeight: isSelected ? FontWeight.bold : FontWeight.normal,
color:
isOutsideRange
? Colors.grey[400]
: isSelected
? Colors.white
: Colors.black,
fontWeight:
isSelected ? FontWeight.bold : FontWeight.normal,
),
),
),
......@@ -193,29 +217,38 @@ class CommonFilter2 {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: displayedMonth.isAfter(DateTime(2020))
? () {
setState(() {
displayedMonth =
DateTime(displayedMonth.year, displayedMonth.month - 1);
});
}
: null,
onTap:
displayedMonth.isAfter(DateTime(2020))
? () {
setState(() {
displayedMonth = DateTime(
displayedMonth.year,
displayedMonth.month - 1,
);
});
}
: null,
child: SvgPicture.asset("assets/svg/arrow_left.svg"),
),
Text(
'${_monthName(displayedMonth.month)} ${displayedMonth.year}',
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
),
),
GestureDetector(
onTap: displayedMonth.isBefore(DateTime(2100))
? () {
setState(() {
displayedMonth =
DateTime(displayedMonth.year, displayedMonth.month + 1);
});
}
: null,
onTap:
displayedMonth.isBefore(DateTime(2100))
? () {
setState(() {
displayedMonth = DateTime(
displayedMonth.year,
displayedMonth.month + 1,
);
});
}
: null,
child: SvgPicture.asset("assets/svg/arrow_right_new.svg"),
),
],
......@@ -225,8 +258,8 @@ class CommonFilter2 {
child: GridView.count(
crossAxisCount: 7,
childAspectRatio: 1.2,
children: dayWidgets,
physics: const NeverScrollableScrollPhysics(),
children: dayWidgets,
),
),
],
......@@ -265,8 +298,13 @@ class CommonFilter2 {
const SizedBox(height: 20),
/// Type filter
const Text("Type",
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500)),
const Text(
"Type",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 8),
DropdownButtonHideUnderline(
child: Row(
......@@ -275,10 +313,15 @@ class CommonFilter2 {
child: DropdownButton2<String>(
isExpanded: true,
value: tempSelectedType,
items: typeItems
.map((type) =>
DropdownMenuItem<String>(value: type, child: Text(type)))
.toList(),
items:
typeItems
.map(
(type) => DropdownMenuItem<String>(
value: type,
child: Text(type),
),
)
.toList(),
onChanged: (value) {
setState(() {
tempSelectedType = value;
......@@ -296,8 +339,13 @@ class CommonFilter2 {
const SizedBox(height: 20),
/// Date range filter
const Text("Date Range",
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500)),
const Text(
"Date Range",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 8),
DropdownButtonHideUnderline(
child: Row(
......@@ -313,27 +361,32 @@ class CommonFilter2 {
color: Colors.black,
),
),
items: filterItems
.map((String item) =>
DropdownMenuItem<String>(
value: item, child: Text(
item,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
color: Colors.black,
),
)
)
)
.toList(),
items:
filterItems
.map(
(String item) =>
DropdownMenuItem<String>(
value: item,
child: Text(
item,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
color: Colors.black,
),
),
),
)
.toList(),
value: tempSelectedValue,
onChanged: (String? value) {
if (value == null) return;
setState(() {
tempSelectedValue = value;
if (value != 'Custom') {
tempSelectedDateRange = getDateRange(value);
tempSelectedDateRange = getDateRange(
value,
);
tempStartDate = null;
tempEndDate = null;
} else {
......@@ -353,47 +406,56 @@ class CommonFilter2 {
),
),
if (tempSelectedValue == 'Custom') ...[
const SizedBox(height: 16),
Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.grey[300]!),
borderRadius: BorderRadius.circular(12),
),
padding: const EdgeInsets.all(12),
child: buildCalendar(setState),
),
if (tempSelectedDateRange != null)
Padding(
padding: const EdgeInsets.only(top: 12.0),
child: Text(
'Selected: ${DateFormat("dd MMM yyyy").format(tempSelectedDateRange!.start)} to ${DateFormat("dd MMM yyyy").format(tempSelectedDateRange!.end)}',
style: TextStyle(
fontSize: 14,
color: Colors.grey[600],
),
),
),
],
if (tempSelectedValue == 'Custom') ...[
const SizedBox(height: 16),
Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.grey[300]!),
borderRadius: BorderRadius.circular(12),
),
padding: const EdgeInsets.all(12),
child: buildCalendar(setState),
),
if (tempSelectedDateRange != null)
Padding(
padding: const EdgeInsets.only(top: 12.0),
child: Text(
'Selected: ${DateFormat("dd MMM yyyy").format(tempSelectedDateRange!.start)} to ${DateFormat("dd MMM yyyy").format(tempSelectedDateRange!.end)}',
style: TextStyle(fontSize: 14, color: Colors.grey[600]),
),
),
],
const SizedBox(height: 20),
const SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
onPressed: () => Navigator.pop(context),
child: Text('Cancel',
style: TextStyle(color: Colors.grey[600])),
child: Text(
'Cancel',
style: TextStyle(color: Colors.grey[600]),
),
),
const SizedBox(width: 8),
ElevatedButton(
onPressed: () {
Navigator.pop(context, {
'type': tempSelectedType, // if you store type separately
'selectedValue': tempSelectedValue, // could be null
'dateRange': tempSelectedDateRange, // could be null
'formatted': tempSelectedDateRange != null
? getFormattedDateRange(tempSelectedDateRange)
: null,
'type':
tempSelectedType, // if you store type separately
'selectedValue':
tempSelectedValue, // could be null
'dateRange':
tempSelectedDateRange, // could be null
'formatted':
tempSelectedDateRange != null
? getFormattedDateRange(
tempSelectedDateRange,
)
: null,
});
},
style: ElevatedButton.styleFrom(
......@@ -405,7 +467,6 @@ class CommonFilter2 {
),
child: const Text('Apply'),
),
],
),
],
......@@ -432,7 +493,7 @@ class CommonFilter2 {
'September',
'October',
'November',
'December'
'December',
];
return months[month - 1];
}
......
......@@ -11,7 +11,7 @@ import 'package:permission_handler/permission_handler.dart';
import '../Utils/commonServices.dart';
class FrontCameraCapture extends StatefulWidget {
const FrontCameraCapture({Key? key}) : super(key: key);
const FrontCameraCapture({super.key});
@override
State<FrontCameraCapture> createState() => _CheckOutScreenState();
......@@ -56,7 +56,7 @@ class _CheckOutScreenState extends State<FrontCameraCapture> {
(camera) => camera.lensDirection == CameraLensDirection.front,
);
// final frontCamera = CameraLensDirection.front;
cam_controller = CameraController(frontCamera, ResolutionPreset.max,);
cam_controller = CameraController(frontCamera, ResolutionPreset.max);
await cam_controller.initialize();
......@@ -82,59 +82,63 @@ class _CheckOutScreenState extends State<FrontCameraCapture> {
return SafeArea(
top: false,
bottom: Platform.isIOS?false:true,
bottom: Platform.isIOS ? false : true,
child: Scaffold(
// appBar: AppBar(automaticallyImplyLeading: false),
body: isLoading
? Center(child: CircularProgressIndicator())
: Row(
children: [
Expanded(
child: SizedBox(
height: double.infinity,
child:
cam_controller.value.isInitialized
? Transform(
alignment: Alignment.center,
transform: Matrix4.rotationY(math.pi),
child: CameraPreview(
cam_controller,
child: Align(
alignment: Alignment.bottomCenter,
child: GestureDetector(
onTap: () async {
if (!cam_controller
.value
.isInitialized)
return;
final image =
await cam_controller
.takePicture();
_image = File(image.path);
Navigator.pop(context, _image);
},
child: Container(
height: 100,
width: double.infinity,
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
color: Colors.black26
),
child: Center(
child: SvgPicture.asset("assets/svg/check_in_cam.svg",width: 50,height: 50,)
body:
isLoading
? Center(child: CircularProgressIndicator())
: Row(
children: [
Expanded(
child: SizedBox(
height: double.infinity,
child:
cam_controller.value.isInitialized
? Transform(
alignment: Alignment.center,
transform: Matrix4.rotationY(math.pi),
child: CameraPreview(
cam_controller,
child: Align(
alignment: Alignment.bottomCenter,
child: GestureDetector(
onTap: () async {
if (!cam_controller
.value
.isInitialized) {
return;
}
final image =
await cam_controller
.takePicture();
_image = File(image.path);
Navigator.pop(context, _image);
},
child: Container(
height: 100,
width: double.infinity,
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
color: Colors.black26,
),
child: Center(
child: SvgPicture.asset(
"assets/svg/check_in_cam.svg",
width: 50,
height: 50,
),
),
),
),
),
),
),
),
)
: Center(child: Text("Camera not ready")),
),
)
: Center(child: Text("Camera not ready")),
),
),
],
),
],
),
),
);
}
......
......@@ -9,17 +9,16 @@ class JobDescriptionScreen extends StatefulWidget {
final String designation;
const JobDescriptionScreen({
Key? key,
super.key,
required this.htmlData,
this.title = "Job Description",
required this.designation,
}) : super(key: key);
});
@override
State<JobDescriptionScreen> createState() => _JobDescriptionScreenState();
}
class _JobDescriptionScreenState extends State<JobDescriptionScreen> {
@override
Widget build(BuildContext context) {
......
......@@ -42,7 +42,7 @@ class _LoginScreenState extends State<LoginScreen>
late FocusNode _passwordFocusNode;
bool _isTextFieldFocused = false;
KeyboardVisibilityController _keyboardVisibilityController =
final KeyboardVisibilityController _keyboardVisibilityController =
KeyboardVisibilityController();
@override
......@@ -118,8 +118,8 @@ class _LoginScreenState extends State<LoginScreen>
actions: [
TextButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.white),
overlayColor: MaterialStateProperty.all(Colors.white),
backgroundColor: WidgetStateProperty.all(Colors.white),
overlayColor: WidgetStateProperty.all(Colors.white),
),
onPressed: () => Navigator.of(context).pop(false),
child: Text(
......@@ -130,8 +130,8 @@ class _LoginScreenState extends State<LoginScreen>
const SizedBox(height: 16),
TextButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.white),
overlayColor: MaterialStateProperty.all(Colors.white70),
backgroundColor: WidgetStateProperty.all(Colors.white),
overlayColor: WidgetStateProperty.all(Colors.white70),
),
onPressed:
() => SystemChannels.platform.invokeMethod(
......@@ -259,7 +259,7 @@ class _LoginScreenState extends State<LoginScreen>
)
: Column(
children: [
Container(
SizedBox(
width: 180,
height: 120,
child: Image.asset(
......@@ -363,7 +363,7 @@ class _LoginScreenState extends State<LoginScreen>
),
),
),
if (loginProv.emailError != null) ...[
...[
Container(
alignment: Alignment.topLeft,
margin: EdgeInsets.only(
......@@ -374,11 +374,12 @@ class _LoginScreenState extends State<LoginScreen>
child: Text(
loginProv.emailError,
textAlign: TextAlign.start,
style: TextStyle(color: Colors.red,fontSize: 10,),
style: TextStyle(
color: Colors.red,
fontSize: 10,
),
),
),
] else ...[
SizedBox(height: 10.0),
],
Container(
padding: EdgeInsets.only(
......@@ -486,7 +487,7 @@ class _LoginScreenState extends State<LoginScreen>
),
),
),
if (loginProv.passwordError != null) ...[
...[
Container(
alignment: Alignment.topLeft,
margin: EdgeInsets.only(
......@@ -503,10 +504,8 @@ class _LoginScreenState extends State<LoginScreen>
),
),
),
] else ...[
SizedBox(height: 15.0),
],
SizedBox(height: 10,),
SizedBox(height: 10),
InkWell(
onTap:
loginProv.isLoading
......@@ -519,9 +518,7 @@ class _LoginScreenState extends State<LoginScreen>
email.text,
password.text,
);
var f = FocusScope.of(
context,
);
var f = FocusScope.of(context);
if (!f.hasPrimaryFocus) {
f.unfocus();
......@@ -550,9 +547,7 @@ class _LoginScreenState extends State<LoginScreen>
child:
loginProv.isLoading
? CircularProgressIndicator.adaptive(
padding: EdgeInsets.all(
5,
),
padding: EdgeInsets.all(5),
valueColor:
AlwaysStoppedAnimation(
Colors.white,
......@@ -560,8 +555,7 @@ class _LoginScreenState extends State<LoginScreen>
)
: Text(
"Login",
textAlign:
TextAlign.center,
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontFamily:
......@@ -609,7 +603,7 @@ class _LoginScreenState extends State<LoginScreen>
),
touchThroughAreaShape: ClipAreaShape.rectangle,
touchThroughAreaCornerRadius: 30,
content: Container(
content: SizedBox(
height: 100,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
......@@ -652,7 +646,7 @@ class _LoginScreenState extends State<LoginScreen>
BorderRadius.circular(10.0),
),
child: Text(
'${loginProv.deviceId}',
loginProv.deviceId,
style: TextStyle(
fontSize: 16,
color: AppColors.semi_black,
......
......@@ -26,7 +26,6 @@ class _ScannerloginState extends State<Scannerlogin> {
// TODO: implement initState
_connectivity.initialise();
_connectivity.myStream.listen((source) {
setState(() => _source = source);
});
......@@ -70,7 +69,7 @@ class _ScannerloginState extends State<Scannerlogin> {
child: Column(
children: [
Spacer(),
Container(
SizedBox(
height: 250,
child: QRView(
......
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:generp/Notifiers/UpdatePasswordProvider.dart';
......@@ -19,7 +18,7 @@ class UpdatePassword extends StatelessWidget {
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: Platform.isIOS?false:true,
bottom: Platform.isIOS ? false : true,
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar(context, "Update Password"),
......@@ -49,90 +48,97 @@ class UpdatePassword extends StatelessWidget {
SizedBox(height: 10),
Container(
alignment: Alignment.topLeft,
padding: EdgeInsets.symmetric(horizontal: 10),
child: Text("New Password",style: TextStyle(
color: AppColors.semi_black
),)),
padding: EdgeInsets.symmetric(horizontal: 10),
child: Text(
"New Password",
style: TextStyle(color: AppColors.semi_black),
),
),
SizedBox(height: 5),
_buildTextField(
controller: provider.password,
hintText: "New Password*",
errorText: provider.passwordError,
obscureText: !provider.pwdVisible,
obscureText: !provider.pwdVisible,
suffixIcon: IconButton(
icon:
provider.pwdVisible
?SvgPicture.asset(
width: 35,
height: 35,
"assets/svg/password_visible.svg",
)
: SvgPicture.asset(
width: 35,
height: 35,
"assets/svg/password_invisible.svg",
),
provider.pwdVisible
? SvgPicture.asset(
width: 35,
height: 35,
"assets/svg/password_visible.svg",
)
: SvgPicture.asset(
width: 35,
height: 35,
"assets/svg/password_invisible.svg",
),
onPressed: () {
provider.pwdVisibility();
},
),
onChanged: provider.onChangePassword
onChanged: provider.onChangePassword,
),
SizedBox(height: 10),
Container(
alignment: Alignment.topLeft,
padding: EdgeInsets.symmetric(horizontal: 10),
child: Text("Confirm Password",style: TextStyle(
color: AppColors.semi_black
),)),
alignment: Alignment.topLeft,
padding: EdgeInsets.symmetric(horizontal: 10),
child: Text(
"Confirm Password",
style: TextStyle(color: AppColors.semi_black),
),
),
SizedBox(height: 5),
_buildTextField(
controller: provider.confPassword,
hintText: "Confirm New Password*",
errorText: provider.confirmPasswordError,
obscureText: !provider.confPwdVisible,
suffixIcon: IconButton(
iconSize: 30,
icon: provider.confPwdVisible?SvgPicture.asset(
width: 35,
height: 35,
"assets/svg/password_visible.svg",
)
: SvgPicture.asset(
width: 35,
height: 35,
"assets/svg/password_invisible.svg",
),
onPressed: () {
provider.confPwdVisibility();
},
),
onChanged: provider.onChangeConfPassword
obscureText: !provider.confPwdVisible,
suffixIcon: IconButton(
iconSize: 30,
icon:
provider.confPwdVisible
? SvgPicture.asset(
width: 35,
height: 35,
"assets/svg/password_visible.svg",
)
: SvgPicture.asset(
width: 35,
height: 35,
"assets/svg/password_invisible.svg",
),
onPressed: () {
provider.confPwdVisibility();
},
),
onChanged: provider.onChangeConfPassword,
),
Spacer(),
InkWell(
onTap: () => provider.updatePassword(context),
child: Container(
alignment: Alignment.center,
height: 45,
margin: EdgeInsets.symmetric(horizontal: 15),
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius: BorderRadius.circular(15.0),
),
child:provider.isLoading
InkWell(
onTap: () => provider.updatePassword(context),
child: Container(
alignment: Alignment.center,
height: 45,
margin: EdgeInsets.symmetric(horizontal: 15),
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius: BorderRadius.circular(15.0),
),
child:
provider.isLoading
? CircularProgressIndicator(
color: Colors.white,
padding: EdgeInsets.all(7.5),
)
color: Colors.white,
padding: EdgeInsets.all(7.5),
)
: Text(
"Update",
style: TextStyle(color: Colors.white),
),
),
),
"Update",
style: TextStyle(
color: Colors.white,
),
),
),
),
SizedBox(height: 10),
],
),
......@@ -175,12 +181,10 @@ class UpdatePassword extends StatelessWidget {
obscureText: obscureText,
decoration: InputDecoration(
hintText: hintText,
hintStyle: TextStyle(color: Color(0xFF818181),
fontSize: 14),
hintStyle: TextStyle(color: Color(0xFF818181), fontSize: 14),
border: InputBorder.none,
suffixIcon: suffixIcon,
),
),
),
),
......
......@@ -34,7 +34,6 @@ Future runErpScreenApp() async {
class WebErpScreen extends StatefulWidget {
final String erp_url;
const WebErpScreen({super.key, required this.erp_url});
@override
......@@ -42,7 +41,6 @@ class WebErpScreen extends StatefulWidget {
}
class _WebErpScreenState extends State<WebErpScreen> {
Map _source = {ConnectivityResult.mobile: true};
final MyConnectivity _connectivity = MyConnectivity.instance;
......@@ -141,266 +139,282 @@ class _WebErpScreenState extends State<WebErpScreen> {
}
return true; // Allow default back button behavior
},
child: connection=="Online"?SafeArea(
top: false,
bottom: Platform.isIOS?false:true,
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar(context, "ERP"),
body: Container(
child: Column(
children: <Widget>[
Expanded(
child: Stack(
children: [
InAppWebView(
initialUrlRequest: URLRequest(
url: WebUri(widget.erp_url),
allowsCellularAccess: true,
allowsConstrainedNetworkAccess: true,
allowsExpensiveNetworkAccess: true,
),
androidOnGeolocationPermissionsShowPrompt: (
InAppWebViewController controller,
String origin,
) async {
return GeolocationPermissionShowPromptResponse(
origin: origin,
allow: true,
retain: true,
);
},
initialOptions: InAppWebViewGroupOptions(
android: AndroidInAppWebViewOptions(
useWideViewPort: true,
loadWithOverviewMode: true,
allowContentAccess: true,
geolocationEnabled: true,
allowFileAccess: true,
databaseEnabled: true,
// Enables the WebView database
domStorageEnabled: true,
// Enables DOM storage
builtInZoomControls: true,
// Enables the built-in zoom controls
displayZoomControls: false,
// Disables displaying zoom controls
safeBrowsingEnabled: true,
// Enables Safe Browsing
clearSessionCache: true,
loadsImagesAutomatically: true,
thirdPartyCookiesEnabled: true,
blockNetworkImage: false,
supportMultipleWindows: true,
blockNetworkLoads: false,
networkAvailable: true,
useShouldInterceptRequest: true,
hardwareAcceleration: true,
// Enable camera access
),
ios: IOSInAppWebViewOptions(
allowsInlineMediaPlayback: true,
allowsLinkPreview: true,
allowsBackForwardNavigationGestures: true,
),
crossPlatform: InAppWebViewOptions(
javaScriptEnabled: true,
useOnDownloadStart: true,
allowFileAccessFromFileURLs: true,
allowUniversalAccessFromFileURLs: true,
mediaPlaybackRequiresUserGesture: true,
),
),
child:
connection == "Online"
? SafeArea(
top: false,
bottom: Platform.isIOS ? false : true,
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar(context, "ERP"),
body: Container(
child: Column(
children: <Widget>[
Expanded(
child: Stack(
children: [
InAppWebView(
initialUrlRequest: URLRequest(
url: WebUri(widget.erp_url),
allowsCellularAccess: true,
allowsConstrainedNetworkAccess: true,
allowsExpensiveNetworkAccess: true,
),
androidOnGeolocationPermissionsShowPrompt: (
InAppWebViewController controller,
String origin,
) async {
return GeolocationPermissionShowPromptResponse(
origin: origin,
allow: true,
retain: true,
);
},
initialOptions: InAppWebViewGroupOptions(
android: AndroidInAppWebViewOptions(
useWideViewPort: true,
loadWithOverviewMode: true,
allowContentAccess: true,
geolocationEnabled: true,
allowFileAccess: true,
databaseEnabled: true,
// Enables the WebView database
domStorageEnabled: true,
// Enables DOM storage
builtInZoomControls: true,
// Enables the built-in zoom controls
displayZoomControls: false,
// Disables displaying zoom controls
safeBrowsingEnabled: true,
// Enables Safe Browsing
clearSessionCache: true,
loadsImagesAutomatically: true,
thirdPartyCookiesEnabled: true,
blockNetworkImage: false,
supportMultipleWindows: true,
blockNetworkLoads: false,
networkAvailable: true,
useShouldInterceptRequest: true,
hardwareAcceleration: true,
// Enable camera access
),
ios: IOSInAppWebViewOptions(
allowsInlineMediaPlayback: true,
allowsLinkPreview: true,
allowsBackForwardNavigationGestures: true,
),
crossPlatform: InAppWebViewOptions(
javaScriptEnabled: true,
useOnDownloadStart: true,
allowFileAccessFromFileURLs: true,
allowUniversalAccessFromFileURLs: true,
mediaPlaybackRequiresUserGesture: true,
),
),
androidOnPermissionRequest: (
InAppWebViewController controller,
String origin,
List<String> resources,
) async {
return PermissionRequestResponse(
resources: resources,
action: PermissionRequestResponseAction.GRANT,
);
},
onPermissionRequest: (controller, request) async {
return PermissionResponse(
resources: request.resources,
action: PermissionResponseAction.GRANT,
);
},
keepAlive: InAppWebViewKeepAlive(),
onWebViewCreated: (controller) {
_webViewController = controller;
_controller.complete(controller);
// _webViewController!.addJavaScriptHandler(
// handlerName: 'downloadBlobHandler',
// callback: (args) async {
// String base64Data = args[0];
// String mimeType = args[1];
// String filename = args[2];
//
// // Save the file
// await saveBase64File(base64Data, filename, mimeType);
// },
// );
_webViewController!.addJavaScriptHandler(
handlerName: 'MobileAppJavascriptInterface',
callback: (args) {
print(
"JavaScript called MobileAppJavascriptInterface with args: $args",
);
return {'status': 'success'};
},
);
_webViewController!.addJavaScriptHandler(
handlerName: 'downloadFile',
callback: (args) async {
if (Platform.isAndroid) {
final url = args[0] as String;
await _handleDownload(
url,
'',
'application/octet-stream',
'',
// controller,context
);
}
},
);
},
pullToRefreshController: pullToRefreshController,
onLoadStart: (controller, url) {
return setState(() {
isLoading = true;
});
},
initialSettings: InAppWebViewSettings(
allowUniversalAccessFromFileURLs: true,
allowFileAccessFromFileURLs: true,
allowFileAccess: true,
allowsInlineMediaPlayback: true,
allowsPictureInPictureMediaPlayback: true,
allowsBackForwardNavigationGestures: true,
iframeAllow: "camera;microphone;files;media;",
domStorageEnabled: true,
allowContentAccess: true,
javaScriptEnabled: true,
supportZoom: true,
builtInZoomControls: true,
displayZoomControls: false,
textZoom: 125,
blockNetworkImage: false,
loadsImagesAutomatically: true,
safeBrowsingEnabled: true,
useWideViewPort: true,
loadWithOverviewMode: true,
javaScriptCanOpenWindowsAutomatically: true,
mediaPlaybackRequiresUserGesture: false,
geolocationEnabled: true,
useOnDownloadStart: true,
allowsLinkPreview: true,
databaseEnabled: true,
// Enables the WebView database
clearSessionCache: true,
mediaType: "image/*,application/pdf",
useShouldInterceptRequest: true,
hardwareAcceleration: true,
),
shouldInterceptRequest: (controller, request) async {
final url = request.url.toString();
print(
'Intercepting request: $url, Headers: ${request.headers}',
);
if (url.endsWith('.pdf')) {
final response = await http.get(
Uri.parse(url),
headers: {'Accept': 'application/pdf'},
);
if (response.statusCode == 200 &&
response.headers['content-type']?.contains(
'application/pdf',
) ==
true) {
return WebResourceResponse(
contentType: 'application/pdf',
data: response.bodyBytes,
);
} else {
print(
'Failed to load PDF: Status ${response.statusCode}, Content-Type: ${response.headers['content-type']}',
);
}
}
return null;
},
shouldOverrideUrlLoading: (
controller,
navigationAction,
) async {
var uri = navigationAction.request.url!;
print("urib scgefes");
print(uri);
print(uri.scheme);
if (uri.toString().contains(
'file_viewer_name.php',
) &&
uri.toString().contains('.pdf')) {
final pdfPath =
Uri.parse(
uri.toString(),
).queryParameters['file_path'];
if (pdfPath != null) {
final pdfUrl = 'https://erp.gengroup.in/$pdfPath';
await controller.loadUrl(
urlRequest: URLRequest(url: WebUri(pdfUrl)),
);
return NavigationActionPolicy.CANCEL;
}
}
if (uri.scheme == "tel") {
// Launch the phone dialer app with the specified phone number
if (await canLaunch(uri.toString())) {
await launch(uri.toString());
return NavigationActionPolicy.CANCEL;
}
} else if (uri.scheme == "mailto") {
if (await canLaunch(uri.toString())) {
await launch(uri.toString());
return NavigationActionPolicy.CANCEL;
}
} else if (uri.scheme == "whatsapp") {
// Launch WhatsApp with the specified chat or phone number
if (await canLaunch(uri.toString())) {
await launch(uri.toString());
return NavigationActionPolicy.CANCEL;
}
}
// // Check if the URL is trying to access the camera for image upload
// if (uri.scheme == 'camera' && uri.path.contains('/camera/')) {
// // Handle camera image upload here
// // You might want to display a custom UI for image selection or directly trigger the camera
// // You can use platform-specific plugins like image_picker for this purpose
// // Once the image is selected, you can pass it to the web view using JavaScript injection
// if (await canLaunch(uri.toString())) {
// await launch(uri.toString());
// return NavigationActionPolicy.CANCEL;
// }
// }
return NavigationActionPolicy.ALLOW;
},
onLoadStop: (controller, url) async {
if (url.toString().contains('file_viewer_name.php') &&
url.toString().contains('.pdf')) {
final uri = Uri.parse(url.toString());
final pdfPath = uri.queryParameters['file_path'];
if (pdfPath != null) {
final pdfUrl = 'https://erp.gengroup.in/$pdfPath';
await controller.evaluateJavascript(
source: '''
androidOnPermissionRequest: (
InAppWebViewController controller,
String origin,
List<String> resources,
) async {
return PermissionRequestResponse(
resources: resources,
action:
PermissionRequestResponseAction.GRANT,
);
},
onPermissionRequest: (
controller,
request,
) async {
return PermissionResponse(
resources: request.resources,
action: PermissionResponseAction.GRANT,
);
},
keepAlive: InAppWebViewKeepAlive(),
onWebViewCreated: (controller) {
_webViewController = controller;
_controller.complete(controller);
// _webViewController!.addJavaScriptHandler(
// handlerName: 'downloadBlobHandler',
// callback: (args) async {
// String base64Data = args[0];
// String mimeType = args[1];
// String filename = args[2];
//
// // Save the file
// await saveBase64File(base64Data, filename, mimeType);
// },
// );
_webViewController!.addJavaScriptHandler(
handlerName: 'MobileAppJavascriptInterface',
callback: (args) {
print(
"JavaScript called MobileAppJavascriptInterface with args: $args",
);
return {'status': 'success'};
},
);
_webViewController!.addJavaScriptHandler(
handlerName: 'downloadFile',
callback: (args) async {
if (Platform.isAndroid) {
final url = args[0] as String;
await _handleDownload(
url,
'',
'application/octet-stream',
'',
// controller,context
);
}
},
);
},
pullToRefreshController:
pullToRefreshController,
onLoadStart: (controller, url) {
return setState(() {
isLoading = true;
});
},
initialSettings: InAppWebViewSettings(
allowUniversalAccessFromFileURLs: true,
allowFileAccessFromFileURLs: true,
allowFileAccess: true,
allowsInlineMediaPlayback: true,
allowsPictureInPictureMediaPlayback: true,
allowsBackForwardNavigationGestures: true,
iframeAllow: "camera;microphone;files;media;",
domStorageEnabled: true,
allowContentAccess: true,
javaScriptEnabled: true,
supportZoom: true,
builtInZoomControls: true,
displayZoomControls: false,
textZoom: 125,
blockNetworkImage: false,
loadsImagesAutomatically: true,
safeBrowsingEnabled: true,
useWideViewPort: true,
loadWithOverviewMode: true,
javaScriptCanOpenWindowsAutomatically: true,
mediaPlaybackRequiresUserGesture: false,
geolocationEnabled: true,
useOnDownloadStart: true,
allowsLinkPreview: true,
databaseEnabled: true,
// Enables the WebView database
clearSessionCache: true,
mediaType: "image/*,application/pdf",
useShouldInterceptRequest: true,
hardwareAcceleration: true,
),
shouldInterceptRequest: (
controller,
request,
) async {
final url = request.url.toString();
print(
'Intercepting request: $url, Headers: ${request.headers}',
);
if (url.endsWith('.pdf')) {
final response = await http.get(
Uri.parse(url),
headers: {'Accept': 'application/pdf'},
);
if (response.statusCode == 200 &&
response.headers['content-type']
?.contains('application/pdf') ==
true) {
return WebResourceResponse(
contentType: 'application/pdf',
data: response.bodyBytes,
);
} else {
print(
'Failed to load PDF: Status ${response.statusCode}, Content-Type: ${response.headers['content-type']}',
);
}
}
return null;
},
shouldOverrideUrlLoading: (
controller,
navigationAction,
) async {
var uri = navigationAction.request.url!;
print("urib scgefes");
print(uri);
print(uri.scheme);
if (uri.toString().contains(
'file_viewer_name.php',
) &&
uri.toString().contains('.pdf')) {
final pdfPath =
Uri.parse(
uri.toString(),
).queryParameters['file_path'];
if (pdfPath != null) {
final pdfUrl =
'https://erp.gengroup.in/$pdfPath';
await controller.loadUrl(
urlRequest: URLRequest(
url: WebUri(pdfUrl),
),
);
return NavigationActionPolicy.CANCEL;
}
}
if (uri.scheme == "tel") {
// Launch the phone dialer app with the specified phone number
if (await canLaunch(uri.toString())) {
await launch(uri.toString());
return NavigationActionPolicy.CANCEL;
}
} else if (uri.scheme == "mailto") {
if (await canLaunch(uri.toString())) {
await launch(uri.toString());
return NavigationActionPolicy.CANCEL;
}
} else if (uri.scheme == "whatsapp") {
// Launch WhatsApp with the specified chat or phone number
if (await canLaunch(uri.toString())) {
await launch(uri.toString());
return NavigationActionPolicy.CANCEL;
}
}
// // Check if the URL is trying to access the camera for image upload
// if (uri.scheme == 'camera' && uri.path.contains('/camera/')) {
// // Handle camera image upload here
// // You might want to display a custom UI for image selection or directly trigger the camera
// // You can use platform-specific plugins like image_picker for this purpose
// // Once the image is selected, you can pass it to the web view using JavaScript injection
// if (await canLaunch(uri.toString())) {
// await launch(uri.toString());
// return NavigationActionPolicy.CANCEL;
// }
// }
return NavigationActionPolicy.ALLOW;
},
onLoadStop: (controller, url) async {
if (url.toString().contains(
'file_viewer_name.php',
) &&
url.toString().contains('.pdf')) {
final uri = Uri.parse(url.toString());
final pdfPath =
uri.queryParameters['file_path'];
if (pdfPath != null) {
final pdfUrl =
'https://erp.gengroup.in/$pdfPath';
await controller.evaluateJavascript(
source: '''
var pdfjsLib = window.pdfjsLib || document.createElement('script');
pdfjsLib.src = 'https://mozilla.github.io/pdf.js/build/pdf.js';
document.head.appendChild(pdfjsLib);
......@@ -423,110 +437,113 @@ class _WebErpScreenState extends State<WebErpScreen> {
});
};
''',
);
}
}
pullToRefreshController?.endRefreshing();
return setState(() {
isLoading = false;
});
},
onReceivedError: (controller, request, error) {
pullToRefreshController?.endRefreshing();
return setState(() {
isLoading = false;
});
},
onProgressChanged: (controller, progress) {
if (progress == 100) {
pullToRefreshController?.endRefreshing();
}
},
onConsoleMessage: (controller, consoleMessage) {
if (kDebugMode) {
debugPrint("consoleMessage${consoleMessage}");
}
debugPrint(
"JavaScript console message: ${consoleMessage.message}",
);
},
// onDownloadStartRequest: (controller, url) async {
// await ApiCalling.download_files(
// empId, sessionId, "${url.url}", context)
// .then((data) => {debugPrint(data)});
//
// },
onDownloadStartRequest: (
controller,
downloadStartRequest,
) async {
// String url = downloadStartRequest.url.toString();
//
// // Use url_launcher or another plugin to handle the download externally
// if (await canLaunchUrl(Uri.parse(url))) {
// await launchUrl(
// Uri.parse(url),
// mode: LaunchMode.externalApplication,
// );
// } else {
// print("Could not launch $url");
// }
if (Platform.isAndroid) {
await _handleDownload(
downloadStartRequest.url.toString(),
downloadStartRequest.suggestedFilename!,
downloadStartRequest.mimeType!,
downloadStartRequest.suggestedFilename ?? '',
// controller,context
);
}
},
),
if (isLoading) ...[
Container(
color: Colors.white.withOpacity(0.7),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SpinKitRing(
color: AppColors.app_blue,
lineWidth: 4,
// duration: Duration(seconds: 2),
size: 50,
);
}
}
pullToRefreshController?.endRefreshing();
return setState(() {
isLoading = false;
});
},
onReceivedError: (controller, request, error) {
pullToRefreshController?.endRefreshing();
return setState(() {
isLoading = false;
});
},
onProgressChanged: (controller, progress) {
if (progress == 100) {
pullToRefreshController?.endRefreshing();
}
},
onConsoleMessage: (controller, consoleMessage) {
if (kDebugMode) {
debugPrint("consoleMessage$consoleMessage");
}
debugPrint(
"JavaScript console message: ${consoleMessage.message}",
);
},
// onDownloadStartRequest: (controller, url) async {
// await ApiCalling.download_files(
// empId, sessionId, "${url.url}", context)
// .then((data) => {debugPrint(data)});
//
// },
onDownloadStartRequest: (
controller,
downloadStartRequest,
) async {
// String url = downloadStartRequest.url.toString();
//
// // Use url_launcher or another plugin to handle the download externally
// if (await canLaunchUrl(Uri.parse(url))) {
// await launchUrl(
// Uri.parse(url),
// mode: LaunchMode.externalApplication,
// );
// } else {
// print("Could not launch $url");
// }
if (Platform.isAndroid) {
await _handleDownload(
downloadStartRequest.url.toString(),
downloadStartRequest.suggestedFilename!,
downloadStartRequest.mimeType!,
downloadStartRequest.suggestedFilename ??
'',
// controller,context
);
}
},
),
const SizedBox(height: 15),
SizedBox(
width: 200,
child: Text(
"Please wait.......",
textAlign: TextAlign.center,
style: TextStyle(
decorationThickness: 0,
fontSize: 15,
fontWeight: FontWeight.normal,
color: AppColors.app_blue,
if (isLoading) ...[
Container(
color: Colors.white.withOpacity(0.7),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SpinKitRing(
color: AppColors.app_blue,
lineWidth: 4,
// duration: Duration(seconds: 2),
size: 50,
),
const SizedBox(height: 15),
SizedBox(
width: 200,
child: Text(
"Please wait.......",
textAlign: TextAlign.center,
style: TextStyle(
decorationThickness: 0,
fontSize: 15,
fontWeight: FontWeight.normal,
color: AppColors.app_blue,
),
),
),
// SvgPicture.asset("/assets/images/NutsLoader.gif")
],
),
),
),
// SvgPicture.asset("/assets/images/NutsLoader.gif")
],
],
),
),
],
],
),
),
),
],
),
),
),
):NoNetwork(context),
)
: NoNetwork(context),
);
}
// Future<void> saveBase64File(String base64Data, String filename, String mimeType) async {
// // Ask for permission
// if (await Permission.storage.request().isGranted) {
......@@ -663,6 +680,7 @@ class _WebErpScreenState extends State<WebErpScreen> {
_webViewController?.evaluateJavascript(source: js);
}
Future<void> _handleDownload(
String url,
String contentDisposition,
......@@ -804,13 +822,13 @@ class _WebErpScreenState extends State<WebErpScreen> {
class SpinKitRing extends StatefulWidget {
const SpinKitRing({
Key? key,
super.key,
required this.color,
this.lineWidth = 7.0,
this.size = 50.0,
this.duration = const Duration(milliseconds: 1200),
this.controller,
}) : super(key: key);
});
final Color color;
final double size;
......
......@@ -160,7 +160,7 @@ class _AccountledgerState extends State<Accountledger> {
SvgPicture.asset("assets/svg/fin_ic.svg", height: 12),
SizedBox(width: 5),
Text(
"${provider.balanceDetails.balance.toString()}" ?? "-",
provider.balanceDetails.balance.toString() ?? "-",
style: TextStyle(fontSize: 12),
),
],
......@@ -204,8 +204,7 @@ class _AccountledgerState extends State<Accountledger> {
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
"${provider.selectedAcVal ?? ""}" +
" " +
(provider.selectedAcVal ?? "") " " +
"Account Ledger List",
),
),
......@@ -346,7 +345,7 @@ class _AccountledgerState extends State<Accountledger> {
children: [
Expanded(
child: Text(
"${totalHeadings[index]}",
totalHeadings[index],
style: TextStyle(
fontFamily: "JakartaMedium",
),
......@@ -429,7 +428,7 @@ class _AccountledgerState extends State<Accountledger> {
),
),
...items.map((item) {
double running_balance = 0;
double runningBalance = 0;
int currentIndex = provider.ledgerList
.indexOf(item);
for (
......@@ -451,7 +450,7 @@ class _AccountledgerState extends State<Accountledger> {
.toString(),
) ??
0;
running_balance += (debit - credit);
runningBalance += (debit - credit);
}
return Container(
......@@ -651,7 +650,7 @@ class _AccountledgerState extends State<Accountledger> {
],
),
);
}).toList(),
}),
],
),
);
......@@ -760,9 +759,7 @@ class _AccountledgerState extends State<Accountledger> {
provider.selectedAcId = value.id!;
provider.selectedAcVal = value.name!;
print(
"hfjkshfg" +
provider.selectedAcId
.toString(),
"hfjkshfg${provider.selectedAcId}",
);
provider.ledgerlistAPI(context);
......
......@@ -39,8 +39,10 @@ class _AccountslistState extends State<Accountslist> {
// fetch first page once
Future.microtask(() {
final provider =
Provider.of<Accountslistprovider>(context, listen: false);
final provider = Provider.of<Accountslistprovider>(
context,
listen: false,
);
provider.commonAccountListAPIFunction(context);
});
}
......@@ -70,21 +72,24 @@ class _AccountslistState extends State<Accountslist> {
_currentPage++;
});
provider.commonAccountListAPIFunction(context, append: true).then((_) {
setState(() {
_isLoadingMore = false;
final newItems = provider.accountsList;
if (newItems.length < _currentPage * 15) {
//api gives 15 records
_hasMoreItems = false;
}
});
}).catchError((_) {
setState(() {
_isLoadingMore = false;
_currentPage--; // rollback
});
});
provider
.commonAccountListAPIFunction(context, append: true)
.then((_) {
setState(() {
_isLoadingMore = false;
final newItems = provider.accountsList;
if (newItems.length < _currentPage * 15) {
//api gives 15 records
_hasMoreItems = false;
}
});
})
.catchError((_) {
setState(() {
_isLoadingMore = false;
_currentPage--; // rollback
});
});
}
void _refreshList(BuildContext context) {
......@@ -111,15 +116,15 @@ class _AccountslistState extends State<Accountslist> {
return (connection == "Online")
? Platform.isAndroid
? WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: true,
child: _scaffold(context),
),
)
: _scaffold(context)
? WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: true,
child: _scaffold(context),
),
)
: _scaffold(context)
: NoNetwork(context);
}
......@@ -152,8 +157,10 @@ class _AccountslistState extends State<Accountslist> {
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child:
SvgPicture.asset("assets/svg/filter_ic.svg", height: 18),
child: SvgPicture.asset(
"assets/svg/filter_ic.svg",
height: 18,
),
),
),
),
......@@ -171,13 +178,14 @@ class _AccountslistState extends State<Accountslist> {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 16),
child: Center(
child: _isLoadingMore
? const CircularProgressIndicator(
color: Colors.blue,
)
: !_hasMoreItems
? const Text("No more accounts to load")
: const SizedBox.shrink(),
child:
_isLoadingMore
? const CircularProgressIndicator(
color: Colors.blue,
)
: !_hasMoreItems
? const Text("No more accounts to load")
: const SizedBox.shrink(),
),
);
}
......@@ -185,31 +193,20 @@ class _AccountslistState extends State<Accountslist> {
final account = accountList[index];
return InkResponse(
onTap: () async {
print(
"length, ${accountList.length}",
);
print("length, ${accountList.length}");
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
Accountslistdetails(
accountID:
accountList[index]
.id,
(context) => Accountslistdetails(
accountID: accountList[index].id,
),
),
);
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5,
vertical: 5,
),
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
padding: EdgeInsets.symmetric(horizontal: 5, vertical: 5),
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
......@@ -234,7 +231,7 @@ class _AccountslistState extends State<Accountslist> {
// ),
Expanded(
flex: 1,
child: Container(
child: SizedBox(
height: 50,
width: 35,
child: SvgPicture.asset(
......@@ -247,29 +244,23 @@ class _AccountslistState extends State<Accountslist> {
flex: 7,
child: SizedBox(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
accountList[index].name!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontFamily:
"JakartaRegular",
fontFamily: "JakartaRegular",
fontSize: 14,
color:
AppColors.semi_black,
color: AppColors.semi_black,
),
),
Text(
accountList[index]
.type ??
"-",
accountList[index].type ?? "-",
maxLines: 1,
style: TextStyle(
fontFamily:
"JakartaRegular",
fontFamily: "JakartaRegular",
fontSize: 12,
color: AppColors.grey_semi,
),
......@@ -289,10 +280,11 @@ class _AccountslistState extends State<Accountslist> {
},
);
}
Future<void> _showFilterSheet1(BuildContext context) {
List<bool> isSelected = List.generate(
2,
(index) => index == 0 ? true : false,
(index) => index == 0 ? true : false,
);
return showModalBottomSheet(
......@@ -314,22 +306,16 @@ class _AccountslistState extends State<Accountslist> {
child: Consumer<Accountslistprovider>(
builder: (context, provider, child) {
int selectedIndex = isSelected.indexWhere(
(element) => element == true,
(element) => element == true,
);
List<String> headings = [
"Account Name",
"Mobile Number",
];
List<String> headings = ["Account Name", "Mobile Number"];
return Container(
height: MediaQuery.of(context).size.height*0.3,
return SizedBox(
height: MediaQuery.of(context).size.height * 0.3,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(left: 15),
child: Text(
......@@ -343,11 +329,13 @@ class _AccountslistState extends State<Accountslist> {
),
const SizedBox(height: 20),
Expanded(
flex:4,
flex: 4,
child: Container(
decoration: BoxDecoration(
border: Border(
top: BorderSide(color: const Color(0xFFA5DAF9)),
top: BorderSide(
color: const Color(0xFFA5DAF9),
),
bottom: BorderSide(
color: const Color(0xFFA5DAF9),
),
......@@ -359,8 +347,9 @@ class _AccountslistState extends State<Accountslist> {
Expanded(
flex: 3,
child: Column(
children: List.generate(headings.length, (jj) {
children: List.generate(headings.length, (
jj,
) {
return Expanded(
child: InkResponse(
onTap: () {
......@@ -368,46 +357,45 @@ class _AccountslistState extends State<Accountslist> {
// Reset all to false
isSelected = List.generate(
headings.length,
(index) => false,
(index) => false,
);
// Set the clicked item to true
isSelected[jj] = true;
});
},
child: Container(
padding: const EdgeInsets.symmetric(
vertical: 7.5,
horizontal: 10,
),
padding:
const EdgeInsets.symmetric(
vertical: 7.5,
horizontal: 10,
),
decoration: BoxDecoration(
border: Border(
left:
isSelected[jj]
? BorderSide(
color:
AppColors
.app_blue,
width: 5.0,
)
: const BorderSide(
color:
Colors
.transparent,
),
isSelected[jj]
? BorderSide(
color:
AppColors
.app_blue,
width: 5.0,
)
: const BorderSide(
color:
Colors
.transparent,
),
bottom:
jj == headings.length - 1
? const BorderSide(
color:
Colors
.transparent,
)
: const BorderSide(
color: Color(
0xFFA5DAF9,
),
),
jj == headings.length - 1
? const BorderSide(
color:
Colors
.transparent,
)
: const BorderSide(
color: Color(
0xFFA5DAF9,
),
),
),
color: const Color(0xFFE6F6FF),
),
......@@ -417,7 +405,8 @@ class _AccountslistState extends State<Accountslist> {
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14,
fontFamily: "JakartaRegular",
fontFamily:
"JakartaRegular",
color: AppColors.semi_black,
),
),
......@@ -437,12 +426,13 @@ class _AccountslistState extends State<Accountslist> {
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
if (selectedIndex == 0) ...[
SizedBox(height: 10,),
SizedBox(height: 10),
textControllerWidget(
context,
provider.companyNameController,
......@@ -453,9 +443,8 @@ class _AccountslistState extends State<Accountslist> {
false,
null,
),
]
else if (selectedIndex == 1) ...[
SizedBox(height: 10,),
] else if (selectedIndex == 1) ...[
SizedBox(height: 10),
textControllerWidget(
context,
provider.mobileNumberController,
......@@ -467,10 +456,7 @@ class _AccountslistState extends State<Accountslist> {
FilteringTextInputFormatter
.digitsOnly,
),
]
],
],
),
),
......@@ -522,7 +508,6 @@ class _AccountslistState extends State<Accountslist> {
}
}
// Divider(
// thickness: 0.5,
// color: Color(0xFFD7D7D7),
......
......@@ -165,7 +165,7 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
children: [
Expanded(
flex: 1,
child: Container(
child: SizedBox(
height: 50,
width: 35,
child: SvgPicture.asset(
......@@ -584,7 +584,7 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
shrinkWrap: true,
itemCount: provider.ledgerList.length,
itemBuilder: (context, index) {
double running_balance = 0;
double runningBalance = 0;
int currentIndex = provider.ledgerList.indexOf(
provider.ledgerList[index],
);
......@@ -600,7 +600,7 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
ledgerItem.debitAmount.toString(),
) ??
0;
running_balance += (debit - credit);
runningBalance += (debit - credit);
}
return InkResponse(
onTap: () async {
......@@ -658,7 +658,8 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
flex: 5,
......@@ -701,8 +702,12 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
.ledgerList[index]
.type ==
"Credit"
? Color(0xFFEF3739)
: Color(0xFF0D9C00),
? Color(
0xFFEF3739,
)
: Color(
0xFF0D9C00,
),
fontSize: 14,
fontFamily:
"JakartaRegular",
......@@ -712,12 +717,17 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
text:
"₹${provider.ledgerList[index].type == "Credit" ? "${provider.ledgerList[index].creditAmount}" : "${provider.ledgerList[index].debitAmount}"}",
style: TextStyle(
color: provider
.ledgerList[index]
.type ==
"Credit"
? Color(0xFFEF3739)
: Color(0xFF0D9C00),
color:
provider
.ledgerList[index]
.type ==
"Credit"
? Color(
0xFFEF3739,
)
: Color(
0xFF0D9C00,
),
fontSize: 14,
fontFamily:
"JakartaRegular",
......@@ -730,7 +740,7 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
),
],
),
SizedBox(height: 7,),
SizedBox(height: 7),
Row(
children: [
Expanded(
......@@ -773,7 +783,7 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
),
),
TextSpan(
text: "$running_balance",
text: "$runningBalance",
style: TextStyle(
color:
AppColors.grey_semi,
......
......@@ -75,13 +75,13 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
);
}
@override
void dispose() {
focusNodes.map((e) => e.dispose());
super.dispose();
_connectivity.disposeStream();
}
Future<bool> onBackPressed(BuildContext context) async {
if (_currentStep > 0) {
_previousStep();
......@@ -90,6 +90,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
return true;
}
}
@override
Widget build(BuildContext context) {
switch (_source.keys.toList()[0]) {
......@@ -127,7 +128,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
"Add Account",
provider.resetValues,
SizedBox.shrink(),
0xFFFFFFFF
0xFFFFFFFF,
),
backgroundColor: AppColors.scaffold_bg_color,
body: Form(
......@@ -161,9 +162,9 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
return CircleAvatar(
radius: 12,
backgroundColor:
stepIndex <= _currentStep
? AppColors.app_blue
: Colors.grey[300],
stepIndex <= _currentStep
? AppColors.app_blue
: Colors.grey[300],
);
},
steps: [
......@@ -171,11 +172,11 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
label: Text("Step 1", style: TextStyle(fontSize: 12)),
title: const Text(''),
isActive: _currentStep >= 0,
content: Column(
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin:EdgeInsets.only(bottom: 5),
margin: EdgeInsets.only(bottom: 5),
child: Text(
"Account Details",
style: TextStyle(
......@@ -186,7 +187,10 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
),
),
Container(
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10),
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
......@@ -195,7 +199,6 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 10),
Text("Account"),
DropdownButtonHideUnderline(
......@@ -216,27 +219,30 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
],
),
items:
provider.accountTypes
.map(
(act) => DropdownMenuItem<String>(
value: act,
child: Text(
act,
style: const TextStyle(
fontSize: 14,
),
overflow: TextOverflow.ellipsis,
),
),
)
.toList(),
provider.accountTypes
.map(
(act) =>
DropdownMenuItem<String>(
value: act,
child: Text(
act,
style: const TextStyle(
fontSize: 14,
),
overflow:
TextOverflow
.ellipsis,
),
),
)
.toList(),
// value: provider.selectedAccountType,
value:
provider.accountTypes.contains(
provider.selectedAccountType,
)
? provider.selectedAccountType
: null,
provider.accountTypes.contains(
provider.selectedAccountType,
)
? provider.selectedAccountType
: null,
onChanged: (value) {
if (value != null) {
provider.selectedAccountType = value;
......@@ -247,8 +253,10 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
......@@ -260,7 +268,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
provider.nameController,
"Company Name",
"Enter Company Name",
(p0) {
(p0) {
provider.updateName(p0);
provider.checkInputsAPI(
context,
......@@ -281,7 +289,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
provider.mobileController,
"Mobile Number",
"Enter Mobile",
(p0) {
(p0) {
provider.updateMobile(p0);
provider.checkInputsAPI(
context,
......@@ -322,11 +330,11 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
label: Text("Step 2", style: TextStyle(fontSize: 12)),
title: const Text(''),
isActive: _currentStep >= 1,
content:Column(
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin:EdgeInsets.only(bottom: 10),
margin: EdgeInsets.only(bottom: 10),
child: Text(
"Address Details",
style: TextStyle(
......@@ -337,7 +345,6 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
),
),
Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
......@@ -349,7 +356,6 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("State"),
DropdownButtonHideUnderline(
child: Row(
......@@ -358,9 +364,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
child: DropdownButton2<States>(
focusNode: focusNodes[2],
autofocus:
focusNodes[2].hasFocus
? true
: false,
focusNodes[2].hasFocus ? true : false,
isExpanded: true,
hint: Text(
'Select State',
......@@ -368,60 +372,50 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
overflow: TextOverflow.ellipsis,
),
items:
provider.states
.map(
(
states,
) => DropdownMenuItem<
States
>(
value: states,
child: Text(
states.name ?? '',
style:
const TextStyle(
fontSize: 14,
),
overflow:
TextOverflow
.ellipsis,
),
),
)
.toList(),
provider.states
.map(
(states) =>
DropdownMenuItem<States>(
value: states,
child: Text(
states.name ?? '',
style: const TextStyle(
fontSize: 14,
),
overflow:
TextOverflow
.ellipsis,
),
),
)
.toList(),
value:
provider.states.contains(
provider.selectedState,
)
? provider.selectedState
: null,
provider.states.contains(
provider.selectedState,
)
? provider.selectedState
: null,
// value: provider.selectedState,
onChanged: (States? value) {
if (value != null) {
if (provider
.states
.isNotEmpty) {
provider.selectedState =
value;
if (provider.states.isNotEmpty) {
provider.selectedState = value;
print(
"Selected Complaint Type: ${value.name}, ID: ${value.id}",
);
provider.selectedStateID =
value.id!;
value.id!;
print(
"hfjkshfg" +
provider.selectedStateID
.toString(),
"hfjkshfg${provider.selectedStateID}",
);
if (provider
.selectedDistricts !=
if (provider.selectedDistricts !=
null) {
provider.districts.clear();
// provider.selectedDistricts = null;
provider.selectedDistrictId =
null;
null;
provider.selectedDistrictValue =
null;
null;
}
provider.getDistrictAPI(
......@@ -435,44 +429,33 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
dropdownSearchData: DropdownSearchData(
searchInnerWidgetHeight: 50,
searchController:
provider
.stateSearchController,
provider.stateSearchController,
searchInnerWidget: Padding(
padding: const EdgeInsets.all(
8,
),
padding: const EdgeInsets.all(8),
child: TextFormField(
controller:
provider
.stateSearchController,
provider.stateSearchController,
decoration: InputDecoration(
isDense: true,
contentPadding:
const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText:
'Search States...',
const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText: 'Search States...',
border: OutlineInputBorder(
borderRadius:
BorderRadius.circular(
8,
),
BorderRadius.circular(8),
),
),
),
),
searchMatchFn: (
item,
searchValue,
) {
searchMatchFn: (item, searchValue) {
return item.value?.name
?.toLowerCase()
.contains(
searchValue
.toLowerCase(),
) ??
?.toLowerCase()
.contains(
searchValue.toLowerCase(),
) ??
false;
},
),
......@@ -482,14 +465,12 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
.clear();
}
},
buttonStyleData:
ddtheme.buttonStyleData,
iconStyleData:
ddtheme.iconStyleData,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
ddtheme.dropdownStyleData,
),
),
],
......@@ -510,65 +491,50 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
overflow: TextOverflow.ellipsis,
),
items:
provider.districts
.map(
(
dist,
) => DropdownMenuItem<
Districts
>(
value: dist,
child: Text(
dist.district ?? '',
style:
const TextStyle(
fontSize: 14,
),
overflow:
TextOverflow
.ellipsis,
),
),
)
.toList(),
provider.districts
.map(
(dist) =>
DropdownMenuItem<Districts>(
value: dist,
child: Text(
dist.district ?? '',
style: const TextStyle(
fontSize: 14,
),
overflow:
TextOverflow
.ellipsis,
),
),
)
.toList(),
value:
provider.districts.contains(
provider
.selectedDistricts,
)
? provider.selectedDistricts
: null,
provider.districts.contains(
provider.selectedDistricts,
)
? provider.selectedDistricts
: null,
// value: provider.selectedDistricts,
onChanged: (Districts? value) {
if (value != null) {
if (provider
.districts
.isNotEmpty) {
provider.selectedDistricts =
value;
print(
"Selected ID: ${value.id}",
);
if (provider.districts.isNotEmpty) {
provider.selectedDistricts = value;
print("Selected ID: ${value.id}");
provider.selectedDistrictId =
value.id!;
value.id!;
provider.selectedDistrictValue =
value.district!;
value.district!;
print(
"hfjkshfg" +
provider
.selectedDistrictId
.toString(),
"hfjkshfg${provider.selectedDistrictId}",
);
if (provider
.selectedSubLocations !=
if (provider.selectedSubLocations !=
null) {
provider.subLocations.clear();
// provider.selectedSubLocations =
// null;
provider.selectedSubLocID =
null;
provider.selectedSubLocID = null;
provider.selectedSubLocValue =
null;
null;
}
provider.getSubLocationAPI(
context,
......@@ -580,62 +546,49 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
dropdownSearchData: DropdownSearchData(
searchInnerWidgetHeight: 50,
searchController:
provider
.districtSearchController,
provider.districtSearchController,
searchInnerWidget: Padding(
padding: const EdgeInsets.all(
8,
),
padding: const EdgeInsets.all(8),
child: TextFormField(
controller:
provider
.districtSearchController,
provider
.districtSearchController,
decoration: InputDecoration(
isDense: true,
contentPadding:
const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText:
'Search Districts...',
const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText: 'Search Districts...',
border: OutlineInputBorder(
borderRadius:
BorderRadius.circular(
8,
),
BorderRadius.circular(8),
),
),
),
),
searchMatchFn: (
item,
searchValue,
) {
searchMatchFn: (item, searchValue) {
return item.value?.district
?.toLowerCase()
.contains(
searchValue
.toLowerCase(),
) ??
?.toLowerCase()
.contains(
searchValue.toLowerCase(),
) ??
false;
},
),
onMenuStateChange: (isOpen) {
if (!isOpen) {
provider
.districtSearchController
provider.districtSearchController
.clear();
}
},
buttonStyleData:
ddtheme.buttonStyleData,
iconStyleData:
ddtheme.iconStyleData,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
ddtheme.dropdownStyleData,
),
),
],
......@@ -656,37 +609,30 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
overflow: TextOverflow.ellipsis,
),
items:
provider.subLocations
.map(
(
subloc,
) => DropdownMenuItem<
SubLocations
>(
value: subloc,
child: Text(
subloc.subLocality ??
'',
style:
const TextStyle(
fontSize: 14,
),
overflow:
TextOverflow
.ellipsis,
),
),
)
.toList(),
provider.subLocations
.map(
(subloc) => DropdownMenuItem<
SubLocations
>(
value: subloc,
child: Text(
subloc.subLocality ?? '',
style: const TextStyle(
fontSize: 14,
),
overflow:
TextOverflow.ellipsis,
),
),
)
.toList(),
// value: provider.selectedSubLocations,
value:
provider.subLocations.contains(
provider
.selectedSubLocations,
)
? provider
.selectedSubLocations
: null,
provider.subLocations.contains(
provider.selectedSubLocations,
)
? provider.selectedSubLocations
: null,
onChanged: (SubLocations? value) {
if (value != null) {
if (provider
......@@ -694,18 +640,13 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
.isNotEmpty) {
provider.selectedSubLocations =
value;
print(
"Selected ID: ${value.id}",
);
print("Selected ID: ${value.id}");
provider.selectedSubLocID =
value.id!;
value.id!;
provider.selectedSubLocValue =
value.subLocality!;
value.subLocality!;
print(
"hfjkshfg" +
provider
.selectedSubLocID
.toString(),
"hfjkshfg${provider.selectedSubLocID}",
);
}
}
......@@ -713,44 +654,34 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
dropdownSearchData: DropdownSearchData(
searchInnerWidgetHeight: 50,
searchController:
provider
.subLocSearchController,
provider.subLocSearchController,
searchInnerWidget: Padding(
padding: const EdgeInsets.all(
8,
),
padding: const EdgeInsets.all(8),
child: TextFormField(
controller:
provider
.subLocSearchController,
provider.subLocSearchController,
decoration: InputDecoration(
isDense: true,
contentPadding:
const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText:
'Search Sub Locality...',
'Search Sub Locality...',
border: OutlineInputBorder(
borderRadius:
BorderRadius.circular(
8,
),
BorderRadius.circular(8),
),
),
),
),
searchMatchFn: (
item,
searchValue,
) {
searchMatchFn: (item, searchValue) {
return item.value?.subLocality
?.toLowerCase()
.contains(
searchValue
.toLowerCase(),
) ??
?.toLowerCase()
.contains(
searchValue.toLowerCase(),
) ??
false;
},
),
......@@ -760,14 +691,12 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
.clear();
}
},
buttonStyleData:
ddtheme.buttonStyleData,
iconStyleData:
ddtheme.iconStyleData,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
ddtheme.dropdownStyleData,
),
),
],
......@@ -788,7 +717,6 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
TextInputAction.done,
),
errorWidget(context, provider.addressError),
],
),
),
......@@ -799,11 +727,12 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
label: Text("Step 3", style: TextStyle(fontSize: 12)),
title: const Text(''),
isActive: _currentStep >= 1,
content:Column( crossAxisAlignment: CrossAxisAlignment.start,
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin:EdgeInsets.only(bottom: 10),
margin: EdgeInsets.only(bottom: 10),
child: Text(
"Bank Details",
style: TextStyle(
......@@ -814,7 +743,6 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
),
),
Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
......@@ -826,8 +754,6 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
textControllerWidget(
context,
provider.bankNameController,
......@@ -855,10 +781,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
focusNodes[8],
TextInputAction.next,
),
errorWidget(
context,
provider.bankBranchError,
),
errorWidget(context, provider.bankBranchError),
textControllerWidget(
context,
provider.bankIfscCotroller,
......@@ -886,10 +809,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
focusNodes[10],
TextInputAction.next,
),
errorWidget(
context,
provider.bankHolderNameError,
),
errorWidget(context, provider.bankHolderNameError),
textControllerWidget(
context,
provider.bankAcNumberController,
......@@ -903,10 +823,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
focusNodes[11],
TextInputAction.next,
),
errorWidget(
context,
provider.bankAcNumberError,
),
errorWidget(context, provider.bankAcNumberError),
textControllerWidget(
context,
provider.bankUpiController,
......@@ -931,11 +848,11 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
label: Text("Step 4", style: TextStyle(fontSize: 12)),
title: const Text(''),
isActive: _currentStep >= 2,
content: Column(
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin:EdgeInsets.only(bottom: 10),
margin: EdgeInsets.only(bottom: 10),
child: Text(
"Contact Details",
style: TextStyle(
......@@ -946,7 +863,6 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
),
),
Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
......@@ -958,7 +874,6 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
textControllerWidget(
context,
provider.contectPersonDesignationController,
......@@ -972,23 +887,18 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
focusNodes[14],
TextInputAction.next,
),
errorWidget(
context,
provider.desigantionError,
),
errorWidget(context, provider.desigantionError),
textControllerWidget(
context,
provider.contectPersonAltMobController,
"Alternative Mobile Number",
"Enter Alternative Mobile Number",
(p0) {
(p0) {
provider.updateAltMobile(p0);
provider.checkInputsAPI(
context,
"mob2",
provider
.contectPersonAltMobController
.text,
provider.contectPersonAltMobController.text,
);
},
TextInputType.number,
......@@ -1036,21 +946,24 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
),
],
controlsBuilder: (context, details) {
return Column(
children: [
if (_currentStep == 3) ...[
InkResponse(
onTap: provider.submitClickced
? null: () {
if (provider.validateStep4()) {
provider.submitClickced = true;
provider.submitCommonAccountsAPI(context, widget.from);
}
onTap:
provider.submitClickced
? null
: () {
if (provider.validateStep4()) {
provider.submitClickced = true;
provider.submitCommonAccountsAPI(
context,
widget.from,
);
}
details.onStepContinue;
},
details.onStepContinue;
},
child: Container(
height: 45,
alignment: Alignment.center,
......@@ -1088,12 +1001,11 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
if (provider.validateStep2()) {
_currentStep = 2;
}
}else if (_currentStep == 2) {
} else if (_currentStep == 2) {
if (provider.validateStep3()) {
_currentStep = 3;
}
}
else {
} else {
_currentStep = 0;
}
});
......@@ -1157,12 +1069,11 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
},
),
),
);
},
);
}
Widget _scaffold1(BuildContext context) {
return Consumer<Accountslistprovider>(
builder: (context, provider, child) {
......@@ -1431,9 +1342,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
provider.selectedStateID =
value.id!;
print(
"hfjkshfg" +
provider.selectedStateID
.toString(),
"hfjkshfg${provider.selectedStateID}",
);
if (provider
.selectedDistricts !=
......@@ -1576,10 +1485,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
provider.selectedDistrictValue =
value.district!;
print(
"hfjkshfg" +
provider
.selectedDistrictId
.toString(),
"hfjkshfg${provider.selectedDistrictId}",
);
if (provider
.selectedSubLocations !=
......@@ -1723,10 +1629,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
provider.selectedSubLocValue =
value.subLocality!;
print(
"hfjkshfg" +
provider
.selectedSubLocID
.toString(),
"hfjkshfg${provider.selectedSubLocID}",
);
}
}
......
......@@ -63,15 +63,14 @@ class Commondaterangefilter {
// Get formatted date range as a list of strings
List<String> getFormattedDateRange(DateTimeRange? dateRange) {
if (dateRange != null) {
return [
formatDate(dateRange.start),
formatDate(dateRange.end),
];
return [formatDate(dateRange.start), formatDate(dateRange.end)];
}
return [];
}
Future<Map<String, dynamic>?> showFilterBottomSheet(BuildContext context) async {
Future<Map<String, dynamic>?> showFilterBottomSheet(
BuildContext context,
) async {
String? tempSelectedValue = selectedValue;
DateTimeRange? tempSelectedDateRange = selectedDateRange;
DateTime? tempStartDate;
......@@ -257,25 +256,45 @@ class Commondaterangefilter {
// );
// }
Widget buildCalendar() {
final firstDayOfMonth = DateTime(displayedMonth.year, displayedMonth.month, 1);
final lastDayOfMonth = DateTime(displayedMonth.year, displayedMonth.month + 1, 0);
final firstDayOfMonth = DateTime(
displayedMonth.year,
displayedMonth.month,
1,
);
final lastDayOfMonth = DateTime(
displayedMonth.year,
displayedMonth.month + 1,
0,
);
final firstDayOfWeek = firstDayOfMonth.weekday;
final daysInMonth = lastDayOfMonth.day;
final daysBefore = (firstDayOfWeek - 1) % 7;
List<Widget> dayWidgets = [];
// Weekday headers
final weekdays = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
dayWidgets.addAll(weekdays.map((day) => Center(
child: Text(
day,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: Colors.grey[700],
final weekdays = [
'Mon',
'Tue',
'Wed',
'Thu',
'Fri',
'Sat',
'Sun',
];
dayWidgets.addAll(
weekdays.map(
(day) => Center(
child: Text(
day,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: Colors.grey[700],
),
),
),
),
)));
);
// Empty cells before the first day
for (int i = 0; i < daysBefore; i++) {
......@@ -284,16 +303,23 @@ class Commondaterangefilter {
// Days of the month
for (int day = 1; day <= daysInMonth; day++) {
final currentDate = DateTime(displayedMonth.year, displayedMonth.month, day);
final currentDate = DateTime(
displayedMonth.year,
displayedMonth.month,
day,
);
bool isSelected = false;
bool isInRange = false;
bool isOutsideRange = currentDate.isBefore(DateTime(2020)) ||
bool isOutsideRange =
currentDate.isBefore(DateTime(2020)) ||
currentDate.isAfter(DateTime(2100));
if (tempStartDate != null && tempEndDate != null) {
isSelected = currentDate.isAtSameMomentAs(tempStartDate!) ||
isSelected =
currentDate.isAtSameMomentAs(tempStartDate!) ||
currentDate.isAtSameMomentAs(tempEndDate!);
isInRange = currentDate.isAfter(tempStartDate!) &&
isInRange =
currentDate.isAfter(tempStartDate!) &&
currentDate.isBefore(tempEndDate!) &&
!isSelected;
} else if (tempStartDate != null) {
......@@ -302,55 +328,61 @@ class Commondaterangefilter {
dayWidgets.add(
GestureDetector(
onTap: isOutsideRange
? null
: () {
setState(() {
if (tempStartDate == null) {
// No start date selected, set it
tempStartDate = currentDate;
tempSelectedDateRange = null;
} else if (tempEndDate == null) {
// Start date selected, set end date
if (currentDate.isBefore(tempStartDate!)) {
// If the new date is before start date, swap them
tempEndDate = tempStartDate;
tempStartDate = currentDate;
} else {
tempEndDate = currentDate;
}
tempSelectedDateRange = DateTimeRange(
start: tempStartDate!,
end: tempEndDate!,
);
} else {
// Both dates selected, reset to start a new range
tempStartDate = currentDate;
tempEndDate = null;
tempSelectedDateRange = null;
}
});
},
onTap:
isOutsideRange
? null
: () {
setState(() {
if (tempStartDate == null) {
// No start date selected, set it
tempStartDate = currentDate;
tempSelectedDateRange = null;
} else if (tempEndDate == null) {
// Start date selected, set end date
if (currentDate.isBefore(tempStartDate!)) {
// If the new date is before start date, swap them
tempEndDate = tempStartDate;
tempStartDate = currentDate;
} else {
tempEndDate = currentDate;
}
tempSelectedDateRange = DateTimeRange(
start: tempStartDate!,
end: tempEndDate!,
);
} else {
// Both dates selected, reset to start a new range
tempStartDate = currentDate;
tempEndDate = null;
tempSelectedDateRange = null;
}
});
},
child: Container(
margin: EdgeInsets.all(2),
decoration: BoxDecoration(
color: isSelected
? Colors.blue[600]
: isInRange
? Colors.blue[100]
: null,
color:
isSelected
? Colors.blue[600]
: isInRange
? Colors.blue[100]
: null,
shape: BoxShape.circle,
),
child: Center(
child: Text(
'$day',
style: TextStyle(
color: isOutsideRange
? Colors.grey[400]
: isSelected
? Colors.white
: Colors.black,
fontWeight: isSelected ? FontWeight.bold : FontWeight.normal,
color:
isOutsideRange
? Colors.grey[400]
: isSelected
? Colors.white
: Colors.black,
fontWeight:
isSelected
? FontWeight.bold
: FontWeight.normal,
),
),
),
......@@ -365,47 +397,57 @@ class Commondaterangefilter {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: displayedMonth.isAfter(DateTime(2020))
? () {
setState(() {
displayedMonth = DateTime(displayedMonth.year, displayedMonth.month - 1);
});
}
: null,
child: SvgPicture.asset(
"assets/svg/arrow_left.svg",
),
onTap:
displayedMonth.isAfter(DateTime(2020))
? () {
setState(() {
displayedMonth = DateTime(
displayedMonth.year,
displayedMonth.month - 1,
);
});
}
: null,
child: SvgPicture.asset("assets/svg/arrow_left.svg"),
),
Text(
'${_monthName(displayedMonth.month)} ${displayedMonth.year}',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
),
),
GestureDetector(
onTap: displayedMonth.isBefore(DateTime(2100))
? () {
setState(() {
displayedMonth = DateTime(displayedMonth.year, displayedMonth.month + 1);
});
}
: null,
onTap:
displayedMonth.isBefore(DateTime(2100))
? () {
setState(() {
displayedMonth = DateTime(
displayedMonth.year,
displayedMonth.month + 1,
);
});
}
: null,
child: SvgPicture.asset(
"assets/svg/arrow_right_new.svg",
),
),
],
),
Container(
SizedBox(
height: 280,
child: GridView.count(
crossAxisCount: 7,
childAspectRatio: 1.2,
children: dayWidgets,
physics: NeverScrollableScrollPhysics(),
children: dayWidgets,
),
),
],
);
}
return SafeArea(
child: Padding(
padding: EdgeInsets.only(
......@@ -421,7 +463,10 @@ class Commondaterangefilter {
children: [
Text(
'Select Date Range',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 16),
DropdownButtonHideUnderline(
......@@ -438,26 +483,29 @@ class Commondaterangefilter {
color: Colors.black,
),
),
items: filterItems.map((String item) {
return DropdownMenuItem<String>(
value: item,
child: Text(
item,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
color: Colors.black,
),
),
);
}).toList(),
items:
filterItems.map((String item) {
return DropdownMenuItem<String>(
value: item,
child: Text(
item,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
color: Colors.black,
),
),
);
}).toList(),
value: tempSelectedValue,
onChanged: (String? value) {
if (value == null) return;
setState(() {
tempSelectedValue = value;
if (value != 'Custom') {
tempSelectedDateRange = getDateRange(value);
tempSelectedDateRange = getDateRange(
value,
);
tempStartDate = null;
tempEndDate = null;
} else {
......@@ -491,7 +539,10 @@ class Commondaterangefilter {
padding: const EdgeInsets.only(top: 12.0),
child: Text(
'Selected: ${formatDate(tempSelectedDateRange!.start)} to ${formatDate(tempSelectedDateRange!.end)}',
style: TextStyle(fontSize: 14, color: Colors.grey[600]),
style: TextStyle(
fontSize: 14,
color: Colors.grey[600],
),
),
),
],
......@@ -508,17 +559,21 @@ class Commondaterangefilter {
),
SizedBox(width: 8),
ElevatedButton(
onPressed: tempSelectedDateRange != null && tempSelectedValue != null
? () {
selectedValue = tempSelectedValue;
selectedDateRange = tempSelectedDateRange;
Navigator.pop(context, {
'selectedValue': tempSelectedValue,
'dateRange': tempSelectedDateRange,
'formatted': getFormattedDateRange(tempSelectedDateRange),
});
}
: null,
onPressed:
tempSelectedDateRange != null &&
tempSelectedValue != null
? () {
selectedValue = tempSelectedValue;
selectedDateRange = tempSelectedDateRange;
Navigator.pop(context, {
'selectedValue': tempSelectedValue,
'dateRange': tempSelectedDateRange,
'formatted': getFormattedDateRange(
tempSelectedDateRange,
),
});
}
: null,
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue[600],
foregroundColor: Colors.white,
......@@ -530,7 +585,9 @@ class Commondaterangefilter {
),
],
),
SizedBox(height: MediaQuery.of(context).viewInsets.bottom),
SizedBox(
height: MediaQuery.of(context).viewInsets.bottom,
),
],
),
),
......@@ -556,7 +613,7 @@ class Commondaterangefilter {
'September',
'October',
'November',
'December'
'December',
];
return months[month - 1];
}
......@@ -596,4 +653,4 @@ class Commondaterangefilter {
// ),
// );
// }
// }
\ No newline at end of file
// }
......@@ -2,7 +2,6 @@ import 'dart:io';
import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:generp/Utils/dropdownTheme.dart';
import 'package:provider/provider.dart';
......@@ -19,7 +18,7 @@ class AppointmentDetails extends StatefulWidget {
}
class _AppointmentDetailsState extends State<AppointmentDetails> {
Dropdowntheme ddtheme = Dropdowntheme();
Dropdowntheme ddtheme = Dropdowntheme();
@override
Widget build(BuildContext context) {
......@@ -30,7 +29,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: Platform.isIOS?false:true,
bottom: Platform.isIOS ? false : true,
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar(context, "Appointment Details"),
......@@ -61,7 +60,6 @@ Dropdowntheme ddtheme = Dropdowntheme();
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
...List.generate(5, (j) {
final textheads = [
"Employee Name",
......@@ -86,7 +84,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
......@@ -101,10 +99,16 @@ Dropdowntheme ddtheme = Dropdowntheme();
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: textSubheads[j]=="View File"?AppColors.app_blue:
Color(0xFF818181),
decoration:textSubheads[j]=="View File"? TextDecoration.underline:TextDecoration.none,
decorationColor: AppColors.app_blue
color:
textSubheads[j] == "View File"
? AppColors.app_blue
: Color(0xFF818181),
decoration:
textSubheads[j] == "View File"
? TextDecoration.underline
: TextDecoration.none,
decorationColor:
AppColors.app_blue,
),
),
),
......@@ -132,10 +136,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
child: Container(
alignment: Alignment.bottomCenter,
height: 45,
width: MediaQuery
.of(context)
.size
.width,
width: MediaQuery.of(context).size.width,
margin: EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
color: AppColors.app_blue,
......@@ -155,13 +156,14 @@ Dropdowntheme ddtheme = Dropdowntheme();
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation.centerFloat,
FloatingActionButtonLocation.centerFloat,
),
),
);
},
);
}
Future<void> _showAddAppointmentSheet(BuildContext context) {
return showModalBottomSheet(
useSafeArea: true,
......@@ -207,31 +209,32 @@ Dropdowntheme ddtheme = Dropdowntheme();
GestureDetector(
onTap: () {
provider.showDatePickerDialog(context);
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Container(
height: 50,
height: 50,
alignment: Alignment.center,
decoration: BoxDecoration(
color: AppColors.text_field_color,
borderRadius: BorderRadius.circular(14),
),
child: Padding(
padding: const EdgeInsets.fromLTRB(10.0, 0.0, 10, 0),
padding: const EdgeInsets.fromLTRB(
10.0,
0.0,
10,
0,
),
child: TextFormField(
controller: provider.dateController,
keyboardType: TextInputType.text,
enabled: false,
maxLines: 1,
maxLines: 1,
readOnly: true,
onChanged: (value) {
},
onChanged: (value) {},
decoration: InputDecoration(
hintText: "Enter Date",
hintStyle: TextStyle(
......@@ -271,20 +274,21 @@ Dropdowntheme ddtheme = Dropdowntheme();
],
),
items:
provider.visitTypes
.map(
(vt) => DropdownMenuItem<String>(
value: vt,
child: Text(
vt,
style: const TextStyle(
fontSize: 14,
),
overflow: TextOverflow.ellipsis,
),
),
)
.toList(),
provider.visitTypes
.map(
(vt) => DropdownMenuItem<String>(
value: vt,
child: Text(
vt,
style: const TextStyle(
fontSize: 14,
),
overflow:
TextOverflow.ellipsis,
),
),
)
.toList(),
value: provider.selectedVisitType,
onChanged: (value) {
if (value != null) {
......@@ -296,14 +300,16 @@ Dropdowntheme ddtheme = Dropdowntheme();
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
),
),
errorWidget(context,provider.visitTypeError),
errorWidget(context, provider.visitTypeError),
textControllerWidget(
context,
......@@ -318,11 +324,20 @@ Dropdowntheme ddtheme = Dropdowntheme();
errorWidget(context, provider.noteError),
InkWell(
onTap: provider.isLoading?null:(){
provider.isLoading = true;
provider.crmLeadDetailsAddAppointmentAPIFunction(context, widget.leadID, provider.formattedDateToSend, provider.selectedVisitType, provider.noteController.text);
},
onTap:
provider.isLoading
? null
: () {
provider.isLoading = true;
provider
.crmLeadDetailsAddAppointmentAPIFunction(
context,
widget.leadID,
provider.formattedDateToSend,
provider.selectedVisitType,
provider.noteController.text,
);
},
child: Container(
alignment: Alignment.center,
height: 45,
......@@ -337,11 +352,18 @@ Dropdowntheme ddtheme = Dropdowntheme();
borderRadius: BorderRadius.circular(14.0),
),
child: Center(
child: provider.isLoading?CircularProgressIndicator.adaptive(valueColor: AlwaysStoppedAnimation(AppColors.white),):Text(
"Submit",
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white),
),
child:
provider.isLoading
? CircularProgressIndicator.adaptive(
valueColor: AlwaysStoppedAnimation(
AppColors.white,
),
)
: Text(
"Submit",
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white),
),
),
),
),
......
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:provider/provider.dart';
import '../../Notifiers/crmProvider/crmLeadDetailsProvider.dart';
......@@ -25,7 +24,7 @@ class _FollowUpDetailsState extends State<FollowUpDetails> {
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: Platform.isIOS?false:true,
bottom: Platform.isIOS ? false : true,
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar(context, "Followup Details"),
......@@ -56,7 +55,6 @@ class _FollowUpDetailsState extends State<FollowUpDetails> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
...List.generate(4, (j) {
final textheads = [
"Employee Name",
......@@ -111,7 +109,6 @@ class _FollowUpDetailsState extends State<FollowUpDetails> {
),
),
),
),
),
);
......
......@@ -253,7 +253,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
children: [
Expanded(
flex: 1,
child: Container(
child: SizedBox(
height: 50,
width: 35,
child: SvgPicture.asset(
......@@ -752,22 +752,30 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
if (productsNotEmpty) ...[
Expanded(
child: InkResponse(
onTap:editProvider.editProductDetailsClicked?null: () async {
HapticFeedback.selectionClick();
editProvider.editProductDetailsClicked = true;
editProvider.resetForm();
await editProvider
.crmLeadDetailsEditProductsViewAPIFunction(
context,
provider.leadDetails.id!,
);
_showAddEditProductsSheet(
context,
widget.mode,
"add",
"",
);
},
onTap:
editProvider
.editProductDetailsClicked
? null
: () async {
HapticFeedback.selectionClick();
editProvider
.editProductDetailsClicked =
true;
editProvider.resetForm();
await editProvider
.crmLeadDetailsEditProductsViewAPIFunction(
context,
provider
.leadDetails
.id!,
);
_showAddEditProductsSheet(
context,
widget.mode,
"add",
"",
);
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
......@@ -801,66 +809,68 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
itemCount: provider.leadProducts.length,
itemBuilder: (context, lp) {
return InkResponse(
onTap:
editProvider.editProductDetailsClicked
? null : () async {
// var res = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (context) => EditProductsList(
// leadID: provider.leadDetails.id ?? "",
// ),
// ),
// );
editProvider.editProductDetailsClicked = true;
await editProvider
.crmLeadDetailsEditProductsViewAPIFunction(
context,
provider.leadDetails.id!,
);
editProvider
.addEditProductPriceController
.text =
provider.leadProducts[lp].price!;
editProvider
.addEditQuantityController
.text =
provider.leadProducts[lp].qty!;
editProvider
.addEditTotalAmountController
.text = provider
.leadProducts[lp]
.prodTotalPrice!;
editProvider
.selectedProducts = editProvider
.productsList
.firstWhere(
(product) =>
product.id ==
provider
.leadProducts[lp]
.productId,
);
editProvider.selectedAddEditProductId =
provider
.leadProducts[lp]
.productId!;
editProvider
.selectedAddEditProductName =
provider
.leadProducts[lp]
.productName!;
_showAddEditProductsSheet(
context,
widget.mode,
"edit",
provider.leadProducts[lp].id,
);
},
editProvider.editProductDetailsClicked
? null
: () async {
// var res = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (context) => EditProductsList(
// leadID: provider.leadDetails.id ?? "",
// ),
// ),
// );
editProvider
.editProductDetailsClicked =
true;
await editProvider
.crmLeadDetailsEditProductsViewAPIFunction(
context,
provider.leadDetails.id!,
);
editProvider
.addEditProductPriceController
.text = provider
.leadProducts[lp]
.price!;
editProvider
.addEditQuantityController
.text = provider
.leadProducts[lp]
.qty!;
editProvider
.addEditTotalAmountController
.text = provider
.leadProducts[lp]
.prodTotalPrice!;
editProvider.selectedProducts =
editProvider.productsList
.firstWhere(
(product) =>
product.id ==
provider
.leadProducts[lp]
.productId,
);
editProvider
.selectedAddEditProductId =
provider
.leadProducts[lp]
.productId!;
editProvider
.selectedAddEditProductName =
provider
.leadProducts[lp]
.productName!;
_showAddEditProductsSheet(
context,
widget.mode,
"edit",
provider.leadProducts[lp].id,
);
},
child: Container(
height: 130,
width:
......@@ -991,22 +1001,26 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
] else ...[
InkResponse(
onTap:editProvider.editProductDetailsClicked?null: () async {
HapticFeedback.selectionClick();
editProvider.editProductDetailsClicked = true;
editProvider.resetForm();
await editProvider
.crmLeadDetailsEditProductsViewAPIFunction(
context,
provider.leadDetails.id!,
);
_showAddEditProductsSheet(
context,
widget.mode,
"add",
"",
);
},
onTap:
editProvider.editProductDetailsClicked
? null
: () async {
HapticFeedback.selectionClick();
editProvider
.editProductDetailsClicked = true;
editProvider.resetForm();
await editProvider
.crmLeadDetailsEditProductsViewAPIFunction(
context,
provider.leadDetails.id!,
);
_showAddEditProductsSheet(
context,
widget.mode,
"add",
"",
);
},
child: Container(
height: 50,
margin: EdgeInsets.symmetric(
......@@ -1055,10 +1069,17 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
if (contactsNotEmpty) ...[
Expanded(
child: InkResponse(
onTap: editProvider.editContactDetailsClicked?null: () {HapticFeedback.selectionClick();
editProvider.editContactDetailsClicked = true;
_showAddContactSheet(context);
},
onTap:
editProvider
.editContactDetailsClicked
? null
: () {
HapticFeedback.selectionClick();
editProvider
.editContactDetailsClicked =
true;
_showAddContactSheet(context);
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
......@@ -1088,31 +1109,54 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
itemCount: provider.contactDetails.length,
itemBuilder: (context, lp) {
return InkResponse(
onTap:editProvider.editContactDetailsClicked?null: () async {HapticFeedback.selectionClick();
editProvider.editContactDetailsClicked = true;
provider.editNameController.text =
provider.contactDetails[lp].name ??
"";
provider.editDesignationController.text =
provider
.contactDetails[lp]
.designation ??
"";
provider.editMobileNumberController.text =
provider.contactDetails[lp].mob1 ??
"";
provider
.editAlternativeMobileController
.text =
provider.contactDetails[lp].mob2 ??
"";
provider.editTelephoneController.text =
provider.contactDetails[lp].tel ?? "";
provider.editEmailController.text =
provider.contactDetails[lp].email ??
"";
_showEditContactSheet(context, lp);
},
onTap:
editProvider.editContactDetailsClicked
? null
: () async {
HapticFeedback.selectionClick();
editProvider
.editContactDetailsClicked =
true;
provider.editNameController.text =
provider
.contactDetails[lp]
.name ??
"";
provider
.editDesignationController
.text = provider
.contactDetails[lp]
.designation ??
"";
provider
.editMobileNumberController
.text = provider
.contactDetails[lp]
.mob1 ??
"";
provider
.editAlternativeMobileController
.text = provider
.contactDetails[lp]
.mob2 ??
"";
provider
.editTelephoneController
.text = provider
.contactDetails[lp]
.tel ??
"";
provider
.editEmailController
.text = provider
.contactDetails[lp]
.email ??
"";
_showEditContactSheet(
context,
lp,
);
},
child: Container(
decoration: BoxDecoration(
color: Colors.white,
......@@ -1169,7 +1213,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
Expanded(
flex: 2,
child: InkResponse(
onTap: () {HapticFeedback.selectionClick();
onTap: () {
HapticFeedback.selectionClick();
launch(
'tel://${provider.contactDetails[lp].mob1}',
);
......@@ -1177,7 +1222,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
child: Text(
textAlign:
TextAlign.right,
"${provider.contactDetails[lp].mob1 ?? "-"}",
provider
.contactDetails[lp]
.mob1 ??
"-",
style: TextStyle(
height: 1,
decorationColor:
......@@ -1202,7 +1250,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
],
),
Text(
"${provider.contactDetails[lp].email ?? "-"}",
provider
.contactDetails[lp]
.email ??
"-",
style: TextStyle(
fontFamily:
"JakartaMedium",
......@@ -1223,10 +1274,15 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
] else ...[
InkResponse(
onTap:editProvider.editContactDetailsClicked?null: () async {HapticFeedback.selectionClick();
editProvider.editContactDetailsClicked = true;
_showAddContactSheet(context);
},
onTap:
editProvider.editContactDetailsClicked
? null
: () async {
HapticFeedback.selectionClick();
editProvider
.editContactDetailsClicked = true;
_showAddContactSheet(context);
},
child: Container(
height: 50,
margin: EdgeInsets.symmetric(
......@@ -1275,7 +1331,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
if (followupNotEmpty) ...[
Expanded(
child: InkResponse(
onTap: () async {HapticFeedback.selectionClick();
onTap: () async {
HapticFeedback.selectionClick();
var res = await Navigator.push(
context,
MaterialPageRoute(
......@@ -1436,7 +1493,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
textAlign:
TextAlign
.right,
"${provider.followupDetails[lp].fstatus ?? "-"}",
provider
.followupDetails[lp]
.fstatus ??
"-",
style: TextStyle(
fontFamily:
"JakartaMedium",
......@@ -1629,7 +1689,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
] else ...[
InkResponse(
onTap: () async {HapticFeedback.selectionClick();
onTap: () async {
HapticFeedback.selectionClick();
var res = await Navigator.push(
context,
MaterialPageRoute(
......@@ -1692,10 +1753,19 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
if (appointmentNotEmpty) ...[
Expanded(
child: InkResponse(
onTap:editProvider.appointmentDetailsClicked?null: () {HapticFeedback.selectionClick();
editProvider.appointmentDetailsClicked = true;
_showAddAppointmentSheet(context);
},
onTap:
editProvider
.appointmentDetailsClicked
? null
: () {
HapticFeedback.selectionClick();
editProvider
.appointmentDetailsClicked =
true;
_showAddAppointmentSheet(
context,
);
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
......@@ -2025,10 +2095,15 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
] else ...[
InkResponse(
onTap: editProvider.appointmentDetailsClicked?null:() {HapticFeedback.selectionClick();
editProvider.appointmentDetailsClicked = true;
_showAddAppointmentSheet(context);
},
onTap:
editProvider.appointmentDetailsClicked
? null
: () {
HapticFeedback.selectionClick();
editProvider
.appointmentDetailsClicked = true;
_showAddAppointmentSheet(context);
},
child: Container(
height: 50,
margin: EdgeInsets.symmetric(
......@@ -2355,7 +2430,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
] else ...[
InkResponse(
onTap: () async {HapticFeedback.selectionClick();
onTap: () async {
HapticFeedback.selectionClick();
var res = await Navigator.push(
context,
MaterialPageRoute(
......@@ -2421,8 +2497,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
return StatefulBuilder(
builder: (context, setState) {
return SafeArea(
child: Consumer2<crmLeadDetailsProvider,Editproductlistprovider>(
builder: (context, provider,editProvider, child) {
child: Consumer2<crmLeadDetailsProvider, Editproductlistprovider>(
builder: (context, provider, editProvider, child) {
editProvider.appointmentDetailsClicked = false;
return Container(
margin: EdgeInsets.only(
......@@ -2452,7 +2528,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
TextWidget(context, "Appointment Date"),
GestureDetector(
onTap: () {HapticFeedback.selectionClick();
onTap: () {
HapticFeedback.selectionClick();
provider.showDatePickerDialog(context);
},
child: Row(
......@@ -2572,7 +2649,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
onTap:
provider.isLoading
? null
: () {HapticFeedback.selectionClick();
: () {
HapticFeedback.selectionClick();
provider.isLoading = true;
provider
.crmLeadDetailsAddAppointmentAPIFunction(
......@@ -2645,8 +2723,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
return StatefulBuilder(
builder: (context, setState) {
return SafeArea(
child: Consumer2<crmLeadDetailsProvider,Editproductlistprovider>(
builder: (context, provider,editProvider, child) {
child: Consumer2<crmLeadDetailsProvider, Editproductlistprovider>(
builder: (context, provider, editProvider, child) {
editProvider.editContactDetailsClicked = false;
return Container(
margin: EdgeInsets.only(
......@@ -2775,7 +2853,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
onTap:
provider.isLoading
? null
: () {HapticFeedback.selectionClick();
: () {
HapticFeedback.selectionClick();
provider.isLoading = true;
provider
.crmLeadDetailsAddContactAPIFunction(
......@@ -2850,10 +2929,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
builder: (context) {
return StatefulBuilder(
builder: (context, setState) {
return SafeArea(
child: Consumer2<crmLeadDetailsProvider,Editproductlistprovider>(
builder: (context, provider,editProvider, child) {
child: Consumer2<crmLeadDetailsProvider, Editproductlistprovider>(
builder: (context, provider, editProvider, child) {
editProvider.editContactDetailsClicked = false;
return Container(
margin: EdgeInsets.only(
......@@ -2984,7 +3062,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
onTap:
provider.isLoading
? null
: () {HapticFeedback.selectionClick();
: () {
HapticFeedback.selectionClick();
provider.isLoading = true;
provider
.crmLeadDetailsEditContactAPIFunction(
......@@ -3097,7 +3176,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...List.generate(assetnames.length, (index) {
return ListTile(
onTap: () {HapticFeedback.selectionClick();
onTap: () {
HapticFeedback.selectionClick();
Navigator.pop(context, true);
switch (index) {
case 0:
......
......@@ -108,6 +108,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
_connectivity.disposeStream();
super.dispose();
}
@override
Widget build(BuildContext context) {
switch (_source.keys.toList()[0]) {
......@@ -162,142 +163,143 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
0xFFFFFFFF,
),
backgroundColor: AppColors.scaffold_bg_color,
body: provider.isLoading
? Center(
child: CircularProgressIndicator.adaptive(
valueColor:
AlwaysStoppedAnimation<Color>(AppColors.app_blue),
),
)
: crmLists.isNotEmpty
? Scrollbar(
controller: _scrollController,
child: ListView.builder(
controller: _scrollController,
itemCount: crmLists.length + (provider.hasMoreData ? 1 : 0),
itemBuilder: (context, index) {
if (index == crmLists.length) {
return provider.isLoadingMore
? const Padding(
padding: EdgeInsets.all(16),
child: Center(
child: CircularProgressIndicator()),
)
: const SizedBox.shrink();
}
final lead = crmLists[index];
return InkResponse(
onTap: () async {
HapticFeedback.selectionClick();
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => LeadDetailsByMode(
pageTitleName: widget.pageTitleName,
mode: widget.mode,
leadId:
provider.crmLeadList[index].leadid,
),
body:
provider.isLoading
? Center(
child: CircularProgressIndicator.adaptive(
valueColor: AlwaysStoppedAnimation<Color>(
AppColors.app_blue,
),
);
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Column(
children: [
Row(
children: [
Expanded(
flex: 1,
child: Container(
height: 50,
width: 35,
child: SvgPicture.asset(
"assets/svg/crm/lead_details_list_ic.svg",
)
: crmLists.isNotEmpty
? Scrollbar(
controller: _scrollController,
child: ListView.builder(
controller: _scrollController,
itemCount:
crmLists.length + (provider.hasMoreData ? 1 : 0),
itemBuilder: (context, index) {
if (index == crmLists.length) {
return provider.isLoadingMore
? const Padding(
padding: EdgeInsets.all(16),
child: Center(
child: CircularProgressIndicator(),
),
)
: const SizedBox.shrink();
}
final lead = crmLists[index];
return InkResponse(
onTap: () async {
HapticFeedback.selectionClick();
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => LeadDetailsByMode(
pageTitleName: widget.pageTitleName,
mode: widget.mode,
leadId:
provider.crmLeadList[index].leadid,
),
),
);
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
SizedBox(width: 10),
Expanded(
flex: 6,
child: SizedBox(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Column(
children: [
Row(
children: [
Text(
crmLists[index].company!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
Expanded(
flex: 1,
child: SizedBox(
height: 50,
width: 35,
child: SvgPicture.asset(
"assets/svg/crm/lead_details_list_ic.svg",
),
),
),
SizedBox(width: 10),
Expanded(
flex: 6,
child: SizedBox(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
crmLists[index].company!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
),
),
Text(
crmLists[index].product ?? "-",
maxLines: 1,
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 12,
color: AppColors.grey_semi,
),
),
],
),
),
),
Text(
crmLists[index].product ?? "-",
maxLines: 1,
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 12,
color: AppColors.grey_semi,
SizedBox(width: 10),
Expanded(
flex: 1,
child: InkResponse(
onTap: () {
HapticFeedback.selectionClick();
launch(
'tel://${crmLists[index].mob1}',
);
},
child: SizedBox(
height: 35,
width: 35,
child: SvgPicture.asset(
"assets/svg/crm/lead_list_call_ic.svg",
),
),
),
),
],
),
),
),
SizedBox(width: 10),
Expanded(
flex: 1,
child: InkResponse(
onTap: () {
HapticFeedback.selectionClick();
launch(
'tel://${crmLists[index].mob1}',
);
},
child: SizedBox(
height: 35,
width: 35,
child: SvgPicture.asset(
"assets/svg/crm/lead_list_call_ic.svg",
),
),
),
],
),
],
),
],
),
);
},
),
),
);
},
),
)
: Emptywidget(context),
)
: Emptywidget(context),
);
},
);
}
Future<void> _showFilterSheetNew(BuildContext context) {
List<bool> isSelected = List.generate(
9,
......@@ -338,7 +340,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
if (widget.mode != "executive") {
headings.add("Employee");
}
return Container(
return SizedBox(
height: MediaQuery.of(context).size.height * 0.7,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
......@@ -515,7 +517,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
EdgeInsets.zero,
),
);
}).toList(),
}),
] else if (selectedIndex == 1) ...[
...provider.openStatusList.map((
status,
......@@ -555,7 +557,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
EdgeInsets.zero,
),
);
}).toList(),
}),
] else if (selectedIndex == 2) ...[
textControllerWidget(
context,
......@@ -589,10 +591,10 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...provider.sourcesList.map((
source,
) {
if (source == null ||
source.id == null ||
source.name == null)
if (source.id == null ||
source.name == null) {
return SizedBox.shrink();
}
return SizedBox(
height: 35,
child: CheckboxListTile(
......@@ -646,7 +648,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
EdgeInsets.zero,
),
);
}).toList(),
}),
] else if (selectedIndex == 5) ...[
if (provider
.referencesList
......@@ -659,10 +661,10 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...provider.referencesList.map((
reference,
) {
if (reference == null ||
reference.id == null ||
reference.name == null)
if (reference.id == null ||
reference.name == null) {
return SizedBox.shrink();
}
return SizedBox(
height: 35,
child: CheckboxListTile(
......@@ -698,7 +700,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
EdgeInsets.zero,
),
);
}).toList(),
}),
],
] else if (selectedIndex == 6) ...[
if (provider.teamsList.isEmpty)
......@@ -708,10 +710,10 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
)
else
...provider.teamsList.map((team) {
if (team == null ||
team.id == null ||
team.name == null)
if (team.id == null ||
team.name == null) {
return SizedBox.shrink();
}
return SizedBox(
height: 35,
child: CheckboxListTile(
......@@ -764,7 +766,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
EdgeInsets.zero,
),
);
}).toList(),
}),
] else if (selectedIndex == 7) ...[
if (provider
.segmentsList
......@@ -777,10 +779,10 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...provider.segmentsList.map((
segment,
) {
if (segment == null ||
segment.id == null ||
segment.name == null)
if (segment.id == null ||
segment.name == null) {
return SizedBox.shrink();
}
return SizedBox(
height: 35,
child: CheckboxListTile(
......@@ -816,7 +818,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
EdgeInsets.zero,
),
);
}).toList(),
}),
],
] else if (widget.mode !=
"executive") ...[
......@@ -829,10 +831,10 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...provider.employeesList.map((
employee,
) {
if (employee == null ||
employee.id == null ||
employee.name == null)
if (employee.id == null ||
employee.name == null) {
return SizedBox.shrink();
}
return SizedBox(
height: 35,
child: CheckboxListTile(
......@@ -868,7 +870,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
EdgeInsets.zero,
),
);
}).toList(),
}),
],
],
),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment