UI_CHANGE_MOBILE

This commit is contained in:
venbaittech 2025-07-30 18:09:46 +05:30
parent 6c98829a21
commit 4960c472be
9 changed files with 2648 additions and 2604 deletions

File diff suppressed because it is too large Load Diff

View File

@ -320,7 +320,7 @@ class _AccomodationListWidgetState extends State<AccomodationListWidget> {
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: 14, fontSize: 14,
fontWeight: fontWeight:
isDesktop ? FontWeight.w800 : FontWeight.w500, isDesktop ? FontWeight.w800 : FontWeight.w600,
color: !isDesktop ? Colors.black : Color(0xFF575A74), color: !isDesktop ? Colors.black : Color(0xFF575A74),
), ),
), ),

View File

@ -423,7 +423,7 @@ class _FlightListWidgetState extends State<FlightListWidget> {
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: 14, fontSize: 14,
fontWeight: fontWeight:
isDesktop ? FontWeight.w800 : FontWeight.w500, isDesktop ? FontWeight.w800 : FontWeight.w600,
color: !isDesktop ? Colors.black : Color(0xFF575A74), color: !isDesktop ? Colors.black : Color(0xFF575A74),
// Color(0xFF114D8B) // Color(0xFF114D8B)

View File

@ -181,7 +181,7 @@ class _ForexListWidgetState extends State<ForexListWidget> {
// // ), // // ),
// ], // ],
// ), // ),
const SizedBox(height: 16), SizedBox(height: isDesktop ? 16 : 4),
// Scroll behavior based on device // Scroll behavior based on device
_buildData(context, isDesktop), _buildData(context, isDesktop),
@ -324,8 +324,10 @@ class _ForexListWidgetState extends State<ForexListWidget> {
Text( Text(
getRequestForCountry(item["country_code"]!.toString()), getRequestForCountry(item["country_code"]!.toString()),
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: 12, fontSize: 14,
fontWeight: FontWeight.w600, fontWeight:
isDesktop ? FontWeight.w800 : FontWeight.w600,
color: !isDesktop ? Colors.black : Color(0xFF575A74),
), ),
), ),
Spacer(), Spacer(),
@ -377,7 +379,7 @@ class _ForexListWidgetState extends State<ForexListWidget> {
: SizedBox.shrink(), // or Container() : SizedBox.shrink(), // or Container()
], ],
), ),
Divider(color: Colors.blueGrey.shade50), // Divider(color: Colors.blueGrey.shade50),
// SizedBox(height: 4), // SizedBox(height: 4),
isDesktop isDesktop
? Row( ? Row(
@ -771,7 +773,7 @@ class _ForexListWidgetState extends State<ForexListWidget> {
title, title,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w600,
), ),
), ),
), ),

View File

