UAE number page search functionality added
This commit is contained in:
parent
9368e08f91
commit
cd141bfcb4
@ -42,9 +42,7 @@ class UaeNumbers extends StatelessWidget {
|
|||||||
'UAE Numbers',
|
'UAE Numbers',
|
||||||
'أرقام الإمارات',
|
'أرقام الإمارات',
|
||||||
)),
|
)),
|
||||||
|
|
||||||
body: uaenumberWidget(),
|
body: uaenumberWidget(),
|
||||||
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -59,7 +57,9 @@ class uaenumberWidget extends ConsumerStatefulWidget {
|
|||||||
|
|
||||||
class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
|
class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
|
||||||
@override
|
@override
|
||||||
|
TextEditingController _searchController = TextEditingController();
|
||||||
List<dynamic> homePageData = [];
|
List<dynamic> homePageData = [];
|
||||||
|
List<dynamic> filteredData = [];
|
||||||
bool isLoading = true;
|
bool isLoading = true;
|
||||||
int? expandedIndex = 0;
|
int? expandedIndex = 0;
|
||||||
|
|
||||||
@ -68,6 +68,17 @@ class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
|
|||||||
super.initState();
|
super.initState();
|
||||||
final locale = ref.read(localeProvider);
|
final locale = ref.read(localeProvider);
|
||||||
fetchData(locale?.languageCode ?? 'en');
|
fetchData(locale?.languageCode ?? 'en');
|
||||||
|
_searchController.addListener(() {
|
||||||
|
setState(() {
|
||||||
|
filterData(_searchController.text);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_searchController.dispose();
|
||||||
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> fetchData(locale) async {
|
Future<void> fetchData(locale) async {
|
||||||
@ -77,7 +88,13 @@ class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
|
|||||||
final response = await http.get(Uri.parse(baseUrl + '?language=$locale'));
|
final response = await http.get(Uri.parse(baseUrl + '?language=$locale'));
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
setState(() {
|
setState(() {
|
||||||
homePageData = json.decode(response.body);
|
homePageData = (json.decode(response.body) as List)
|
||||||
|
.map((e) => Map<String, dynamic>.from(e))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
filteredData = List.from(homePageData);
|
||||||
|
// Show all initially
|
||||||
|
|
||||||
// print("HomeDAta $homePageData");
|
// print("HomeDAta $homePageData");
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
});
|
});
|
||||||
@ -92,6 +109,63 @@ class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void filterData(String query) {
|
||||||
|
if (query.isEmpty) {
|
||||||
|
setState(() {
|
||||||
|
filteredData = List.from(homePageData); // Reset if empty
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Map<String, dynamic>> tempList = [];
|
||||||
|
|
||||||
|
for (var mainTopic in homePageData) {
|
||||||
|
if (mainTopic["main_topic"].toLowerCase().contains(query.toLowerCase())) {
|
||||||
|
tempList.add(mainTopic);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Map<String, dynamic>> matchingSubTopics = [];
|
||||||
|
|
||||||
|
for (var subTopic in mainTopic["sub_topics"]) {
|
||||||
|
if (subTopic["sub_topic"].toLowerCase().contains(query.toLowerCase())) {
|
||||||
|
matchingSubTopics.add(subTopic);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Map<String, dynamic>> matchingTileData = [];
|
||||||
|
|
||||||
|
for (var tile in subTopic["tile_data"]) {
|
||||||
|
if (tile["data_set"].toLowerCase().contains(query.toLowerCase()) ||
|
||||||
|
tile["data_set_tile_heading"]
|
||||||
|
.toLowerCase()
|
||||||
|
.contains(query.toLowerCase())) {
|
||||||
|
matchingTileData.add(tile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (matchingTileData.isNotEmpty) {
|
||||||
|
matchingSubTopics.add({
|
||||||
|
...subTopic,
|
||||||
|
"tile_data": matchingTileData,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (matchingSubTopics.isNotEmpty) {
|
||||||
|
tempList.add({
|
||||||
|
...mainTopic,
|
||||||
|
"sub_topics": matchingSubTopics,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
filteredData = tempList;
|
||||||
|
print(filteredData); // Debugging: Check filtered output in console
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
ref.listen<Locale?>(localeProvider, (previous, next) {
|
ref.listen<Locale?>(localeProvider, (previous, next) {
|
||||||
final localeCode = next?.languageCode ?? 'en'; // Default to 'en' if null
|
final localeCode = next?.languageCode ?? 'en'; // Default to 'en' if null
|
||||||
@ -101,7 +175,8 @@ class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
|
|||||||
double mywidth = MediaQuery.of(context).size.width;
|
double mywidth = MediaQuery.of(context).size.width;
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(left: 16.0,right: 16.0,top: 5.0,bottom: 5.0),
|
padding:
|
||||||
|
const EdgeInsets.only(left: 16.0, right: 16.0, top: 5.0, bottom: 5.0),
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
@ -114,18 +189,21 @@ class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
|
|||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.only(left: 12.0),
|
padding: EdgeInsets.only(left: 12.0),
|
||||||
child: TextField(
|
child: TextField(
|
||||||
|
controller: _searchController,
|
||||||
|
onChanged: (value) {
|
||||||
|
filterData(
|
||||||
|
value); // Call filter function directly on input change
|
||||||
|
},
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "Search",
|
hintText: "Search",
|
||||||
hintStyle: TextStyle(color: Color(0xFF898C81)),
|
hintStyle: TextStyle(color: Color(0xFF898C81)),
|
||||||
|
|
||||||
|
|
||||||
prefixIcon: Image(
|
prefixIcon: Image(
|
||||||
image: ExactAssetImage(MiscIconAssetPath.search),
|
image: ExactAssetImage(MiscIconAssetPath.search),
|
||||||
width: 24,
|
width: 24,
|
||||||
height: 24,
|
height: 24,
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
||||||
// prefixIcon: Image.asset(
|
// prefixIcon: Image.asset(
|
||||||
// MiscIconAssetPath.search,
|
// MiscIconAssetPath.search,
|
||||||
// // fit: BoxFit.contain,
|
// // fit: BoxFit.contain,
|
||||||
@ -134,18 +212,19 @@ class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
|
|||||||
contentPadding:
|
contentPadding:
|
||||||
EdgeInsets.symmetric(vertical: 8.0, horizontal: 18.0),
|
EdgeInsets.symmetric(vertical: 8.0, horizontal: 18.0),
|
||||||
),
|
),
|
||||||
),),
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: myheight / 40,
|
height: myheight / 40,
|
||||||
),
|
),
|
||||||
...homePageData.map<Widget>((mainTopic) {
|
...filteredData.map<Widget>((mainTopic) {
|
||||||
String colorPattern = mainTopic['color_pattern'];
|
String colorPattern = mainTopic['color_pattern'];
|
||||||
print('colorPattern $colorPattern');
|
print('colorPattern $colorPattern');
|
||||||
Color backgroundColor = Color(int.parse(colorPattern));
|
Color backgroundColor = Color(int.parse(colorPattern));
|
||||||
print('backgroundColor $backgroundColor');
|
print('backgroundColor $backgroundColor');
|
||||||
Color borderColor = backgroundColor;
|
Color borderColor = backgroundColor;
|
||||||
int index = homePageData.indexOf(mainTopic);
|
int index = filteredData.indexOf(mainTopic);
|
||||||
bool isFirstTile = index == 0;
|
bool isFirstTile = index == 0;
|
||||||
|
|
||||||
return CustomExpandableTile(
|
return CustomExpandableTile(
|
||||||
@ -158,8 +237,8 @@ class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
|
|||||||
},
|
},
|
||||||
title: mainTopic['main_topic'],
|
title: mainTopic['main_topic'],
|
||||||
titleBackgroundColor: backgroundColor,
|
titleBackgroundColor: backgroundColor,
|
||||||
children: _buildSubTopics(mainTopic['sub_topics'] ?? [], mywidth,myheight,
|
children: _buildSubTopics(mainTopic['sub_topics'] ?? [], mywidth,
|
||||||
borderColor, colorPattern, mainTopic['main_topic']),
|
myheight, borderColor, colorPattern, mainTopic['main_topic']),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
@ -167,8 +246,8 @@ class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> _buildSubTopics(List<dynamic> subTopics, double myWidth,myheight,
|
List<Widget> _buildSubTopics(List<dynamic> subTopics, double myWidth,
|
||||||
Color borderColor, String colorPattern, mainTopic) {
|
myheight, Color borderColor, String colorPattern, mainTopic) {
|
||||||
print('colorPattern123 $borderColor');
|
print('colorPattern123 $borderColor');
|
||||||
// Sort sub-topics based on `sub_topic_list_order`
|
// Sort sub-topics based on `sub_topic_list_order`
|
||||||
subTopics.sort((a, b) => (a['sub_topic_list_order'] ?? 0)
|
subTopics.sort((a, b) => (a['sub_topic_list_order'] ?? 0)
|
||||||
@ -209,7 +288,6 @@ class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
|
|||||||
? myWidth
|
? myWidth
|
||||||
: (myWidth - 16) / 2.6; // Subtract spacing for padding
|
: (myWidth - 16) / 2.6; // Subtract spacing for padding
|
||||||
|
|
||||||
|
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding:
|
padding:
|
||||||
@ -275,7 +353,6 @@ class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
|
|||||||
Color boldColor,
|
Color boldColor,
|
||||||
colorPattern,
|
colorPattern,
|
||||||
double mywidth,
|
double mywidth,
|
||||||
|
|
||||||
String mainTopic) {
|
String mainTopic) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
@ -305,18 +382,16 @@ class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
|
|||||||
borderRadius:
|
borderRadius:
|
||||||
BorderRadius.circular(12), // Optional: Rounded corners
|
BorderRadius.circular(12), // Optional: Rounded corners
|
||||||
),
|
),
|
||||||
padding: const EdgeInsets.only(top: 3.0, bottom: 3.0, left: 5.0, right: 5.0),
|
padding: const EdgeInsets.only(
|
||||||
|
top: 3.0, bottom: 3.0, left: 5.0, right: 5.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
title,
|
title,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: robotoRegular11,
|
style: robotoRegular11,
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
||||||
SizedBox(height: 0.1),
|
SizedBox(height: 0.1),
|
||||||
Text(subtitle, textAlign: TextAlign.center, style: subtitleStyle),
|
Text(subtitle, textAlign: TextAlign.center, style: subtitleStyle),
|
||||||
SizedBox(height: 0.3),
|
SizedBox(height: 0.3),
|
||||||
@ -377,13 +452,13 @@ class _CustomExpandableTileState extends State<CustomExpandableTile> {
|
|||||||
onTap: () => widget.onTap(widget.index),
|
onTap: () => widget.onTap(widget.index),
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white, // Ensuring the background outside the rounded container is white
|
color: Colors
|
||||||
|
.white, // Ensuring the background outside the rounded container is white
|
||||||
),
|
),
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: widget.titleBackgroundColor,
|
color: widget.titleBackgroundColor,
|
||||||
borderRadius: BorderRadius.all(Radius.circular(35))
|
borderRadius: BorderRadius.all(Radius.circular(35))),
|
||||||
),
|
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: 16, bottom: 5, top: 5, right: 10),
|
left: 16, bottom: 5, top: 5, right: 10),
|
||||||
child: Row(
|
child: Row(
|
||||||
|
|||||||
@ -2051,13 +2051,16 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.all(4),
|
padding: EdgeInsets.all(4),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: isBookmarked ?Colors.white.withAlpha(90):null, // Background color
|
color: isBookmarked
|
||||||
borderRadius: BorderRadius.circular(8), // Curved corners
|
? Colors.white.withAlpha(90)
|
||||||
|
: null, // Background color
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
8), // Curved corners
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
isBookmarked?
|
isBookmarked
|
||||||
Text(
|
? Text(
|
||||||
context.translate(
|
context.translate(
|
||||||
'Bookmarked',
|
'Bookmarked',
|
||||||
'إشارة مرجعية',
|
'إشارة مرجعية',
|
||||||
@ -2065,11 +2068,14 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
color: Color(int.parse(
|
color: Color(int.parse(
|
||||||
(chartScreenData['body_color'] ?? '#898C81')
|
(chartScreenData[
|
||||||
.replaceFirst('#', '0xff'))),
|
'body_color'] ??
|
||||||
|
'#898C81')
|
||||||
|
.replaceFirst(
|
||||||
|
'#', '0xff'))),
|
||||||
),
|
),
|
||||||
):
|
)
|
||||||
Text(
|
: Text(
|
||||||
context.translate(
|
context.translate(
|
||||||
'Bookmark',
|
'Bookmark',
|
||||||
'إشارة مرجعية',
|
'إشارة مرجعية',
|
||||||
@ -2103,8 +2109,11 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
Icons.bookmarks_rounded,
|
Icons.bookmarks_rounded,
|
||||||
color: isBookmarked
|
color: isBookmarked
|
||||||
? Color(int.parse(
|
? Color(int.parse(
|
||||||
(chartScreenData['body_color'] ?? '#898C81')
|
(chartScreenData[
|
||||||
.replaceFirst('#', '0xff')))
|
'body_color'] ??
|
||||||
|
'#898C81')
|
||||||
|
.replaceFirst(
|
||||||
|
'#', '0xff')))
|
||||||
: Colors.white,
|
: Colors.white,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -2134,8 +2143,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
semanticsLabel: 'share',
|
semanticsLabel: 'share',
|
||||||
width: 24,
|
width: 24,
|
||||||
height: 24,
|
height: 24,
|
||||||
)
|
)),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -2274,6 +2282,9 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
print('item item item $item');
|
print('item item item $item');
|
||||||
final chart_type = item['chart_type'];
|
final chart_type = item['chart_type'];
|
||||||
final chart_heading = item['chart_heading'];
|
final chart_heading = item['chart_heading'];
|
||||||
|
final card_full_length =
|
||||||
|
item['card_full_length'];
|
||||||
|
print('cardfulllength $card_full_length');
|
||||||
final response =
|
final response =
|
||||||
item['response'] as List<dynamic>? ??
|
item['response'] as List<dynamic>? ??
|
||||||
[];
|
[];
|
||||||
@ -2287,11 +2298,15 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
chart_type == 'averages')
|
chart_type == 'averages')
|
||||||
? 180.0
|
? 180.0
|
||||||
: 130.0;
|
: 130.0;
|
||||||
|
// double myheight = MediaQuery.of(context).size.height;
|
||||||
|
// double mywidth = MediaQuery.of(context).size.width;
|
||||||
|
// final cardWidth = rowItems.length == 1 ? myWidth : (myWidth - 16) / 2.6;
|
||||||
|
print('find width $cardData');
|
||||||
final itemdata = cardData[index];
|
final itemdata = cardData[index];
|
||||||
bool isLastSingleCard =
|
// bool isOddLength = cardData.length % 2 != 0;
|
||||||
(index == cardData.length - 1 &&
|
// bool isLastSingleCard = isOddLength &&
|
||||||
cardData.length % 2 != 0);
|
// index == cardData.length - 1;
|
||||||
|
// print('isLastSingleCard $isLastSingleCard');
|
||||||
|
|
||||||
if (response.isEmpty) {
|
if (response.isEmpty) {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
@ -2302,7 +2317,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
if (response.length == 1) {
|
if (response.length == 1) {
|
||||||
return Container(
|
return Container(
|
||||||
margin: const EdgeInsets.all(10),
|
margin: const EdgeInsets.all(10),
|
||||||
width: isLastSingleCard
|
width: card_full_length
|
||||||
? double.infinity
|
? double.infinity
|
||||||
: null,
|
: null,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -2359,91 +2374,123 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(height: 1),
|
const SizedBox(height: 1),
|
||||||
Flexible(
|
MouseRegion(
|
||||||
fit: FlexFit.loose,
|
onEnter: (event) {
|
||||||
// child: FittedBox(
|
// Show tooltip on hover
|
||||||
|
final overlay = Overlay
|
||||||
|
.of(context)
|
||||||
|
.context
|
||||||
|
.findRenderObject()
|
||||||
|
as RenderBox;
|
||||||
|
final entry =
|
||||||
|
OverlayEntry(
|
||||||
|
builder: (context) =>
|
||||||
|
Positioned(
|
||||||
|
left: overlay
|
||||||
|
.localToGlobal(
|
||||||
|
Offset.zero)
|
||||||
|
.dx,
|
||||||
|
top: overlay
|
||||||
|
.localToGlobal(
|
||||||
|
Offset.zero)
|
||||||
|
.dy,
|
||||||
|
child: Material(
|
||||||
|
color: Colors
|
||||||
|
.transparent,
|
||||||
|
child: Container(
|
||||||
|
padding:
|
||||||
|
EdgeInsets
|
||||||
|
.all(8),
|
||||||
|
decoration:
|
||||||
|
BoxDecoration(
|
||||||
|
color: Colors
|
||||||
|
.black87,
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius
|
||||||
|
.circular(
|
||||||
|
4),
|
||||||
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
'${chart_heading ?? 'NA'}',
|
chart_heading ??
|
||||||
|
'NA',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors
|
||||||
|
.white),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
Overlay.of(context)
|
||||||
|
.insert(entry);
|
||||||
|
Future.delayed(
|
||||||
|
Duration(seconds: 2),
|
||||||
|
() => entry.remove());
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
chart_heading ?? 'NA',
|
||||||
textAlign:
|
textAlign:
|
||||||
TextAlign.center,
|
TextAlign.center,
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
// Limit to 2 lines
|
overflow: TextOverflow
|
||||||
softWrap: true,
|
.ellipsis, // Truncate text with '...'
|
||||||
// Enable soft wrapping
|
|
||||||
// overflow: TextOverflow.ellipsis, // Handle overflow gracefully
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 9,
|
fontSize: 11,
|
||||||
fontWeight:
|
fontWeight:
|
||||||
FontWeight.w400,
|
FontWeight.w400,
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// ),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 5),
|
const SizedBox(height: 5),
|
||||||
Flexible(
|
Text(
|
||||||
fit: FlexFit.loose,
|
|
||||||
child: SizedBox(
|
|
||||||
height: 20.0,
|
|
||||||
child: FittedBox(
|
|
||||||
child: Text(
|
|
||||||
// '(${response[0]['display_value'] ?? 'NA'})',
|
|
||||||
RegExp(r'\d').hasMatch(
|
RegExp(r'\d').hasMatch(
|
||||||
response[0][
|
response[0][
|
||||||
'display_value'] ??
|
'display_value'] ??
|
||||||
'')
|
'')
|
||||||
? '(${response[0]['display_value'] ?? 'NA'})'
|
? '(${response[0]['display_value'] ?? 'NA'})'
|
||||||
: '${response[0]['display_value'] ?? 'NA'}',
|
: '${response[0]['display_value'] ?? 'NA'}',
|
||||||
style:
|
style: const TextStyle(
|
||||||
const TextStyle(
|
fontSize: 11,
|
||||||
fontSize: 10,
|
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
overflow:
|
overflow: TextOverflow
|
||||||
TextOverflow
|
.ellipsis, // Truncate if text overflows
|
||||||
.ellipsis,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
maxLines:
|
||||||
|
1, // Limit to one line to prevent overflow
|
||||||
|
textAlign: TextAlign
|
||||||
|
.center, // Ensure proper alignment
|
||||||
),
|
),
|
||||||
const SizedBox(height: 1),
|
const SizedBox(height: 1),
|
||||||
Flexible(
|
Row(
|
||||||
fit: FlexFit.loose,
|
mainAxisAlignment:
|
||||||
child: SizedBox(
|
MainAxisAlignment
|
||||||
height: 50.0,
|
.center, // Center-aligns the row contents
|
||||||
child: FittedBox(
|
|
||||||
fit: BoxFit.contain,
|
|
||||||
child: Row(
|
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
response[0][
|
response[0]['value'] ??
|
||||||
'value'] ??
|
|
||||||
'NA',
|
'NA',
|
||||||
// '${data['roundedAverage'] ??
|
textAlign: TextAlign
|
||||||
// 'NA'}',
|
.center, // Ensures text is centered
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18,
|
fontSize: 23,
|
||||||
fontWeight:
|
fontWeight:
|
||||||
FontWeight
|
FontWeight.w800,
|
||||||
.w800,
|
color: (response[0][
|
||||||
color: response[0]
|
'font_color'] ??
|
||||||
[
|
'')
|
||||||
'calculation'] ==
|
.isEmpty
|
||||||
'different'
|
? bodyColor
|
||||||
? _getColorFromHex(
|
: _getColorFromHex(
|
||||||
response[0]
|
response[0][
|
||||||
[
|
'font_color']),
|
||||||
'font_color'])
|
|
||||||
: bodyColor,
|
|
||||||
// color: Color(
|
|
||||||
// 0xFF90B0D5),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width:
|
width:
|
||||||
1), // Space between text and icon
|
4), // Space between text and icon
|
||||||
if (response[0][
|
if (response[0]
|
||||||
'calculation'] ==
|
['calculation'] ==
|
||||||
'different') ...[
|
'different') ...[
|
||||||
if (response[0][
|
if (response[0][
|
||||||
'font_color'] ==
|
'font_color'] ==
|
||||||
@ -2451,25 +2498,20 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
const Icon(
|
const Icon(
|
||||||
Icons
|
Icons
|
||||||
.arrow_downward,
|
.arrow_downward,
|
||||||
color: Colors
|
color: Colors.red,
|
||||||
.red,
|
|
||||||
size: 20)
|
size: 20)
|
||||||
else if (response[
|
else if (response[0][
|
||||||
0][
|
|
||||||
'font_color'] ==
|
'font_color'] ==
|
||||||
'#11AF22')
|
'#11AF22')
|
||||||
const Icon(
|
const Icon(
|
||||||
Icons
|
Icons
|
||||||
.arrow_upward,
|
.arrow_upward,
|
||||||
color: Colors
|
color:
|
||||||
.green,
|
Colors.green,
|
||||||
size: 20),
|
size: 20),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
),
|
)
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2477,7 +2519,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
} else {
|
} else {
|
||||||
return Container(
|
return Container(
|
||||||
margin: const EdgeInsets.all(10),
|
margin: const EdgeInsets.all(10),
|
||||||
width: isLastSingleCard
|
width: card_full_length
|
||||||
? double.infinity
|
? double.infinity
|
||||||
: null,
|
: null,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -2532,23 +2574,61 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(height: 3),
|
const SizedBox(height: 3),
|
||||||
Flexible(
|
MouseRegion(
|
||||||
fit: FlexFit.loose,
|
onEnter: (event) {
|
||||||
child: FittedBox(
|
final overlay =
|
||||||
child: SizedBox(
|
Overlay.of(context);
|
||||||
// height: 70.0,
|
final entry = OverlayEntry(
|
||||||
|
builder: (context) =>
|
||||||
|
Positioned(
|
||||||
|
left: event.position.dx,
|
||||||
|
top: event.position.dy +
|
||||||
|
10, // Adjust tooltip position
|
||||||
|
child: Material(
|
||||||
|
color: Colors
|
||||||
|
.transparent,
|
||||||
|
child: Container(
|
||||||
|
padding:
|
||||||
|
EdgeInsets.all(
|
||||||
|
8),
|
||||||
|
decoration:
|
||||||
|
BoxDecoration(
|
||||||
|
color: Colors
|
||||||
|
.black87,
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius
|
||||||
|
.circular(
|
||||||
|
4),
|
||||||
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
'${chart_heading ?? 'NA'}',
|
chart_heading ??
|
||||||
// "TOTAL",
|
'NA',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors
|
||||||
|
.white,
|
||||||
|
fontSize: 10),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
overlay.insert(entry);
|
||||||
|
Future.delayed(
|
||||||
|
Duration(seconds: 2),
|
||||||
|
() => entry.remove());
|
||||||
|
},
|
||||||
|
child: SizedBox(
|
||||||
|
width: double
|
||||||
|
.infinity, // Ensures it uses available space
|
||||||
|
child: Text(
|
||||||
|
chart_heading ?? 'NA',
|
||||||
textAlign:
|
textAlign:
|
||||||
TextAlign.center,
|
TextAlign.center,
|
||||||
maxLines:
|
maxLines: 2,
|
||||||
2, // Limit to 2 lines
|
overflow: TextOverflow
|
||||||
softWrap:
|
.ellipsis, // Truncate with '...'
|
||||||
true, // Enable soft wrapping
|
|
||||||
// overflow: TextOverflow.ellipsis, // Handle overflow gracefully
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 8,
|
fontSize: 11,
|
||||||
fontWeight:
|
fontWeight:
|
||||||
FontWeight.w400,
|
FontWeight.w400,
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
@ -2556,7 +2636,6 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
const SizedBox(height: 1),
|
const SizedBox(height: 1),
|
||||||
Text(
|
Text(
|
||||||
// '(${response[0]['display_value'] ?? 'NA'})',
|
// '(${response[0]['display_value'] ?? 'NA'})',
|
||||||
@ -2569,38 +2648,30 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
: '${response[0]['display_value'] ?? 'NA'}',
|
: '${response[0]['display_value'] ?? 'NA'}',
|
||||||
|
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 10,
|
fontSize: 11,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
overflow:
|
overflow:
|
||||||
TextOverflow.ellipsis,
|
TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 1),
|
const SizedBox(height: 1),
|
||||||
Flexible(
|
Text(
|
||||||
fit: FlexFit.loose,
|
response[0]['value'] ?? 'NA',
|
||||||
child: FittedBox(
|
overflow: TextOverflow
|
||||||
fit: BoxFit.contain,
|
.ellipsis, // Truncate text if it overflows
|
||||||
child: Text(
|
maxLines:
|
||||||
response[0]['value'] ??
|
1, // Ensures text stays in a single line
|
||||||
'NA',
|
|
||||||
|
|
||||||
// apiService.formatAmount(
|
|
||||||
// data['lastYearValue']),
|
|
||||||
// apiService.formatAmount(
|
|
||||||
// data['lastYearValue']),
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18,
|
fontSize: 23,
|
||||||
fontWeight:
|
fontWeight: FontWeight.w900,
|
||||||
FontWeight.w900,
|
color: (response[0][
|
||||||
color: response[0][
|
'font_color'] ??
|
||||||
'calculation'] ==
|
'')
|
||||||
'different'
|
.isEmpty
|
||||||
? _getColorFromHex(
|
? bodyColor
|
||||||
response[0][
|
: _getColorFromHex(
|
||||||
'font_color'])
|
response[0]
|
||||||
: bodyColor,
|
['font_color']),
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -2612,30 +2683,25 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
1, // Divider line thickness
|
1, // Divider line thickness
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Flexible(
|
Text(
|
||||||
fit: FlexFit.loose,
|
response[1]['value'] ?? 'NA',
|
||||||
child: FittedBox(
|
|
||||||
fit: BoxFit.contain,
|
|
||||||
child: Text(
|
|
||||||
response[1]['value'] ??
|
|
||||||
'NA',
|
|
||||||
// apiService.formatAmount(
|
|
||||||
// data['secondLastYearValue']),
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 16,
|
||||||
fontWeight:
|
fontWeight: FontWeight.w600,
|
||||||
FontWeight.w600,
|
color: (response[1][
|
||||||
color: response[1][
|
'font_color'] ??
|
||||||
'calculation'] ==
|
'')
|
||||||
'different'
|
.isEmpty
|
||||||
? _getColorFromHex(
|
? const Color(
|
||||||
response[0][
|
0xFFD83731)
|
||||||
'font_color'])
|
: _getColorFromHex(
|
||||||
: const Color(
|
response[1]
|
||||||
0xFFD83731),
|
['font_color']),
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
textAlign: TextAlign
|
||||||
|
.center, // Ensure proper alignment
|
||||||
|
overflow: TextOverflow
|
||||||
|
.ellipsis, // Truncate if text overflows
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
// '(${response[1]['display_value'] ?? 'NA'})',
|
// '(${response[1]['display_value'] ?? 'NA'})',
|
||||||
@ -2646,7 +2712,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
? '(${response[1]['display_value'] ?? 'NA'})'
|
? '(${response[1]['display_value'] ?? 'NA'})'
|
||||||
: '${response[1]['display_value'] ?? 'NA'}',
|
: '${response[1]['display_value'] ?? 'NA'}',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 9,
|
fontSize: 8,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
overflow:
|
overflow:
|
||||||
@ -2783,6 +2849,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> shareCurrentPage(BuildContext context) async {
|
Future<void> shareCurrentPage(BuildContext context) async {
|
||||||
try {
|
try {
|
||||||
// Get current route from go_router
|
// Get current route from go_router
|
||||||
@ -2798,7 +2865,8 @@ Future<void> shareCurrentPage(BuildContext context) async {
|
|||||||
width: 200,
|
width: 200,
|
||||||
height: 200,
|
height: 200,
|
||||||
);
|
);
|
||||||
final Uint8List? capturedImage = await screenshotController.captureFromWidget(
|
final Uint8List? capturedImage =
|
||||||
|
await screenshotController.captureFromWidget(
|
||||||
Material(child: svgWidget),
|
Material(child: svgWidget),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -2824,6 +2892,7 @@ Future<void> shareCurrentPage(BuildContext context) async {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to convert hex color string to Color
|
// Function to convert hex color string to Color
|
||||||
Color _getColorFromHex(String hexColor) {
|
Color _getColorFromHex(String hexColor) {
|
||||||
hexColor = hexColor.replaceFirst('#', '');
|
hexColor = hexColor.replaceFirst('#', '');
|
||||||
|
|||||||
@ -195,45 +195,124 @@ class _MyHomePageState extends ConsumerState<MyHomePage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _showExitConfirmation(BuildContext context) {
|
void _showExitConfirmation(BuildContext context) {
|
||||||
|
double myheight = MediaQuery.of(context).size.height;
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AlertDialog(
|
barrierDismissible: false, // User must tap a button to dismiss dialog
|
||||||
|
builder: (dialogContext) => AlertDialog(
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(5.0), // Rounded corners
|
||||||
|
),
|
||||||
|
contentPadding: EdgeInsets.zero,
|
||||||
title: Text(
|
title: Text(
|
||||||
context.translate(
|
context.translate('Log Out Confirmation', 'تأكيد تسجيل الخروج'),
|
||||||
'Logout',
|
textAlign: TextAlign.center,
|
||||||
'تسجيل الخروج',
|
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
|
content: Padding(
|
||||||
|
padding: const EdgeInsets.all(20.0),
|
||||||
|
child: Text(
|
||||||
|
context.translate('Are you sure you want to log out?',
|
||||||
|
'هل أنت متأكد أنك تريد تسجيل الخروج؟'),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
color: Color(0xFF898C81),
|
||||||
),
|
),
|
||||||
content: Text(
|
|
||||||
context.translate(
|
|
||||||
'Are you sure you want to logout?',
|
|
||||||
'هل أنت متأكد أنك تريد تسجيل الخروج؟',
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
Row(
|
||||||
onPressed: () => Navigator.of(context).pop(), // Close dialog
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceEvenly, // Space buttons evenly
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 120, // Set button width
|
||||||
|
child: TextButton(
|
||||||
|
onPressed: () => Navigator.pop(dialogContext),
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
|
),
|
||||||
|
side: BorderSide(
|
||||||
|
color: Color(0xFFAA8E83), // Border color
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
context.translate(
|
context.translate('Cancel', 'إلغاء'),
|
||||||
'Cancel',
|
style: TextStyle(
|
||||||
'إلغاء',
|
color: Color(0xFFAA8E83),
|
||||||
|
fontSize: 16,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextButton(
|
),
|
||||||
onPressed: () => logout(context), // Exit the app
|
SizedBox(
|
||||||
|
width: 120, // Set button width
|
||||||
|
child: TextButton(
|
||||||
|
onPressed: () => logout(context),
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
backgroundColor: Color(0xFFAA8E83), // Background color
|
||||||
|
foregroundColor: Colors.white,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
context.translate(
|
context.translate('Log Out', 'تسجيل الخروج'),
|
||||||
'Logout',
|
style: TextStyle(color: Colors.white, fontSize: 16),
|
||||||
'تسجيل الخروج',
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
SizedBox(height: 10), // Add spacing below buttons
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// void _showExitConfirmation(BuildContext context) {
|
||||||
|
// showDialog(
|
||||||
|
// context: context,
|
||||||
|
// builder: (context) => AlertDialog(
|
||||||
|
// title: Text(
|
||||||
|
// context.translate(
|
||||||
|
// 'Logout',
|
||||||
|
// 'تسجيل الخروج',
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// content: Text(
|
||||||
|
// context.translate(
|
||||||
|
// 'Are you sure you want to logout?',
|
||||||
|
// 'هل أنت متأكد أنك تريد تسجيل الخروج؟',
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// actions: [
|
||||||
|
// TextButton(
|
||||||
|
// onPressed: () => Navigator.of(context).pop(), // Close dialog
|
||||||
|
// child: Text(
|
||||||
|
// context.translate(
|
||||||
|
// 'Cancel',
|
||||||
|
// 'إلغاء',
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// TextButton(
|
||||||
|
// onPressed: () => logout(context), // Exit the app
|
||||||
|
// child: Text(
|
||||||
|
// context.translate(
|
||||||
|
// 'Logout',
|
||||||
|
// 'تسجيل الخروج',
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
double myheight = MediaQuery.of(context).size.height;
|
double myheight = MediaQuery.of(context).size.height;
|
||||||
@ -422,7 +501,9 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
iconSize: 20,
|
iconSize: 20,
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
locale.languageCode == 'ar' ?Icons.arrow_back : Icons.arrow_forward,
|
locale.languageCode == 'ar'
|
||||||
|
? Icons.arrow_back
|
||||||
|
: Icons.arrow_forward,
|
||||||
color: Colors.white),
|
color: Colors.white),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
tutorialCoachMark.next();
|
tutorialCoachMark.next();
|
||||||
@ -440,11 +521,11 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
TargetContent(
|
TargetContent(
|
||||||
padding: EdgeInsets.only(left:locale.languageCode == 'ar'
|
padding: EdgeInsets.only(
|
||||||
? 0
|
left: locale.languageCode == 'ar' ? 0 : screenWidth * 0.4,
|
||||||
: screenWidth * 0.4, bottom: 0,right:locale.languageCode == 'ar'
|
bottom: 0,
|
||||||
? screenWidth * 0.4
|
right: locale.languageCode == 'ar' ? screenWidth * 0.4 : 0,
|
||||||
: 0 ,),
|
),
|
||||||
align: ContentAlign.bottom,
|
align: ContentAlign.bottom,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 200,
|
width: 200,
|
||||||
@ -528,16 +609,25 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
Container(
|
Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: locale.languageCode=='ar' ? Color(0xFF7DAFBC):null,
|
color: locale.languageCode == 'ar'
|
||||||
|
? Color(0xFF7DAFBC)
|
||||||
|
: null,
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color:locale.languageCode=='ar' ? Color(0xFF7DAFBC): Colors.white, width: 2.0),
|
color: locale.languageCode == 'ar'
|
||||||
|
? Color(0xFF7DAFBC)
|
||||||
|
: Colors.white,
|
||||||
|
width: 2.0),
|
||||||
),
|
),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
iconSize: 20,
|
iconSize: 20,
|
||||||
icon: Icon(Icons.arrow_back,
|
icon: Icon(
|
||||||
color: Colors.white,),
|
Icons.arrow_back,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
locale.languageCode=='ar' ?tutorialCoachMark.next() : tutorialCoachMark.previous();
|
locale.languageCode == 'ar'
|
||||||
|
? tutorialCoachMark.next()
|
||||||
|
: tutorialCoachMark.previous();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -545,16 +635,23 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
Container(
|
Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: locale.languageCode=='ar' ? null:Color(0xFF7DAFBC),
|
color: locale.languageCode == 'ar'
|
||||||
|
? null
|
||||||
|
: Color(0xFF7DAFBC),
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color:locale.languageCode=='ar' ? Colors.white: Color(0xFF7DAFBC), width: 1),
|
color: locale.languageCode == 'ar'
|
||||||
|
? Colors.white
|
||||||
|
: Color(0xFF7DAFBC),
|
||||||
|
width: 1),
|
||||||
),
|
),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
iconSize: 20,
|
iconSize: 20,
|
||||||
icon: Icon(Icons.arrow_forward,
|
icon: Icon(Icons.arrow_forward,
|
||||||
color: Colors.white),
|
color: Colors.white),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
locale.languageCode=='ar' ?tutorialCoachMark.previous() : tutorialCoachMark.next();
|
locale.languageCode == 'ar'
|
||||||
|
? tutorialCoachMark.previous()
|
||||||
|
: tutorialCoachMark.next();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -570,9 +667,11 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
TargetContent(
|
TargetContent(
|
||||||
padding: EdgeInsets.only(left:locale.languageCode == 'ar'
|
padding: EdgeInsets.only(
|
||||||
? 0: screenWidth * 0.4, bottom: 0, right: locale.languageCode == 'en'
|
left: locale.languageCode == 'ar' ? 0 : screenWidth * 0.4,
|
||||||
? 0: screenWidth * 0.4, ),
|
bottom: 0,
|
||||||
|
right: locale.languageCode == 'en' ? 0 : screenWidth * 0.4,
|
||||||
|
),
|
||||||
align: ContentAlign.bottom,
|
align: ContentAlign.bottom,
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 200,
|
width: 200,
|
||||||
@ -685,21 +784,36 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
Container(
|
Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: locale.languageCode=='ar' ? Color(0xFF7DAFBC):null,
|
color: locale.languageCode == 'ar'
|
||||||
|
? Color(0xFF7DAFBC)
|
||||||
|
: null,
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color:locale.languageCode=='ar' ? Color(0xFF7DAFBC): Colors.white, width: 2.0,),
|
color: locale.languageCode == 'ar'
|
||||||
|
? Color(0xFF7DAFBC)
|
||||||
|
: Colors.white,
|
||||||
|
width: 2.0,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
iconSize: 20,
|
iconSize: 20,
|
||||||
icon: Icon(Icons.arrow_back,
|
icon: Icon(
|
||||||
color: Colors.white,),
|
Icons.arrow_back,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (locale.languageCode == 'ar') {
|
if (locale.languageCode == 'ar') {
|
||||||
tutorialCoachMark.finish();
|
tutorialCoachMark.finish();
|
||||||
ref.read(previousHomeTourProvider.notifier).state = true;
|
ref
|
||||||
ref.read(chartsTourProvider.notifier).state = false;
|
.read(previousHomeTourProvider
|
||||||
|
.notifier)
|
||||||
|
.state = true;
|
||||||
|
ref
|
||||||
|
.read(
|
||||||
|
chartsTourProvider.notifier)
|
||||||
|
.state = false;
|
||||||
context.go(
|
context.go(
|
||||||
'/chartScreen/hotels?bgColor=0xFF90B0D5&mainTopic=ECONOMY&title=Hotel+Establishments',);
|
'/chartScreen/hotels?bgColor=0xFF90B0D5&mainTopic=ECONOMY&title=Hotel+Establishments',
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
tutorialCoachMark.next();
|
tutorialCoachMark.next();
|
||||||
}
|
}
|
||||||
@ -710,9 +824,15 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
Container(
|
Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: locale.languageCode=='ar' ? null:Color(0xFF7DAFBC),
|
color: locale.languageCode == 'ar'
|
||||||
|
? null
|
||||||
|
: Color(0xFF7DAFBC),
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color:locale.languageCode=='ar' ? Colors.white: Color(0xFF7DAFBC), width: 1,),
|
color: locale.languageCode == 'ar'
|
||||||
|
? Colors.white
|
||||||
|
: Color(0xFF7DAFBC),
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
iconSize: 20,
|
iconSize: 20,
|
||||||
@ -723,8 +843,14 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
tutorialCoachMark.next();
|
tutorialCoachMark.next();
|
||||||
} else {
|
} else {
|
||||||
tutorialCoachMark.finish();
|
tutorialCoachMark.finish();
|
||||||
ref.read(previousHomeTourProvider.notifier).state = true;
|
ref
|
||||||
ref.read(chartsTourProvider.notifier).state = false;
|
.read(previousHomeTourProvider
|
||||||
|
.notifier)
|
||||||
|
.state = true;
|
||||||
|
ref
|
||||||
|
.read(
|
||||||
|
chartsTourProvider.notifier)
|
||||||
|
.state = false;
|
||||||
context.go(
|
context.go(
|
||||||
'/chartScreen/hotels?bgColor=0xFF90B0D5&mainTopic=ECONOMY&title=Hotel+Establishments');
|
'/chartScreen/hotels?bgColor=0xFF90B0D5&mainTopic=ECONOMY&title=Hotel+Establishments');
|
||||||
}
|
}
|
||||||
@ -745,9 +871,11 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
TargetContent(
|
TargetContent(
|
||||||
padding: EdgeInsets.only(left:locale.languageCode == 'ar'
|
padding: EdgeInsets.only(
|
||||||
? 0: screenWidth * 0.4, bottom: 0, right: locale.languageCode == 'en'
|
left: locale.languageCode == 'ar' ? 0 : screenWidth * 0.4,
|
||||||
? 0: screenWidth * 0.4, ),
|
bottom: 0,
|
||||||
|
right: locale.languageCode == 'en' ? 0 : screenWidth * 0.4,
|
||||||
|
),
|
||||||
align: ContentAlign.bottom,
|
align: ContentAlign.bottom,
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 200,
|
width: 200,
|
||||||
@ -838,8 +966,12 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
),
|
),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
iconSize: 20,
|
iconSize: 20,
|
||||||
icon: Icon(locale.languageCode == 'ar' ?Icons.arrow_back : Icons.arrow_forward ,
|
icon: Icon(
|
||||||
color: Colors.white,),
|
locale.languageCode == 'ar'
|
||||||
|
? Icons.arrow_back
|
||||||
|
: Icons.arrow_forward,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
tutorialCoachMark.previous();
|
tutorialCoachMark.previous();
|
||||||
},
|
},
|
||||||
@ -857,8 +989,11 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
TargetContent(
|
TargetContent(
|
||||||
padding: EdgeInsets.only(left:locale.languageCode == 'ar' ? 0 : screenWidth * 0.4, bottom: 0,
|
padding: EdgeInsets.only(
|
||||||
right:locale.languageCode == 'ar' ? screenWidth * 0.4 : 0 ,),
|
left: locale.languageCode == 'ar' ? 0 : screenWidth * 0.4,
|
||||||
|
bottom: 0,
|
||||||
|
right: locale.languageCode == 'ar' ? screenWidth * 0.4 : 0,
|
||||||
|
),
|
||||||
align: ContentAlign.bottom,
|
align: ContentAlign.bottom,
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 200,
|
width: 200,
|
||||||
@ -1048,7 +1183,8 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
RoundedCornerContainer(
|
RoundedCornerContainer(
|
||||||
key: mainTopic['main_topic'] == 'ECONOMY' || mainTopic['main_topic'] == 'اقتصاد'
|
key: mainTopic['main_topic'] == 'ECONOMY' ||
|
||||||
|
mainTopic['main_topic'] == 'اقتصاد'
|
||||||
? cardTopicKey
|
? cardTopicKey
|
||||||
: null,
|
: null,
|
||||||
text: mainTopic['main_topic'],
|
text: mainTopic['main_topic'],
|
||||||
@ -1062,7 +1198,8 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: myheight / 4.8, // Set dynamic height
|
height: myheight / 4.8, // Set dynamic height
|
||||||
child: Container(
|
child: Container(
|
||||||
key: mainTopic['main_topic'] == 'ECONOMY' || mainTopic['main_topic'] == 'اقتصاد'
|
key: mainTopic['main_topic'] == 'ECONOMY' ||
|
||||||
|
mainTopic['main_topic'] == 'اقتصاد'
|
||||||
? cardsKey
|
? cardsKey
|
||||||
: null,
|
: null,
|
||||||
// color: Colors.grey[200], // Set a background color for the scrollable container
|
// color: Colors.grey[200], // Set a background color for the scrollable container
|
||||||
|
|||||||
@ -55,7 +55,8 @@ class _ManageUserRouterState extends State<ManageUserRouter> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
userData = result.map((record) {
|
userData = result.map((record) {
|
||||||
final createdDate = DateTime.parse(record.created).add(Duration(hours: 4));// Parse the created date
|
final createdDate = DateTime.parse(record.created)
|
||||||
|
.add(Duration(hours: 4)); // Parse the created date
|
||||||
final formattedDate = DateFormat('dd/MM/yyyy').format(createdDate);
|
final formattedDate = DateFormat('dd/MM/yyyy').format(createdDate);
|
||||||
return User(
|
return User(
|
||||||
id: record.id, // Correctly passing the ID
|
id: record.id, // Correctly passing the ID
|
||||||
@ -72,7 +73,6 @@ class _ManageUserRouterState extends State<ManageUserRouter> {
|
|||||||
return dateB.compareTo(dateA);
|
return dateB.compareTo(dateA);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
filteredUserData = List.from(userData);
|
filteredUserData = List.from(userData);
|
||||||
|
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
@ -341,28 +341,24 @@ class _ManageUserRouterState extends State<ManageUserRouter> {
|
|||||||
child: TextField(
|
child: TextField(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "Search",
|
hintText: "Search",
|
||||||
hintStyle: const TextStyle(
|
hintStyle: TextStyle(color: Color(0xFF898C81)),
|
||||||
color: Color(0xFFC3C6CB),
|
|
||||||
fontSize: 14,
|
|
||||||
),
|
|
||||||
prefixIcon: Image(
|
prefixIcon: Image(
|
||||||
image: ExactAssetImage(MiscIconAssetPath.search),
|
image: ExactAssetImage(MiscIconAssetPath.search),
|
||||||
width: 24,
|
width: 24,
|
||||||
height: 24,
|
height: 24,
|
||||||
color: Color(0xFFAA8E83)
|
color: Color(0xFFAA8E83)),
|
||||||
),
|
|
||||||
|
|
||||||
|
|
||||||
// prefixIcon: Image.asset(
|
// prefixIcon: Image.asset(
|
||||||
// MiscIconAssetPath.search,
|
// MiscIconAssetPath.search,
|
||||||
// // fit: BoxFit.contain,
|
// // fit: BoxFit.contain,
|
||||||
// ),
|
// ),
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
contentPadding:
|
contentPadding: EdgeInsets.symmetric(
|
||||||
EdgeInsets.symmetric(vertical: 8.0, horizontal: 18.0),
|
vertical: 8.0, horizontal: 18.0),
|
||||||
),
|
),
|
||||||
onChanged: filterUsers,
|
onChanged: filterUsers,
|
||||||
),),
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: myheight / 40),
|
SizedBox(height: myheight / 40),
|
||||||
isLoading
|
isLoading
|
||||||
@ -400,7 +396,8 @@ class _ManageUserRouterState extends State<ManageUserRouter> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
"We couldn't find anything matching your search.",
|
"We couldn't find anything matching your search.",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18, color: Color(0xFF898C81)),
|
fontSize: 18,
|
||||||
|
color: Color(0xFF898C81)),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -423,8 +420,10 @@ class _ManageUserRouterState extends State<ManageUserRouter> {
|
|||||||
AppLocalizations.of(context)!.user_name,
|
AppLocalizations.of(context)!.user_name,
|
||||||
),
|
),
|
||||||
onSort: (columnIndex, ascending) {
|
onSort: (columnIndex, ascending) {
|
||||||
_sort((user) => user.userName.toLowerCase(),
|
_sort(
|
||||||
columnIndex, ascending);
|
(user) => user.userName.toLowerCase(),
|
||||||
|
columnIndex,
|
||||||
|
ascending);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
DataColumn(
|
DataColumn(
|
||||||
@ -432,8 +431,10 @@ class _ManageUserRouterState extends State<ManageUserRouter> {
|
|||||||
AppLocalizations.of(context)!.email_id,
|
AppLocalizations.of(context)!.email_id,
|
||||||
),
|
),
|
||||||
onSort: (columnIndex, ascending) {
|
onSort: (columnIndex, ascending) {
|
||||||
_sort((user) => user.emailId.toLowerCase(),
|
_sort(
|
||||||
columnIndex, ascending);
|
(user) => user.emailId.toLowerCase(),
|
||||||
|
columnIndex,
|
||||||
|
ascending);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
DataColumn(
|
DataColumn(
|
||||||
@ -484,13 +485,15 @@ class _ManageUserRouterState extends State<ManageUserRouter> {
|
|||||||
cells: [
|
cells: [
|
||||||
DataCell(Text(user.userName)),
|
DataCell(Text(user.userName)),
|
||||||
DataCell(Text(user.emailId)),
|
DataCell(Text(user.emailId)),
|
||||||
DataCell(Text(user.registrationDate)),
|
DataCell(
|
||||||
|
Text(user.registrationDate)),
|
||||||
DataCell(
|
DataCell(
|
||||||
DropdownButton<String>(
|
DropdownButton<String>(
|
||||||
value: user.status,
|
value: user.status,
|
||||||
items: statusOptions.entries
|
items: statusOptions.entries
|
||||||
.map((status) {
|
.map((status) {
|
||||||
return DropdownMenuItem<String>(
|
return DropdownMenuItem<
|
||||||
|
String>(
|
||||||
value: status.key,
|
value: status.key,
|
||||||
child: Text(
|
child: Text(
|
||||||
status.value,
|
status.value,
|
||||||
|
|||||||
@ -202,24 +202,36 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
|
|||||||
Container(
|
Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: locale.languageCode=='ar' ? Color(0xFF7DAFBC):null,
|
color: locale.languageCode == 'ar'
|
||||||
|
? Color(0xFF7DAFBC)
|
||||||
|
: null,
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color:locale.languageCode=='ar' ? Color(0xFF7DAFBC): Colors.white, width: 2.0),
|
color: locale.languageCode == 'ar'
|
||||||
|
? Color(0xFF7DAFBC)
|
||||||
|
: Colors.white,
|
||||||
|
width: 2.0),
|
||||||
),
|
),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
icon: const Icon(Icons.arrow_back,
|
icon: const Icon(
|
||||||
color: Colors.white,),
|
Icons.arrow_back,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (locale.languageCode == 'ar') {
|
if (locale.languageCode == 'ar') {
|
||||||
tutorialCoachMark.next();
|
tutorialCoachMark.next();
|
||||||
} else {
|
} else {
|
||||||
tutorialCoachMark.finish();
|
tutorialCoachMark.finish();
|
||||||
ref.read(scaffoldTourProvider.notifier).state = true;
|
ref
|
||||||
ref.read(previousChartsTourProvider.notifier).state = false;
|
.read(scaffoldTourProvider.notifier)
|
||||||
|
.state = true;
|
||||||
|
ref
|
||||||
|
.read(previousChartsTourProvider
|
||||||
|
.notifier)
|
||||||
|
.state = false;
|
||||||
context.go(
|
context.go(
|
||||||
'/chartScreen/hotels?bgColor=0xFF90B0D5&mainTopic=ECONOMY&title=Hotel+Establishments',);
|
'/chartScreen/hotels?bgColor=0xFF90B0D5&mainTopic=ECONOMY&title=Hotel+Establishments',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -227,9 +239,14 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
|
|||||||
Container(
|
Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: locale.languageCode=='ar' ? null:Color(0xFF7DAFBC),
|
color: locale.languageCode == 'ar'
|
||||||
|
? null
|
||||||
|
: Color(0xFF7DAFBC),
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color:locale.languageCode=='ar' ? Colors.white: Color(0xFF7DAFBC), width: 1),
|
color: locale.languageCode == 'ar'
|
||||||
|
? Colors.white
|
||||||
|
: Color(0xFF7DAFBC),
|
||||||
|
width: 1),
|
||||||
),
|
),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
icon: const Icon(Icons.arrow_forward,
|
icon: const Icon(Icons.arrow_forward,
|
||||||
@ -237,10 +254,16 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (locale.languageCode == 'ar') {
|
if (locale.languageCode == 'ar') {
|
||||||
tutorialCoachMark.finish();
|
tutorialCoachMark.finish();
|
||||||
ref.read(scaffoldTourProvider.notifier).state = true;
|
ref
|
||||||
ref.read(previousChartsTourProvider.notifier).state = false;
|
.read(scaffoldTourProvider.notifier)
|
||||||
|
.state = true;
|
||||||
|
ref
|
||||||
|
.read(previousChartsTourProvider
|
||||||
|
.notifier)
|
||||||
|
.state = false;
|
||||||
context.go(
|
context.go(
|
||||||
'/chartScreen/hotels?bgColor=0xFF90B0D5&mainTopic=ECONOMY&title=Hotel+Establishments',);
|
'/chartScreen/hotels?bgColor=0xFF90B0D5&mainTopic=ECONOMY&title=Hotel+Establishments',
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
tutorialCoachMark.next();
|
tutorialCoachMark.next();
|
||||||
}
|
}
|
||||||
@ -327,15 +350,25 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
|
|||||||
Container(
|
Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: locale.languageCode=='ar' ? Color(0xFF7DAFBC):null,
|
color: locale.languageCode == 'ar'
|
||||||
|
? Color(0xFF7DAFBC)
|
||||||
|
: null,
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color:locale.languageCode=='ar' ? Color(0xFF7DAFBC): Colors.white, width: 2.0,),
|
color: locale.languageCode == 'ar'
|
||||||
|
? Color(0xFF7DAFBC)
|
||||||
|
: Colors.white,
|
||||||
|
width: 2.0,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
icon: const Icon(Icons.arrow_back,
|
icon: const Icon(
|
||||||
color: Colors.white,),
|
Icons.arrow_back,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
locale.languageCode=='ar' ?tutorialCoachMark.next() : tutorialCoachMark.previous();
|
locale.languageCode == 'ar'
|
||||||
|
? tutorialCoachMark.next()
|
||||||
|
: tutorialCoachMark.previous();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -343,15 +376,24 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
|
|||||||
Container(
|
Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: locale.languageCode=='ar' ? null:Color(0xFF7DAFBC),
|
color: locale.languageCode == 'ar'
|
||||||
|
? null
|
||||||
|
: Color(0xFF7DAFBC),
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color:locale.languageCode=='ar' ? Colors.white: Color(0xFF7DAFBC), width: 1),
|
color: locale.languageCode == 'ar'
|
||||||
|
? Colors.white
|
||||||
|
: Color(0xFF7DAFBC),
|
||||||
|
width: 1),
|
||||||
),
|
),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
icon: const Icon(Icons.arrow_forward,
|
icon: const Icon(
|
||||||
color: Colors.white,),
|
Icons.arrow_forward,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
locale.languageCode=='ar' ?tutorialCoachMark.previous() : tutorialCoachMark.next();
|
locale.languageCode == 'ar'
|
||||||
|
? tutorialCoachMark.previous()
|
||||||
|
: tutorialCoachMark.next();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -367,8 +409,14 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
TargetContent(
|
TargetContent(
|
||||||
padding: EdgeInsets.only(right:locale.languageCode=='ar' ? 0: screenWidth * 0.7, top: locale.languageCode=='ar' ?20 : 20, left: locale.languageCode=='ar' ? screenWidth * 0.7:0,),
|
padding: EdgeInsets.only(
|
||||||
align: locale.languageCode=='ar' ? ContentAlign.left : ContentAlign.right,
|
right: locale.languageCode == 'ar' ? 0 : screenWidth * 0.7,
|
||||||
|
top: locale.languageCode == 'ar' ? 20 : 20,
|
||||||
|
left: locale.languageCode == 'ar' ? screenWidth * 0.7 : 0,
|
||||||
|
),
|
||||||
|
align: locale.languageCode == 'ar'
|
||||||
|
? ContentAlign.left
|
||||||
|
: ContentAlign.right,
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 200,
|
width: 200,
|
||||||
height: screenHeight / 4,
|
height: screenHeight / 4,
|
||||||
@ -452,7 +500,6 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
|
|||||||
elevation: 0,
|
elevation: 0,
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
|
|
||||||
AppLocalizations.of(context)!.skip,
|
AppLocalizations.of(context)!.skip,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
@ -469,8 +516,12 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
|
|||||||
color: Colors.white, width: 2.0),
|
color: Colors.white, width: 2.0),
|
||||||
),
|
),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
icon: Icon(locale.languageCode=='ar' ? Icons.arrow_forward: Icons.arrow_back,
|
icon: Icon(
|
||||||
color: Colors.white,),
|
locale.languageCode == 'ar'
|
||||||
|
? Icons.arrow_forward
|
||||||
|
: Icons.arrow_back,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
tutorialCoachMark.previous();
|
tutorialCoachMark.previous();
|
||||||
},
|
},
|
||||||
@ -480,12 +531,25 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
|
|||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
debugPrint('Got it clicked');
|
debugPrint('Got it clicked');
|
||||||
ref.read(chartsTourProvider.notifier).state = true;
|
ref
|
||||||
ref.read(previousChartsTourProvider.notifier).state = true;
|
.read(chartsTourProvider.notifier)
|
||||||
ref.read(homeTourProvider.notifier).state = true;
|
.state = true;
|
||||||
ref.read(previousHomeTourProvider.notifier).state = true;
|
ref
|
||||||
ref.read(scaffoldTourProvider.notifier).state = true;
|
.read(
|
||||||
ref.read(previousScaffoldTourProvider.notifier).state = true;
|
previousChartsTourProvider.notifier)
|
||||||
|
.state = true;
|
||||||
|
ref.read(homeTourProvider.notifier).state =
|
||||||
|
true;
|
||||||
|
ref
|
||||||
|
.read(previousHomeTourProvider.notifier)
|
||||||
|
.state = true;
|
||||||
|
ref
|
||||||
|
.read(scaffoldTourProvider.notifier)
|
||||||
|
.state = true;
|
||||||
|
ref
|
||||||
|
.read(previousScaffoldTourProvider
|
||||||
|
.notifier)
|
||||||
|
.state = true;
|
||||||
tutorialCoachMark.finish();
|
tutorialCoachMark.finish();
|
||||||
},
|
},
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
@ -516,11 +580,14 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
TargetContent(
|
TargetContent(
|
||||||
padding: EdgeInsets.only(left: locale.languageCode=='ar' ? 0: screenWidth * 0.7,
|
padding: EdgeInsets.only(
|
||||||
|
left: locale.languageCode == 'ar' ? 0 : screenWidth * 0.7,
|
||||||
top: toggleHeight,
|
top: toggleHeight,
|
||||||
right: locale.languageCode == 'ar' ? screenWidth * 0.7 : 0,
|
right: locale.languageCode == 'ar' ? screenWidth * 0.7 : 0,
|
||||||
),
|
),
|
||||||
align : locale.languageCode=='ar' ? ContentAlign.right :ContentAlign.left,
|
align: locale.languageCode == 'ar'
|
||||||
|
? ContentAlign.right
|
||||||
|
: ContentAlign.left,
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 200,
|
width: 200,
|
||||||
height: screenHeight / 4,
|
height: screenHeight / 4,
|
||||||
@ -825,9 +892,13 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
|
|||||||
] else ...[
|
] else ...[
|
||||||
Text(userName ?? 'Loading...'),
|
Text(userName ?? 'Loading...'),
|
||||||
Tooltip(
|
Tooltip(
|
||||||
message: userEmail ?? 'Loading...', // Shows full email on hover
|
message: userEmail ??
|
||||||
|
'Loading...', // Shows full email on hover
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: MediaQuery.of(context).size.width * 0.6, // Adjust width as needed
|
width: MediaQuery.of(context)
|
||||||
|
.size
|
||||||
|
.width *
|
||||||
|
0.6, // Adjust width as needed
|
||||||
child: Text(
|
child: Text(
|
||||||
userEmail ?? 'Loading...',
|
userEmail ?? 'Loading...',
|
||||||
style: TextStyle(fontSize: 12),
|
style: TextStyle(fontSize: 12),
|
||||||
@ -1078,6 +1149,16 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final PAuthRepo _authRepo = PAuthRepo();
|
||||||
|
|
||||||
|
Future<void> logout(BuildContext context) async {
|
||||||
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
await _authRepo.logout();
|
||||||
|
prefs.clear();
|
||||||
|
context.go('/login'); // Redirect to login after logout
|
||||||
|
}
|
||||||
|
|
||||||
void _showLogoutConfirmationDialog(BuildContext context) {
|
void _showLogoutConfirmationDialog(BuildContext context) {
|
||||||
double myheight = MediaQuery.of(context).size.height;
|
double myheight = MediaQuery.of(context).size.height;
|
||||||
showDialog(
|
showDialog(
|
||||||
@ -1096,8 +1177,7 @@ void _showLogoutConfirmationDialog(BuildContext context) {
|
|||||||
content: Padding(
|
content: Padding(
|
||||||
padding: const EdgeInsets.all(20.0),
|
padding: const EdgeInsets.all(20.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
context.translate(
|
context.translate('Are you sure you want to log out?',
|
||||||
'Are you sure you want to log out?',
|
|
||||||
'هل أنت متأكد أنك تريد تسجيل الخروج؟'),
|
'هل أنت متأكد أنك تريد تسجيل الخروج؟'),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -1108,7 +1188,8 @@ void _showLogoutConfirmationDialog(BuildContext context) {
|
|||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, // Space buttons evenly
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceEvenly, // Space buttons evenly
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 120, // Set button width
|
width: 120, // Set button width
|
||||||
@ -1135,10 +1216,7 @@ void _showLogoutConfirmationDialog(BuildContext context) {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
width: 120, // Set button width
|
width: 120, // Set button width
|
||||||
child: TextButton(
|
child: TextButton(
|
||||||
onPressed: () async {
|
onPressed: () => logout(context),
|
||||||
await logout(dialogContext); // Pass dialogContext to logout
|
|
||||||
Navigator.pop(dialogContext); // Close the dialog
|
|
||||||
},
|
|
||||||
style: TextButton.styleFrom(
|
style: TextButton.styleFrom(
|
||||||
backgroundColor: Color(0xFFAA8E83), // Background color
|
backgroundColor: Color(0xFFAA8E83), // Background color
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
@ -1159,11 +1237,3 @@ void _showLogoutConfirmationDialog(BuildContext context) {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> logout(BuildContext context) async {
|
|
||||||
final prefs = await SharedPreferences.getInstance();
|
|
||||||
await prefs.clear(); // Clear shared preferences
|
|
||||||
context.go('/login'); // Navigate to the root route (e.g., login screen)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user