notification and chart bug fix

This commit is contained in:
venbaittech 2025-03-20 18:24:00 +05:30
parent 7564a66d8c
commit 8ccf26d99b
6 changed files with 47 additions and 26 deletions

View File

@ -20,12 +20,12 @@ if (project.hasProperty('google-services.json')) {
def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
if (flutterVersionCode == null) {
flutterVersionCode = "40"
flutterVersionCode = "41"
}
def flutterVersionName = localProperties.getProperty("flutter.versionName")
if (flutterVersionName == null) {
flutterVersionName = "1.0.39"
flutterVersionName = "1.0.40"
}
def keystorePropertiesFile = rootProject.file("key.properties")

View File

@ -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/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/auth_verification/forgot_password.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/terms&conditions.dart';
@ -478,6 +479,13 @@ final GoRouter router = GoRouter(
return Changepassword(userId: userId);
},
),
GoRoute(
path: '/forgot-password/:email',
builder: (context, state) {
final email = state.pathParameters['email']!;
return ForgotPassword(email: email);
},
),
GoRoute(
path: '/createNewPw/:userId/:email',
builder: (context, state) {

View File

@ -20,9 +20,9 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:uae_stat/config/my_theme.dart';
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
ConsumerState<ForgotPassword> createState() => _ForgotPasswordState();
@ -108,7 +108,7 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
}
Future<void> updatePassword(
String userId, String oldPassword, String newPassword) async {
String email, String oldPassword, String newPassword) async {
try {
setState(() {
isLoading = true;
@ -124,7 +124,7 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
// Update password
await _pb.collection('users').update(
userId,
email,
body: {
'password': newPassword,
'passwordConfirm': newPassword,
@ -482,7 +482,7 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
});
if ((_formKey.currentState?.validate() ?? false)) {
await updatePassword(
widget.userId,
widget.email,
_oldPassword ?? '',
_newPassword ?? '',
);

View File

@ -319,8 +319,9 @@ class ChartWidget extends StatelessWidget {
// color: Colors.primaries[index % Colors.primaries.length],
// color: adjustColor(bodyColor, index), // Adjust alpha dynamically
color: uniqueColors[index % uniqueColors.length],
title: '${percentage.toStringAsFixed(1)}%',
radius: isTouched ? 60 : 50,
// title: '${percentage.toStringAsFixed(1)}%',
title: percentage > 1 ? '${percentage.toStringAsFixed(1)}%' : '',
radius: isTouched ? 70 : 50,
// Increase size when touched
titleStyle: TextStyle(
@ -329,7 +330,7 @@ class ChartWidget extends StatelessWidget {
color: Colors.black,
// color: Colors.white,
),
titlePositionPercentageOffset: 1.3,
titlePositionPercentageOffset: 1.4,
);
}).toList();
}
@ -1624,7 +1625,7 @@ class ChartWidget extends StatelessWidget {
displayTitle,
softWrap: true,
textAlign:
TextAlign.end,
TextAlign.right,
style: TextStyle(
fontSize: 10,
),
@ -2045,7 +2046,7 @@ class ChartWidget extends StatelessWidget {
title,
softWrap: true,
maxLines: 2,
textAlign: TextAlign.end,
textAlign: TextAlign.right,
style: TextStyle(fontSize: 10),
// overflow: TextOverflow.ellipsis,
)),
@ -2334,8 +2335,8 @@ class ChartWidget extends StatelessWidget {
// );
return BarTooltipItem(
'$formattedValue', // This is your main tooltip text
' $formattedValue', // This is your main tooltip text
// textAlign: TextAlign.center,
const TextStyle(
color: Colors.black,
fontWeight: FontWeight.w400,
@ -2345,6 +2346,7 @@ class ChartWidget extends StatelessWidget {
TextSpan(
text: '', // Add extra information here
// text: '\n$crop', // Add extra information here
style: TextStyle(
color: Colors.grey[
700], // Optional: Different color for extra text
@ -3014,7 +3016,7 @@ class ChartWidget extends StatelessWidget {
// print("Bottomtiles");
// print(value);
return Padding(
padding: const EdgeInsets.only(top: 10, left: 20.0),
padding: const EdgeInsets.only(top: 5, left: 20.0),
child: SizedBox(
width: 40,
child: Transform.rotate(
@ -3022,6 +3024,7 @@ class ChartWidget extends StatelessWidget {
angle: -1.5, // Slight rotation to improve readability
child: Text(
value.toInt().toString(),
textAlign: TextAlign.center,
style: TextStyle(color: Colors.black, fontSize: 12),
),
),

View File

@ -25,7 +25,7 @@ class _NotificationPageState extends ConsumerState<NotificationPage> {
final _pb = PocketBase(apiUrl);
bool isLoading = true;
List<Map<String, dynamic>> notifications = [];
List<String> pushedNotification = [];
List<String> userReadedNotiOrNot = [];
// Current selected tab index
int selectedTabIndex = 0;
@ -48,7 +48,6 @@ class _NotificationPageState extends ConsumerState<NotificationPage> {
super.initState();
locale = ref.read(localeProvider) ?? const Locale('en');
_userService = UserService();
_fetchUserData();
fetchNotifications(locale?.languageCode ?? 'en');
}
@ -75,15 +74,25 @@ class _NotificationPageState extends ConsumerState<NotificationPage> {
setState(() {
print('In');
// Extract pushed_notification from response
List<dynamic> notifications =
List<dynamic> userReadedNotification =
userDetailsResponse.data['pushed_notification'];
// 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) {
setState(() {
isLoading = false;
});
print('Error fetching user details: $e');
}
}
@ -113,7 +122,8 @@ class _NotificationPageState extends ConsumerState<NotificationPage> {
notifications = List<Map<String, dynamic>>.from(
jsonResponse['data']); // Assign decoded data
print('notifications $notifications');
isLoading = false;
_fetchUserData();
// isLoading = false;
});
} else {
setState(() {
@ -250,7 +260,7 @@ class _NotificationPageState extends ConsumerState<NotificationPage> {
notification['category'] ?? 'Unknown',
message: notification['message'] ?? '',
id: notification['id'],
pushedNotification: pushedNotification,
userReadedNotiOrNot: userReadedNotiOrNot,
userID: userID,
),
);
@ -329,7 +339,7 @@ class NotificationTile extends StatelessWidget {
final String category;
final String id;
final String userID;
final List<String> pushedNotification;
final List<String> userReadedNotiOrNot;
const NotificationTile({
required this.title,
@ -338,12 +348,12 @@ class NotificationTile extends StatelessWidget {
required this.category,
required this.id,
required this.userID,
required this.pushedNotification,
required this.userReadedNotiOrNot,
});
@override
Widget build(BuildContext context) {
bool isPushed = pushedNotification.contains(id);
bool isPushed = userReadedNotiOrNot.contains(id);
print('isPushed $isPushed , $id');
return GestureDetector(

View File

@ -1,7 +1,7 @@
name: uae_stat
description: "View statistics about the UAE from the Federal Center for Statistics and Competitiveness."
publish_to: "none"
version: 1.0.39+40
version: 1.0.40+41
environment:
sdk: ">=3.2.3 <4.0.0"