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
attendance.attendanceHistory.isNotEmpty
? attendance
.attendanceHistory
.first['check_in_location'].toString()??"-":"-",
attendance.attendanceHistory.isNotEmpty? attendance
.first['check_in_location']
.toString() ??
"-"
: "-",
attendance.attendanceHistory.isNotEmpty
? attendance
.attendanceHistory
.first['check_out_location'].toString()??"-":"-",
.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,9 +426,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
),
GestureDetector(
onTap: () {
attendance.setNextMonth(
context,
);
attendance.setNextMonth(context);
},
child: Padding(
padding: const EdgeInsets.all(4.0),
......@@ -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,19 +61,26 @@ class _CheckInOutScreenState extends State<CheckInOutScreen> {
Size size = MediaQuery.of(context).size;
double screenWidth = MediaQuery.of(context).size.width;
return (connection=='Online')?Consumer<CheckInOutProvider>(
return (connection == 'Online')
? Consumer<CheckInOutProvider>(
builder: (context, provider, child) {
return WillPopScope(
onWillPop: () {
provider.dispose();
return onBackPressed(context);},
return onBackPressed(context);
},
child: SafeArea(
top: false,
bottom: Platform.isIOS?false:true,
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(
appBar: appbar2(
context,
widget.getAttendanceStatus == 0 ? "Check In" : "Check Out",
provider.dispose,
SizedBox(width: 0),
),
body: Container(
child: SafeArea(
child: Column(
children: [
......@@ -88,7 +92,8 @@ class _CheckInOutScreenState extends State<CheckInOutScreen> {
zoomGesturesEnabled: true,
scrollGesturesEnabled: false,
initialCameraPosition: CameraPosition(
target: provider.currentLocationLatLng ??
target:
provider.currentLocationLatLng ??
provider.startLocation,
zoom: 20.0,
),
......@@ -101,7 +106,7 @@ class _CheckInOutScreenState extends State<CheckInOutScreen> {
provider.getLocationPermission(context);
},
onCameraMove: (position) {
provider.onCameraMove(position,context);
provider.onCameraMove(position, context);
},
),
Positioned(
......@@ -125,18 +130,20 @@ class _CheckInOutScreenState extends State<CheckInOutScreen> {
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20.0),
horizontal: 20.0,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
"Share Your Details",
style: TextStyle(
color: AppColors.app_blue,
fontFamily: "JakartaSemiBold"
fontFamily: "JakartaSemiBold",
),
),
SizedBox(height: 10,),
SizedBox(height: 10),
Text(
"Location",
style: TextStyle(
......@@ -150,7 +157,8 @@ class _CheckInOutScreenState extends State<CheckInOutScreen> {
SizedBox(height: 5),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20.0),
horizontal: 20.0,
),
child: Container(
height: 50,
......@@ -163,46 +171,50 @@ class _CheckInOutScreenState extends State<CheckInOutScreen> {
child: Padding(
padding:
const EdgeInsets.fromLTRB(
10.0, 0.0, 10, 0),
10.0,
0.0,
10,
0,
),
child: TextFormField(
controller:
provider.locationController,
keyboardType:
TextInputType.text,
onChanged: (value) {
provider.validateLocation = "";
provider.validateLocation =
"";
provider.notifyListeners();
},
decoration: InputDecoration(
hintText:
"Enter Check ${widget.getAttendanceStatus==0?"In":"Out"} Location",
"Enter Check ${widget.getAttendanceStatus == 0 ? "In" : "Out"} Location",
hintStyle: TextStyle(
fontWeight: FontWeight.w400,
fontSize: 14,
color: Color(0xFF818181)
color: Color(0xFF818181),
),
enabledBorder:
InputBorder.none,
focusedBorder:
InputBorder.none,
),
),
),
),
),
if (provider.validateLocation != null)
Padding(
padding:
const EdgeInsets.symmetric(
horizontal: 20.0),
padding: const EdgeInsets.symmetric(
horizontal: 20.0,
),
child: Container(
alignment: Alignment.topLeft,
margin: EdgeInsets.only(
top: 2.5,
bottom: 2.5,
left: 25),
left: 25,
),
child: Text(
provider.validateLocation!,
textAlign: TextAlign.start,
......@@ -217,7 +229,8 @@ class _CheckInOutScreenState extends State<CheckInOutScreen> {
SizedBox(height: 20),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20.0),
horizontal: 20.0,
),
child: InkWell(
onTap: () async {
if (provider
......@@ -230,38 +243,48 @@ class _CheckInOutScreenState extends State<CheckInOutScreen> {
} else {
provider.validateLocation = "";
if (Platform.isAndroid) {
provider.image = await Navigator.push(
provider
.image = await Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
FrontCameraCapture()));
builder:
(context) =>
FrontCameraCapture(),
),
);
print("${provider.image}");
if(provider.image!=null){
if (provider.image != null) {
provider.imagePicked = 1;
}
var file = await FlutterImageCompress.compressWithFile(
var file =
await FlutterImageCompress.compressWithFile(
provider.image!.path,
);
if (file != null) {
if (widget.getAttendanceStatus == 0) {
if (widget
.getAttendanceStatus ==
0) {
provider.checkIn(context);
} else if (widget.getAttendanceStatus == 1) {
provider.checkOut(context);
} else if (widget
.getAttendanceStatus ==
1) {
provider.checkOut(
context,
);
}
}
} else if (Platform.isIOS) {
// BackgroundLocation.stopLocationService();
provider.imgFromCamera(
context,widget.getAttendanceStatus);
context,
widget.getAttendanceStatus,
);
// setState(() {
// isLoading = true;
// image_picked = 0;
// CheckIn();
// });
}
}
},
child: Container(
......@@ -275,11 +298,13 @@ class _CheckInOutScreenState extends State<CheckInOutScreen> {
BorderRadius.circular(15.0),
),
child: Text(
widget.getAttendanceStatus==0? "Check In":"Check Out",
widget.getAttendanceStatus == 0
? "Check In"
: "Check Out",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 16,
color: Colors.white
color: Colors.white,
),
),
),
......@@ -300,8 +325,7 @@ class _CheckInOutScreenState extends State<CheckInOutScreen> {
),
);
},
):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,7 +109,9 @@ class CommonFilter2 {
List<Widget> dayWidgets = [];
final weekdays = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
dayWidgets.addAll(weekdays.map((day) => Center(
dayWidgets.addAll(
weekdays.map(
(day) => Center(
child: Text(
day,
style: TextStyle(
......@@ -111,23 +120,32 @@ class CommonFilter2 {
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,7 +154,8 @@ class CommonFilter2 {
dayWidgets.add(
GestureDetector(
onTap: isOutsideRange
onTap:
isOutsideRange
? null
: () {
setState(() {
......@@ -150,8 +169,10 @@ class CommonFilter2 {
} else {
tempEndDate = currentDate;
}
tempSelectedDateRange =
DateTimeRange(start: tempStartDate!, end: tempEndDate!);
tempSelectedDateRange = DateTimeRange(
start: tempStartDate!,
end: tempEndDate!,
);
} else {
tempStartDate = currentDate;
tempEndDate = null;
......@@ -162,7 +183,8 @@ class CommonFilter2 {
child: Container(
margin: const EdgeInsets.all(2),
decoration: BoxDecoration(
color: isSelected
color:
isSelected
? Colors.blue[600]
: isInRange
? Colors.blue[100]
......@@ -173,12 +195,14 @@ class CommonFilter2 {
child: Text(
'$day',
style: TextStyle(
color: isOutsideRange
color:
isOutsideRange
? Colors.grey[400]
: isSelected
? Colors.white
: Colors.black,
fontWeight: isSelected ? FontWeight.bold : FontWeight.normal,
fontWeight:
isSelected ? FontWeight.bold : FontWeight.normal,
),
),
),
......@@ -193,11 +217,14 @@ class CommonFilter2 {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: displayedMonth.isAfter(DateTime(2020))
onTap:
displayedMonth.isAfter(DateTime(2020))
? () {
setState(() {
displayedMonth =
DateTime(displayedMonth.year, displayedMonth.month - 1);
displayedMonth = DateTime(
displayedMonth.year,
displayedMonth.month - 1,
);
});
}
: null,
......@@ -205,14 +232,20 @@ class CommonFilter2 {
),
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))
onTap:
displayedMonth.isBefore(DateTime(2100))
? () {
setState(() {
displayedMonth =
DateTime(displayedMonth.year, displayedMonth.month + 1);
displayedMonth = DateTime(
displayedMonth.year,
displayedMonth.month + 1,
);
});
}
: null,
......@@ -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,9 +313,14 @@ class CommonFilter2 {
child: DropdownButton2<String>(
isExpanded: true,
value: tempSelectedType,
items: typeItems
.map((type) =>
DropdownMenuItem<String>(value: type, child: Text(type)))
items:
typeItems
.map(
(type) => DropdownMenuItem<String>(
value: type,
child: Text(type),
),
)
.toList(),
onChanged: (value) {
setState(() {
......@@ -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,18 +361,21 @@ class CommonFilter2 {
color: Colors.black,
),
),
items: filterItems
.map((String item) =>
items:
filterItems
.map(
(String item) =>
DropdownMenuItem<String>(
value: item, child: Text(
value: item,
child: Text(
item,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
color: Colors.black,
),
)
)
),
),
)
.toList(),
value: tempSelectedValue,
......@@ -333,7 +384,9 @@ class CommonFilter2 {
setState(() {
tempSelectedValue = value;
if (value != 'Custom') {
tempSelectedDateRange = getDateRange(value);
tempSelectedDateRange = getDateRange(
value,
);
tempStartDate = null;
tempEndDate = null;
} else {
......@@ -353,7 +406,6 @@ class CommonFilter2 {
),
),
if (tempSelectedValue == 'Custom') ...[
const SizedBox(height: 16),
Container(
......@@ -369,30 +421,40 @@ class CommonFilter2 {
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]),
style: TextStyle(
fontSize: 14,
color: Colors.grey[600],
),
),
),
],
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)
'type':
tempSelectedType, // if you store type separately
'selectedValue':
tempSelectedValue, // could be null
'dateRange':
tempSelectedDateRange, // could be null
'formatted':
tempSelectedDateRange != null
? getFormattedDateRange(
tempSelectedDateRange,
)
: null,
});
},
......@@ -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,10 +82,11 @@ 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
body:
isLoading
? Center(child: CircularProgressIndicator())
: Row(
children: [
......@@ -105,25 +106,28 @@ class _CheckOutScreenState extends State<FrontCameraCapture> {
onTap: () async {
if (!cam_controller
.value
.isInitialized)
.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
color: Colors.black26,
),
child: Center(
child: SvgPicture.asset("assets/svg/check_in_cam.svg",width: 50,height: 50,)
child: SvgPicture.asset(
"assets/svg/check_in_cam.svg",
width: 50,
height: 50,
),
),
),
),
......
......@@ -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"),
......@@ -50,12 +49,13 @@ class UpdatePassword extends StatelessWidget {
Container(
alignment: Alignment.topLeft,
padding: EdgeInsets.symmetric(horizontal: 10),
child: Text("New Password",style: TextStyle(
color: AppColors.semi_black
),)),
child: Text(
"New Password",
style: TextStyle(color: AppColors.semi_black),
),
),
SizedBox(height: 5),
_buildTextField(
controller: provider.password,
hintText: "New Password*",
errorText: provider.passwordError,
......@@ -63,7 +63,7 @@ class UpdatePassword extends StatelessWidget {
suffixIcon: IconButton(
icon:
provider.pwdVisible
?SvgPicture.asset(
? SvgPicture.asset(
width: 35,
height: 35,
"assets/svg/password_visible.svg",
......@@ -77,15 +77,17 @@ class UpdatePassword extends StatelessWidget {
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
),)),
child: Text(
"Confirm Password",
style: TextStyle(color: AppColors.semi_black),
),
),
SizedBox(height: 5),
_buildTextField(
controller: provider.confPassword,
......@@ -94,7 +96,9 @@ class UpdatePassword extends StatelessWidget {
obscureText: !provider.confPwdVisible,
suffixIcon: IconButton(
iconSize: 30,
icon: provider.confPwdVisible?SvgPicture.asset(
icon:
provider.confPwdVisible
? SvgPicture.asset(
width: 35,
height: 35,
"assets/svg/password_visible.svg",
......@@ -108,7 +112,7 @@ class UpdatePassword extends StatelessWidget {
provider.confPwdVisibility();
},
),
onChanged: provider.onChangeConfPassword
onChanged: provider.onChangeConfPassword,
),
Spacer(),
InkWell(
......@@ -121,15 +125,17 @@ class UpdatePassword extends StatelessWidget {
color: AppColors.app_blue,
borderRadius: BorderRadius.circular(15.0),
),
child:provider.isLoading
child:
provider.isLoading
? CircularProgressIndicator(
color: Colors.white,
padding: EdgeInsets.all(7.5),
)
: Text(
"Update",
style: TextStyle(color: Colors.white),
style: TextStyle(
color: Colors.white,
),
),
),
),
......@@ -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,9 +139,11 @@ class _WebErpScreenState extends State<WebErpScreen> {
}
return true; // Allow default back button behavior
},
child: connection=="Online"?SafeArea(
child:
connection == "Online"
? SafeArea(
top: false,
bottom: Platform.isIOS?false:true,
bottom: Platform.isIOS ? false : true,
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar(context, "ERP"),
......@@ -220,10 +220,14 @@ class _WebErpScreenState extends State<WebErpScreen> {
) async {
return PermissionRequestResponse(
resources: resources,
action: PermissionRequestResponseAction.GRANT,
action:
PermissionRequestResponseAction.GRANT,
);
},
onPermissionRequest: (controller, request) async {
onPermissionRequest: (
controller,
request,
) async {
return PermissionResponse(
resources: request.resources,
action: PermissionResponseAction.GRANT,
......@@ -271,7 +275,8 @@ class _WebErpScreenState extends State<WebErpScreen> {
},
);
},
pullToRefreshController: pullToRefreshController,
pullToRefreshController:
pullToRefreshController,
onLoadStart: (controller, url) {
return setState(() {
isLoading = true;
......@@ -309,7 +314,10 @@ class _WebErpScreenState extends State<WebErpScreen> {
useShouldInterceptRequest: true,
hardwareAcceleration: true,
),
shouldInterceptRequest: (controller, request) async {
shouldInterceptRequest: (
controller,
request,
) async {
final url = request.url.toString();
print(
'Intercepting request: $url, Headers: ${request.headers}',
......@@ -320,9 +328,8 @@ class _WebErpScreenState extends State<WebErpScreen> {
headers: {'Accept': 'application/pdf'},
);
if (response.statusCode == 200 &&
response.headers['content-type']?.contains(
'application/pdf',
) ==
response.headers['content-type']
?.contains('application/pdf') ==
true) {
return WebResourceResponse(
contentType: 'application/pdf',
......@@ -353,9 +360,12 @@ class _WebErpScreenState extends State<WebErpScreen> {
uri.toString(),
).queryParameters['file_path'];
if (pdfPath != null) {
final pdfUrl = 'https://erp.gengroup.in/$pdfPath';
final pdfUrl =
'https://erp.gengroup.in/$pdfPath';
await controller.loadUrl(
urlRequest: URLRequest(url: WebUri(pdfUrl)),
urlRequest: URLRequest(
url: WebUri(pdfUrl),
),
);
return NavigationActionPolicy.CANCEL;
}
......@@ -393,12 +403,16 @@ class _WebErpScreenState extends State<WebErpScreen> {
},
onLoadStop: (controller, url) async {
if (url.toString().contains('file_viewer_name.php') &&
if (url.toString().contains(
'file_viewer_name.php',
) &&
url.toString().contains('.pdf')) {
final uri = Uri.parse(url.toString());
final pdfPath = uri.queryParameters['file_path'];
final pdfPath =
uri.queryParameters['file_path'];
if (pdfPath != null) {
final pdfUrl = 'https://erp.gengroup.in/$pdfPath';
final pdfUrl =
'https://erp.gengroup.in/$pdfPath';
await controller.evaluateJavascript(
source: '''
var pdfjsLib = window.pdfjsLib || document.createElement('script');
......@@ -444,19 +458,19 @@ class _WebErpScreenState extends State<WebErpScreen> {
},
onConsoleMessage: (controller, consoleMessage) {
if (kDebugMode) {
debugPrint("consoleMessage${consoleMessage}");
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,
......@@ -473,12 +487,12 @@ class _WebErpScreenState extends State<WebErpScreen> {
// print("Could not launch $url");
// }
if (Platform.isAndroid) {
await _handleDownload(
downloadStartRequest.url.toString(),
downloadStartRequest.suggestedFilename!,
downloadStartRequest.mimeType!,
downloadStartRequest.suggestedFilename ?? '',
downloadStartRequest.suggestedFilename ??
'',
// controller,context
);
}
......@@ -488,7 +502,8 @@ class _WebErpScreenState extends State<WebErpScreen> {
Container(
color: Colors.white.withOpacity(0.7),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SpinKitRing(
......@@ -524,9 +539,11 @@ class _WebErpScreenState extends State<WebErpScreen> {
),
),
),
):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,7 +72,9 @@ class _AccountslistState extends State<Accountslist> {
_currentPage++;
});
provider.commonAccountListAPIFunction(context, append: true).then((_) {
provider
.commonAccountListAPIFunction(context, append: true)
.then((_) {
setState(() {
_isLoadingMore = false;
final newItems = provider.accountsList;
......@@ -79,7 +83,8 @@ class _AccountslistState extends State<Accountslist> {
_hasMoreItems = false;
}
});
}).catchError((_) {
})
.catchError((_) {
setState(() {
_isLoadingMore = false;
_currentPage--; // rollback
......@@ -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,7 +178,8 @@ class _AccountslistState extends State<Accountslist> {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 16),
child: Center(
child: _isLoadingMore
child:
_isLoadingMore
? const CircularProgressIndicator(
color: Colors.blue,
)
......@@ -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,6 +280,7 @@ class _AccountslistState extends State<Accountslist> {
},
);
}
Future<void> _showFilterSheet1(BuildContext context) {
List<bool> isSelected = List.generate(
2,
......@@ -316,20 +308,14 @@ class _AccountslistState extends State<Accountslist> {
int selectedIndex = isSelected.indexWhere(
(element) => element == true,
);
List<String> headings = [
"Account Name",
"Mobile Number",
];
return Container(
List<String> headings = ["Account Name", "Mobile Number"];
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: () {
......@@ -375,7 +364,8 @@ class _AccountslistState extends State<Accountslist> {
});
},
child: Container(
padding: const EdgeInsets.symmetric(
padding:
const EdgeInsets.symmetric(
vertical: 7.5,
horizontal: 10,
),
......@@ -384,12 +374,10 @@ class _AccountslistState extends State<Accountslist> {
left:
isSelected[jj]
? BorderSide(
color:
AppColors
.app_blue,
width: 5.0,
)
: const BorderSide(
color:
......@@ -417,7 +405,8 @@ class _AccountslistState extends State<Accountslist> {
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14,
fontFamily: "JakartaRegular",
fontFamily:
"JakartaRegular",
color: AppColors.semi_black,
),
),
......@@ -438,11 +427,12 @@ class _AccountslistState extends State<Accountslist> {
child: Column(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.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
color:
provider
.ledgerList[index]
.type ==
"Credit"
? Color(0xFFEF3739)
: Color(0xFF0D9C00),
? 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(
......@@ -175,7 +176,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
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(
......@@ -218,14 +221,17 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
items:
provider.accountTypes
.map(
(act) => DropdownMenuItem<String>(
(act) =>
DropdownMenuItem<String>(
value: act,
child: Text(
act,
style: const TextStyle(
fontSize: 14,
),
overflow: TextOverflow.ellipsis,
overflow:
TextOverflow
.ellipsis,
),
),
)
......@@ -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,
),
),
],
......@@ -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',
......@@ -370,16 +374,12 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
items:
provider.states
.map(
(
states,
) => DropdownMenuItem<
States
>(
(states) =>
DropdownMenuItem<States>(
value: states,
child: Text(
states.name ?? '',
style:
const TextStyle(
style: const TextStyle(
fontSize: 14,
),
overflow:
......@@ -398,23 +398,17 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
// 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!;
print(
"hfjkshfg" +
provider.selectedStateID
.toString(),
"hfjkshfg${provider.selectedStateID}",
);
if (provider
.selectedDistricts !=
if (provider.selectedDistricts !=
null) {
provider.districts.clear();
// provider.selectedDistricts = null;
......@@ -435,16 +429,12 @@ 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:
......@@ -452,26 +442,19 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
horizontal: 10,
vertical: 8,
),
hintText:
'Search States...',
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(),
searchValue.toLowerCase(),
) ??
false;
},
......@@ -482,10 +465,8 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
.clear();
}
},
buttonStyleData:
ddtheme.buttonStyleData,
iconStyleData:
ddtheme.iconStyleData,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
......@@ -512,16 +493,12 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
items:
provider.districts
.map(
(
dist,
) => DropdownMenuItem<
Districts
>(
(dist) =>
DropdownMenuItem<Districts>(
value: dist,
child: Text(
dist.district ?? '',
style:
const TextStyle(
style: const TextStyle(
fontSize: 14,
),
overflow:
......@@ -533,40 +510,29 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
.toList(),
value:
provider.districts.contains(
provider
.selectedDistricts,
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!;
provider.selectedDistrictValue =
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;
}
......@@ -580,12 +546,9 @@ 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
......@@ -597,41 +560,31 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
horizontal: 10,
vertical: 8,
),
hintText:
'Search Districts...',
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(),
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,
dropdownStyleData:
......@@ -658,22 +611,17 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
items:
provider.subLocations
.map(
(
subloc,
) => DropdownMenuItem<
(subloc) => DropdownMenuItem<
SubLocations
>(
value: subloc,
child: Text(
subloc.subLocality ??
'',
style:
const TextStyle(
subloc.subLocality ?? '',
style: const TextStyle(
fontSize: 14,
),
overflow:
TextOverflow
.ellipsis,
TextOverflow.ellipsis,
),
),
)
......@@ -681,11 +629,9 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
// value: provider.selectedSubLocations,
value:
provider.subLocations.contains(
provider
.selectedSubLocations,
provider.selectedSubLocations,
)
? provider
.selectedSubLocations
? provider.selectedSubLocations
: null,
onChanged: (SubLocations? value) {
if (value != null) {
......@@ -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!;
provider.selectedSubLocValue =
value.subLocality!;
print(
"hfjkshfg" +
provider
.selectedSubLocID
.toString(),
"hfjkshfg${provider.selectedSubLocID}",
);
}
}
......@@ -713,16 +654,12 @@ 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:
......@@ -734,22 +671,16 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
'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(),
searchValue.toLowerCase(),
) ??
false;
},
......@@ -760,10 +691,8 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
.clear();
}
},
buttonStyleData:
ddtheme.buttonStyleData,
iconStyleData:
ddtheme.iconStyleData,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
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,
......@@ -935,7 +852,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
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,10 +887,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
focusNodes[14],
TextInputAction.next,
),
errorWidget(
context,
provider.desigantionError,
),
errorWidget(context, provider.desigantionError),
textControllerWidget(
context,
provider.contectPersonAltMobController,
......@@ -986,9 +898,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
provider.checkInputsAPI(
context,
"mob2",
provider
.contectPersonAltMobController
.text,
provider.contectPersonAltMobController.text,
);
},
TextInputType.number,
......@@ -1036,17 +946,20 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
),
],
controlsBuilder: (context, details) {
return Column(
children: [
if (_currentStep == 3) ...[
InkResponse(
onTap: provider.submitClickced
? null: () {
onTap:
provider.submitClickced
? null
: () {
if (provider.validateStep4()) {
provider.submitClickced = true;
provider.submitCommonAccountsAPI(context, widget.from);
provider.submitCommonAccountsAPI(
context,
widget.from,
);
}
details.onStepContinue;
......@@ -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,16 +256,34 @@ 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(
final weekdays = [
'Mon',
'Tue',
'Wed',
'Thu',
'Fri',
'Sat',
'Sun',
];
dayWidgets.addAll(
weekdays.map(
(day) => Center(
child: Text(
day,
style: TextStyle(
......@@ -275,7 +292,9 @@ class Commondaterangefilter {
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,7 +328,8 @@ class Commondaterangefilter {
dayWidgets.add(
GestureDetector(
onTap: isOutsideRange
onTap:
isOutsideRange
? null
: () {
setState(() {
......@@ -334,7 +361,8 @@ class Commondaterangefilter {
child: Container(
margin: EdgeInsets.all(2),
decoration: BoxDecoration(
color: isSelected
color:
isSelected
? Colors.blue[600]
: isInRange
? Colors.blue[100]
......@@ -345,12 +373,16 @@ class Commondaterangefilter {
child: Text(
'$day',
style: TextStyle(
color: isOutsideRange
color:
isOutsideRange
? Colors.grey[400]
: isSelected
? Colors.white
: Colors.black,
fontWeight: isSelected ? FontWeight.bold : FontWeight.normal,
fontWeight:
isSelected
? FontWeight.bold
: FontWeight.normal,
),
),
),
......@@ -365,26 +397,35 @@ class Commondaterangefilter {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: displayedMonth.isAfter(DateTime(2020))
onTap:
displayedMonth.isAfter(DateTime(2020))
? () {
setState(() {
displayedMonth = DateTime(displayedMonth.year, displayedMonth.month - 1);
displayedMonth = DateTime(
displayedMonth.year,
displayedMonth.month - 1,
);
});
}
: null,
child: SvgPicture.asset(
"assets/svg/arrow_left.svg",
),
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))
onTap:
displayedMonth.isBefore(DateTime(2100))
? () {
setState(() {
displayedMonth = DateTime(displayedMonth.year, displayedMonth.month + 1);
displayedMonth = DateTime(
displayedMonth.year,
displayedMonth.month + 1,
);
});
}
: null,
......@@ -394,18 +435,19 @@ class Commondaterangefilter {
),
],
),
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,7 +483,8 @@ class Commondaterangefilter {
color: Colors.black,
),
),
items: filterItems.map((String item) {
items:
filterItems.map((String item) {
return DropdownMenuItem<String>(
value: item,
child: Text(
......@@ -457,7 +503,9 @@ class Commondaterangefilter {
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,14 +559,18 @@ class Commondaterangefilter {
),
SizedBox(width: 8),
ElevatedButton(
onPressed: tempSelectedDateRange != null && tempSelectedValue != null
onPressed:
tempSelectedDateRange != null &&
tempSelectedValue != null
? () {
selectedValue = tempSelectedValue;
selectedDateRange = tempSelectedDateRange;
Navigator.pop(context, {
'selectedValue': tempSelectedValue,
'dateRange': tempSelectedDateRange,
'formatted': getFormattedDateRange(tempSelectedDateRange),
'formatted': getFormattedDateRange(
tempSelectedDateRange,
),
});
}
: null,
......@@ -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];
}
......
......@@ -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",
......@@ -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,
......@@ -162,6 +163,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
},
);
}
Future<void> _showAddAppointmentSheet(BuildContext context) {
return showModalBottomSheet(
useSafeArea: true,
......@@ -207,14 +209,12 @@ Dropdowntheme ddtheme = Dropdowntheme();
GestureDetector(
onTap: () {
provider.showDatePickerDialog(context);
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Container(
height: 50,
alignment: Alignment.center,
decoration: BoxDecoration(
......@@ -222,16 +222,19 @@ Dropdowntheme ddtheme = Dropdowntheme();
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,
readOnly: true,
onChanged: (value) {
},
onChanged: (value) {},
decoration: InputDecoration(
hintText: "Enter Date",
hintStyle: TextStyle(
......@@ -280,7 +283,8 @@ Dropdowntheme ddtheme = Dropdowntheme();
style: const TextStyle(
fontSize: 14,
),
overflow: TextOverflow.ellipsis,
overflow:
TextOverflow.ellipsis,
),
),
)
......@@ -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,10 +324,19 @@ Dropdowntheme ddtheme = Dropdowntheme();
errorWidget(context, provider.noteError),
InkWell(
onTap: provider.isLoading?null:(){
onTap:
provider.isLoading
? null
: () {
provider.isLoading = true;
provider.crmLeadDetailsAddAppointmentAPIFunction(context, widget.leadID, provider.formattedDateToSend, provider.selectedVisitType, provider.noteController.text);
provider
.crmLeadDetailsAddAppointmentAPIFunction(
context,
widget.leadID,
provider.formattedDateToSend,
provider.selectedVisitType,
provider.noteController.text,
);
},
child: Container(
alignment: Alignment.center,
......@@ -337,7 +352,14 @@ Dropdowntheme ddtheme = Dropdowntheme();
borderRadius: BorderRadius.circular(14.0),
),
child: Center(
child: provider.isLoading?CircularProgressIndicator.adaptive(valueColor: AlwaysStoppedAnimation(AppColors.white),):Text(
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,14 +752,22 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
if (productsNotEmpty) ...[
Expanded(
child: InkResponse(
onTap:editProvider.editProductDetailsClicked?null: () async {
onTap:
editProvider
.editProductDetailsClicked
? null
: () async {
HapticFeedback.selectionClick();
editProvider.editProductDetailsClicked = true;
editProvider
.editProductDetailsClicked =
true;
editProvider.resetForm();
await editProvider
.crmLeadDetailsEditProductsViewAPIFunction(
context,
provider.leadDetails.id!,
provider
.leadDetails
.id!,
);
_showAddEditProductsSheet(
context,
......@@ -801,12 +809,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
itemCount: provider.leadProducts.length,
itemBuilder: (context, lp) {
return InkResponse(
onTap:
editProvider.editProductDetailsClicked
? null : () async {
? null
: () async {
// var res = await Navigator.push(
// context,
// MaterialPageRoute(
......@@ -816,7 +822,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
// ),
// ),
// );
editProvider.editProductDetailsClicked = true;
editProvider
.editProductDetailsClicked =
true;
await editProvider
.crmLeadDetailsEditProductsViewAPIFunction(
context,
......@@ -824,20 +832,21 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
);
editProvider
.addEditProductPriceController
.text =
provider.leadProducts[lp].price!;
.text = provider
.leadProducts[lp]
.price!;
editProvider
.addEditQuantityController
.text =
provider.leadProducts[lp].qty!;
.text = provider
.leadProducts[lp]
.qty!;
editProvider
.addEditTotalAmountController
.text = provider
.leadProducts[lp]
.prodTotalPrice!;
editProvider
.selectedProducts = editProvider
.productsList
editProvider.selectedProducts =
editProvider.productsList
.firstWhere(
(product) =>
product.id ==
......@@ -845,7 +854,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
.leadProducts[lp]
.productId,
);
editProvider.selectedAddEditProductId =
editProvider
.selectedAddEditProductId =
provider
.leadProducts[lp]
.productId!;
......@@ -991,9 +1001,13 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
] else ...[
InkResponse(
onTap:editProvider.editProductDetailsClicked?null: () async {
onTap:
editProvider.editProductDetailsClicked
? null
: () async {
HapticFeedback.selectionClick();
editProvider.editProductDetailsClicked = true;
editProvider
.editProductDetailsClicked = true;
editProvider.resetForm();
await editProvider
.crmLeadDetailsEditProductsViewAPIFunction(
......@@ -1055,8 +1069,15 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
if (contactsNotEmpty) ...[
Expanded(
child: InkResponse(
onTap: editProvider.editContactDetailsClicked?null: () {HapticFeedback.selectionClick();
editProvider.editContactDetailsClicked = true;
onTap:
editProvider
.editContactDetailsClicked
? null
: () {
HapticFeedback.selectionClick();
editProvider
.editContactDetailsClicked =
true;
_showAddContactSheet(context);
},
child: Padding(
......@@ -1088,30 +1109,53 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
itemCount: provider.contactDetails.length,
itemBuilder: (context, lp) {
return InkResponse(
onTap:editProvider.editContactDetailsClicked?null: () async {HapticFeedback.selectionClick();
editProvider.editContactDetailsClicked = true;
onTap:
editProvider.editContactDetailsClicked
? null
: () async {
HapticFeedback.selectionClick();
editProvider
.editContactDetailsClicked =
true;
provider.editNameController.text =
provider.contactDetails[lp].name ??
provider
.contactDetails[lp]
.name ??
"";
provider.editDesignationController.text =
provider
.editDesignationController
.text = provider
.contactDetails[lp]
.designation ??
"";
provider.editMobileNumberController.text =
provider.contactDetails[lp].mob1 ??
provider
.editMobileNumberController
.text = provider
.contactDetails[lp]
.mob1 ??
"";
provider
.editAlternativeMobileController
.text =
provider.contactDetails[lp].mob2 ??
.text = provider
.contactDetails[lp]
.mob2 ??
"";
provider.editTelephoneController.text =
provider.contactDetails[lp].tel ?? "";
provider.editEmailController.text =
provider.contactDetails[lp].email ??
provider
.editTelephoneController
.text = provider
.contactDetails[lp]
.tel ??
"";
provider
.editEmailController
.text = provider
.contactDetails[lp]
.email ??
"";
_showEditContactSheet(context, lp);
_showEditContactSheet(
context,
lp,
);
},
child: Container(
decoration: BoxDecoration(
......@@ -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,8 +1274,13 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
] else ...[
InkResponse(
onTap:editProvider.editContactDetailsClicked?null: () async {HapticFeedback.selectionClick();
editProvider.editContactDetailsClicked = true;
onTap:
editProvider.editContactDetailsClicked
? null
: () async {
HapticFeedback.selectionClick();
editProvider
.editContactDetailsClicked = true;
_showAddContactSheet(context);
},
child: Container(
......@@ -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,9 +1753,18 @@ 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),
......@@ -2025,8 +2095,13 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
] else ...[
InkResponse(
onTap: editProvider.appointmentDetailsClicked?null:() {HapticFeedback.selectionClick();
editProvider.appointmentDetailsClicked = true;
onTap:
editProvider.appointmentDetailsClicked
? null
: () {
HapticFeedback.selectionClick();
editProvider
.appointmentDetailsClicked = true;
_showAddAppointmentSheet(context);
},
child: Container(
......@@ -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,11 +163,13 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
0xFFFFFFFF,
),
backgroundColor: AppColors.scaffold_bg_color,
body: provider.isLoading
body:
provider.isLoading
? Center(
child: CircularProgressIndicator.adaptive(
valueColor:
AlwaysStoppedAnimation<Color>(AppColors.app_blue),
valueColor: AlwaysStoppedAnimation<Color>(
AppColors.app_blue,
),
),
)
: crmLists.isNotEmpty
......@@ -174,14 +177,16 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
controller: _scrollController,
child: ListView.builder(
controller: _scrollController,
itemCount: crmLists.length + (provider.hasMoreData ? 1 : 0),
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()),
child: CircularProgressIndicator(),
),
)
: const SizedBox.shrink();
}
......@@ -222,7 +227,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
children: [
Expanded(
flex: 1,
child: Container(
child: SizedBox(
height: 50,
width: 35,
child: SvgPicture.asset(
......@@ -295,9 +300,6 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
);
}
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