notification and chart bug fix
This commit is contained in:
parent
7564a66d8c
commit
8ccf26d99b
@ -20,12 +20,12 @@ if (project.hasProperty('google-services.json')) {
|
|||||||
|
|
||||||
def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
|
def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
|
||||||
if (flutterVersionCode == null) {
|
if (flutterVersionCode == null) {
|
||||||
flutterVersionCode = "40"
|
flutterVersionCode = "41"
|
||||||
}
|
}
|
||||||
|
|
||||||
def flutterVersionName = localProperties.getProperty("flutter.versionName")
|
def flutterVersionName = localProperties.getProperty("flutter.versionName")
|
||||||
if (flutterVersionName == null) {
|
if (flutterVersionName == null) {
|
||||||
flutterVersionName = "1.0.39"
|
flutterVersionName = "1.0.40"
|
||||||
}
|
}
|
||||||
|
|
||||||
def keystorePropertiesFile = rootProject.file("key.properties")
|
def keystorePropertiesFile = rootProject.file("key.properties")
|
||||||
|
|||||||
@ -302,6 +302,7 @@ import 'package:uae_stat/domain/entities/session_entity.dart';
|
|||||||
import 'package:uae_stat/infrastructure/data/p_auth_repo.dart';
|
import 'package:uae_stat/infrastructure/data/p_auth_repo.dart';
|
||||||
import 'package:uae_stat/presentation/Screens/Bottom%20Navigation%20Pages/UAE_Numbers/Social/marriages.dart';
|
import 'package:uae_stat/presentation/Screens/Bottom%20Navigation%20Pages/UAE_Numbers/Social/marriages.dart';
|
||||||
import 'package:uae_stat/presentation/Screens/app_tour/WelcomePage.dart';
|
import 'package:uae_stat/presentation/Screens/app_tour/WelcomePage.dart';
|
||||||
|
import 'package:uae_stat/presentation/Screens/auth_verification/forgot_password.dart';
|
||||||
import 'package:uae_stat/presentation/Screens/auth_verification/privacy_policy.dart';
|
import 'package:uae_stat/presentation/Screens/auth_verification/privacy_policy.dart';
|
||||||
import 'package:uae_stat/presentation/Screens/auth_verification/registration.dart';
|
import 'package:uae_stat/presentation/Screens/auth_verification/registration.dart';
|
||||||
import 'package:uae_stat/presentation/Screens/auth_verification/terms&conditions.dart';
|
import 'package:uae_stat/presentation/Screens/auth_verification/terms&conditions.dart';
|
||||||
@ -478,6 +479,13 @@ final GoRouter router = GoRouter(
|
|||||||
return Changepassword(userId: userId);
|
return Changepassword(userId: userId);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: '/forgot-password/:email',
|
||||||
|
builder: (context, state) {
|
||||||
|
final email = state.pathParameters['email']!;
|
||||||
|
return ForgotPassword(email: email);
|
||||||
|
},
|
||||||
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/createNewPw/:userId/:email',
|
path: '/createNewPw/:userId/:email',
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
|
|||||||
@ -20,9 +20,9 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
|||||||
import 'package:uae_stat/config/my_theme.dart';
|
import 'package:uae_stat/config/my_theme.dart';
|
||||||
|
|
||||||
class ForgotPassword extends ConsumerStatefulWidget {
|
class ForgotPassword extends ConsumerStatefulWidget {
|
||||||
final String userId;
|
final String email;
|
||||||
|
|
||||||
const ForgotPassword({Key? key, required this.userId});
|
const ForgotPassword({Key? key, required this.email});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ConsumerState<ForgotPassword> createState() => _ForgotPasswordState();
|
ConsumerState<ForgotPassword> createState() => _ForgotPasswordState();
|
||||||
@ -108,7 +108,7 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> updatePassword(
|
Future<void> updatePassword(
|
||||||
String userId, String oldPassword, String newPassword) async {
|
String email, String oldPassword, String newPassword) async {
|
||||||
try {
|
try {
|
||||||
setState(() {
|
setState(() {
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
@ -124,7 +124,7 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
|
|||||||
|
|
||||||
// Update password
|
// Update password
|
||||||
await _pb.collection('users').update(
|
await _pb.collection('users').update(
|
||||||
userId,
|
email,
|
||||||
body: {
|
body: {
|
||||||
'password': newPassword,
|
'password': newPassword,
|
||||||
'passwordConfirm': newPassword,
|
'passwordConfirm': newPassword,
|
||||||
@ -482,7 +482,7 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
|
|||||||
});
|
});
|
||||||
if ((_formKey.currentState?.validate() ?? false)) {
|
if ((_formKey.currentState?.validate() ?? false)) {
|
||||||
await updatePassword(
|
await updatePassword(
|
||||||
widget.userId,
|
widget.email,
|
||||||
_oldPassword ?? '',
|
_oldPassword ?? '',
|
||||||
_newPassword ?? '',
|
_newPassword ?? '',
|
||||||
);
|
);
|
||||||
|
|||||||
@ -319,8 +319,9 @@ class ChartWidget extends StatelessWidget {
|
|||||||
// color: Colors.primaries[index % Colors.primaries.length],
|
// color: Colors.primaries[index % Colors.primaries.length],
|
||||||
// color: adjustColor(bodyColor, index), // Adjust alpha dynamically
|
// color: adjustColor(bodyColor, index), // Adjust alpha dynamically
|
||||||
color: uniqueColors[index % uniqueColors.length],
|
color: uniqueColors[index % uniqueColors.length],
|
||||||
title: '${percentage.toStringAsFixed(1)}%',
|
// title: '${percentage.toStringAsFixed(1)}%',
|
||||||
radius: isTouched ? 60 : 50,
|
title: percentage > 1 ? '${percentage.toStringAsFixed(1)}%' : '',
|
||||||
|
radius: isTouched ? 70 : 50,
|
||||||
|
|
||||||
// Increase size when touched
|
// Increase size when touched
|
||||||
titleStyle: TextStyle(
|
titleStyle: TextStyle(
|
||||||
@ -329,7 +330,7 @@ class ChartWidget extends StatelessWidget {
|
|||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
// color: Colors.white,
|
// color: Colors.white,
|
||||||
),
|
),
|
||||||
titlePositionPercentageOffset: 1.3,
|
titlePositionPercentageOffset: 1.4,
|
||||||
);
|
);
|
||||||
}).toList();
|
}).toList();
|
||||||
}
|
}
|
||||||
@ -1624,7 +1625,7 @@ class ChartWidget extends StatelessWidget {
|
|||||||
displayTitle,
|
displayTitle,
|
||||||
softWrap: true,
|
softWrap: true,
|
||||||
textAlign:
|
textAlign:
|
||||||
TextAlign.end,
|
TextAlign.right,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 10,
|
fontSize: 10,
|
||||||
),
|
),
|
||||||
@ -2045,7 +2046,7 @@ class ChartWidget extends StatelessWidget {
|
|||||||
title,
|
title,
|
||||||
softWrap: true,
|
softWrap: true,
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.right,
|
||||||
style: TextStyle(fontSize: 10),
|
style: TextStyle(fontSize: 10),
|
||||||
// overflow: TextOverflow.ellipsis,
|
// overflow: TextOverflow.ellipsis,
|
||||||
)),
|
)),
|
||||||
@ -2335,7 +2336,7 @@ class ChartWidget extends StatelessWidget {
|
|||||||
|
|
||||||
return BarTooltipItem(
|
return BarTooltipItem(
|
||||||
' $formattedValue', // This is your main tooltip text
|
' $formattedValue', // This is your main tooltip text
|
||||||
|
// textAlign: TextAlign.center,
|
||||||
const TextStyle(
|
const TextStyle(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
@ -2345,6 +2346,7 @@ class ChartWidget extends StatelessWidget {
|
|||||||
TextSpan(
|
TextSpan(
|
||||||
text: '', // Add extra information here
|
text: '', // Add extra information here
|
||||||
// text: '\n$crop', // Add extra information here
|
// text: '\n$crop', // Add extra information here
|
||||||
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.grey[
|
color: Colors.grey[
|
||||||
700], // Optional: Different color for extra text
|
700], // Optional: Different color for extra text
|
||||||
@ -3014,7 +3016,7 @@ class ChartWidget extends StatelessWidget {
|
|||||||
// print("Bottomtiles");
|
// print("Bottomtiles");
|
||||||
// print(value);
|
// print(value);
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(top: 10, left: 20.0),
|
padding: const EdgeInsets.only(top: 5, left: 20.0),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 40,
|
width: 40,
|
||||||
child: Transform.rotate(
|
child: Transform.rotate(
|
||||||
@ -3022,6 +3024,7 @@ class ChartWidget extends StatelessWidget {
|
|||||||
angle: -1.5, // Slight rotation to improve readability
|
angle: -1.5, // Slight rotation to improve readability
|
||||||
child: Text(
|
child: Text(
|
||||||
value.toInt().toString(),
|
value.toInt().toString(),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(color: Colors.black, fontSize: 12),
|
style: TextStyle(color: Colors.black, fontSize: 12),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -25,7 +25,7 @@ class _NotificationPageState extends ConsumerState<NotificationPage> {
|
|||||||
final _pb = PocketBase(apiUrl);
|
final _pb = PocketBase(apiUrl);
|
||||||
bool isLoading = true;
|
bool isLoading = true;
|
||||||
List<Map<String, dynamic>> notifications = [];
|
List<Map<String, dynamic>> notifications = [];
|
||||||
List<String> pushedNotification = [];
|
List<String> userReadedNotiOrNot = [];
|
||||||
|
|
||||||
// Current selected tab index
|
// Current selected tab index
|
||||||
int selectedTabIndex = 0;
|
int selectedTabIndex = 0;
|
||||||
@ -48,7 +48,6 @@ class _NotificationPageState extends ConsumerState<NotificationPage> {
|
|||||||
super.initState();
|
super.initState();
|
||||||
locale = ref.read(localeProvider) ?? const Locale('en');
|
locale = ref.read(localeProvider) ?? const Locale('en');
|
||||||
_userService = UserService();
|
_userService = UserService();
|
||||||
_fetchUserData();
|
|
||||||
fetchNotifications(locale?.languageCode ?? 'en');
|
fetchNotifications(locale?.languageCode ?? 'en');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,15 +74,25 @@ class _NotificationPageState extends ConsumerState<NotificationPage> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
print('In');
|
print('In');
|
||||||
// Extract pushed_notification from response
|
// Extract pushed_notification from response
|
||||||
List<dynamic> notifications =
|
List<dynamic> userReadedNotification =
|
||||||
userDetailsResponse.data['pushed_notification'];
|
userDetailsResponse.data['pushed_notification'];
|
||||||
|
|
||||||
// Convert to List<String>
|
// Convert to List<String>
|
||||||
pushedNotification = List<String>.from(notifications);
|
userReadedNotiOrNot = List<String>.from(userReadedNotification);
|
||||||
|
|
||||||
print('pushedNotification: $pushedNotification');
|
print('userReadedNotiOrNot: $userReadedNotiOrNot');
|
||||||
|
print('notifications: $notifications');
|
||||||
|
// for (var notification in notifications) {
|
||||||
|
// notification["isReadedOrNot"] =
|
||||||
|
// userReadedNotiOrNot.contains(notification["id"]);
|
||||||
|
// }
|
||||||
|
// print('After Added: $notifications');
|
||||||
|
isLoading = false;
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
setState(() {
|
||||||
|
isLoading = false;
|
||||||
|
});
|
||||||
print('Error fetching user details: $e');
|
print('Error fetching user details: $e');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,7 +122,8 @@ class _NotificationPageState extends ConsumerState<NotificationPage> {
|
|||||||
notifications = List<Map<String, dynamic>>.from(
|
notifications = List<Map<String, dynamic>>.from(
|
||||||
jsonResponse['data']); // Assign decoded data
|
jsonResponse['data']); // Assign decoded data
|
||||||
print('notifications $notifications');
|
print('notifications $notifications');
|
||||||
isLoading = false;
|
_fetchUserData();
|
||||||
|
// isLoading = false;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -250,7 +260,7 @@ class _NotificationPageState extends ConsumerState<NotificationPage> {
|
|||||||
notification['category'] ?? 'Unknown',
|
notification['category'] ?? 'Unknown',
|
||||||
message: notification['message'] ?? '',
|
message: notification['message'] ?? '',
|
||||||
id: notification['id'],
|
id: notification['id'],
|
||||||
pushedNotification: pushedNotification,
|
userReadedNotiOrNot: userReadedNotiOrNot,
|
||||||
userID: userID,
|
userID: userID,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -329,7 +339,7 @@ class NotificationTile extends StatelessWidget {
|
|||||||
final String category;
|
final String category;
|
||||||
final String id;
|
final String id;
|
||||||
final String userID;
|
final String userID;
|
||||||
final List<String> pushedNotification;
|
final List<String> userReadedNotiOrNot;
|
||||||
|
|
||||||
const NotificationTile({
|
const NotificationTile({
|
||||||
required this.title,
|
required this.title,
|
||||||
@ -338,12 +348,12 @@ class NotificationTile extends StatelessWidget {
|
|||||||
required this.category,
|
required this.category,
|
||||||
required this.id,
|
required this.id,
|
||||||
required this.userID,
|
required this.userID,
|
||||||
required this.pushedNotification,
|
required this.userReadedNotiOrNot,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
bool isPushed = pushedNotification.contains(id);
|
bool isPushed = userReadedNotiOrNot.contains(id);
|
||||||
print('isPushed $isPushed , $id');
|
print('isPushed $isPushed , $id');
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
name: uae_stat
|
name: uae_stat
|
||||||
description: "View statistics about the UAE from the Federal Center for Statistics and Competitiveness."
|
description: "View statistics about the UAE from the Federal Center for Statistics and Competitiveness."
|
||||||
publish_to: "none"
|
publish_to: "none"
|
||||||
version: 1.0.39+40
|
version: 1.0.40+41
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.2.3 <4.0.0"
|
sdk: ">=3.2.3 <4.0.0"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user