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( boxShadow:
color: Colors.black12, isDesktop
blurRadius: 3, ? [
offset: Offset(0, 1), BoxShadow(
), color: Colors.black12,
], blurRadius: 3,
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,176 +245,206 @@ 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,
style: GoogleFonts.poppins( child: Text(
fontSize: 14, getRequestForInsuranceType(
fontWeight: FontWeight.w800, item["type_of_insurance"]!.toString(),
color: !isDesktop ? Color(0xFF114D8B) : Color(0xFF575A74) ),
style: GoogleFonts.poppins(
fontSize: 14,
fontWeight:
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: [
Expanded( Expanded(
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(fontSize: 11),
style: GoogleFonts.poppins( ),
fontSize: 11, ),
), Expanded(
)), flex: 2,
Expanded( child: Text(
flex: 2, " Comments",
child: Text( style: GoogleFonts.poppins(fontSize: 11),
" Comments", ),
style: GoogleFonts.poppins( ),
fontSize: 11, ],
), )
)),
],
)
: SizedBox.shrink(), : SizedBox.shrink(),
isDesktop isDesktop
? Row( ? Row(
children: [
Expanded(
flex: 2,
child: Text(
getRequestForInsuranceType(
item["type_of_insurance"]!.toString()),
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
),
SizedBox(width: 10),
Expanded(
flex: 2,
child: Text(
"${formatDate(item["start_date"]!)} - ${formatDate(item["end_date"]!)}",
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
),
SizedBox(width: 10),
Expanded(
flex: 2,
child: _buildComments(
"Comments:", item["comments"] ?? "N/A"),
),
],
)
:
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: [ children: [
_infoBlock("Insurance Type", getRequestForInsuranceType(item["type_of_insurance"]!.toString()) ?? "N/A"), Expanded(
_infoBlock("Start Date", formatDate(item["start_date"]!) ?? "N/A"), flex: 2,
_infoBlock("End Date", formatDate(item["end_date"]) ?? "N/A"), child: Text(
getRequestForInsuranceType(
item["type_of_insurance"]!.toString(),
),
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
),
SizedBox(width: 10),
Expanded(
flex: 2,
child: Text(
"${formatDate(item["start_date"]!)} - ${formatDate(item["end_date"]!)}",
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
),
SizedBox(width: 10),
Expanded(
flex: 2,
child: _buildComments(
"Comments:",
item["comments"] ?? "N/A",
),
),
], ],
), )
const SizedBox(height: 16), : Container(
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"])} ',
),
// Comment label SizedBox(width: 10),
Text( _buildRow("Comments", item["comments"] ?? "N/A"),
"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(
// children: [ // crossAxisAlignment: CrossAxisAlignment.start,
// _buildRow( // children: [
// "InsuranceType:", // // Top Row (Country, Currency, Total)
// getRequestForInsuranceType( // // Row(
// item["type_of_insurance"]!.toString())), // // mainAxisAlignment: MainAxisAlignment.spaceBetween,
// SizedBox(width: 10), // Wrap(
// _buildRow( // spacing: 20, // horizontal space between items
// "StartDate:", formatDate(item["start_date"]!)), // runSpacing: 10, // vertical space between rows
// SizedBox(width: 10), // children: [
// _buildRow("EndDate:", formatDate(item["end_date"])), // _infoBlock(
// SizedBox(width: 10), // "Insurance Type",
// _buildRow("Comments:", item["comments"] ?? "N/A"), // 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",
// style: GoogleFonts.poppins(
// fontSize: 12,
// color: Colors.black87,
// ),
// ),
// )
// else
// const Text("N/A", style: TextStyle(fontSize: 12)),
// ],
// ),
], ],
), ),
), ),
@ -391,31 +473,35 @@ class InsuranceListWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
child: exceedsLimit child:
? Tooltip( exceedsLimit
message: wrapText(value, 50), ? Tooltip(
decoration: BoxDecoration( message: wrapText(value, 50),
color: Colors.grey.shade200, // Black background decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6), color: Colors.grey.shade200, // Black background
), borderRadius: BorderRadius.circular(6),
textStyle: ),
TextStyle(color: Colors.black), // Tooltip text color textStyle: TextStyle(
padding: EdgeInsets.all(8), color: Colors.black,
preferBelow: false, ), // Tooltip text color
child: Text(value.substring(0, limit) + "...", padding: EdgeInsets.all(8),
preferBelow: false,
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( )
value, : Text(
style: GoogleFonts.poppins( value,
fontSize: 12, style: GoogleFonts.poppins(
fontWeight: FontWeight.w600, fontSize: 12,
fontWeight: FontWeight.w600,
),
), ),
),
), ),
], ],
); );
@ -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,40 +552,39 @@ class InsuranceListWidget extends StatelessWidget {
return Row( return Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( SizedBox(
title, width: 100,
style: GoogleFonts.poppins( child: Text(
fontSize: 12, title,
fontWeight: FontWeight.w600, style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
), ),
), ),
SizedBox(width: 8), SizedBox(width: 8),
Expanded( Expanded(
child: exceedsLimit child:
? Tooltip( exceedsLimit
message: wrapText(value, 50), ? Tooltip(
decoration: BoxDecoration( message: wrapText(value, 50),
color: Colors.grey.shade200, // Black background decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6), color: Colors.grey.shade200, // Black background
), borderRadius: BorderRadius.circular(6),
textStyle: TextStyle(
color: Colors.black, fontSize: 12), // Tooltip text color
padding: EdgeInsets.all(8),
preferBelow: false,
child: Text(
value.substring(0, limit) + "...",
style: GoogleFonts.poppins(
fontSize: 12,
), ),
overflow: TextOverflow.ellipsis, textStyle: TextStyle(
), color: Colors.black,
) fontSize: 12,
: Text( ), // Tooltip text color
value, padding: EdgeInsets.all(8),
style: GoogleFonts.poppins( preferBelow: false,
fontSize: 12, child: Text(
), value.substring(0, limit) + "...",
), style: GoogleFonts.poppins(fontSize: 12),
overflow: TextOverflow.ellipsis,
),
)
: Text(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,47 +612,55 @@ 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(
// DataCell(Text(item["indx"]?.toString() ?? "N/A")), // Index column cells: [
// DataCell(Text(item["type_of_insurance"]!)), // DataCell(Text(item["indx"]?.toString() ?? "N/A")), // Index column
DataCell(Text( // DataCell(Text(item["type_of_insurance"]!)),
getRequestForInsuranceType(item["type_of_insurance"]!.toString()))), DataCell(
DataCell(Text(item["start_date"]!)), Text(
DataCell(Text(item["end_date"]!)), getRequestForInsuranceType(item["type_of_insurance"]!.toString()),
DataCell(Row( ),
children: [ ),
GestureDetector( DataCell(Text(item["start_date"]!)),
onTap: () => onOpen(true, item, "Insurance"), DataCell(Text(item["end_date"]!)),
child: Tooltip( DataCell(
message: 'Edit Insurance Details', Row(
child: Image.asset( children: [
'assets/images/IconsImg/edit.png', GestureDetector(
width: 20, onTap: () => widget.onOpen(true, item, "Insurance"),
height: 15, child: Tooltip(
message: 'Edit Insurance Details',
child: Image.asset(
'assets/images/IconsImg/edit.png',
width: 20,
height: 15,
),
),
), ),
), SizedBox(width: 10),
), GestureDetector(
SizedBox(width: 10), onTap: () => widget.onDeleteInsurance(item),
GestureDetector( child: Tooltip(
onTap: () => onDeleteInsurance(item), message: 'Delete Insurance Details',
child: Tooltip( child: Image.asset(
message: 'Delete Insurance Details', 'assets/images/IconsImg/delete.png',
child: Image.asset( width: 20,
'assets/images/IconsImg/delete.png', height: 15,
width: 20, ),
height: 15, ),
), ),
), IconButton(
icon: Icon(
Icons.keyboard_arrow_down_outlined,
size: 28,
color: Color(0xFF475569),
),
onPressed: () {
// Expand logic
},
),
],
), ),
IconButton(
icon: Icon(Icons.keyboard_arrow_down_outlined,
size: 28, color: Color(0xFF475569)),
onPressed: () {
// 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,20 +92,20 @@ 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:
MainAxisSize.min, // Ensures content fits nicely MainAxisSize.min, // Ensures content fits nicely
children: [ children: [
// Text( // Text(
// "Add New", // "Add New",
@ -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,12 +194,12 @@ 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,
orElse: () => {"dropdown_value": "N/A"}, orElse: () => {"dropdown_value": "N/A"},
)["dropdown_value"] )["dropdown_value"]
.toString(); .toString();
} }
@ -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:
BoxShadow( isDesktop
color: Colors.black12, ? [
blurRadius: 3, BoxShadow(
offset: Offset(0, 1), color: Colors.black12,
), blurRadius: 3,
], 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,95 +272,69 @@ 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: [
Expanded( Expanded(
flex: 2, flex: 2,
child: Text( child: Text(
"Special Request", "Special Request",
style: GoogleFonts.poppins(fontSize: 11), style: GoogleFonts.poppins(fontSize: 11),
), ),
),
Expanded(
flex: 3,
child: Text(
" Comments",
style: GoogleFonts.poppins(fontSize: 11),
),
),
],
)
// : SizedBox.shrink(),
// isDesktop
// ? 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: [
// 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( Expanded(
item["comments"] ?? "N/A", flex: 3,
style: GoogleFonts.poppins(fontSize: 12, color: Colors.black87), child: Text(
" Comments",
style: GoogleFonts.poppins(fontSize: 11),
),
), ),
) ],
else )
const Text( "N/A", style: TextStyle(fontSize: 12), ), : SizedBox.shrink(),
], isDesktop
), ? Row(
// Column( children: [
// children: [ Expanded(
// _buildRow( flex: 2,
// "Special Request:", child: Text(
// getRequestValue(item["special_request"]?.toString()), getRequestValue(
// ), item["special_request"]?.toString(),
// SizedBox(width: 10), ),
// _buildRow("Comments:", item["comments"] ?? "N/A"), style: GoogleFonts.poppins(
// ], fontSize: 12,
// ), fontWeight: FontWeight.w600,
),
),
),
Expanded(
flex: 3,
child: Text(
item["comments"],
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
),
],
)
: Container(
color: Colors.white,
padding: const EdgeInsets.all(4.0),
child: Column(
children: [
// _buildRow(
// "Special Request",
// getRequestValue(item["special_request"]?.toString()),
// ),
SizedBox(width: 10),
_buildRow("Comments", item["comments"] ?? "N/A"),
],
),
),
], ],
), ),
), ),
@ -335,34 +364,34 @@ class MiscellaneousListWidget extends StatelessWidget {
children: [ children: [
Expanded( Expanded(
child: child:
exceedsLimit 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, color: Colors.black,
), // Tooltip text color ), // 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,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
) )
: Text( : Text(
value, value,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
), ),
], ],
); );
@ -387,102 +416,108 @@ class MiscellaneousListWidget extends StatelessWidget {
return Row( return Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( SizedBox(
title, width: 100,
style: GoogleFonts.poppins(fontSize: 12, fontWeight: FontWeight.w600), child: Text(
title,
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
), ),
SizedBox(width: 8), SizedBox(width: 8),
Expanded( Expanded(
child: child:
exceedsLimit 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, color: Colors.black,
fontSize: 12, fontSize: 12,
), // Tooltip text color ), // 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) + "...",
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
) )
: Text(value), : Text(value),
), ),
], ],
); );
} }
// //
// Widget _buildData(BuildContext context) { // Widget _buildData(BuildContext context) {
// return Container( // return Container(
// width: MediaQuery.of(context).size.width, // width: MediaQuery.of(context).size.width,
// child: DataTable( // child: DataTable(
// border: TableBorder( // border: TableBorder(
// bottom: BorderSide(color: Colors.black12), // bottom: BorderSide(color: Colors.black12),
// horizontalInside: BorderSide(color: Colors.black12), // horizontalInside: BorderSide(color: Colors.black12),
// ), // ),
// columns: const [ // columns: const [
// DataColumn(label: Text('Special Request')), // DataColumn(label: Text('Special Request')),
// DataColumn(label: Text('Comments')), // DataColumn(label: Text('Comments')),
// DataColumn(label: Text('Actions')), // DataColumn(label: Text('Actions')),
// ], // ],
// rows: _buildDataRows(), // rows: _buildDataRows(),
// ), // ),
// ); // );
// } // }
// //
// List<DataRow> _buildDataRows() { // List<DataRow> _buildDataRows() {
// List<dynamic> purposeList = apiData?['miscellaneous_special_request'] ?? []; // List<dynamic> purposeList = apiData?['miscellaneous_special_request'] ?? [];
// //
// String getRequestValue(String? specialRequestKey) { // String getRequestValue(String? specialRequestKey) {
// if (specialRequestKey == null) return "N/A"; // if (specialRequestKey == null) return "N/A";
// return purposeList // return purposeList
// .firstWhere( // .firstWhere(
// (element) => // (element) =>
// element["dropdown_key"].toString() == specialRequestKey, // element["dropdown_key"].toString() == specialRequestKey,
// orElse: () => {"dropdown_value": "N/A"}, // orElse: () => {"dropdown_value": "N/A"},
// )["dropdown_value"] // )["dropdown_value"]
// .toString(); // .toString();
// } // }
// //
// List<Map<String, dynamic>> filteredList = // List<Map<String, dynamic>> filteredList =
// miscellaneousList.where((item) => item["is_active"] == "1").toList(); // miscellaneousList.where((item) => item["is_active"] == "1").toList();
// //
// 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(getRequestValue(item["special_request"]?.toString()))), // DataCell(Text(getRequestValue(item["special_request"]?.toString()))),
// DataCell(Text(item["comments"] ?? "N/A")), // DataCell(Text(item["comments"] ?? "N/A")),
// DataCell(Row( // DataCell(Row(
// children: [ // children: [
// GestureDetector( // GestureDetector(
// onTap: () => onOpen(true, item, "Miscellaneous"), // onTap: () => onOpen(true, item, "Miscellaneous"),
// child: Image.asset('assets/images/IconsImg/edit.png', // child: Image.asset('assets/images/IconsImg/edit.png',
// width: 20, height: 15), // width: 20, height: 15),
// ), // ),
// SizedBox(width: 10), // SizedBox(width: 10),
// GestureDetector( // GestureDetector(
// onTap: () => onOpen(true, item, "Miscellaneous"), // onTap: () => onOpen(true, item, "Miscellaneous"),
// child: Image.asset('assets/images/IconsImg/delete.png', // child: Image.asset('assets/images/IconsImg/delete.png',
// width: 20, height: 15), // width: 20, height: 15),
// ), // ),
// IconButton( // IconButton(
// icon: Icon(Icons.keyboard_arrow_down_outlined, // icon: Icon(Icons.keyboard_arrow_down_outlined,
// size: 28, color: Color(0xFF475569)), // size: 28, color: Color(0xFF475569)),
// onPressed: () { // onPressed: () {
// // Expand logic (optional) // // Expand logic (optional)
// }, // },
// ), // ),
// ], // ],
// )), // )),
// ]); // ]);
// }).toList(); // }).toList();
// } // }
} }

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:
BoxShadow( isDesktop
color: Colors.black12, ? [
blurRadius: 3, BoxShadow(
offset: Offset(0, 1), color: Colors.black12,
), blurRadius: 3,
], 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(
"${getRequestForTaxiClass(item["car_type"]!.toString())} For ${item["no_of_passengers"]!} Passenger", flex: 1,
style: GoogleFonts.poppins( child: Text(
fontSize: 13, "${getRequestForTaxiClass(item["car_type"]!.toString())} For ${item["no_of_passengers"]!} Passenger",
fontWeight: FontWeight.w800, style: GoogleFonts.poppins(
color: !isDesktop ? Color(0xFF114D8B) : Color(0xFF575A74) fontSize: 13,
fontWeight:
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,
crossAxisAlignment: CrossAxisAlignment.start, padding: const EdgeInsets.all(4.0),
children: [ child: Column(
// First row: City & Location crossAxisAlignment: CrossAxisAlignment.start,
Row( children: [
mainAxisAlignment: MainAxisAlignment.spaceBetween, _buildRow("City", item["destination_city"]),
children: [ SizedBox(width: 10),
_infoColumn("City", item["destination_city"] ?? "N/A"), _buildRow("Location", item["location_of_pickup"]!),
_infoColumn("Location", item["location_of_pickup"] ?? "N/A",alignEnd: true), SizedBox(width: 10),
], _buildDateTimeRow(
"Date",
formatDate(item["date"]!),
formatTime(item["time"]!),
), ),
const SizedBox(height: 16), _buildRow("Comments", item["comments"] ?? "N/A"),
],
),
// Second row: Date & Time // Column(
Row( // crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween, // children: [
children: [ // // First row: City & Location
_infoColumn("Date", "${formatDate(item["date"]!)}" ?? "N/A"), // Row(
_infoColumn("Time", "${formatTime(item["time"]!)}" ?? "N/A",alignEnd: true), // mainAxisAlignment: MainAxisAlignment.spaceBetween,
], // children: [
), // _infoColumn("City", item["destination_city"] ?? "N/A"),
const SizedBox(height: 16), // _infoColumn("Location", item["location_of_pickup"] ?? "N/A",alignEnd: true),
// ],
// Comment label // ),
Text( // const SizedBox(height: 16),
"Comment", //
style: GoogleFonts.poppins( // // Second row: Date & Time
fontSize: 14, // Row(
fontWeight: FontWeight.w600, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
), // children: [
), // _infoColumn("Date", "${formatDate(item["date"]!)}" ?? "N/A"),
const SizedBox(height: 8), // _infoColumn("Time", "${formatTime(item["time"]!)}" ?? "N/A",alignEnd: true),
// ],
// Comment box // ),
if (item["comments"] != null && item["comments"].toString().trim().isNotEmpty) // const SizedBox(height: 16),
Container( //
width: double.infinity, // // Comment label
padding: const EdgeInsets.all(12), // Text(
decoration: BoxDecoration( // "Comment",
border: Border.all(color: const Color(0xFF7098DD), width: 1), // style: GoogleFonts.poppins(
borderRadius: BorderRadius.circular(6), // fontSize: 14,
), // fontWeight: FontWeight.w600,
child: Text( // ),
item["comments"] ?? "N/A", // ),
style: GoogleFonts.poppins(fontSize: 12, color: Colors.black87), // const SizedBox(height: 8),
), //
)else const Text( "N/A", style: TextStyle(fontSize: 12), ), // // Comment box
// if (item["comments"] != null && item["comments"].toString().trim().isNotEmpty)
] ) // Container(
// Column( // width: double.infinity,
// crossAxisAlignment: CrossAxisAlignment.start, // padding: const EdgeInsets.all(12),
// children: [ // decoration: BoxDecoration(
// _buildRow("City:", item["destination_city"]), // border: Border.all(color: const Color(0xFF7098DD), width: 1),
// SizedBox(width: 10), // borderRadius: BorderRadius.circular(6),
// _buildRow("Pickup:", item["location_of_pickup"]!), // ),
// SizedBox(width: 10), // child: Text(
// _buildDateTimeRow( // item["comments"] ?? "N/A",
// "Date:", // style: GoogleFonts.poppins(fontSize: 12, color: Colors.black87),
// formatDate(item["date"]!), // ),
// formatTime(item["time"]!), // )else const Text( "N/A", style: TextStyle(fontSize: 12), ),
// ), //
// _buildRow("TaxiFor:", item["car_required_for"]!), // ] ),
// _buildRow("Comments:", item["comments"] ?? "N/A"), ),
// ],
// ),
], ],
), ),
), ),
@ -516,9 +574,12 @@ class TaxiListWidget extends StatelessWidget {
return Row( return Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( SizedBox(
title, width: 100,
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 12), child: Text(
title,
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 12),
),
), ),
SizedBox(width: 8), SizedBox(width: 8),
Expanded( Expanded(
@ -551,9 +612,15 @@ class TaxiListWidget extends StatelessWidget {
return Row( return Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( SizedBox(
title, width: 100,
style: GoogleFonts.poppins(fontSize: 12, fontWeight: FontWeight.w600), child: Text(
title,
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
), ),
SizedBox(width: 8), SizedBox(width: 8),
Expanded( Expanded(
@ -562,30 +629,27 @@ class TaxiListWidget extends StatelessWidget {
], ],
); );
} }
Widget _infoColumn(String label, String value, {bool alignEnd = false}) {
return Column(
// crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
alignEnd ? CrossAxisAlignment.end : CrossAxisAlignment.start,
children: [
Text(
label,
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Colors.black87,
),
),
const SizedBox(height: 4),
Text(
value,
style: GoogleFonts.poppins(
fontSize: 12,
color: Colors.black87,
),
),
],
);
}
Widget _infoColumn(String label, String value, {bool alignEnd = false}) {
return Column(
// crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
alignEnd ? CrossAxisAlignment.end : CrossAxisAlignment.start,
children: [
Text(
label,
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Colors.black87,
),
),
const SizedBox(height: 4),
Text(
value,
style: GoogleFonts.poppins(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( // Text(
" ", // " ",
style: const TextStyle( // style: const TextStyle(
fontSize: 18, // fontSize: 18,
fontWeight: FontWeight.bold, // fontWeight: FontWeight.bold,
), // ),
), // ),
MouseRegion( // MouseRegion(
cursor: isViewMode // cursor:
? SystemMouseCursors.forbidden // widget.isViewMode
: SystemMouseCursors.click, // ? SystemMouseCursors.forbidden
// : SystemMouseCursors.click,
//
// child: GestureDetector(
// onTap:
// widget.isViewMode
// ? null
// : () {
// print("New data");
// widget.onAddNew("Visa", true);
// },
// child: Row(
// mainAxisSize:
// MainAxisSize.min, // Ensures content fits nicely
// children: [
// // Text(
// // "Add New",
// // style: TextStyle(fontSize: 13),
// // ),
// // SizedBox(width: 8), // spacing between icon and text
// // Icon(
// // Icons.add_circle_sharp,
// // size: 30,
// // color: Color(0xFF114D8B),
// // )
// ],
// ),
// ),
// // onPressed: isViewMode
// // ? null
// // : () {
// // print("New data");
// //
// // },
// // child: Row(
// // mainAxisSize: MainAxisSize.min,
// // children: [
// // Icon(
// // Icons.add_circle_sharp,
// // size: 30,
// // color: Color(0xFF114D8B),
// // )
// // ],
// // ),
// ),
// ],
// ),
// const SizedBox(height: 16),
child: GestureDetector(
onTap: isViewMode
? null
: () {
print("New data");
onAddNew("Visa", true);
},
child: Row(
mainAxisSize:
MainAxisSize.min, // Ensures content fits nicely
children: [
// Text(
// "Add New",
// style: TextStyle(fontSize: 13),
// ),
// SizedBox(width: 8), // spacing between icon and text
// Icon(
// Icons.add_circle_sharp,
// size: 30,
// color: Color(0xFF114D8B),
// )
],
),
),
// onPressed: isViewMode
// ? null
// : () {
// print("New data");
//
// },
// child: Row(
// mainAxisSize: MainAxisSize.min,
// children: [
// Icon(
// Icons.add_circle_sharp,
// size: 30,
// color: Color(0xFF114D8B),
// )
// ],
// ),
),
],
),
const SizedBox(height: 16),
// Scroll behavior based on device // Scroll behavior based on device
_buildData(context, isDesktop),
_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:
BoxShadow( isDesktop
color: Colors.black12, ? [
blurRadius: 3, BoxShadow(
offset: Offset(0, 1), color: Colors.black12,
), blurRadius: 3,
], 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,155 +391,179 @@ class VisaListWidget extends StatelessWidget {
), ),
], ],
), ),
Divider( // Divider(color: Colors.blueGrey.shade50),
color: Colors.blueGrey.shade50,
),
SizedBox(height: 4), SizedBox(height: 4),
isDesktop isDesktop
? Row( ? Row(
children: [ children: [
Expanded( Expanded(
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(fontSize: 11),
style: GoogleFonts.poppins( ),
fontSize: 11, ),
), Expanded(
)), flex: 2,
Expanded( child: Text(
flex: 2, " Date",
child: Text( style: GoogleFonts.poppins(fontSize: 11),
" Date", ),
style: GoogleFonts.poppins( ),
fontSize: 11, Expanded(
), flex: 2,
)), child: Text(
Expanded( " Comments",
flex: 2, style: GoogleFonts.poppins(fontSize: 11),
child: Text( ),
" Comments", ),
style: GoogleFonts.poppins( ],
fontSize: 11, )
),
)),
],
)
: SizedBox.shrink(), : SizedBox.shrink(),
isDesktop isDesktop
? Row( ? Row(
children: [
Expanded(
flex: 2,
child: Text(
getRequestForCountry(
item["country_code"]!.toString()),
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
),
SizedBox(width: 10),
Expanded(
flex: 2,
child: Text(
getRequestForVisa(
item["type_of_visa"]!.toString()),
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
),
SizedBox(width: 10),
Expanded(
flex: 2,
child: Text(
formatDate(item["start_date"]!),
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
),
SizedBox(width: 10),
Expanded(
flex: 2,
child: _buildComments(
"Comments:", item["comments"] ?? "N/A"),
),
],
)
:
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: [ children: [
_infoBlock("Visa Type", getRequestForCountry(item["country_code"]!.toString()) ?? "N/A"), Expanded(
_infoBlock("Country", getRequestForCountry(item["country_code"]!.toString()) ?? "N/A"), flex: 2,
_infoBlock("Start Date", formatDate(item["start_date"]!) ?? "N/A"), child: Text(
getRequestForCountry(
item["country_code"]!.toString(),
),
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
),
SizedBox(width: 10),
Expanded(
flex: 2,
child: Text(
getRequestForVisa(item["type_of_visa"]!.toString()),
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
),
SizedBox(width: 10),
Expanded(
flex: 2,
child: Text(
formatDate(item["start_date"]!),
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
),
SizedBox(width: 10),
Expanded(
flex: 2,
child: _buildComments(
"Comments:",
item["comments"] ?? "N/A",
),
),
], ],
), )
const SizedBox(height: 16), : Container(
color: Colors.white,
// Comment label padding: const EdgeInsets.all(4.0),
Text( child: Column(
"Comment", crossAxisAlignment: CrossAxisAlignment.start,
style: GoogleFonts.poppins( children: [
fontSize: 14, _buildRow(
fontWeight: FontWeight.w600, "VisaType",
getRequestForVisa(item["type_of_visa"]!.toString()),
),
SizedBox(height: 6),
_buildRow(
"Country",
getRequestForCountry(
item["country_code"]!.toString(),
),
),
SizedBox(height: 6),
_buildRow("StartDate", item["start_date"]!),
SizedBox(height: 6),
_buildRow("Comments", item["comments"] ?? "N/A"),
],
), ),
), ),
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: [
// getRequestForCountry( // _infoBlock(
// item["country_code"]!.toString())), // "Visa Type",
// SizedBox(height: 6), // getRequestForCountry(
// _buildRow("StartDate:", item["start_date"]!), // item["country_code"]!.toString(),
// SizedBox(height: 6), // ) ??
// _buildRow("Comments:", item["comments"] ?? "N/A"), // "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,31 +592,37 @@ class VisaListWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
child: exceedsLimit child:
? Tooltip( exceedsLimit
message: wrapText(value, 50), ? Tooltip(
decoration: BoxDecoration( message: wrapText(value, 50),
color: Colors.grey.shade200, // Black background decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6), color: Colors.grey.shade200, // Black background
), borderRadius: BorderRadius.circular(6),
textStyle: ),
TextStyle(color: Colors.black), // Tooltip text color textStyle: TextStyle(
padding: EdgeInsets.all(8), color: Colors.black,
preferBelow: false, ), // Tooltip text color
child: Text(value.substring(0, limit) + "...", padding: EdgeInsets.all(8),
preferBelow: false,
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( ),
value, )
style: TextStyle( : Text(
value,
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(
title, width: 100,
style: GoogleFonts.poppins( child: Text(
fontSize: 12, title,
fontWeight: FontWeight.w600, style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
), ),
), ),
SizedBox(width: 8), SizedBox(width: 8),
Expanded( Expanded(
child: exceedsLimit child:
? Tooltip( exceedsLimit
message: wrapText(value, 50), ? Tooltip(
decoration: BoxDecoration( message: wrapText(value, 50),
color: Colors.grey.shade200, // Black background decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6), color: Colors.grey.shade200, // Black background
), borderRadius: BorderRadius.circular(6),
textStyle: ),
TextStyle(color: Colors.black), // Tooltip text color textStyle: TextStyle(
padding: EdgeInsets.all(8), color: Colors.black,
preferBelow: false, ), // Tooltip text color
child: Text(value.substring(0, limit) + "...", padding: EdgeInsets.all(8),
preferBelow: false,
child: Text(
value.substring(0, limit) + "...",
style: TextStyle(fontSize: 12), style: TextStyle(fontSize: 12),
overflow: TextOverflow.ellipsis), overflow: TextOverflow.ellipsis,
) ),
: Text( )
value, : Text(value, style: TextStyle(fontSize: 12)),
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">