@ -4,7 +4,9 @@ import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
class InsuranceListWidget extends StatelessWidget { import '../../utils/auth_utils.dart';
class InsuranceListWidget extends StatefulWidget {
final List<Map<String, dynamic>> insuranceList; final List<Map<String, dynamic>> insuranceList;
final Function(bool, Map<String, dynamic>, String) onOpen; final Function(bool, Map<String, dynamic>, String) onOpen;
final Function(Map<String, dynamic>) onDeleteInsurance; final Function(Map<String, dynamic>) onDeleteInsurance;
@ -13,21 +15,67 @@ class InsuranceListWidget extends StatelessWidget {
final Function(String, bool) onAddNew; final Function(String, bool) onAddNew;
final bool isViewMode; final bool isViewMode;
const InsuranceListWidget( const InsuranceListWidget({
{super.key, super.key,
required this.insuranceList, required this.insuranceList,
required this.onOpen, required this.onOpen,
required this.apiData, required this.apiData,
required this.onDeleteInsurance, required this.onDeleteInsurance,
required this.onAddNew, required this.onAddNew,
required this.isViewMode}); required this.isViewMode,
});
@override
State<InsuranceListWidget> createState() => _InsuranceListWidgetState();
}
class _InsuranceListWidgetState extends State<InsuranceListWidget> {
Color? layoutColor;
Color? secondColor;
Color? thridColor;
@override
void initState() {
super.initState();
loadInitialData();
}
void loadInitialData() async {
String? layoutString = await getLayoutColor();
String? secondString = await getSecondaryColor();
String? thridString = await getTernaryColor();
// String? bodyStringColor = await getBodyColor();
setState(() {
layoutColor =
layoutString != null
? Color(int.parse(layoutString))
: Colors.redAccent;
secondColor =
layoutString != null
? Color(int.parse(secondString!))
: Colors.orange;
thridColor =
layoutString != null
? Color(int.parse(thridString!))
: Colors.orangeAccent;
// bodyColor =
// bodyStringColor != null
// ? Color(int.parse(bodyStringColor))
// : Colors.white;
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final isDesktop = MediaQuery.of(context).size.width > 1024; final isDesktop = MediaQuery.of(context).size.width > 1024;
return Padding( return Padding(
padding: const EdgeInsets.all(16.0), padding:
isDesktop ? const EdgeInsets.all(16.0) : const EdgeInsets.all(5.0),
child: Container( child: Container(
margin: const EdgeInsets.only(top: 16.0), margin: const EdgeInsets.only(top: 16.0),
child: Column( child: Column(
@ -107,10 +155,10 @@ class InsuranceListWidget extends StatelessWidget {
// ), // ),
// ], // ],
// ), // ),
const SizedBox(height: 16), // const SizedBox(height: 16),
// Scroll behavior based on device
_buildData(context, isDesktop) // Scroll behavior based on device
_buildData(context, isDesktop),
], ],
), ),
), ),
@ -119,11 +167,11 @@ class InsuranceListWidget extends StatelessWidget {
Widget _buildData(BuildContext context, bool isDesktop) { Widget _buildData(BuildContext context, bool isDesktop) {
List<Map<String, dynamic>> filteredList = List<Map<String, dynamic>> filteredList =
insuranceList.where((item) => item["is_active"] == "1").toList(); widget.insuranceList.where((item) => item["is_active"] == "1").toList();
print("filteredList- $filteredList"); print("filteredList- $filteredList");
List<dynamic> insurancetypeList = List<dynamic> insurancetypeList =
apiData?['insurance_type_of_insurance'] ?? []; widget.apiData?['insurance_type_of_insurance'] ?? [];
String getRequestForInsuranceType(String? specialRequestKey) { String getRequestForInsuranceType(String? specialRequestKey) {
if (specialRequestKey == null) return "N/A"; if (specialRequestKey == null) return "N/A";
@ -146,7 +194,7 @@ class InsuranceListWidget extends StatelessWidget {
String getRequestValue(String? specialRequestKey) { String getRequestValue(String? specialRequestKey) {
if (specialRequestKey == null) return "N/A"; if (specialRequestKey == null) return "N/A";
return (apiData?['miscellaneous_special_request'] ?? []) return (widget.apiData?['miscellaneous_special_request'] ?? [])
.firstWhere( .firstWhere(
(element) => (element) =>
element["dropdown_key"].toString() == specialRequestKey, element["dropdown_key"].toString() == specialRequestKey,
@ -177,14 +225,18 @@ class InsuranceListWidget extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
// color: Colors.orange.shade50, // color: Colors.orange.shade50,
color: Colors.white, // color: Colors.white,
boxShadow: [ color: isDesktop ? Colors.white : thridColor,
boxShadow:
isDesktop
? [
BoxShadow( BoxShadow(
color: Colors.black12, color: Colors.black12,
blurRadius: 3, blurRadius: 3,
offset: Offset(0, 1), offset: Offset(0, 1),
), ),
], ]
: [],
border: Border( border: Border(
top: BorderSide( top: BorderSide(
color: Colors.white70, // Change color to match your theme color: Colors.white70, // Change color to match your theme
@ -193,54 +245,58 @@ class InsuranceListWidget extends StatelessWidget {
), ),
), ),
child: Padding( child: Padding(
padding: EdgeInsets.all(12), padding: isDesktop ? EdgeInsets.all(12) : EdgeInsets.all(8),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
Text( Expanded(
getRequestForInsuranceType(item["type_of_insurance"]!.toString()), flex: 1,
child: Text(
getRequestForInsuranceType(
item["type_of_insurance"]!.toString(),
),
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w800, fontWeight:
color: !isDesktop ? Color(0xFF114D8B) : Color(0xFF575A74) isDesktop ? FontWeight.w800 : FontWeight.w600,
color: !isDesktop ? Colors.black : Color(0xFF575A74),
),
), ),
), ),
Spacer(), Spacer(),
GestureDetector( GestureDetector(
onTap: () => onOpen(true, item, "Insurance"), onTap: () => widget.onOpen(true, item, "Insurance"),
child: Tooltip( child: Tooltip(
message: 'Edit Insurance Details', message: 'Edit Insurance Details',
child: Image.asset( child: Image.asset(
'assets/images/IconsImg/edit.png', 'assets/images/IconsImg/edit.png',
width: 20, width: 20,
height: 15, height: 15,
color: Color(0xFF114D8B), color: isDesktop ? Color(0xFF114D8B) : Colors.black,
),
),
),
SizedBox(width: 10),
GestureDetector(
onTap: () => widget.onDeleteInsurance(item),
child: Tooltip(
message: 'Delete Insurance Details',
child: Image.asset(
'assets/images/IconsImg/delete.png',
width: 20,
height: 15,
color: Colors.red,
), ),
), ),
), ),
// SizedBox(width: 10),
// GestureDetector(
// onTap: () => onDeleteInsurance(item),
// child: Tooltip(
// message: 'Delete Insurance Details',
// child: Image.asset(
// 'assets/images/IconsImg/delete.png',
// width: 20,
// height: 15,
// color: Colors.red,
// ),
// ),
// ),
], ],
), ),
SizedBox(height: 4), SizedBox(height: 4),
Divider( // Divider(color: Colors.blueGrey.shade50),
color: Colors.blueGrey.shade50, // SizedBox(height: 4),
),
SizedBox(height: 4),
isDesktop isDesktop
? Row( ? Row(
children: [ children: [
@ -248,26 +304,23 @@ class InsuranceListWidget extends StatelessWidget {
flex: 2, flex: 2,
child: Text( child: Text(
" InsuranceType", " InsuranceType",
style: GoogleFonts.poppins( style: GoogleFonts.poppins(fontSize: 11),
fontSize: 11, ),
), ),
)),
Expanded( Expanded(
flex: 2, flex: 2,
child: Text( child: Text(
" Time Period ", " Time Period ",
style: GoogleFonts.poppins( style: GoogleFonts.poppins(fontSize: 11),
fontSize: 11, ),
), ),
)),
Expanded( Expanded(
flex: 2, flex: 2,
child: Text( child: Text(
" Comments", " Comments",
style: GoogleFonts.poppins( style: GoogleFonts.poppins(fontSize: 11),
fontSize: 11, ),
), ),
)),
], ],
) )
: SizedBox.shrink(), : SizedBox.shrink(),
@ -278,7 +331,8 @@ class InsuranceListWidget extends StatelessWidget {
flex: 2, flex: 2,
child: Text( child: Text(
getRequestForInsuranceType( getRequestForInsuranceType(
item["type_of_insurance"]!.toString()), item["type_of_insurance"]!.toString(),
),
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -300,67 +354,95 @@ class InsuranceListWidget extends StatelessWidget {
Expanded( Expanded(
flex: 2, flex: 2,
child: _buildComments( child: _buildComments(
"Comments:", item["comments"] ?? "N/A"), "Comments:",
),
],
)
:
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Top Row (Country, Currency, Total)
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
Wrap(
spacing: 20, // horizontal space between items
runSpacing: 10, // vertical space between rows
children: [
_infoBlock("Insurance Type", getRequestForInsuranceType(item["type_of_insurance"]!.toString()) ?? "N/A"),
_infoBlock("Start Date", formatDate(item["start_date"]!) ?? "N/A"),
_infoBlock("End Date", formatDate(item["end_date"]) ?? "N/A"),
],
),
const SizedBox(height: 16),
// Comment label
Text(
"Comment",
style: GoogleFonts.poppins(
fontSize: 14,
fontWeight: FontWeight.w600,
),
),
const SizedBox(height: 8),
if (item["comments"] != null && item["comments"].toString().trim().isNotEmpty)
Container(
width: double.infinity,
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
border: Border.all(color: const Color(0xFF7098DD), width: 1),
borderRadius: BorderRadius.circular(6),
),
child: Text(
item["comments"] ?? "N/A", item["comments"] ?? "N/A",
style: GoogleFonts.poppins(fontSize: 12, color: Colors.black87),
), ),
),
],
) )
else : Container(
const Text( "N/A", style: TextStyle(fontSize: 12), ), color: Colors.white,
padding: const EdgeInsets.all(4.0),
child: Column(
children: [
_buildRow(
"InsuranceType",
getRequestForInsuranceType(
item["type_of_insurance"]!.toString(),
),
),
SizedBox(width: 10),
_buildRow(
"TimePeriod",
'${formatDate(item["start_date"]!)} - ${formatDate(item["end_date"])} ',
),
SizedBox(width: 10),
_buildRow("Comments", item["comments"] ?? "N/A"),
], ],
), ),
),
// Column( // Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [ // children: [
// _buildRow( // // Top Row (Country, Currency, Total)
// "InsuranceType:", // // Row(
// // mainAxisAlignment: MainAxisAlignment.spaceBetween,
// Wrap(
// spacing: 20, // horizontal space between items
// runSpacing: 10, // vertical space between rows
// children: [
// _infoBlock(
// "Insurance Type",
// getRequestForInsuranceType( // getRequestForInsuranceType(
// item["type_of_insurance"]!.toString())), // item["type_of_insurance"]!.toString(),
// SizedBox(width: 10), // ) ??
// _buildRow( // "N/A",
// "StartDate:", formatDate(item["start_date"]!)), // ),
// SizedBox(width: 10), // _infoBlock(
// _buildRow("EndDate:", formatDate(item["end_date"])), // "Start Date",
// SizedBox(width: 10), // formatDate(item["start_date"]!) ?? "N/A",
// _buildRow("Comments:", item["comments"] ?? "N/A"), // ),
// _infoBlock(
// "End Date",
// formatDate(item["end_date"]) ?? "N/A",
// ),
// ],
// ),
// const SizedBox(height: 16),
//
// // Comment label
// Text(
// "Comment",
// style: GoogleFonts.poppins(
// fontSize: 14,
// fontWeight: FontWeight.w600,
// ),
// ),
// const SizedBox(height: 8),
// if (item["comments"] != null &&
// item["comments"].toString().trim().isNotEmpty)
// Container(
// width: double.infinity,
// padding: const EdgeInsets.all(12),
// decoration: BoxDecoration(
// border: Border.all(
// color: const Color(0xFF7098DD),
// width: 1,
// ),
// borderRadius: BorderRadius.circular(6),
// ),
// child: Text(
// item["comments"] ?? "N/A",
// style: GoogleFonts.poppins(
// fontSize: 12,
// color: Colors.black87,
// ),
// ),
// )
// else
// const Text("N/A", style: TextStyle(fontSize: 12)),
// ], // ],
// ), // ),
], ],
@ -391,23 +473,27 @@ class InsuranceListWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
child: exceedsLimit child:
exceedsLimit
? Tooltip( ? Tooltip(
message: wrapText(value, 50), message: wrapText(value, 50),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.grey.shade200, // Black background color: Colors.grey.shade200, // Black background
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),
), ),
textStyle: textStyle: TextStyle(
TextStyle(color: Colors.black), // Tooltip text color color: Colors.black,
), // Tooltip text color
padding: EdgeInsets.all(8), padding: EdgeInsets.all(8),
preferBelow: false, preferBelow: false,
child: Text(value.substring(0, limit) + "...", child: Text(
value.substring(0, limit) + "...",
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
overflow: TextOverflow.ellipsis), overflow: TextOverflow.ellipsis,
),
) )
: Text( : Text(
value, value,
@ -439,16 +525,14 @@ class InsuranceListWidget extends StatelessWidget {
const SizedBox(height: 4), const SizedBox(height: 4),
Text( Text(
value, value,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(fontSize: 12, color: Colors.black87),
fontSize: 12,
color: Colors.black87,
),
), ),
], ],
), ),
), ),
); );
} }
Widget _buildRow(String title, String value) { Widget _buildRow(String title, String value) {
// Define character limits based on title // Define character limits based on title
Map<String, int> limits = { Map<String, int> limits = {
@ -468,16 +552,20 @@ class InsuranceListWidget extends StatelessWidget {
return Row( return Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( SizedBox(
width: 100,
child: Text(
title, title,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
),
SizedBox(width: 8), SizedBox(width: 8),
Expanded( Expanded(
child: exceedsLimit child:
exceedsLimit
? Tooltip( ? Tooltip(
message: wrapText(value, 50), message: wrapText(value, 50),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -485,23 +573,18 @@ class InsuranceListWidget extends StatelessWidget {
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),
), ),
textStyle: TextStyle( textStyle: TextStyle(
color: Colors.black, fontSize: 12), // Tooltip text color color: Colors.black,
fontSize: 12,
), // Tooltip text color
padding: EdgeInsets.all(8), padding: EdgeInsets.all(8),
preferBelow: false, preferBelow: false,
child: Text( child: Text(
value.substring(0, limit) + "...", value.substring(0, limit) + "...",
style: GoogleFonts.poppins( style: GoogleFonts.poppins(fontSize: 12),
fontSize: 12,
),
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
) )
: Text( : Text(value, style: GoogleFonts.poppins(fontSize: 12)),
value,
style: GoogleFonts.poppins(
fontSize: 12,
),
),
), ),
], ],
); );
@ -509,11 +592,11 @@ class InsuranceListWidget extends StatelessWidget {
List<DataRow> _buildDataRows() { List<DataRow> _buildDataRows() {
List<Map<String, dynamic>> filteredList = List<Map<String, dynamic>> filteredList =
insuranceList.where((item) => item["is_active"] == "1").toList(); widget.insuranceList.where((item) => item["is_active"] == "1").toList();
print("filteredList- $filteredList"); print("filteredList- $filteredList");
List<dynamic> insurancetypeList = List<dynamic> insurancetypeList =
apiData?['insurance_type_of_insurance'] ?? []; widget.apiData?['insurance_type_of_insurance'] ?? [];
String getRequestForInsuranceType(String? specialRequestKey) { String getRequestForInsuranceType(String? specialRequestKey) {
if (specialRequestKey == null) return "N/A"; if (specialRequestKey == null) return "N/A";
@ -529,17 +612,22 @@ class InsuranceListWidget extends StatelessWidget {
return filteredList.asMap().entries.map((entry) { return filteredList.asMap().entries.map((entry) {
Map<String, dynamic> item = entry.value; Map<String, dynamic> item = entry.value;
return DataRow(cells: [ return DataRow(
cells: [
// DataCell(Text(item["indx"]?.toString() ?? "N/A")), // Index column // DataCell(Text(item["indx"]?.toString() ?? "N/A")), // Index column
// DataCell(Text(item["type_of_insurance"]!)), // DataCell(Text(item["type_of_insurance"]!)),
DataCell(Text( DataCell(
getRequestForInsuranceType(item["type_of_insurance"]!.toString()))), Text(
getRequestForInsuranceType(item["type_of_insurance"]!.toString()),
),
),
DataCell(Text(item["start_date"]!)), DataCell(Text(item["start_date"]!)),
DataCell(Text(item["end_date"]!)), DataCell(Text(item["end_date"]!)),
DataCell(Row( DataCell(
Row(
children: [ children: [
GestureDetector( GestureDetector(
onTap: () => onOpen(true, item, "Insurance"), onTap: () => widget.onOpen(true, item, "Insurance"),
child: Tooltip( child: Tooltip(
message: 'Edit Insurance Details', message: 'Edit Insurance Details',
child: Image.asset( child: Image.asset(
@ -551,7 +639,7 @@ class InsuranceListWidget extends StatelessWidget {
), ),
SizedBox(width: 10), SizedBox(width: 10),
GestureDetector( GestureDetector(
onTap: () => onDeleteInsurance(item), onTap: () => widget.onDeleteInsurance(item),
child: Tooltip( child: Tooltip(
message: 'Delete Insurance Details', message: 'Delete Insurance Details',
child: Image.asset( child: Image.asset(
@ -562,14 +650,17 @@ class InsuranceListWidget extends StatelessWidget {
), ),
), ),
IconButton( IconButton(
icon: Icon(Icons.keyboard_arrow_down_outlined, icon: Icon(
size: 28, color: Color(0xFF475569)), Icons.keyboard_arrow_down_outlined,
size: 28,
color: Color(0xFF475569),
),
onPressed: () { onPressed: () {
// Expand logic // Expand logic
}, },
), ),
], ],
) ),
// Row( // Row(
// children: [ // children: [
@ -593,9 +684,9 @@ class InsuranceListWidget extends StatelessWidget {
// ), // ),
// ], // ],
// ) // )
), ),
]); ],
);
}).toList(); }).toList();
} }
} }

View File

@ -1,7 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
class MiscellaneousListWidget extends StatelessWidget { import '../../utils/auth_utils.dart';
class MiscellaneousListWidget extends StatefulWidget {
final List<Map<String, dynamic>> miscellaneousList; final List<Map<String, dynamic>> miscellaneousList;
final Function(bool, Map<String, dynamic>, String) onOpen; final Function(bool, Map<String, dynamic>, String) onOpen;
final Function(Map<String, dynamic>) onDeleteMiscellaneous; final Function(Map<String, dynamic>) onDeleteMiscellaneous;
@ -19,12 +21,58 @@ class MiscellaneousListWidget extends StatelessWidget {
required this.isViewMode, required this.isViewMode,
}); });
@override
State<MiscellaneousListWidget> createState() =>
_MiscellaneousListWidgetState();
}
class _MiscellaneousListWidgetState extends State<MiscellaneousListWidget> {
Color? layoutColor;
Color? secondColor;
Color? thridColor;
@override
void initState() {
super.initState();
loadInitialData();
}
void loadInitialData() async {
String? layoutString = await getLayoutColor();
String? secondString = await getSecondaryColor();
String? thridString = await getTernaryColor();
// String? bodyStringColor = await getBodyColor();
setState(() {
layoutColor =
layoutString != null
? Color(int.parse(layoutString))
: Colors.redAccent;
secondColor =
layoutString != null
? Color(int.parse(secondString!))
: Colors.orange;
thridColor =
layoutString != null
? Color(int.parse(thridString!))
: Colors.orangeAccent;
// bodyColor =
// bodyStringColor != null
// ? Color(int.parse(bodyStringColor))
// : Colors.white;
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final isDesktop = MediaQuery.of(context).size.width > 1024; final isDesktop = MediaQuery.of(context).size.width > 1024;
return Padding( return Padding(
padding: const EdgeInsets.all(16.0), padding:
isDesktop ? const EdgeInsets.all(16.0) : const EdgeInsets.all(5.0),
child: Container( child: Container(
margin: const EdgeInsets.only(top: 16.0), margin: const EdgeInsets.only(top: 16.0),
child: Column( child: Column(
@ -34,7 +82,7 @@ class MiscellaneousListWidget extends StatelessWidget {
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
if ((!isDesktop) && miscellaneousList.isNotEmpty) if ((!isDesktop) && widget.miscellaneousList.isNotEmpty)
Text( Text(
" ", " ",
style: const TextStyle( style: const TextStyle(
@ -44,16 +92,16 @@ class MiscellaneousListWidget extends StatelessWidget {
), ),
MouseRegion( MouseRegion(
cursor: cursor:
isViewMode widget.isViewMode
? SystemMouseCursors.forbidden ? SystemMouseCursors.forbidden
: SystemMouseCursors.click, : SystemMouseCursors.click,
child: GestureDetector( child: GestureDetector(
onTap: onTap:
isViewMode widget.isViewMode
? null ? null
: () { : () {
print("New data"); print("New data");
onAddNew("Miscellaneous", true); widget.onAddNew("Miscellaneous", true);
}, },
child: Row( child: Row(
mainAxisSize: mainAxisSize:
@ -133,7 +181,9 @@ class MiscellaneousListWidget extends StatelessWidget {
Widget _buildData(BuildContext context, bool isDesktop) { Widget _buildData(BuildContext context, bool isDesktop) {
List<Map<String, dynamic>> filteredList = List<Map<String, dynamic>> filteredList =
miscellaneousList.where((item) => item["is_active"] == "1").toList(); widget.miscellaneousList
.where((item) => item["is_active"] == "1")
.toList();
return ListView.builder( return ListView.builder(
shrinkWrap: true, shrinkWrap: true,
@ -144,7 +194,7 @@ class MiscellaneousListWidget extends StatelessWidget {
String getRequestValue(String? specialRequestKey) { String getRequestValue(String? specialRequestKey) {
if (specialRequestKey == null) return "N/A"; if (specialRequestKey == null) return "N/A";
return (apiData?['miscellaneous_special_request'] ?? []) return (widget.apiData?['miscellaneous_special_request'] ?? [])
.firstWhere( .firstWhere(
(element) => (element) =>
element["dropdown_key"].toString() == specialRequestKey, element["dropdown_key"].toString() == specialRequestKey,
@ -158,14 +208,17 @@ class MiscellaneousListWidget extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
// color: Colors.yellow.shade50, // color: Colors.yellow.shade50,
color: Colors.white, color: isDesktop ? Colors.white : thridColor,
boxShadow: [ boxShadow:
isDesktop
? [
BoxShadow( BoxShadow(
color: Colors.black12, color: Colors.black12,
blurRadius: 3, blurRadius: 3,
offset: Offset(0, 1), offset: Offset(0, 1),
), ),
], ]
: [],
border: Border( border: Border(
top: BorderSide( top: BorderSide(
color: Colors.white70, // Change color to match your theme color: Colors.white70, // Change color to match your theme
@ -174,7 +227,7 @@ class MiscellaneousListWidget extends StatelessWidget {
), ),
), ),
child: Padding( child: Padding(
padding: EdgeInsets.all(12), padding: isDesktop ? EdgeInsets.all(12) : EdgeInsets.all(8),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -185,26 +238,28 @@ class MiscellaneousListWidget extends StatelessWidget {
getRequestValue(item["special_request"]?.toString()), getRequestValue(item["special_request"]?.toString()),
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w800, fontWeight:
isDesktop ? FontWeight.w800 : FontWeight.w600,
color: !isDesktop ? Colors.black : Color(0xFF575A74),
), ),
), ),
Spacer(), Spacer(),
GestureDetector( GestureDetector(
onTap: () => onOpen(true, item, "Miscellaneous"), onTap: () => widget.onOpen(true, item, "Miscellaneous"),
child: Tooltip( child: Tooltip(
message: 'Edit Miscellaneous Details', message: 'Edit Miscellaneous Details',
child: Image.asset( child: Image.asset(
'assets/images/IconsImg/edit.png', 'assets/images/IconsImg/edit.png',
width: 20, width: 20,
height: 15, height: 15,
color: Color(0xFF114D8B), color: isDesktop ? Color(0xFF114D8B) : Colors.black,
), ),
), ),
), ),
SizedBox(width: 10), SizedBox(width: 10),
GestureDetector( GestureDetector(
// onTap: () => onOpen(true, item, "Miscellaneous"), // onTap: () => onOpen(true, item, "Miscellaneous"),
onTap: () => onDeleteMiscellaneous(item), onTap: () => widget.onDeleteMiscellaneous(item),
child: Tooltip( child: Tooltip(
message: 'Delete Miscellaneous Details', message: 'Delete Miscellaneous Details',
child: Image.asset( child: Image.asset(
@ -217,8 +272,8 @@ class MiscellaneousListWidget extends StatelessWidget {
), ),
], ],
), ),
Divider(color: Colors.blueGrey.shade50), // Divider(color: Colors.blueGrey.shade50),
SizedBox(height: 4), // SizedBox(height: 4),
isDesktop isDesktop
? Row( ? Row(
children: [ children: [
@ -238,74 +293,48 @@ class MiscellaneousListWidget extends StatelessWidget {
), ),
], ],
) )
// : SizedBox.shrink(), : SizedBox.shrink(),
// isDesktop isDesktop
// ? Row( ? Row(
// children: [
// Expanded(
// flex: 2,
// child: Text(
// getRequestValue(
// item["special_request"]?.toString(),
// ),
// style: GoogleFonts.poppins(
// fontSize: 12,
// fontWeight: FontWeight.w600,
// ),
// ),
// ),
// Expanded(
// flex: 3,
// child: Text(
// item["comments"],
// style: GoogleFonts.poppins(
// fontSize: 12,
// fontWeight: FontWeight.w600,
// ),
// ),
// ),
// ],
// )
:
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// Comment label Expanded(
Text( flex: 2,
"Comment", child: Text(
getRequestValue(
item["special_request"]?.toString(),
),
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: 14, fontSize: 12,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
const SizedBox(height: 8),
if (item["comments"] != null && item["comments"].toString().trim().isNotEmpty)
Container(
width: double.infinity,
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
border: Border.all(color: const Color(0xFF7098DD), width: 1),
borderRadius: BorderRadius.circular(6),
), ),
Expanded(
flex: 3,
child: Text( child: Text(
item["comments"] ?? "N/A", item["comments"],
style: GoogleFonts.poppins(fontSize: 12, color: Colors.black87), style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
), ),
)
else
const Text( "N/A", style: TextStyle(fontSize: 12), ),
], ],
), )
// Column( : Container(
// children: [ color: Colors.white,
padding: const EdgeInsets.all(4.0),
child: Column(
children: [
// _buildRow( // _buildRow(
// "Special Request:", // "Special Request",
// getRequestValue(item["special_request"]?.toString()), // getRequestValue(item["special_request"]?.toString()),
// ), // ),
// SizedBox(width: 10), SizedBox(width: 10),
// _buildRow("Comments:", item["comments"] ?? "N/A"), _buildRow("Comments", item["comments"] ?? "N/A"),
// ], ],
// ), ),
),
], ],
), ),
), ),
@ -387,9 +416,15 @@ class MiscellaneousListWidget extends StatelessWidget {
return Row( return Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( SizedBox(
width: 100,
child: Text(
title, title,
style: GoogleFonts.poppins(fontSize: 12, fontWeight: FontWeight.w600), style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
), ),
SizedBox(width: 8), SizedBox(width: 8),
Expanded( Expanded(

View File

@ -2,7 +2,9 @@ import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
class TaxiListWidget extends StatelessWidget { import '../../utils/auth_utils.dart';
class TaxiListWidget extends StatefulWidget {
final List<Map<String, dynamic>> taxiList; final List<Map<String, dynamic>> taxiList;
final Function(bool, Map<String, dynamic>, String) onOpen; final Function(bool, Map<String, dynamic>, String) onOpen;
final Function(Map<String, dynamic>) onDeleteTaxi; final Function(Map<String, dynamic>) onDeleteTaxi;
@ -21,12 +23,57 @@ class TaxiListWidget extends StatelessWidget {
required this.isViewMode, required this.isViewMode,
}); });
@override
State<TaxiListWidget> createState() => _TaxiListWidgetState();
}
class _TaxiListWidgetState extends State<TaxiListWidget> {
Color? layoutColor;
Color? secondColor;
Color? thridColor;
@override
void initState() {
super.initState();
loadInitialData();
}
void loadInitialData() async {
String? layoutString = await getLayoutColor();
String? secondString = await getSecondaryColor();
String? thridString = await getTernaryColor();
// String? bodyStringColor = await getBodyColor();
setState(() {
layoutColor =
layoutString != null
? Color(int.parse(layoutString))
: Colors.redAccent;
secondColor =
layoutString != null
? Color(int.parse(secondString!))
: Colors.orange;
thridColor =
layoutString != null
? Color(int.parse(thridString!))
: Colors.orangeAccent;
// bodyColor =
// bodyStringColor != null
// ? Color(int.parse(bodyStringColor))
// : Colors.white;
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final isDesktop = MediaQuery.of(context).size.width > 1024; final isDesktop = MediaQuery.of(context).size.width > 1024;
return Padding( return Padding(
padding: const EdgeInsets.all(16.0), padding:
isDesktop ? const EdgeInsets.all(16.0) : const EdgeInsets.all(5.0),
child: Container( child: Container(
margin: const EdgeInsets.only(top: 16.0), margin: const EdgeInsets.only(top: 16.0),
child: Column( child: Column(
@ -36,7 +83,7 @@ class TaxiListWidget extends StatelessWidget {
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
if ((!isDesktop) && taxiList.isNotEmpty) if ((!isDesktop) && widget.taxiList.isNotEmpty)
Text( Text(
" ", " ",
style: const TextStyle( style: const TextStyle(
@ -46,17 +93,17 @@ class TaxiListWidget extends StatelessWidget {
), ),
MouseRegion( MouseRegion(
cursor: cursor:
isViewMode widget.isViewMode
? SystemMouseCursors.forbidden ? SystemMouseCursors.forbidden
: SystemMouseCursors.click, : SystemMouseCursors.click,
child: GestureDetector( child: GestureDetector(
onTap: onTap:
isViewMode widget.isViewMode
? null ? null
: () { : () {
print("New data"); print("New data");
onAddNew("Taxi", true); widget.onAddNew("Taxi", true);
}, },
child: Row( child: Row(
mainAxisSize: mainAxisSize:
@ -121,11 +168,12 @@ class TaxiListWidget extends StatelessWidget {
Widget _buildData(BuildContext context, bool isDesktop) { Widget _buildData(BuildContext context, bool isDesktop) {
List<Map<String, dynamic>> filteredList = List<Map<String, dynamic>> filteredList =
taxiList.where((item) => item["is_active"] == "1").toList(); widget.taxiList.where((item) => item["is_active"] == "1").toList();
print("filteredList- $filteredList"); print("filteredList- $filteredList");
List<dynamic> taxiClassList = apiData?['taxt_car_type'] ?? []; List<dynamic> taxiClassList = widget.apiData?['taxt_car_type'] ?? [];
List<dynamic> taxirequiredFor = apiData?['taxi_car_required_for'] ?? []; List<dynamic> taxirequiredFor =
widget.apiData?['taxi_car_required_for'] ?? [];
String getRequestForTaxiClass(String? specialRequestKey) { String getRequestForTaxiClass(String? specialRequestKey) {
if (specialRequestKey == null) return "N/A"; if (specialRequestKey == null) return "N/A";
@ -228,14 +276,17 @@ class TaxiListWidget extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
// color: Colors.orange.shade50, // color: Colors.orange.shade50,
color: Colors.white, color: isDesktop ? Colors.white : thridColor,
boxShadow: [ boxShadow:
isDesktop
? [
BoxShadow( BoxShadow(
color: Colors.black12, color: Colors.black12,
blurRadius: 3, blurRadius: 3,
offset: Offset(0, 1), offset: Offset(0, 1),
), ),
], ]
: [],
border: Border( border: Border(
top: BorderSide( top: BorderSide(
color: Colors.white70, // Change color to match your theme color: Colors.white70, // Change color to match your theme
@ -244,37 +295,41 @@ class TaxiListWidget extends StatelessWidget {
), ),
), ),
child: Padding( child: Padding(
padding: EdgeInsets.all(12), padding: isDesktop ? EdgeInsets.all(12) : EdgeInsets.all(8),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
Text( Expanded(
flex: 1,
child: Text(
"${getRequestForTaxiClass(item["car_type"]!.toString())} For ${item["no_of_passengers"]!} Passenger", "${getRequestForTaxiClass(item["car_type"]!.toString())} For ${item["no_of_passengers"]!} Passenger",
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: 13, fontSize: 13,
fontWeight: FontWeight.w800, fontWeight:
color: !isDesktop ? Color(0xFF114D8B) : Color(0xFF575A74) isDesktop ? FontWeight.w800 : FontWeight.w600,
color: !isDesktop ? Colors.black : Color(0xFF575A74),
),
), ),
), ),
Spacer(), Spacer(),
GestureDetector( GestureDetector(
onTap: () => onOpen(true, item, "Taxi"), onTap: () => widget.onOpen(true, item, "Taxi"),
child: Tooltip( child: Tooltip(
message: 'Edit Taxi Details', message: 'Edit Taxi Details',
child: Image.asset( child: Image.asset(
'assets/images/IconsImg/edit.png', 'assets/images/IconsImg/edit.png',
width: 20, width: 20,
height: 15, height: 15,
color: Color(0xFF114D8B), color: isDesktop ? Color(0xFF114D8B) : Colors.black,
), ),
), ),
), ),
SizedBox(width: 10), SizedBox(width: 10),
GestureDetector( GestureDetector(
onTap: () => onDeleteTaxi(item), onTap: () => widget.onDeleteTaxi(item),
child: Tooltip( child: Tooltip(
message: 'Delete Taxi Details', message: 'Delete Taxi Details',
child: Image.asset( child: Image.asset(
@ -287,7 +342,7 @@ class TaxiListWidget extends StatelessWidget {
), ),
], ],
), ),
Divider(color: Colors.blueGrey.shade50), // Divider(color: Colors.blueGrey.shade50),
SizedBox(height: 4), SizedBox(height: 4),
isDesktop isDesktop
? Row( ? Row(
@ -369,72 +424,75 @@ class TaxiListWidget extends StatelessWidget {
), ),
], ],
) )
: : Container(
Column( color: Colors.white,
padding: const EdgeInsets.all(4.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// First row: City & Location _buildRow("City", item["destination_city"]),
Row( SizedBox(width: 10),
mainAxisAlignment: MainAxisAlignment.spaceBetween, _buildRow("Location", item["location_of_pickup"]!),
children: [ SizedBox(width: 10),
_infoColumn("City", item["destination_city"] ?? "N/A"), _buildDateTimeRow(
_infoColumn("Location", item["location_of_pickup"] ?? "N/A",alignEnd: true), "Date",
formatDate(item["date"]!),
formatTime(item["time"]!),
),
_buildRow("Comments", item["comments"] ?? "N/A"),
], ],
), ),
const SizedBox(height: 16),
// Second row: Date & Time
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_infoColumn("Date", "${formatDate(item["date"]!)}" ?? "N/A"),
_infoColumn("Time", "${formatTime(item["time"]!)}" ?? "N/A",alignEnd: true),
],
),
const SizedBox(height: 16),
// Comment label
Text(
"Comment",
style: GoogleFonts.poppins(
fontSize: 14,
fontWeight: FontWeight.w600,
),
),
const SizedBox(height: 8),
// Comment box
if (item["comments"] != null && item["comments"].toString().trim().isNotEmpty)
Container(
width: double.infinity,
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
border: Border.all(color: const Color(0xFF7098DD), width: 1),
borderRadius: BorderRadius.circular(6),
),
child: Text(
item["comments"] ?? "N/A",
style: GoogleFonts.poppins(fontSize: 12, color: Colors.black87),
),
)else const Text( "N/A", style: TextStyle(fontSize: 12), ),
] )
// Column( // Column(
// crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
// children: [ // children: [
// _buildRow("City:", item["destination_city"]), // // First row: City & Location
// SizedBox(width: 10), // Row(
// _buildRow("Pickup:", item["location_of_pickup"]!), // mainAxisAlignment: MainAxisAlignment.spaceBetween,
// SizedBox(width: 10), // children: [
// _buildDateTimeRow( // _infoColumn("City", item["destination_city"] ?? "N/A"),
// "Date:", // _infoColumn("Location", item["location_of_pickup"] ?? "N/A",alignEnd: true),
// formatDate(item["date"]!),
// formatTime(item["time"]!),
// ),
// _buildRow("TaxiFor:", item["car_required_for"]!),
// _buildRow("Comments:", item["comments"] ?? "N/A"),
// ], // ],
// ), // ),
// const SizedBox(height: 16),
//
// // Second row: Date & Time
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// _infoColumn("Date", "${formatDate(item["date"]!)}" ?? "N/A"),
// _infoColumn("Time", "${formatTime(item["time"]!)}" ?? "N/A",alignEnd: true),
// ],
// ),
// const SizedBox(height: 16),
//
// // Comment label
// Text(
// "Comment",
// style: GoogleFonts.poppins(
// fontSize: 14,
// fontWeight: FontWeight.w600,
// ),
// ),
// const SizedBox(height: 8),
//
// // Comment box
// if (item["comments"] != null && item["comments"].toString().trim().isNotEmpty)
// Container(
// width: double.infinity,
// padding: const EdgeInsets.all(12),
// decoration: BoxDecoration(
// border: Border.all(color: const Color(0xFF7098DD), width: 1),
// borderRadius: BorderRadius.circular(6),
// ),
// child: Text(
// item["comments"] ?? "N/A",
// style: GoogleFonts.poppins(fontSize: 12, color: Colors.black87),
// ),
// )else const Text( "N/A", style: TextStyle(fontSize: 12), ),
//
// ] ),
),
], ],
), ),
), ),
@ -516,10 +574,13 @@ class TaxiListWidget extends StatelessWidget {
return Row( return Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( SizedBox(
width: 100,
child: Text(
title, title,
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 12), style: TextStyle(fontWeight: FontWeight.w600, fontSize: 12),
), ),
),
SizedBox(width: 8), SizedBox(width: 8),
Expanded( Expanded(
child: child:
@ -551,9 +612,15 @@ class TaxiListWidget extends StatelessWidget {
return Row( return Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( SizedBox(
width: 100,
child: Text(
title, title,
style: GoogleFonts.poppins(fontSize: 12, fontWeight: FontWeight.w600), style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
), ),
SizedBox(width: 8), SizedBox(width: 8),
Expanded( Expanded(
@ -562,6 +629,7 @@ class TaxiListWidget extends StatelessWidget {
], ],
); );
} }
Widget _infoColumn(String label, String value, {bool alignEnd = false}) { Widget _infoColumn(String label, String value, {bool alignEnd = false}) {
return Column( return Column(
// crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
@ -579,13 +647,9 @@ class TaxiListWidget extends StatelessWidget {
const SizedBox(height: 4), const SizedBox(height: 4),
Text( Text(
value, value,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(fontSize: 12, color: Colors.black87),
fontSize: 12,
color: Colors.black87,
),
), ),
], ],
); );
} }
} }

View File

@ -2,7 +2,9 @@ import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
class VisaListWidget extends StatelessWidget { import '../../utils/auth_utils.dart';
class VisaListWidget extends StatefulWidget {
final List<Map<String, dynamic>> visaList; final List<Map<String, dynamic>> visaList;
final Function(bool, Map<String, dynamic>, String) onOpen; final Function(bool, Map<String, dynamic>, String) onOpen;
final Function(Map<String, dynamic>) onDeleteMiscellaneous; final Function(Map<String, dynamic>) onDeleteMiscellaneous;
@ -12,91 +14,138 @@ class VisaListWidget extends StatelessWidget {
final Function(String, bool) onAddNew; final Function(String, bool) onAddNew;
final bool isViewMode; final bool isViewMode;
const VisaListWidget( const VisaListWidget({
{super.key, super.key,
required this.visaList, required this.visaList,
required this.onOpen, required this.onOpen,
required this.onDeleteMiscellaneous, required this.onDeleteMiscellaneous,
required this.apiData, required this.apiData,
required this.apiCountryData, required this.apiCountryData,
required this.onAddNew, required this.onAddNew,
required this.isViewMode}); required this.isViewMode,
});
State<VisaListWidget> createState() => _VisaListWidgetState();
}
class _VisaListWidgetState extends State<VisaListWidget> {
Color? layoutColor;
Color? secondColor;
Color? thridColor;
@override
void initState() {
super.initState();
loadInitialData();
}
void loadInitialData() async {
String? layoutString = await getLayoutColor();
String? secondString = await getSecondaryColor();
String? thridString = await getTernaryColor();
// String? bodyStringColor = await getBodyColor();
setState(() {
layoutColor =
layoutString != null
? Color(int.parse(layoutString))
: Colors.redAccent;
secondColor =
layoutString != null
? Color(int.parse(secondString!))
: Colors.orange;
thridColor =
layoutString != null
? Color(int.parse(thridString!))
: Colors.orangeAccent;
// bodyColor =
// bodyStringColor != null
// ? Color(int.parse(bodyStringColor))
// : Colors.white;
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final isDesktop = MediaQuery.of(context).size.width > 1024; final isDesktop = MediaQuery.of(context).size.width > 1024;
return Padding( return Padding(
padding: const EdgeInsets.all(16.0), padding:
isDesktop ? const EdgeInsets.all(16.0) : const EdgeInsets.all(5.0),
child: Container( child: Container(
margin: const EdgeInsets.only(top: 16.0), margin: const EdgeInsets.only(top: 16.0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
// Header with title and button // Header with title and button
Row( // Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ // children: [
if ((!isDesktop) && visaList.isNotEmpty) // if ((!isDesktop) && widget.visaList.isNotEmpty)
Text(
" ",
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
MouseRegion(
cursor: isViewMode
? SystemMouseCursors.forbidden
: SystemMouseCursors.click,
child: GestureDetector(
onTap: isViewMode
? null
: () {
print("New data");
onAddNew("Visa", true);
},
child: Row(
mainAxisSize:
MainAxisSize.min, // Ensures content fits nicely
children: [
// Text( // Text(
// "Add New", // " ",
// style: TextStyle(fontSize: 13), // style: const TextStyle(
// fontSize: 18,
// fontWeight: FontWeight.bold,
// ), // ),
// SizedBox(width: 8), // spacing between icon and text // ),
// Icon( // MouseRegion(
// Icons.add_circle_sharp, // cursor:
// size: 30, // widget.isViewMode
// color: Color(0xFF114D8B), // ? SystemMouseCursors.forbidden
// ) // : SystemMouseCursors.click,
], //
), // child: GestureDetector(
), // onTap:
// onPressed: isViewMode // widget.isViewMode
// ? null // ? null
// : () { // : () {
// print("New data"); // print("New data");
// // widget.onAddNew("Visa", true);
// }, // },
// child: Row( // child: Row(
// mainAxisSize: MainAxisSize.min, // mainAxisSize:
// MainAxisSize.min, // Ensures content fits nicely
// children: [ // children: [
// Icon( // // Text(
// Icons.add_circle_sharp, // // "Add New",
// size: 30, // // style: TextStyle(fontSize: 13),
// color: Color(0xFF114D8B), // // ),
// ) // // SizedBox(width: 8), // spacing between icon and text
// // Icon(
// // Icons.add_circle_sharp,
// // size: 30,
// // color: Color(0xFF114D8B),
// // )
// ], // ],
// ), // ),
), // ),
], // // onPressed: isViewMode
), // // ? null
const SizedBox(height: 16), // // : () {
// Scroll behavior based on device // // print("New data");
// //
// // },
// // child: Row(
// // mainAxisSize: MainAxisSize.min,
// // children: [
// // Icon(
// // Icons.add_circle_sharp,
// // size: 30,
// // color: Color(0xFF114D8B),
// // )
// // ],
// // ),
// ),
// ],
// ),
// const SizedBox(height: 16),
_buildData(context, isDesktop) // Scroll behavior based on device
_buildData(context, isDesktop),
], ],
), ),
), ),
@ -191,11 +240,11 @@ class VisaListWidget extends StatelessWidget {
Widget _buildData(BuildContext context, bool isDesktop) { Widget _buildData(BuildContext context, bool isDesktop) {
List<Map<String, dynamic>> filteredList = List<Map<String, dynamic>> filteredList =
visaList.where((item) => item["is_active"] == "1").toList(); widget.visaList.where((item) => item["is_active"] == "1").toList();
print("filteredList- $filteredList"); print("filteredList- $filteredList");
List<dynamic> visatypeList = apiData?['visa_type_of_visa'] ?? []; List<dynamic> visatypeList = widget.apiData?['visa_type_of_visa'] ?? [];
List<dynamic> countryList = apiCountryData ?? []; List<dynamic> countryList = widget.apiCountryData ?? [];
String getRequestForVisa(String? specialRequestKey) { String getRequestForVisa(String? specialRequestKey) {
if (specialRequestKey == null) return "N/A"; if (specialRequestKey == null) return "N/A";
@ -249,8 +298,11 @@ class VisaListWidget extends StatelessWidget {
if (hour == 24 && minute == 0) { if (hour == 24 && minute == 0) {
// 24:00 is treated as 00:00 on the next day // 24:00 is treated as 00:00 on the next day
dateTime = DateTime(now.year, now.month, now.day) dateTime = DateTime(
.add(const Duration(days: 1)); now.year,
now.month,
now.day,
).add(const Duration(days: 1));
} else { } else {
if (hour < 0 || hour > 23 || minute < 0 || minute > 59) { if (hour < 0 || hour > 23 || minute < 0 || minute > 59) {
throw FormatException("Invalid hour or minute"); throw FormatException("Invalid hour or minute");
@ -276,14 +328,17 @@ class VisaListWidget extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
// color: Colors.orange.shade50, // color: Colors.orange.shade50,
color: Colors.white, color: isDesktop ? Colors.white : thridColor,
boxShadow: [ boxShadow:
isDesktop
? [
BoxShadow( BoxShadow(
color: Colors.black12, color: Colors.black12,
blurRadius: 3, blurRadius: 3,
offset: Offset(0, 1), offset: Offset(0, 1),
), ),
], ]
: [],
border: Border( border: Border(
top: BorderSide( top: BorderSide(
color: Colors.white70, // Change color to match your theme color: Colors.white70, // Change color to match your theme
@ -292,7 +347,7 @@ class VisaListWidget extends StatelessWidget {
), ),
), ),
child: Padding( child: Padding(
padding: EdgeInsets.all(12), padding: isDesktop ? EdgeInsets.all(12) : EdgeInsets.all(8),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -303,26 +358,27 @@ class VisaListWidget extends StatelessWidget {
getRequestForVisa(item["type_of_visa"]!.toString()), getRequestForVisa(item["type_of_visa"]!.toString()),
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w800, fontWeight:
color: !isDesktop ? Color(0xFF114D8B) : Color(0xFF575A74) isDesktop ? FontWeight.w800 : FontWeight.w600,
color: !isDesktop ? Colors.black : Color(0xFF575A74),
), ),
), ),
Spacer(), Spacer(),
GestureDetector( GestureDetector(
onTap: () => onOpen(true, item, "Visa"), onTap: () => widget.onOpen(true, item, "Visa"),
child: Tooltip( child: Tooltip(
message: 'Edit Visa Details', message: 'Edit Visa Details',
child: Image.asset( child: Image.asset(
'assets/images/IconsImg/edit.png', 'assets/images/IconsImg/edit.png',
width: 20, width: 20,
height: 15, height: 15,
color: Color(0xFF114D8B), color: isDesktop ? Color(0xFF114D8B) : Colors.black,
), ),
), ),
), ),
SizedBox(width: 10), SizedBox(width: 10),
GestureDetector( GestureDetector(
onTap: () => onDeleteMiscellaneous(item), onTap: () => widget.onDeleteMiscellaneous(item),
child: Tooltip( child: Tooltip(
message: 'Delete Visa Details', message: 'Delete Visa Details',
child: Image.asset( child: Image.asset(
@ -335,9 +391,7 @@ class VisaListWidget extends StatelessWidget {
), ),
], ],
), ),
Divider( // Divider(color: Colors.blueGrey.shade50),
color: Colors.blueGrey.shade50,
),
SizedBox(height: 4), SizedBox(height: 4),
isDesktop isDesktop
? Row( ? Row(
@ -346,34 +400,30 @@ class VisaListWidget extends StatelessWidget {
flex: 2, flex: 2,
child: Text( child: Text(
" Country", " Country",
style: GoogleFonts.poppins( style: GoogleFonts.poppins(fontSize: 11),
fontSize: 11, ),
), ),
)),
Expanded( Expanded(
flex: 2, flex: 2,
child: Text( child: Text(
" Visa Type", " Visa Type",
style: GoogleFonts.poppins( style: GoogleFonts.poppins(fontSize: 11),
fontSize: 11, ),
), ),
)),
Expanded( Expanded(
flex: 2, flex: 2,
child: Text( child: Text(
" Date", " Date",
style: GoogleFonts.poppins( style: GoogleFonts.poppins(fontSize: 11),
fontSize: 11, ),
), ),
)),
Expanded( Expanded(
flex: 2, flex: 2,
child: Text( child: Text(
" Comments", " Comments",
style: GoogleFonts.poppins( style: GoogleFonts.poppins(fontSize: 11),
fontSize: 11, ),
), ),
)),
], ],
) )
: SizedBox.shrink(), : SizedBox.shrink(),
@ -384,7 +434,8 @@ class VisaListWidget extends StatelessWidget {
flex: 2, flex: 2,
child: Text( child: Text(
getRequestForCountry( getRequestForCountry(
item["country_code"]!.toString()), item["country_code"]!.toString(),
),
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -395,8 +446,7 @@ class VisaListWidget extends StatelessWidget {
Expanded( Expanded(
flex: 2, flex: 2,
child: Text( child: Text(
getRequestForVisa( getRequestForVisa(item["type_of_visa"]!.toString()),
item["type_of_visa"]!.toString()),
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -418,70 +468,100 @@ class VisaListWidget extends StatelessWidget {
Expanded( Expanded(
flex: 2, flex: 2,
child: _buildComments( child: _buildComments(
"Comments:", item["comments"] ?? "N/A"), "Comments:",
item["comments"] ?? "N/A",
),
), ),
], ],
) )
: : Container(
Column( color: Colors.white,
padding: const EdgeInsets.all(4.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// Top Row (Country, Currency, Total) _buildRow(
// Row( "VisaType",
// mainAxisAlignment: MainAxisAlignment.spaceBetween, getRequestForVisa(item["type_of_visa"]!.toString()),
Wrap( ),
spacing: 20, // horizontal space between items SizedBox(height: 6),
runSpacing: 10, // vertical space between rows _buildRow(
children: [ "Country",
_infoBlock("Visa Type", getRequestForCountry(item["country_code"]!.toString()) ?? "N/A"), getRequestForCountry(
_infoBlock("Country", getRequestForCountry(item["country_code"]!.toString()) ?? "N/A"), item["country_code"]!.toString(),
_infoBlock("Start Date", formatDate(item["start_date"]!) ?? "N/A"), ),
),
SizedBox(height: 6),
_buildRow("StartDate", item["start_date"]!),
SizedBox(height: 6),
_buildRow("Comments", item["comments"] ?? "N/A"),
], ],
), ),
const SizedBox(height: 16), ),
// Comment label
Text(
"Comment",
style: GoogleFonts.poppins(
fontSize: 14,
fontWeight: FontWeight.w600,
),
),
const SizedBox(height: 8),
if (item["comments"] != null && item["comments"].toString().trim().isNotEmpty)
Container(
width: double.infinity,
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
border: Border.all(color: const Color(0xFF7098DD), width: 1),
borderRadius: BorderRadius.circular(6),
),
child: Text(
item["comments"] ?? "N/A",
style: GoogleFonts.poppins(fontSize: 12, color: Colors.black87),
),
)
else
const Text( "N/A", style: TextStyle(fontSize: 12), ),
],
),
// Column( // Column(
// crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
// children: [ // children: [
// _buildRow( // // Top Row (Country, Currency, Total)
// "VisaType:", // // Row(
// getRequestForVisa( // // mainAxisAlignment: MainAxisAlignment.spaceBetween,
// item["type_of_visa"]!.toString())), // Wrap(
// SizedBox(height: 6), // spacing: 20, // horizontal space between items
// _buildRow( // runSpacing: 10, // vertical space between rows
// "Country:", // children: [
// _infoBlock(
// "Visa Type",
// getRequestForCountry( // getRequestForCountry(
// item["country_code"]!.toString())), // item["country_code"]!.toString(),
// SizedBox(height: 6), // ) ??
// _buildRow("StartDate:", item["start_date"]!), // "N/A",
// SizedBox(height: 6), // ),
// _buildRow("Comments:", item["comments"] ?? "N/A"), // _infoBlock(
// "Country",
// getRequestForCountry(
// item["country_code"]!.toString(),
// ) ??
// "N/A",
// ),
// _infoBlock(
// "Start Date",
// formatDate(item["start_date"]!) ?? "N/A",
// ),
// ],
// ),
// const SizedBox(height: 16),
//
// // Comment label
// Text(
// "Comment",
// style: GoogleFonts.poppins(
// fontSize: 14,
// fontWeight: FontWeight.w600,
// ),
// ),
// const SizedBox(height: 8),
// if (item["comments"] != null &&
// item["comments"].toString().trim().isNotEmpty)
// Container(
// width: double.infinity,
// padding: const EdgeInsets.all(12),
// decoration: BoxDecoration(
// border: Border.all(
// color: const Color(0xFF7098DD),
// width: 1,
// ),
// borderRadius: BorderRadius.circular(6),
// ),
// child: Text(
// item["comments"] ?? "N/A",
// style: GoogleFonts.poppins(
// fontSize: 12,
// color: Colors.black87,
// ),
// ),
// )
// else
// const Text("N/A", style: TextStyle(fontSize: 12)),
// ], // ],
// ), // ),
], ],
@ -512,30 +592,36 @@ class VisaListWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
child: exceedsLimit child:
exceedsLimit
? Tooltip( ? Tooltip(
message: wrapText(value, 50), message: wrapText(value, 50),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.grey.shade200, // Black background color: Colors.grey.shade200, // Black background
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),
), ),
textStyle: textStyle: TextStyle(
TextStyle(color: Colors.black), // Tooltip text color color: Colors.black,
), // Tooltip text color
padding: EdgeInsets.all(8), padding: EdgeInsets.all(8),
preferBelow: false, preferBelow: false,
child: Text(value.substring(0, limit) + "...", child: Text(
value.substring(0, limit) + "...",
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontFamily: "Archivo"), fontFamily: "Archivo",
overflow: TextOverflow.ellipsis), ),
overflow: TextOverflow.ellipsis,
),
) )
: Text( : Text(
value, value,
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontFamily: "Archivo"), fontFamily: "Archivo",
),
), ),
), ),
], ],
@ -560,16 +646,14 @@ class VisaListWidget extends StatelessWidget {
const SizedBox(height: 4), const SizedBox(height: 4),
Text( Text(
value, value,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(fontSize: 12, color: Colors.black87),
fontSize: 12,
color: Colors.black87,
),
), ),
], ],
), ),
), ),
); );
} }
Widget _buildRow(String title, String value) { Widget _buildRow(String title, String value) {
// Define character limits based on title // Define character limits based on title
Map<String, int> limits = { Map<String, int> limits = {
@ -589,34 +673,38 @@ class VisaListWidget extends StatelessWidget {
return Row( return Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( SizedBox(
width: 100,
child: Text(
title, title,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
),
SizedBox(width: 8), SizedBox(width: 8),
Expanded( Expanded(
child: exceedsLimit child:
exceedsLimit
? Tooltip( ? Tooltip(
message: wrapText(value, 50), message: wrapText(value, 50),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.grey.shade200, // Black background color: Colors.grey.shade200, // Black background
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),
), ),
textStyle: textStyle: TextStyle(
TextStyle(color: Colors.black), // Tooltip text color color: Colors.black,
), // Tooltip text color
padding: EdgeInsets.all(8), padding: EdgeInsets.all(8),
preferBelow: false, preferBelow: false,
child: Text(value.substring(0, limit) + "...", child: Text(
style: TextStyle(fontSize: 12), value.substring(0, limit) + "...",
overflow: TextOverflow.ellipsis),
)
: Text(
value,
style: TextStyle(fontSize: 12), style: TextStyle(fontSize: 12),
overflow: TextOverflow.ellipsis,
), ),
)
: Text(value, style: TextStyle(fontSize: 12)),
), ),
], ],
); );

View File

@ -13,7 +13,7 @@
This is a placeholder for base href that will be replaced by the value of This is a placeholder for base href that will be replaced by the value of
the `--base-href` argument provided to `flutter build`. the `--base-href` argument provided to `flutter build`.
--> --> TSTAT_TEST_19July.
<base href="/tstat/"> <base href="/tstat/">
<meta charset="UTF-8"> <meta charset="UTF-8">