bug fix and notification
This commit is contained in:
parent
f9a16ec99a
commit
cbe243ea1d
@ -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 = "33"
|
flutterVersionCode = "34"
|
||||||
}
|
}
|
||||||
|
|
||||||
def flutterVersionName = localProperties.getProperty("flutter.versionName")
|
def flutterVersionName = localProperties.getProperty("flutter.versionName")
|
||||||
if (flutterVersionName == null) {
|
if (flutterVersionName == null) {
|
||||||
flutterVersionName = "1.0.32"
|
flutterVersionName = "1.0.33"
|
||||||
}
|
}
|
||||||
|
|
||||||
def keystorePropertiesFile = rootProject.file("key.properties")
|
def keystorePropertiesFile = rootProject.file("key.properties")
|
||||||
|
|||||||
15
lib/config/connectivity_provider.dart
Normal file
15
lib/config/connectivity_provider.dart
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:internet_connection_checker/internet_connection_checker.dart';
|
||||||
|
|
||||||
|
final connectivityProvider = StreamProvider<bool>((ref) async* {
|
||||||
|
await for (var result in Connectivity().onConnectivityChanged) {
|
||||||
|
bool isConnected = result != ConnectivityResult.none;
|
||||||
|
|
||||||
|
if (isConnected) {
|
||||||
|
isConnected = await InternetConnectionChecker.instance.hasConnection;
|
||||||
|
}
|
||||||
|
|
||||||
|
yield isConnected;
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -377,7 +377,7 @@ final GoRouter router = GoRouter(
|
|||||||
// ),
|
// ),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/internetcheck',
|
path: '/internetcheck',
|
||||||
builder: (context, state) => InternetCheck(),
|
builder: (context, state) => InternetCheckScreen(),
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/login',
|
path: '/login',
|
||||||
@ -653,7 +653,8 @@ final GoRouter router = GoRouter(
|
|||||||
],
|
],
|
||||||
redirect: (context, state) async {
|
redirect: (context, state) async {
|
||||||
if (state.uri.path == '/SessionCheckScreen' ||
|
if (state.uri.path == '/SessionCheckScreen' ||
|
||||||
state.uri.path == '/login') {
|
state.uri.path == '/login' ||
|
||||||
|
state.uri.path == '/register') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:uae_stat/config/connectivity_provider.dart';
|
||||||
import 'package:uae_stat/domain/use_cases/language.dart';
|
import 'package:uae_stat/domain/use_cases/language.dart';
|
||||||
import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/misc_icon_asset_path.dart';
|
import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/misc_icon_asset_path.dart';
|
||||||
import 'package:uae_stat/presentation/components/indicators/locale_provider.dart';
|
import 'package:uae_stat/presentation/components/indicators/locale_provider.dart';
|
||||||
@ -170,10 +171,20 @@ class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final isConnected = ref.watch(connectivityProvider);
|
||||||
|
|
||||||
|
// If no internet, redirect to InternetCheckScreen
|
||||||
|
ref.listen<AsyncValue<bool>>(connectivityProvider, (previous, hasInternet) {
|
||||||
|
if (hasInternet.value == false) {
|
||||||
|
context.go('/internetcheck');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
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
|
||||||
fetchData(localeCode);
|
fetchData(localeCode);
|
||||||
});
|
});
|
||||||
|
|
||||||
double myheight = MediaQuery.of(context).size.height;
|
double myheight = MediaQuery.of(context).size.height;
|
||||||
double mywidth = MediaQuery.of(context).size.width;
|
double mywidth = MediaQuery.of(context).size.width;
|
||||||
|
|
||||||
@ -362,6 +373,16 @@ class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
|
|||||||
colorPattern,
|
colorPattern,
|
||||||
double mywidth,
|
double mywidth,
|
||||||
String mainTopic) {
|
String mainTopic) {
|
||||||
|
print('UAE Numbers $value , $title');
|
||||||
|
// Check if title is "Population Growth"
|
||||||
|
bool isPopulationGrowth = title == "Population Growth";
|
||||||
|
|
||||||
|
// Convert value to double for checking positive or negative (only for Population Growth)
|
||||||
|
double parsedValue = isPopulationGrowth
|
||||||
|
? double.tryParse(value.replaceAll('%', '')) ?? 0.0
|
||||||
|
: 0.0;
|
||||||
|
bool isPositive = parsedValue >= 0;
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
// print('checking data');
|
// print('checking data');
|
||||||
@ -403,14 +424,29 @@ class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
|
|||||||
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),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
Text(
|
Text(
|
||||||
value,
|
value,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
color: boldColor,
|
color: isPopulationGrowth
|
||||||
|
? (isPositive ? Colors.green : Colors.red)
|
||||||
|
: boldColor,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (isPopulationGrowth) ...[
|
||||||
|
const SizedBox(width: 5),
|
||||||
|
Icon(
|
||||||
|
isPositive ? Icons.arrow_upward : Icons.arrow_downward,
|
||||||
|
color: isPositive ? Colors.green : Colors.red,
|
||||||
|
size: 20,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -176,21 +176,22 @@ class _RegisterScreenState extends ConsumerState<RegisterScreen> {
|
|||||||
List<String> missingConstraints = [];
|
List<String> missingConstraints = [];
|
||||||
|
|
||||||
if (!hasUppercase.hasMatch(value)) {
|
if (!hasUppercase.hasMatch(value)) {
|
||||||
missingConstraints.add(context.translate('uppercase letter','حرف كبير'));
|
missingConstraints.add(context.translate('uppercase letter', 'حرف كبير'));
|
||||||
}
|
}
|
||||||
if (!hasLowercase.hasMatch(value)) {
|
if (!hasLowercase.hasMatch(value)) {
|
||||||
missingConstraints.add(context.translate('lowercase letter','حرف صغير'));
|
missingConstraints.add(context.translate('lowercase letter', 'حرف صغير'));
|
||||||
}
|
}
|
||||||
if (!hasDigit.hasMatch(value)) {
|
if (!hasDigit.hasMatch(value)) {
|
||||||
missingConstraints.add(context.translate('numeric digit','رقم'));
|
missingConstraints.add(context.translate('numeric digit', 'رقم'));
|
||||||
}
|
}
|
||||||
if (!hasSpecialCharacter.hasMatch(value)) {
|
if (!hasSpecialCharacter.hasMatch(value)) {
|
||||||
missingConstraints.add(context.translate('special character','رمز خاص'));
|
missingConstraints.add(context.translate('special character', 'رمز خاص'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there are missing constraints, return a consolidated message
|
// If there are missing constraints, return a consolidated message
|
||||||
if (missingConstraints.isNotEmpty) {
|
if (missingConstraints.isNotEmpty) {
|
||||||
return context.translate('At least one ${missingConstraints.join(', ')}','${missingConstraints.join(', ')}على الأقل واحد ');
|
return context.translate('At least one ${missingConstraints.join(', ')}',
|
||||||
|
'${missingConstraints.join(', ')}على الأقل واحد ');
|
||||||
}
|
}
|
||||||
|
|
||||||
_password = value; // Store the password for confirm password validation
|
_password = value; // Store the password for confirm password validation
|
||||||
@ -273,11 +274,15 @@ class _RegisterScreenState extends ConsumerState<RegisterScreen> {
|
|||||||
builder: (context) {
|
builder: (context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
title: Text(context.translate( 'Email Exists','البريد الإلكتروني موجود'),),
|
title: Text(
|
||||||
|
context.translate(
|
||||||
|
'Email Exists', 'البريد الإلكتروني موجود'),
|
||||||
|
),
|
||||||
content: Text(
|
content: Text(
|
||||||
context.translate( 'Email ID already exists. Please use a different email.',
|
context.translate(
|
||||||
'معرف البريد الإلكتروني موجود بالفعل. يرجى استخدام بريد إلكتروني آخر.'
|
'Email ID already exists. Please use a different email.',
|
||||||
),),
|
'معرف البريد الإلكتروني موجود بالفعل. يرجى استخدام بريد إلكتروني آخر.'),
|
||||||
|
),
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
@ -288,18 +293,19 @@ class _RegisterScreenState extends ConsumerState<RegisterScreen> {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
style: TextButton.styleFrom(
|
style: TextButton.styleFrom(
|
||||||
backgroundColor: Color(0xFFAA8E83), // Set background color
|
backgroundColor:
|
||||||
|
Color(0xFFAA8E83), // Set background color
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(10.0), // Set text color
|
borderRadius:
|
||||||
|
BorderRadius.circular(10.0), // Set text color
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
context.translate('Ok','حسنًا'),
|
context.translate('Ok', 'حسنًا'),
|
||||||
style: TextStyle(color: Colors.white, fontSize: 16),
|
style: TextStyle(color: Colors.white, fontSize: 16),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -376,10 +382,11 @@ class _RegisterScreenState extends ConsumerState<RegisterScreen> {
|
|||||||
Align(
|
Align(
|
||||||
alignment: AlignmentDirectional.topEnd,
|
alignment: AlignmentDirectional.topEnd,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.only(top: 16.0, right :16.0),
|
padding: EdgeInsets.only(top: 16.0, right: 16.0),
|
||||||
child: Consumer(
|
child: Consumer(
|
||||||
builder: (context, ref, _) {
|
builder: (context, ref, _) {
|
||||||
final locale = ref.watch(localeProvider); // Current locale
|
final locale =
|
||||||
|
ref.watch(localeProvider); // Current locale
|
||||||
return MyToggle(
|
return MyToggle(
|
||||||
isOn: locale?.languageCode == 'en',
|
isOn: locale?.languageCode == 'en',
|
||||||
knobTextWhenOn: 'ع',
|
knobTextWhenOn: 'ع',
|
||||||
@ -390,7 +397,8 @@ class _RegisterScreenState extends ConsumerState<RegisterScreen> {
|
|||||||
final formState = _formKey.currentState;
|
final formState = _formKey.currentState;
|
||||||
ref.read(localeProvider.notifier).toggleLocale();
|
ref.read(localeProvider.notifier).toggleLocale();
|
||||||
Future.delayed(Duration(milliseconds: 100), () {
|
Future.delayed(Duration(milliseconds: 100), () {
|
||||||
if (hasValidated && formState?.validate() == false) {
|
if (hasValidated &&
|
||||||
|
formState?.validate() == false) {
|
||||||
formState?.validate();
|
formState?.validate();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -436,19 +444,21 @@ class _RegisterScreenState extends ConsumerState<RegisterScreen> {
|
|||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () => {context.go('/login')},
|
onPressed: () => {context.go('/login')},
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: Color(0xFFAA8E83), // Background color
|
backgroundColor:
|
||||||
|
Color(0xFFAA8E83), // Background color
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(12), // Border radius
|
borderRadius: BorderRadius.circular(
|
||||||
|
12), // Border radius
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
context.translate('Go to Login', 'اذهب إلى تسجيل الدخول'),
|
context.translate(
|
||||||
|
'Go to Login', 'اذهب إلى تسجيل الدخول'),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.white, // Text color
|
color: Colors.white, // Text color
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
SizedBox(height: screenheight / 5),
|
SizedBox(height: screenheight / 5),
|
||||||
Center(
|
Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -545,7 +555,8 @@ class _RegisterScreenState extends ConsumerState<RegisterScreen> {
|
|||||||
fontWeight: FontWeight.w400),
|
fontWeight: FontWeight.w400),
|
||||||
),
|
),
|
||||||
SizedBox(height: 10),
|
SizedBox(height: 10),
|
||||||
Text(AppLocalizations.of(context)!
|
Text(
|
||||||
|
AppLocalizations.of(context)!
|
||||||
.register_details,
|
.register_details,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: context.translate(18.0, 14.0),
|
fontSize: context.translate(18.0, 14.0),
|
||||||
@ -981,8 +992,10 @@ class _RegisterScreenState extends ConsumerState<RegisterScreen> {
|
|||||||
left: 15.5,
|
left: 15.5,
|
||||||
right: 30),
|
right: 30),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment:
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Checkbox(
|
Checkbox(
|
||||||
value: isChecked,
|
value: isChecked,
|
||||||
@ -996,7 +1009,8 @@ class _RegisterScreenState extends ConsumerState<RegisterScreen> {
|
|||||||
color: showError
|
color: showError
|
||||||
? Color(0xFFb22222)
|
? Color(0xFFb22222)
|
||||||
: MyTheme.topicColor(
|
: MyTheme.topicColor(
|
||||||
IndicatorTopic.economy)
|
IndicatorTopic
|
||||||
|
.economy)
|
||||||
.shade400,
|
.shade400,
|
||||||
width: 1,
|
width: 1,
|
||||||
),
|
),
|
||||||
@ -1004,11 +1018,13 @@ class _RegisterScreenState extends ConsumerState<RegisterScreen> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
top: 14.0,),
|
top: 0,
|
||||||
|
),
|
||||||
child: Text.rich(
|
child: Text.rich(
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: AppLocalizations.of(
|
text: AppLocalizations.of(
|
||||||
context,)!
|
context,
|
||||||
|
)!
|
||||||
.agree,
|
.agree,
|
||||||
// text: 'I agree to ',
|
// text: 'I agree to ',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -1019,12 +1035,16 @@ class _RegisterScreenState extends ConsumerState<RegisterScreen> {
|
|||||||
? 12
|
? 12
|
||||||
: 14,
|
: 14,
|
||||||
color: Color(
|
color: Color(
|
||||||
0xFF898C81,), // Change to your desired color
|
0xFF898C81,
|
||||||
|
), // Change to your desired color
|
||||||
),
|
),
|
||||||
children: [
|
children: [
|
||||||
TextSpan(
|
TextSpan(
|
||||||
recognizer:TapGestureRecognizer()
|
recognizer:
|
||||||
..onTap = () => context.push('/terms&conditions'),
|
TapGestureRecognizer()
|
||||||
|
..onTap = () =>
|
||||||
|
context.push(
|
||||||
|
'/terms&conditions'),
|
||||||
text: AppLocalizations.of(
|
text: AppLocalizations.of(
|
||||||
context)!
|
context)!
|
||||||
.terms_conditions,
|
.terms_conditions,
|
||||||
@ -1057,8 +1077,11 @@ class _RegisterScreenState extends ConsumerState<RegisterScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
recognizer: TapGestureRecognizer()
|
recognizer:
|
||||||
..onTap = () => context.push('/privacy_policy'),
|
TapGestureRecognizer()
|
||||||
|
..onTap = () =>
|
||||||
|
context.push(
|
||||||
|
'/privacy_policy'),
|
||||||
text: AppLocalizations.of(
|
text: AppLocalizations.of(
|
||||||
context)!
|
context)!
|
||||||
.privacy_policy,
|
.privacy_policy,
|
||||||
@ -1085,7 +1108,8 @@ class _RegisterScreenState extends ConsumerState<RegisterScreen> {
|
|||||||
context)!
|
context)!
|
||||||
.conditions,
|
.conditions,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight:
|
||||||
|
FontWeight.w500,
|
||||||
fontSize: registerLocale
|
fontSize: registerLocale
|
||||||
?.languageCode ==
|
?.languageCode ==
|
||||||
'ar'
|
'ar'
|
||||||
@ -1110,7 +1134,7 @@ class _RegisterScreenState extends ConsumerState<RegisterScreen> {
|
|||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
left:registerLocale
|
left: registerLocale
|
||||||
?.languageCode ==
|
?.languageCode ==
|
||||||
'ar'
|
'ar'
|
||||||
? 0
|
? 0
|
||||||
@ -1119,9 +1143,11 @@ class _RegisterScreenState extends ConsumerState<RegisterScreen> {
|
|||||||
?.languageCode ==
|
?.languageCode ==
|
||||||
'ar'
|
'ar'
|
||||||
? 45
|
? 45
|
||||||
: 0.0,),
|
: 0.0,
|
||||||
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
context.translate('Required', 'مطلوب'),
|
context.translate(
|
||||||
|
'Required', 'مطلوب'),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Color(0xFFb22222),
|
color: Color(0xFFb22222),
|
||||||
fontSize: registerLocale
|
fontSize: registerLocale
|
||||||
@ -1188,8 +1214,7 @@ class _RegisterScreenState extends ConsumerState<RegisterScreen> {
|
|||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
fontSize:
|
fontSize:
|
||||||
registerLocale?.languageCode ==
|
registerLocale?.languageCode == 'ar'
|
||||||
'ar'
|
|
||||||
? 12
|
? 12
|
||||||
: 14,
|
: 14,
|
||||||
color: Color(0xFF898C81),
|
color: Color(0xFF898C81),
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import 'package:screenshot/screenshot.dart';
|
|||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:tutorial_coach_mark/tutorial_coach_mark.dart';
|
import 'package:tutorial_coach_mark/tutorial_coach_mark.dart';
|
||||||
import 'package:uae_stat/config/api_config.dart';
|
import 'package:uae_stat/config/api_config.dart';
|
||||||
|
import 'package:uae_stat/config/connectivity_provider.dart';
|
||||||
import 'package:uae_stat/config/toast_util.dart';
|
import 'package:uae_stat/config/toast_util.dart';
|
||||||
import 'package:uae_stat/domain/use_cases/language.dart';
|
import 'package:uae_stat/domain/use_cases/language.dart';
|
||||||
import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/uae_numbers_asset_path.dart';
|
import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/uae_numbers_asset_path.dart';
|
||||||
@ -2098,6 +2099,15 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
final locale = ref.watch(localeProvider);
|
final locale = ref.watch(localeProvider);
|
||||||
final localeNotifier = ref.read(localeProvider.notifier);
|
final localeNotifier = ref.read(localeProvider.notifier);
|
||||||
|
|
||||||
|
final isConnected = ref.watch(connectivityProvider);
|
||||||
|
|
||||||
|
// If no internet, redirect to InternetCheckScreen
|
||||||
|
ref.listen<AsyncValue<bool>>(connectivityProvider, (previous, hasInternet) {
|
||||||
|
if (hasInternet.value == false) {
|
||||||
|
context.go('/internetcheck');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
@ -2330,7 +2340,8 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => shareCurrentPage(context, _isSharing),
|
onTap: () =>
|
||||||
|
shareCurrentPage(context, _isSharing),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
@ -2345,7 +2356,8 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
? SizedBox(
|
? SizedBox(
|
||||||
width: 24,
|
width: 24,
|
||||||
height: 24,
|
height: 24,
|
||||||
child: CircularProgressIndicator(
|
child:
|
||||||
|
CircularProgressIndicator(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
strokeWidth: 2,
|
strokeWidth: 2,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -2684,6 +2684,8 @@ class ChartWidget extends StatelessWidget {
|
|||||||
|
|
||||||
print('spots - $spots');
|
print('spots - $spots');
|
||||||
|
|
||||||
|
// lineChartLabel = spots;
|
||||||
|
|
||||||
// List<FlSpot> spots = filteredData
|
// List<FlSpot> spots = filteredData
|
||||||
// .where((entry) => entry['ObsKey'][groupByKey] == group)
|
// .where((entry) => entry['ObsKey'][groupByKey] == group)
|
||||||
// .map<FlSpot>((entry) {
|
// .map<FlSpot>((entry) {
|
||||||
|
|||||||
@ -1,34 +1,60 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:uae_stat/presentation/components/constant/constant.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:internet_connection_checker/internet_connection_checker.dart';
|
||||||
|
import 'package:uae_stat/config/connectivity_provider.dart';
|
||||||
|
|
||||||
class InternetCheck extends StatelessWidget {
|
class InternetCheckScreen extends ConsumerWidget {
|
||||||
const InternetCheck({super.key});
|
const InternetCheckScreen({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
double myheight = MediaQuery.of(context).size.height;
|
// Listen to changes in connectivity and navigate back to Home if online
|
||||||
double mywidth = MediaQuery.of(context).size.width;
|
ref.listen<AsyncValue<bool>>(connectivityProvider, (previous, hasInternet) {
|
||||||
|
if (hasInternet.value == true) {
|
||||||
|
Navigator.pop(context);
|
||||||
|
// context.go('/myhomepage');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
double myHeight = MediaQuery.of(context).size.height;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Container(
|
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Image(image: AssetImage('assets/logos/no-internet.png')),
|
Image.asset('assets/logos/no-internet.png', width: 150),
|
||||||
SizedBox(height: myheight/40,),
|
SizedBox(height: myHeight / 40),
|
||||||
Text("No Internet Connection",style: TextStyle(fontSize: 25,fontWeight: FontWeight.bold)),
|
Text("No Internet Connection",
|
||||||
Text("Please check with your Wi-Fi or Mobile",style: TextStyle(fontSize: 15,fontWeight: FontWeight.w500)),
|
style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold)),
|
||||||
Text("Data connection and try again",style: TextStyle(fontSize: 15,fontWeight: FontWeight.w500)),
|
Text("Please check your Wi-Fi or Mobile Data",
|
||||||
SizedBox(height: myheight/40,),
|
style: TextStyle(fontSize: 15, fontWeight: FontWeight.w500)),
|
||||||
|
Text("connection and try again",
|
||||||
|
style: TextStyle(fontSize: 15, fontWeight: FontWeight.w500)),
|
||||||
|
SizedBox(height: myHeight / 40),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: (){
|
onPressed: () async {
|
||||||
Navigator.pop(context);
|
bool hasInternet =
|
||||||
|
await InternetConnectionChecker.instance.hasConnection;
|
||||||
|
|
||||||
|
if (hasInternet) {
|
||||||
|
Navigator.pop(
|
||||||
|
context); // Redirect to home if internet is available
|
||||||
|
} else {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(
|
||||||
|
content:
|
||||||
|
Text("No internet connection. Please try again."),
|
||||||
|
backgroundColor: Colors.red,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: Color(
|
backgroundColor: Color(0xFFA7887A),
|
||||||
0xFFA7887A), // Brownish color for Register
|
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(10)),
|
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||||||
),
|
),
|
||||||
@ -36,14 +62,10 @@ class InternetCheck extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text("Retry",
|
||||||
"Retry",
|
style: TextStyle(fontSize: 16, color: Colors.white)),
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16, color: Colors.white),
|
|
||||||
),
|
|
||||||
SizedBox(width: 8),
|
SizedBox(width: 8),
|
||||||
Icon(Icons.arrow_forward_ios_outlined,size: 12,
|
Icon(Icons.refresh, size: 16, color: Colors.white),
|
||||||
color: Colors.white),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -51,7 +73,6 @@ class InternetCheck extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import 'package:intl/intl.dart';
|
|||||||
import 'package:pocketbase/pocketbase.dart';
|
import 'package:pocketbase/pocketbase.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:uae_stat/config/api_config.dart';
|
import 'package:uae_stat/config/api_config.dart';
|
||||||
|
import 'package:uae_stat/config/connectivity_provider.dart';
|
||||||
import 'package:uae_stat/config/my_theme.dart';
|
import 'package:uae_stat/config/my_theme.dart';
|
||||||
import 'package:uae_stat/domain/use_cases/language.dart';
|
import 'package:uae_stat/domain/use_cases/language.dart';
|
||||||
import 'package:uae_stat/infrastructure/data/p_auth_repo.dart';
|
import 'package:uae_stat/infrastructure/data/p_auth_repo.dart';
|
||||||
@ -467,6 +468,14 @@ class _ProfileScreenState extends ConsumerState<ProfileScreen> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final isConnected = ref.watch(connectivityProvider);
|
||||||
|
|
||||||
|
// If no internet, redirect to InternetCheckScreen
|
||||||
|
ref.listen<AsyncValue<bool>>(connectivityProvider, (previous, hasInternet) {
|
||||||
|
if (hasInternet.value == false) {
|
||||||
|
context.go('/internetcheck');
|
||||||
|
}
|
||||||
|
});
|
||||||
final profileLocale = ref.watch(localeProvider);
|
final profileLocale = ref.watch(localeProvider);
|
||||||
return PopScope(
|
return PopScope(
|
||||||
canPop: false, // Allow back navigation only if not login screen
|
canPop: false, // Allow back navigation only if not login screen
|
||||||
|
|||||||
@ -209,6 +209,21 @@ class LoginRoute extends HookConsumerWidget {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
emailValidation({String? message, String? requiredMessage}) {
|
||||||
|
return (fieldValue) {
|
||||||
|
if (fieldValue == null || fieldValue.trim().isEmpty) {
|
||||||
|
return requiredMessage ?? "Email is required";
|
||||||
|
}
|
||||||
|
if (!Validator.isEmail(fieldValue)) {
|
||||||
|
if (fieldValue.contains(" ")) {
|
||||||
|
return "Space is present, email is not correct";
|
||||||
|
}
|
||||||
|
return message ?? "Email is not correct";
|
||||||
|
}
|
||||||
|
return null; // Validation passed
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final hasValidated = useState(false);
|
final hasValidated = useState(false);
|
||||||
@ -241,7 +256,7 @@ class LoginRoute extends HookConsumerWidget {
|
|||||||
content: Form(
|
content: Form(
|
||||||
key: forgotPwFormKey,
|
key: forgotPwFormKey,
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
validator: FieldValidator.email(),
|
validator: emailValidation(),
|
||||||
controller: emailCtl,
|
controller: emailCtl,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: context.translate(
|
labelText: context.translate(
|
||||||
@ -456,7 +471,8 @@ class LoginRoute extends HookConsumerWidget {
|
|||||||
print("Is Profile Complete: $isProfileComplete");
|
print("Is Profile Complete: $isProfileComplete");
|
||||||
|
|
||||||
// Extract intendedPath from query parameters (if coming from redirect)
|
// Extract intendedPath from query parameters (if coming from redirect)
|
||||||
final String? intendedPath = GoRouterState.of(context).uri.queryParameters['intendedPath'];
|
final String? intendedPath =
|
||||||
|
GoRouterState.of(context).uri.queryParameters['intendedPath'];
|
||||||
print("Extracted intendedPath after login: $intendedPath");
|
print("Extracted intendedPath after login: $intendedPath");
|
||||||
|
|
||||||
if (!context.mounted) return;
|
if (!context.mounted) return;
|
||||||
|
|||||||
@ -168,6 +168,7 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:pocketbase/pocketbase.dart';
|
import 'package:pocketbase/pocketbase.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:uae_stat/config/api_config.dart';
|
import 'package:uae_stat/config/api_config.dart';
|
||||||
|
import 'package:uae_stat/config/connectivity_provider.dart';
|
||||||
import 'package:uae_stat/domain/use_cases/language.dart';
|
import 'package:uae_stat/domain/use_cases/language.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/components/indicators/locale_provider.dart';
|
import 'package:uae_stat/presentation/components/indicators/locale_provider.dart';
|
||||||
@ -1134,6 +1135,16 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
final localeCode = next?.languageCode ?? 'en'; // Default to 'en' if null
|
final localeCode = next?.languageCode ?? 'en'; // Default to 'en' if null
|
||||||
fetchData(localeCode);
|
fetchData(localeCode);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
final isConnected = ref.watch(connectivityProvider);
|
||||||
|
|
||||||
|
// If no internet, redirect to InternetCheckScreen
|
||||||
|
ref.listen<AsyncValue<bool>>(connectivityProvider, (previous, hasInternet) {
|
||||||
|
if (hasInternet.value == false) {
|
||||||
|
context.go('/internetcheck');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
double myheight = MediaQuery.of(context).size.height;
|
double myheight = MediaQuery.of(context).size.height;
|
||||||
double mywidth = MediaQuery.of(context).size.width;
|
double mywidth = MediaQuery.of(context).size.width;
|
||||||
|
|
||||||
|
|||||||
@ -7,13 +7,13 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
|||||||
import 'package:pocketbase/pocketbase.dart';
|
import 'package:pocketbase/pocketbase.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:uae_stat/config/api_config.dart';
|
import 'package:uae_stat/config/api_config.dart';
|
||||||
|
import 'package:uae_stat/config/connectivity_provider.dart';
|
||||||
import 'package:uae_stat/domain/use_cases/language.dart';
|
import 'package:uae_stat/domain/use_cases/language.dart';
|
||||||
import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/bookmark_asset_path.dart';
|
import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/bookmark_asset_path.dart';
|
||||||
import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/uae_numbers_asset_path.dart';
|
import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/uae_numbers_asset_path.dart';
|
||||||
import 'package:uae_stat/presentation/components/indicators/locale_provider.dart';
|
import 'package:uae_stat/presentation/components/indicators/locale_provider.dart';
|
||||||
import 'package:uae_stat/presentation/routes/drawer_routes/custom_drawer_routes.dart';
|
import 'package:uae_stat/presentation/routes/drawer_routes/custom_drawer_routes.dart';
|
||||||
|
|
||||||
|
|
||||||
class BookMark extends ConsumerStatefulWidget {
|
class BookMark extends ConsumerStatefulWidget {
|
||||||
const BookMark({super.key});
|
const BookMark({super.key});
|
||||||
|
|
||||||
@ -35,7 +35,6 @@ class _BookMarkState extends ConsumerState<BookMark> {
|
|||||||
super.initState();
|
super.initState();
|
||||||
final locale = ref.read(localeProvider);
|
final locale = ref.read(localeProvider);
|
||||||
fetchBookmarks(locale?.languageCode ?? 'en');
|
fetchBookmarks(locale?.languageCode ?? 'en');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String colorToHex(Color color) {
|
String colorToHex(Color color) {
|
||||||
@ -43,6 +42,7 @@ class _BookMarkState extends ConsumerState<BookMark> {
|
|||||||
'${color.green.toRadixString(16).padLeft(2, '0').toUpperCase()}'
|
'${color.green.toRadixString(16).padLeft(2, '0').toUpperCase()}'
|
||||||
'${color.blue.toRadixString(16).padLeft(2, '0').toUpperCase()}';
|
'${color.blue.toRadixString(16).padLeft(2, '0').toUpperCase()}';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to convert hex color string to int
|
// Function to convert hex color string to int
|
||||||
Color _parseColor(String? colorString) {
|
Color _parseColor(String? colorString) {
|
||||||
if (colorString == null || colorString.isEmpty) {
|
if (colorString == null || colorString.isEmpty) {
|
||||||
@ -105,26 +105,26 @@ class _BookMarkState extends ConsumerState<BookMark> {
|
|||||||
String? mainTopic = item['main_topic'];
|
String? mainTopic = item['main_topic'];
|
||||||
String subtitle = item['subtitle'];
|
String subtitle = item['subtitle'];
|
||||||
|
|
||||||
|
|
||||||
// Ignore if main_topic is null
|
// Ignore if main_topic is null
|
||||||
if (mainTopic == null) continue;
|
if (mainTopic == null) continue;
|
||||||
|
|
||||||
// If main_topic doesn't exist in groupedMap, create a new entry
|
// If main_topic doesn't exist in groupedMap, create a new entry
|
||||||
if (!groupedMap.containsKey(mainTopic)) {
|
if (!groupedMap.containsKey(mainTopic)) {
|
||||||
groupedMap[mainTopic] = {'main_topic': mainTopic,
|
groupedMap[mainTopic] = {
|
||||||
|
'main_topic': mainTopic,
|
||||||
'valueColor': item['valueColor'],
|
'valueColor': item['valueColor'],
|
||||||
'SubTopic': []
|
'SubTopic': []
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add subtitle as a key with its corresponding map value
|
// Add subtitle as a key with its corresponding map value
|
||||||
groupedMap[mainTopic]!['SubTopic'].add ({
|
groupedMap[mainTopic]!['SubTopic'].add({
|
||||||
'subtitle': subtitle,
|
'subtitle': subtitle,
|
||||||
'isBookmark': item['isBookmark'],
|
'isBookmark': item['isBookmark'],
|
||||||
'value': item['value'],
|
'value': item['value'],
|
||||||
'title':item['title'],
|
'title': item['title'],
|
||||||
'value_source':item['value_source'],
|
'value_source': item['value_source'],
|
||||||
'data_set':item['data_set'],
|
'data_set': item['data_set'],
|
||||||
'id': item['id'],
|
'id': item['id'],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -253,7 +253,8 @@ class _BookMarkState extends ConsumerState<BookMark> {
|
|||||||
backgroundColor: Color(0xFFAA8E83), // Set background color
|
backgroundColor: Color(0xFFAA8E83), // Set background color
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(10.0), // Set text color
|
borderRadius:
|
||||||
|
BorderRadius.circular(10.0), // Set text color
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -264,7 +265,6 @@ class _BookMarkState extends ConsumerState<BookMark> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -272,12 +272,32 @@ class _BookMarkState extends ConsumerState<BookMark> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final isConnected = ref.watch(connectivityProvider);
|
||||||
|
|
||||||
|
// If no internet, redirect to InternetCheckScreen
|
||||||
|
ref.listen<AsyncValue<bool>>(connectivityProvider, (previous, hasInternet) {
|
||||||
|
if (hasInternet.value == false) {
|
||||||
|
context.go('/internetcheck');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
final List<Map<String, dynamic>> tabs = [
|
final List<Map<String, dynamic>> tabs = [
|
||||||
{ 'title':AppLocalizations.of(context)!.all_bookmarks, 'color': Colors.black},
|
{
|
||||||
{ 'title': AppLocalizations.of(context)!.economy_title, 'color': Color(0xFF90B0D5)},
|
'title': AppLocalizations.of(context)!.all_bookmarks,
|
||||||
{ 'title':AppLocalizations.of(context)!.social_title, 'color': Color(0xFFAA8E83)},
|
'color': Colors.black
|
||||||
{ 'title': AppLocalizations.of(context)!.environment_title, 'color': Color(0xFF7DAFBC)},
|
},
|
||||||
|
{
|
||||||
|
'title': AppLocalizations.of(context)!.economy_title,
|
||||||
|
'color': Color(0xFF90B0D5)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': AppLocalizations.of(context)!.social_title,
|
||||||
|
'color': Color(0xFFAA8E83)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': AppLocalizations.of(context)!.environment_title,
|
||||||
|
'color': Color(0xFF7DAFBC)
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
ref.listen<Locale?>(localeProvider, (previous, next) {
|
ref.listen<Locale?>(localeProvider, (previous, next) {
|
||||||
@ -285,23 +305,26 @@ class _BookMarkState extends ConsumerState<BookMark> {
|
|||||||
fetchBookmarks(localeCode);
|
fetchBookmarks(localeCode);
|
||||||
});
|
});
|
||||||
|
|
||||||
List<Map<String, dynamic>> bookmarks = dataList.where((item) => item['isBookmark'] == true).toList();
|
List<Map<String, dynamic>> bookmarks =
|
||||||
List<Map<String, dynamic>> filteredBookmarks = dataList
|
dataList.where((item) => item['isBookmark'] == true).toList();
|
||||||
.where((bookmark) {
|
List<Map<String, dynamic>> filteredBookmarks = dataList.where((bookmark) {
|
||||||
String mainTopic = bookmark['main_topic'].toString().trim().toLowerCase();
|
String mainTopic = bookmark['main_topic'].toString().trim().toLowerCase();
|
||||||
String selectedTabTitle = tabs[selectedTabIndex]['title'].toString().trim().toLowerCase();
|
String selectedTabTitle =
|
||||||
|
tabs[selectedTabIndex]['title'].toString().trim().toLowerCase();
|
||||||
|
|
||||||
// Debugging prints
|
// Debugging prints
|
||||||
print("main_topic: '$mainTopic', selected_tab_title: '$selectedTabTitle'");
|
print(
|
||||||
|
"main_topic: '$mainTopic', selected_tab_title: '$selectedTabTitle'");
|
||||||
|
|
||||||
return mainTopic == selectedTabTitle;
|
return mainTopic == selectedTabTitle;
|
||||||
})
|
}).toList();
|
||||||
.toList();
|
|
||||||
// print( 'filtered one :${filteredBookmarks['main_topic']} , Tabs : ${tabs[selectedTabIndex]["title"]}');
|
// print( 'filtered one :${filteredBookmarks['main_topic']} , Tabs : ${tabs[selectedTabIndex]["title"]}');
|
||||||
List<Map<String, dynamic>> transformedList = groupedMap.values.toList();
|
List<Map<String, dynamic>> transformedList = groupedMap.values.toList();
|
||||||
// print('filtered $filteredBookmarks');
|
// print('filtered $filteredBookmarks');
|
||||||
return BaseScaffold(
|
return BaseScaffold(
|
||||||
title: Text(AppLocalizations.of(context)!.bookmarks,),
|
title: Text(
|
||||||
|
AppLocalizations.of(context)!.bookmarks,
|
||||||
|
),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: [
|
||||||
TabBarHeader(
|
TabBarHeader(
|
||||||
@ -321,19 +344,20 @@ class _BookMarkState extends ConsumerState<BookMark> {
|
|||||||
children: List.generate(transformedList.length, (i) {
|
children: List.generate(transformedList.length, (i) {
|
||||||
final mainTopic = transformedList[i];
|
final mainTopic = transformedList[i];
|
||||||
print('oustside1 $mainTopic');
|
print('oustside1 $mainTopic');
|
||||||
final list=List.from(mainTopic['SubTopic'] ?? []);
|
final list = List.from(mainTopic['SubTopic'] ?? []);
|
||||||
print('oustside2 $list');
|
print('oustside2 $list');
|
||||||
return CustomExpandableTile(
|
return CustomExpandableTile(
|
||||||
index: i,
|
index: i,
|
||||||
isExpanded: expandedIndex == i,
|
isExpanded: expandedIndex == i,
|
||||||
onTap: (int index) { // 🔹 Expecting an index
|
onTap: (int index) {
|
||||||
|
// 🔹 Expecting an index
|
||||||
setState(() {
|
setState(() {
|
||||||
expandedIndex = (expandedIndex == index) ? null : index;
|
expandedIndex =
|
||||||
|
(expandedIndex == index) ? null : index;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
title: mainTopic['main_topic'] ?? 'No Topic',
|
title: mainTopic['main_topic'] ?? 'No Topic',
|
||||||
childWidget:
|
childWidget: Container(
|
||||||
Container(
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
// borderRadius: BorderRadius.all(Radius.circular(20))
|
// borderRadius: BorderRadius.all(Radius.circular(20))
|
||||||
@ -349,13 +373,18 @@ class _BookMarkState extends ConsumerState<BookMark> {
|
|||||||
mainAxisSpacing: 10.0,
|
mainAxisSpacing: 10.0,
|
||||||
mainAxisExtent: 100,
|
mainAxisExtent: 100,
|
||||||
),
|
),
|
||||||
itemCount:list.length,
|
itemCount: list.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return _buildBoxes(mainTopic['SubTopic'][index], context,mainTopic['valueColor']);
|
return _buildBoxes(
|
||||||
|
mainTopic['SubTopic'][index],
|
||||||
|
context,
|
||||||
|
mainTopic['valueColor']);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
filteredBookmarks: List.from(mainTopic['SubTopic'] ?? []), titleBackgroundColor: mainTopic['valueColor'],
|
filteredBookmarks:
|
||||||
|
List.from(mainTopic['SubTopic'] ?? []),
|
||||||
|
titleBackgroundColor: mainTopic['valueColor'],
|
||||||
// Ensure it's a new list
|
// Ensure it's a new list
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
@ -369,14 +398,15 @@ class _BookMarkState extends ConsumerState<BookMark> {
|
|||||||
size: 100, color: Colors.grey[400]),
|
size: 100, color: Colors.grey[400]),
|
||||||
SizedBox(height: 16),
|
SizedBox(height: 16),
|
||||||
Text(
|
Text(
|
||||||
context.translate('No BookMark Added','لم يتم إضافة أي علامة مرجعية'),
|
context.translate('No BookMark Added',
|
||||||
|
'لم يتم إضافة أي علامة مرجعية'),
|
||||||
style:
|
style:
|
||||||
TextStyle(fontSize: 16, color: Colors.grey),
|
TextStyle(fontSize: 16, color: Colors.grey),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
))
|
))
|
||||||
:filteredBookmarks.isEmpty
|
: filteredBookmarks.isEmpty
|
||||||
? Center(
|
? Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@ -399,12 +429,13 @@ class _BookMarkState extends ConsumerState<BookMark> {
|
|||||||
Container(
|
Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: tabs[selectedTabIndex]['color'],
|
color: tabs[selectedTabIndex]['color'],
|
||||||
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(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
tabs[selectedTabIndex]['title'],
|
tabs[selectedTabIndex]['title'],
|
||||||
@ -417,7 +448,9 @@ class _BookMarkState extends ConsumerState<BookMark> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 20,),
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: GridView.builder(
|
child: GridView.builder(
|
||||||
gridDelegate:
|
gridDelegate:
|
||||||
@ -429,7 +462,8 @@ class _BookMarkState extends ConsumerState<BookMark> {
|
|||||||
),
|
),
|
||||||
itemCount: filteredBookmarks.length,
|
itemCount: filteredBookmarks.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return _buildBox(filteredBookmarks[index], context);
|
return _buildBox(
|
||||||
|
filteredBookmarks[index], context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -438,12 +472,10 @@ class _BookMarkState extends ConsumerState<BookMark> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildBox(Map<String, dynamic> data, BuildContext context) {
|
Widget _buildBox(Map<String, dynamic> data, BuildContext context) {
|
||||||
// Color borderColor = data['valueColor'];
|
// Color borderColor = data['valueColor'];
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
@ -501,10 +533,9 @@ class _BookMarkState extends ConsumerState<BookMark> {
|
|||||||
child: SvgPicture.asset(
|
child: SvgPicture.asset(
|
||||||
BookmarkAssetPath.delete,
|
BookmarkAssetPath.delete,
|
||||||
semanticsLabel: 'share',
|
semanticsLabel: 'share',
|
||||||
width:23,
|
width: 23,
|
||||||
height: 20,
|
height: 20,
|
||||||
)
|
)),
|
||||||
),
|
|
||||||
|
|
||||||
// GestureDetector(
|
// GestureDetector(
|
||||||
// onTap: () {
|
// onTap: () {
|
||||||
@ -543,7 +574,8 @@ class _BookMarkState extends ConsumerState<BookMark> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildBoxes(Map<String, dynamic> data, BuildContext context, Color styleColor) {
|
Widget _buildBoxes(
|
||||||
|
Map<String, dynamic> data, BuildContext context, Color styleColor) {
|
||||||
// Color borderColor = data['valueColor'];
|
// Color borderColor = data['valueColor'];
|
||||||
print('inside function $data');
|
print('inside function $data');
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
@ -555,7 +587,8 @@ class _BookMarkState extends ConsumerState<BookMark> {
|
|||||||
final encodedTitle = data['title'];
|
final encodedTitle = data['title'];
|
||||||
String hexColor = colorToHex(styleColor);
|
String hexColor = colorToHex(styleColor);
|
||||||
|
|
||||||
debugPrint( '/chartScreen/$data_set?bgColor=$hexColor&mainTopic=$encodedMainTopic&title=$encodedTitle');
|
debugPrint(
|
||||||
|
'/chartScreen/$data_set?bgColor=$hexColor&mainTopic=$encodedMainTopic&title=$encodedTitle');
|
||||||
|
|
||||||
// String hexColor = colorToHex(colorPattern); // Get hex string
|
// String hexColor = colorToHex(colorPattern); // Get hex string
|
||||||
// print(hexColor); // Prints: 0xFFAA8E83
|
// print(hexColor); // Prints: 0xFFAA8E83
|
||||||
@ -573,8 +606,7 @@ class _BookMarkState extends ConsumerState<BookMark> {
|
|||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10),
|
||||||
border: Border.all(color: styleColor),
|
border: Border.all(color: styleColor),
|
||||||
),
|
),
|
||||||
child:
|
child: Align(
|
||||||
Align(
|
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
@ -603,10 +635,9 @@ class _BookMarkState extends ConsumerState<BookMark> {
|
|||||||
child: SvgPicture.asset(
|
child: SvgPicture.asset(
|
||||||
BookmarkAssetPath.delete,
|
BookmarkAssetPath.delete,
|
||||||
semanticsLabel: 'share',
|
semanticsLabel: 'share',
|
||||||
width:23,
|
width: 23,
|
||||||
height: 20,
|
height: 20,
|
||||||
)
|
)),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
@ -630,7 +661,6 @@ class _BookMarkState extends ConsumerState<BookMark> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class TabBarHeader extends StatelessWidget {
|
class TabBarHeader extends StatelessWidget {
|
||||||
@ -715,7 +745,6 @@ class CustomExpandableTile extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _CustomExpandableTileState extends State<CustomExpandableTile> {
|
class _CustomExpandableTileState extends State<CustomExpandableTile> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState(); // Initialize isExpanded based on widget's property
|
super.initState(); // Initialize isExpanded based on widget's property
|
||||||
@ -733,13 +762,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(
|
||||||
@ -771,8 +800,8 @@ class _CustomExpandableTileState extends State<CustomExpandableTile> {
|
|||||||
curve: Curves.easeInOut,
|
curve: Curves.easeInOut,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
height:widget.isExpanded ? myheight * 0.4 : 0,
|
// height: widget.isExpanded ? myheight * 0.4 : 0,
|
||||||
child:widget.isExpanded
|
child: widget.isExpanded
|
||||||
? SingleChildScrollView(
|
? SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:pocketbase/pocketbase.dart';
|
import 'package:pocketbase/pocketbase.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:uae_stat/config/api_config.dart';
|
import 'package:uae_stat/config/api_config.dart';
|
||||||
import 'package:uae_stat/domain/use_cases/language.dart';
|
import 'package:uae_stat/domain/use_cases/language.dart';
|
||||||
import 'package:uae_stat/presentation/components/indicators/locale_provider.dart';
|
import 'package:uae_stat/presentation/components/indicators/locale_provider.dart';
|
||||||
@ -21,28 +22,67 @@ class _NotificationPageState extends ConsumerState<NotificationPage> {
|
|||||||
// Example notification data
|
// Example notification data
|
||||||
final _pb = PocketBase(apiUrl);
|
final _pb = PocketBase(apiUrl);
|
||||||
List<Map<String, dynamic>> notifications = [];
|
List<Map<String, dynamic>> notifications = [];
|
||||||
|
List<String> pushedNotification = [];
|
||||||
|
|
||||||
// Current selected tab index
|
// Current selected tab index
|
||||||
int selectedTabIndex = 0;
|
int selectedTabIndex = 0;
|
||||||
late final Locale locale;
|
late final Locale locale;
|
||||||
|
dynamic userID;
|
||||||
|
|
||||||
// Tab categories
|
// Tab categories
|
||||||
final List<String> tabs = [
|
// final List<String> tabs = [
|
||||||
"All updates",
|
// "All updates",
|
||||||
"App updates",
|
// "App updates",
|
||||||
"Social",
|
// "Social",
|
||||||
"Economy",
|
// "Economy",
|
||||||
"Environment",
|
// "Environment",
|
||||||
"Favourites"
|
// "Favourites"
|
||||||
];
|
// ];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
locale = ref.read(localeProvider) ?? const Locale('en');
|
locale = ref.read(localeProvider) ?? const Locale('en');
|
||||||
|
_fetchUserData();
|
||||||
fetchNotifications(locale?.languageCode ?? 'en');
|
fetchNotifications(locale?.languageCode ?? 'en');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<String?> getUserId() async {
|
||||||
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
return prefs.getString('userId'); // Retrieve the userId
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _fetchUserData() async {
|
||||||
|
try {
|
||||||
|
String? fetchedUserId = await getUserId();
|
||||||
|
userID = fetchedUserId;
|
||||||
|
final adminAuth = await _pb.admins
|
||||||
|
.authWithPassword('pb@venbainfotech.com', 'pb@venbainfotech.com');
|
||||||
|
final adminToken = adminAuth.token;
|
||||||
|
print('adminToken- ${adminToken}');
|
||||||
|
final userDetailsResponse = await _pb.collection('users').getOne(
|
||||||
|
fetchedUserId!,
|
||||||
|
headers: {
|
||||||
|
'Authorization': 'Bearer $adminToken',
|
||||||
|
},
|
||||||
|
);
|
||||||
|
print('userDetails: $userDetailsResponse');
|
||||||
|
setState(() {
|
||||||
|
print('In');
|
||||||
|
// Extract pushed_notification from response
|
||||||
|
List<dynamic> notifications =
|
||||||
|
userDetailsResponse.data['pushed_notification'];
|
||||||
|
|
||||||
|
// Convert to List<String>
|
||||||
|
pushedNotification = List<String>.from(notifications);
|
||||||
|
|
||||||
|
print('pushedNotification: $pushedNotification');
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
print('Error fetching user details: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String formatDate(String dateString) {
|
String formatDate(String dateString) {
|
||||||
try {
|
try {
|
||||||
DateTime dateTime =
|
DateTime dateTime =
|
||||||
@ -81,21 +121,6 @@ class _NotificationPageState extends ConsumerState<NotificationPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Future<void> fetchNotifications() async {/api/getNotification?language=ar
|
|
||||||
// try {
|
|
||||||
// await _pb.admins
|
|
||||||
// .authWithPassword('pb@venbainfotech.com', 'pb@venbainfotech.com');
|
|
||||||
//
|
|
||||||
// final result = await _pb.collection('notification').getFullList();
|
|
||||||
//
|
|
||||||
// setState(() {
|
|
||||||
// notifications = result.map((record) => record.toJson()).toList();
|
|
||||||
// });
|
|
||||||
// } catch (e) {
|
|
||||||
// print('Error fetching notifications: $e');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
ref.listen<Locale?>(localeProvider, (previous, next) {
|
ref.listen<Locale?>(localeProvider, (previous, next) {
|
||||||
@ -177,6 +202,8 @@ class _NotificationPageState extends ConsumerState<NotificationPage> {
|
|||||||
category: notification['category'] ?? 'Unknown',
|
category: notification['category'] ?? 'Unknown',
|
||||||
message: notification['message'] ?? '',
|
message: notification['message'] ?? '',
|
||||||
id: notification['id'],
|
id: notification['id'],
|
||||||
|
pushedNotification: pushedNotification,
|
||||||
|
userID: userID,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -253,6 +280,8 @@ class NotificationTile extends StatelessWidget {
|
|||||||
final String date;
|
final String date;
|
||||||
final String category;
|
final String category;
|
||||||
final String id;
|
final String id;
|
||||||
|
final String userID;
|
||||||
|
final List<String> pushedNotification;
|
||||||
|
|
||||||
const NotificationTile({
|
const NotificationTile({
|
||||||
required this.title,
|
required this.title,
|
||||||
@ -260,12 +289,19 @@ class NotificationTile extends StatelessWidget {
|
|||||||
required this.date,
|
required this.date,
|
||||||
required this.category,
|
required this.category,
|
||||||
required this.id,
|
required this.id,
|
||||||
|
required this.userID,
|
||||||
|
required this.pushedNotification,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
bool isPushed = pushedNotification.contains(id);
|
||||||
|
print('isPushed $isPushed , $id');
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: isPushed
|
||||||
|
? () {
|
||||||
|
readedNotification(userID, id);
|
||||||
final encodedKey = Uri.encodeQueryComponent('notification');
|
final encodedKey = Uri.encodeQueryComponent('notification');
|
||||||
context.go('/notification_details', extra: {
|
context.go('/notification_details', extra: {
|
||||||
'title': title,
|
'title': title,
|
||||||
@ -275,22 +311,61 @@ class NotificationTile extends StatelessWidget {
|
|||||||
'id': id,
|
'id': id,
|
||||||
'backNavigation': encodedKey
|
'backNavigation': encodedKey
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
: null,
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
// leading: Icon(Icons.circle,
|
leading: isPushed
|
||||||
// size: 12, color: category == "Social" ? Colors.red : Colors.grey),
|
? const Icon(Icons.circle, size: 12, color: Color(0xFFFF274E))
|
||||||
leading: Icon(Icons.circle, size: 12, color: Colors.red),
|
: const Icon(Icons.circle, size: 12, color: Color(0x99414042)),
|
||||||
title: Text(title, style: const TextStyle(fontWeight: FontWeight.bold)),
|
title: Text(
|
||||||
|
title,
|
||||||
|
style: TextStyle(
|
||||||
|
color: isPushed ? const Color(0xFF414042) : const Color(0x99414042),
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
date,
|
date,
|
||||||
style: const TextStyle(
|
style: TextStyle(
|
||||||
color: Color(0xFF8E8E8E),
|
color: isPushed ? const Color(0xFF8E8E8E) : const Color(0x998E8E8E),
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.w400),
|
fontWeight: FontWeight.w400,
|
||||||
),
|
),
|
||||||
trailing: const Icon(Icons.arrow_forward_ios,
|
),
|
||||||
size: 16, color: Color(0xFF898C81)),
|
trailing: isPushed
|
||||||
|
? const Icon(Icons.arrow_forward_ios,
|
||||||
|
size: 16, color: Color(0xFF898C81))
|
||||||
|
: null,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final pb = PocketBase(apiUrl);
|
||||||
|
Future<void> readedNotification(String userId, String notificationId) async {
|
||||||
|
await pb.admins.authWithPassword(
|
||||||
|
'pb@venbainfotech.com',
|
||||||
|
'pb@venbainfotech.com',
|
||||||
|
);
|
||||||
|
|
||||||
|
final url =
|
||||||
|
"${pb.baseUrl}api/removeNotification?user_id=$userId¬ification_id=$notificationId";
|
||||||
|
|
||||||
|
try {
|
||||||
|
final response = await http.get(
|
||||||
|
Uri.parse(url),
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json', // Add this
|
||||||
|
'Authorization': pb.authStore.token, // Correct way to send auth token
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
print("✅ updated successfully!");
|
||||||
|
} else {
|
||||||
|
print("❌ Failed to update : ${response.body}");
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
print("🚨 Error updating : $e");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
40
pubspec.lock
40
pubspec.lock
@ -173,10 +173,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: built_value
|
name: built_value
|
||||||
sha256: "8b158ab94ec6913e480dc3f752418348b5ae099eb75868b5f4775f0572999c61"
|
sha256: ea90e81dc4a25a043d9bee692d20ed6d1c4a1662a28c03a96417446c093ed6b4
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "8.9.4"
|
version: "8.9.5"
|
||||||
characters:
|
characters:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -824,10 +824,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: image_picker_android
|
name: image_picker_android
|
||||||
sha256: "82652a75e3dd667a91187769a6a2cc81bd8c111bbead698d8e938d2b63e5e89a"
|
sha256: "8bd392ba8b0c8957a157ae0dc9fcf48c58e6c20908d5880aea1d79734df090e9"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.8.12+21"
|
version: "0.8.12+22"
|
||||||
image_picker_for_web:
|
image_picker_for_web:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -892,6 +892,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.7.0"
|
version: "2.7.0"
|
||||||
|
internet_connection_checker:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: internet_connection_checker
|
||||||
|
sha256: ee08f13d8b13b978affe226e9274ca3ba7a9bed07c9479e8ae245f785b7a488a
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.1"
|
||||||
intl:
|
intl:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -1104,10 +1112,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_android
|
name: path_provider_android
|
||||||
sha256: "4adf4fd5423ec60a29506c76581bc05854c55e3a0b72d35bb28d661c9686edf2"
|
sha256: "0ca7359dad67fd7063cb2892ab0c0737b2daafd807cf1acecd62374c8fae6c12"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.15"
|
version: "2.2.16"
|
||||||
path_provider_foundation:
|
path_provider_foundation:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -1192,10 +1200,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: pub_semver
|
name: pub_semver
|
||||||
sha256: "7b3cfbf654f3edd0c6298ecd5be782ce997ddf0e00531b9464b55245185bbbbd"
|
sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.5"
|
version: "2.2.0"
|
||||||
pubspec_parse:
|
pubspec_parse:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -1311,10 +1319,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: shared_preferences_android
|
name: shared_preferences_android
|
||||||
sha256: a768fc8ede5f0c8e6150476e14f38e2417c0864ca36bb4582be8e21925a03c22
|
sha256: "3ec7210872c4ba945e3244982918e502fa2bfb5230dff6832459ca0e1879b7ad"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.4.6"
|
version: "2.4.8"
|
||||||
shared_preferences_foundation:
|
shared_preferences_foundation:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -1539,10 +1547,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: url_launcher_android
|
name: url_launcher_android
|
||||||
sha256: "6fc2f56536ee873eeb867ad176ae15f304ccccc357848b351f6f0d8d4a40d193"
|
sha256: "1d0eae19bd7606ef60fe69ef3b312a437a16549476c42321d5dc1506c9ca3bf4"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.3.14"
|
version: "6.3.15"
|
||||||
url_launcher_ios:
|
url_launcher_ios:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -1643,10 +1651,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: video_player_android
|
name: video_player_android
|
||||||
sha256: "7018dbcb395e2bca0b9a898e73989e67c0c4a5db269528e1b036ca38bcca0d0b"
|
sha256: d949a83d1a333178eb3a9683f70afa41b7771c2bfa4cedd894fe836942de06b1
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.7.17"
|
version: "2.8.1"
|
||||||
video_player_avfoundation:
|
video_player_avfoundation:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -1723,10 +1731,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: webview_flutter_android
|
name: webview_flutter_android
|
||||||
sha256: "512c26ccc5b8a571fd5d13ec994b7509f142ff6faf85835e243dde3538fdc713"
|
sha256: "631093a7fbd93e9690ac61d8c8f3e857efbc189fc33f712b9ad6c01a623517ef"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.3.2"
|
version: "4.3.3"
|
||||||
webview_flutter_platform_interface:
|
webview_flutter_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@ -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.32+33
|
version: 1.0.33+34
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.2.3 <4.0.0"
|
sdk: ">=3.2.3 <4.0.0"
|
||||||
@ -68,6 +68,7 @@ dependencies:
|
|||||||
flutter_svg: ^2.0.17
|
flutter_svg: ^2.0.17
|
||||||
boxy: ^2.2.1
|
boxy: ^2.2.1
|
||||||
firebase_messaging: ^15.2.4
|
firebase_messaging: ^15.2.4
|
||||||
|
internet_connection_checker: ^3.0.1
|
||||||
|
|
||||||
dependency_overrides:
|
dependency_overrides:
|
||||||
fading_edge_scrollview: ^4.1.1
|
fading_edge_scrollview: ^4.1.1
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user