App Tour first time login and fiter change
This commit is contained in:
parent
b5d4df493e
commit
3ba3650e92
@ -15,12 +15,12 @@ if (localPropertiesFile.exists()) {
|
|||||||
|
|
||||||
def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
|
def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
|
||||||
if (flutterVersionCode == null) {
|
if (flutterVersionCode == null) {
|
||||||
flutterVersionCode = "6"
|
flutterVersionCode = "7"
|
||||||
}
|
}
|
||||||
|
|
||||||
def flutterVersionName = localProperties.getProperty("flutter.versionName")
|
def flutterVersionName = localProperties.getProperty("flutter.versionName")
|
||||||
if (flutterVersionName == null) {
|
if (flutterVersionName == null) {
|
||||||
flutterVersionName = "1.0.5"
|
flutterVersionName = "1.0.6"
|
||||||
}
|
}
|
||||||
|
|
||||||
def keystorePropertiesFile = rootProject.file("key.properties")
|
def keystorePropertiesFile = rootProject.file("key.properties")
|
||||||
|
|||||||
BIN
assets/icons/misc/vector.png
Normal file
BIN
assets/icons/misc/vector.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 557 B |
BIN
assets/icons/misc/visibility_off.png
Normal file
BIN
assets/icons/misc/visibility_off.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
BIN
assets/icons/misc/visible_on.png
Normal file
BIN
assets/icons/misc/visible_on.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 818 B |
@ -328,16 +328,15 @@ final GoRouter router = GoRouter(
|
|||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/',
|
path: '/',
|
||||||
//builder: (context, state) => LoginRoute(),
|
//builder: (context, state) => LoginRoute(),
|
||||||
builder: (context, state) => LoginRoute(),
|
builder: (context, state) => LoginRoute(isLoginScreen: true),
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/internetcheck',
|
path: '/internetcheck',
|
||||||
builder: (context, state) => InternetCheck(),
|
builder: (context, state) => InternetCheck(),
|
||||||
|
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/login',
|
path: '/login',
|
||||||
builder: (context, state) => LoginRoute(),
|
builder: (context, state) => LoginRoute(isLoginScreen: true),
|
||||||
//builder: (context, state) => LoginRoute(),
|
//builder: (context, state) => LoginRoute(),
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
|
|||||||
@ -6,4 +6,7 @@ abstract class MiscIconAssetPath {
|
|||||||
static const menu = '$_basePath/menu.png';
|
static const menu = '$_basePath/menu.png';
|
||||||
static const person = '$_basePath/person.png';
|
static const person = '$_basePath/person.png';
|
||||||
static const back = '$_basePath/back.png';
|
static const back = '$_basePath/back.png';
|
||||||
|
static const vector = '$_basePath/vector.png';
|
||||||
|
static const visibleOn = '$_basePath/visible_on.png';
|
||||||
|
static const visibilityOff = '$_basePath/visibility_off.png';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,14 +12,16 @@
|
|||||||
"enter_your_email": "Enter your email",
|
"enter_your_email": "Enter your email",
|
||||||
"enter_your_password": "Enter your password",
|
"enter_your_password": "Enter your password",
|
||||||
"register_Confirm_password": "Confirm password",
|
"register_Confirm_password": "Confirm password",
|
||||||
"agree": "I agree to ",
|
"agree": "I agree to the",
|
||||||
"t_and": " and ",
|
"t_and": " and ",
|
||||||
"conditions": " of Fcsc",
|
"conditions": " of FCSC",
|
||||||
"terms_conditions": "terms & conditions",
|
"terms_conditions": "Terms & Conditions",
|
||||||
"privacy_policy":"privacy policy",
|
"privacy_policy":"Privacy Policy",
|
||||||
"account_confirmation": "Already have an account? Login",
|
"account_confirmation": "Already have an account?",
|
||||||
"login_title": "Login",
|
"login_title": "Login",
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"profile_title": "Edit Profile",
|
"profile_title": "Edit Profile",
|
||||||
"my_profile": "My Profile",
|
"my_profile": "My Profile",
|
||||||
"logout": "Logout",
|
"logout": "Logout",
|
||||||
|
|||||||
@ -1,10 +1,13 @@
|
|||||||
|
import 'package:external_repos/external_repos.dart';
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:pocketbase/pocketbase.dart';
|
import 'package:pocketbase/pocketbase.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/services/img_asset_paths/icons/misc_icon_asset_path.dart';
|
||||||
import 'package:uae_stat/presentation/Screens/profilepage.dart';
|
import 'package:uae_stat/presentation/Screens/profilepage.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
@ -471,14 +474,15 @@ class _RegisterScreenState extends State<RegisterScreen> {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Padding(
|
: Padding(
|
||||||
padding: const EdgeInsets.all(20.0),
|
padding: const EdgeInsets.only(top: 5.0,bottom: 20, left: 20,right: 20),
|
||||||
|
|
||||||
child: Form(
|
child: Form(
|
||||||
key: _formKey,
|
key: _formKey,
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(height: screenheight / 15),
|
SizedBox(height: screenheight / 60),
|
||||||
Text(
|
Text(
|
||||||
// 'Register',
|
// 'Register',
|
||||||
AppLocalizations.of(context)!.register_title,
|
AppLocalizations.of(context)!.register_title,
|
||||||
@ -492,18 +496,42 @@ class _RegisterScreenState extends State<RegisterScreen> {
|
|||||||
// Display this if registration is pending approval
|
// Display this if registration is pending approval
|
||||||
TextFormField(
|
TextFormField(
|
||||||
controller: _usernameController,
|
controller: _usernameController,
|
||||||
focusNode: _focusNodes[0],
|
// focusNode: _focusNodes[0],
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
// hintText: _showHints[0] ? 'Username' : null,
|
// hintText: _showHints[0] ? 'Username' : null,
|
||||||
hintText: _showHints[0]
|
hintText: _showHints[0]
|
||||||
? AppLocalizations.of(context)!.register_name
|
? AppLocalizations.of(context)!.register_name
|
||||||
: null,
|
: null,
|
||||||
prefixIcon: Icon(
|
prefixIcon: Padding(
|
||||||
Icons.person,
|
padding: const EdgeInsets.all(8.0), // Adjust the padding as needed
|
||||||
color: Colors.blue,
|
child: Image.asset(
|
||||||
|
MiscIconAssetPath.person,
|
||||||
|
color: Color(0xFF90B0D5),
|
||||||
|
width: 24,
|
||||||
|
height: 24,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// prefixIcon: Icon(
|
||||||
|
// Icons.person,
|
||||||
|
// color: Color(0xFF90B0D5),
|
||||||
|
//
|
||||||
|
// ),
|
||||||
|
// border: OutlineInputBorder(),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
borderSide: BorderSide(color: Color(0xFF90B0D5), width: 2), // Enabled border
|
||||||
|
),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
borderSide: BorderSide(color: Colors.deepPurple, width: 2), // Focused border
|
||||||
|
),
|
||||||
|
errorBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
borderSide: BorderSide(color: Color(0xFFD83731), width: 1), // Error border
|
||||||
),
|
),
|
||||||
border: OutlineInputBorder(),
|
|
||||||
counterText: '',
|
counterText: '',
|
||||||
|
hintStyle: TextStyle(color: Color(0xFFC3C6CB)),
|
||||||
),
|
),
|
||||||
validator: _validateUsername,
|
validator: _validateUsername,
|
||||||
maxLength:
|
maxLength:
|
||||||
@ -513,7 +541,7 @@ class _RegisterScreenState extends State<RegisterScreen> {
|
|||||||
SizedBox(height: 15),
|
SizedBox(height: 15),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
controller: _emailController,
|
controller: _emailController,
|
||||||
focusNode: _focusNodes[1],
|
// focusNode: _focusNodes[1],
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
// hintText: 'Enter your email',
|
// hintText: 'Enter your email',
|
||||||
hintText: _showHints[1]
|
hintText: _showHints[1]
|
||||||
@ -521,12 +549,30 @@ class _RegisterScreenState extends State<RegisterScreen> {
|
|||||||
.enter_your_email
|
.enter_your_email
|
||||||
: null,
|
: null,
|
||||||
// _showHints[1] ? 'Enter your email' : null,
|
// _showHints[1] ? 'Enter your email' : null,
|
||||||
prefixIcon: Icon(
|
prefixIcon: Padding(
|
||||||
Icons.email,
|
padding: const EdgeInsets.all(8.0), // Adjust the padding as needed
|
||||||
color: Colors.blue,
|
child: Image.asset(
|
||||||
|
MiscIconAssetPath.vector,
|
||||||
|
color: Color(0xFF90B0D5),
|
||||||
|
width: 24,
|
||||||
|
height: 24,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// border: OutlineInputBorder(),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
borderSide: BorderSide(color: Color(0xFF90B0D5), width: 2), // Enabled border
|
||||||
|
),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
borderSide: BorderSide(color: Colors.deepPurple, width: 2), // Focused border
|
||||||
|
),
|
||||||
|
errorBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
borderSide: BorderSide(color: Color(0xFFD83731), width: 1), // Error border
|
||||||
),
|
),
|
||||||
border: OutlineInputBorder(),
|
|
||||||
counterText: '',
|
counterText: '',
|
||||||
|
hintStyle: TextStyle(color: Color(0xFFC3C6CB)),
|
||||||
),
|
),
|
||||||
validator: _validateEmail,
|
validator: _validateEmail,
|
||||||
maxLength: 320,
|
maxLength: 320,
|
||||||
@ -539,7 +585,7 @@ class _RegisterScreenState extends State<RegisterScreen> {
|
|||||||
SizedBox(height: 15),
|
SizedBox(height: 15),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
controller: _passwordController,
|
controller: _passwordController,
|
||||||
focusNode: _focusNodes[2],
|
// focusNode: _focusNodes[2],
|
||||||
obscureText: _obscurePassword,
|
obscureText: _obscurePassword,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: _showHints[2]
|
hintText: _showHints[2]
|
||||||
@ -547,25 +593,59 @@ class _RegisterScreenState extends State<RegisterScreen> {
|
|||||||
.enter_your_password
|
.enter_your_password
|
||||||
: null,
|
: null,
|
||||||
// _showHints[2] ? 'Enter your password' : null,
|
// _showHints[2] ? 'Enter your password' : null,
|
||||||
prefixIcon: Icon(
|
prefixIcon: Padding(
|
||||||
Icons.lock,
|
padding: const EdgeInsets.all(8.0), // Adjust the padding as needed
|
||||||
color: Colors.blue,
|
child: Image.asset(
|
||||||
),
|
MiscIconAssetPath.lock,
|
||||||
suffixIcon: IconButton(
|
color: Color(0xFF90B0D5),
|
||||||
icon: Icon(
|
width: 24,
|
||||||
_obscurePassword
|
height: 24,
|
||||||
? Icons.visibility_off
|
|
||||||
: Icons.visibility,
|
|
||||||
color: Colors.blue,
|
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
// prefixIcon: Icon(
|
||||||
|
// Icons.lock,
|
||||||
|
// color: Color(0xFF90B0D5),
|
||||||
|
// ),
|
||||||
|
suffixIcon: IconButton(
|
||||||
|
// icon: Icon(
|
||||||
|
// _obscurePassword
|
||||||
|
// ? Icons.visibility_off
|
||||||
|
// : Icons.visibility,
|
||||||
|
// color: Color(0xFF9EA2A9),
|
||||||
|
// ),
|
||||||
|
|
||||||
|
icon: Image.asset(
|
||||||
|
_obscurePassword
|
||||||
|
?MiscIconAssetPath.visibilityOff
|
||||||
|
:MiscIconAssetPath.visibleOn,
|
||||||
|
|
||||||
|
color: Color(0xFF9EA2A9), // Apply color if needed, but keep in mind `Image.asset` might not support color directly.
|
||||||
|
width: 24,
|
||||||
|
height: 24,
|
||||||
|
),
|
||||||
|
|
||||||
|
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_obscurePassword = !_obscurePassword;
|
_obscurePassword = !_obscurePassword;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
border: OutlineInputBorder(),
|
// border: OutlineInputBorder(),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
borderSide: BorderSide(color: Color(0xFF90B0D5), width: 2), // Enabled border
|
||||||
|
),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
borderSide: BorderSide(color: Colors.deepPurple, width: 2), // Focused border
|
||||||
|
),
|
||||||
|
errorBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
borderSide: BorderSide(color: Color(0xFFD83731), width: 1), // Error border
|
||||||
|
),
|
||||||
counterText: '',
|
counterText: '',
|
||||||
|
hintStyle: TextStyle(color: Color(0xFFC3C6CB)),
|
||||||
),
|
),
|
||||||
validator: _validatePassword,
|
validator: _validatePassword,
|
||||||
maxLength: 40,
|
maxLength: 40,
|
||||||
@ -574,7 +654,7 @@ class _RegisterScreenState extends State<RegisterScreen> {
|
|||||||
SizedBox(height: 15),
|
SizedBox(height: 15),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
controller: _confirmpasswordController,
|
controller: _confirmpasswordController,
|
||||||
focusNode: _focusNodes[3],
|
// focusNode: _focusNodes[3],
|
||||||
obscureText: _obscureConfirmPassword,
|
obscureText: _obscureConfirmPassword,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: _showHints[3]
|
hintText: _showHints[3]
|
||||||
@ -582,16 +662,25 @@ class _RegisterScreenState extends State<RegisterScreen> {
|
|||||||
.register_Confirm_password
|
.register_Confirm_password
|
||||||
: null,
|
: null,
|
||||||
// _showHints[3] ? 'Confirm password' : null,
|
// _showHints[3] ? 'Confirm password' : null,
|
||||||
prefixIcon: Icon(
|
prefixIcon: Padding(
|
||||||
Icons.lock,
|
padding: const EdgeInsets.all(8.0), // Adjust the padding as needed
|
||||||
color: Colors.blue,
|
child: Image.asset(
|
||||||
|
MiscIconAssetPath.lock,
|
||||||
|
color: Color(0xFF90B0D5),
|
||||||
|
width: 24,
|
||||||
|
height: 24,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
suffixIcon: IconButton(
|
suffixIcon: IconButton(
|
||||||
icon: Icon(
|
|
||||||
|
icon: Image.asset(
|
||||||
_obscureConfirmPassword
|
_obscureConfirmPassword
|
||||||
? Icons.visibility_off
|
?MiscIconAssetPath.visibilityOff
|
||||||
: Icons.visibility,
|
:MiscIconAssetPath.visibleOn,
|
||||||
color: Colors.blue,
|
|
||||||
|
color: Color(0xFF9EA2A9), // Apply color if needed, but keep in mind `Image.asset` might not support color directly.
|
||||||
|
width: 24,
|
||||||
|
height: 24,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -600,8 +689,23 @@ class _RegisterScreenState extends State<RegisterScreen> {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
border: OutlineInputBorder(),
|
// border: OutlineInputBorder(
|
||||||
|
// borderSide: BorderSide(color: Colors.blue, width: 2), // Default border color
|
||||||
|
// ),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
borderSide: BorderSide(color: Color(0xFF90B0D5), width: 2), // Enabled border
|
||||||
|
),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
borderSide: BorderSide(color: Colors.deepPurple, width: 2), // Focused border
|
||||||
|
),
|
||||||
|
errorBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
borderSide: BorderSide(color: Color(0xFFD83731), width: 1), // Error border
|
||||||
|
),
|
||||||
counterText: '',
|
counterText: '',
|
||||||
|
hintStyle: TextStyle(color: Color(0xFFC3C6CB)),
|
||||||
),
|
),
|
||||||
validator: _validateConfirmPassword,
|
validator: _validateConfirmPassword,
|
||||||
maxLength: 40,
|
maxLength: 40,
|
||||||
@ -623,7 +727,7 @@ class _RegisterScreenState extends State<RegisterScreen> {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
side: BorderSide(
|
side: BorderSide(
|
||||||
color: showError ? Colors.red : Colors.grey,
|
color: showError ? Colors.red : Color(0xFF92722A),
|
||||||
width: 1.5,
|
width: 1.5,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -637,7 +741,7 @@ class _RegisterScreenState extends State<RegisterScreen> {
|
|||||||
text: AppLocalizations.of(context)!
|
text: AppLocalizations.of(context)!
|
||||||
.terms_conditions,
|
.terms_conditions,
|
||||||
// text: 'Terms & Conditions',
|
// text: 'Terms & Conditions',
|
||||||
style: TextStyle(color: Colors.blue),
|
style: TextStyle( color: MyTheme.topicColor(IndicatorTopic.economy).shade600,),
|
||||||
),
|
),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: AppLocalizations.of(context)!
|
text: AppLocalizations.of(context)!
|
||||||
@ -645,7 +749,7 @@ class _RegisterScreenState extends State<RegisterScreen> {
|
|||||||
TextSpan(
|
TextSpan(
|
||||||
text: AppLocalizations.of(context)!
|
text: AppLocalizations.of(context)!
|
||||||
.privacy_policy,
|
.privacy_policy,
|
||||||
style: TextStyle(color: Colors.blue),
|
style: TextStyle( color: MyTheme.topicColor(IndicatorTopic.economy).shade600,),
|
||||||
),
|
),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: AppLocalizations.of(context)!
|
text: AppLocalizations.of(context)!
|
||||||
@ -695,8 +799,10 @@ class _RegisterScreenState extends State<RegisterScreen> {
|
|||||||
fontSize: 16, color: Colors.white),
|
fontSize: 16, color: Colors.white),
|
||||||
),
|
),
|
||||||
SizedBox(width: 8),
|
SizedBox(width: 8),
|
||||||
Icon(Icons.arrow_forward,
|
const Icon(
|
||||||
color: Colors.white),
|
Icons.chevron_right_outlined,
|
||||||
|
color: Colors.white, // Set your desired color here
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -730,8 +836,10 @@ class _RegisterScreenState extends State<RegisterScreen> {
|
|||||||
fontSize: 16, color: Colors.white),
|
fontSize: 16, color: Colors.white),
|
||||||
),
|
),
|
||||||
SizedBox(width: 8),
|
SizedBox(width: 8),
|
||||||
Icon(Icons.arrow_forward,
|
const Icon(
|
||||||
color: Colors.white),
|
Icons.chevron_right_outlined,
|
||||||
|
color: Colors.white, // Set your desired color here
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|||||||
@ -369,9 +369,15 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
itemCount: filters.length,
|
itemCount: filters.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
|
filters.sort((a, b) => a["filter_text_and_order"]["order"]
|
||||||
|
.compareTo(b["filter_text_and_order"]["order"]));
|
||||||
|
|
||||||
final filter = filters[index];
|
final filter = filters[index];
|
||||||
final filterKey = filter["filter_key"];
|
final filterKey = filter["filter_key"];
|
||||||
final filterData = filter["filter_data"];
|
final filterData = filter["filter_data"];
|
||||||
|
final filter_text_and_order =
|
||||||
|
filter["filter_text_and_order"];
|
||||||
|
final fieldOrder = filter_text_and_order['order'];
|
||||||
|
|
||||||
return StatefulBuilder(
|
return StatefulBuilder(
|
||||||
builder: (context, setState) {
|
builder: (context, setState) {
|
||||||
@ -386,7 +392,9 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
capitalizeAndSplit(filterKey),
|
context.translate(filter_text_and_order['en'],
|
||||||
|
filter_text_and_order['ar']),
|
||||||
|
// capitalizeAndSplit(filterKey),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
@ -399,8 +407,13 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return StatefulBuilder(
|
return StatefulBuilder(
|
||||||
builder: (context, dialogSetState) {
|
builder: (context, dialogSetState) {
|
||||||
|
final locale =
|
||||||
|
ref.watch(localeProvider);
|
||||||
|
print('localelocale $locale');
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: Text('Select $filterKey'),
|
title: Text(
|
||||||
|
// "${locale == 'ar' ? 'يختار ' : 'Select '}"
|
||||||
|
"${context.translate(filter_text_and_order['en'], filter_text_and_order['ar'])}"),
|
||||||
content: SingleChildScrollView(
|
content: SingleChildScrollView(
|
||||||
child: ListBody(
|
child: ListBody(
|
||||||
children: filterData
|
children: filterData
|
||||||
@ -465,7 +478,9 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
children:
|
children:
|
||||||
selectedFilter["filter_data"].isEmpty
|
selectedFilter["filter_data"].isEmpty
|
||||||
? [
|
? [
|
||||||
Text('Select $filterKey',
|
Text(
|
||||||
|
// "${locale == 'ar' ? 'يختار ' : 'Select '}"
|
||||||
|
"${context.translate(filter_text_and_order['en'], filter_text_and_order['ar'])}",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.grey))
|
color: Colors.grey))
|
||||||
]
|
]
|
||||||
@ -1023,26 +1038,31 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
Flexible(
|
Flexible(
|
||||||
fit: FlexFit.loose,
|
fit: FlexFit.loose,
|
||||||
child: FittedBox(
|
child: FittedBox(
|
||||||
child: Text(
|
child: SizedBox(
|
||||||
'${chart_heading ?? 'NA'}',
|
// height: 70.0,
|
||||||
textAlign: TextAlign.center,
|
child: Text(
|
||||||
maxLines: 2, // Limit to 2 lines
|
'${chart_heading ?? 'NA'}',
|
||||||
softWrap:
|
textAlign: TextAlign.center,
|
||||||
true, // Enable soft wrapping
|
maxLines: 2, // Limit to 2 lines
|
||||||
// overflow: TextOverflow.ellipsis, // Handle overflow gracefully
|
softWrap:
|
||||||
style: TextStyle(
|
true, // Enable soft wrapping
|
||||||
fontSize: 11,
|
// overflow: TextOverflow.ellipsis, // Handle overflow gracefully
|
||||||
fontWeight: FontWeight.w400,
|
style: TextStyle(
|
||||||
color: Colors.black87,
|
fontSize: 8,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
color: Colors.black87,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 1),
|
||||||
Text(
|
Text(
|
||||||
'(${data['lastYear'] ?? 'NA'})',
|
'(${data['lastYear'] ?? 'NA'})',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 11, color: Colors.grey),
|
fontSize: 10, color: Colors.grey),
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 1),
|
||||||
Flexible(
|
Flexible(
|
||||||
fit: FlexFit.loose,
|
fit: FlexFit.loose,
|
||||||
child: FittedBox(
|
child: FittedBox(
|
||||||
@ -1051,7 +1071,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
apiService.formatAmount(
|
apiService.formatAmount(
|
||||||
data['lastYearValue']),
|
data['lastYearValue']),
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 26,
|
fontSize: 18,
|
||||||
fontWeight: FontWeight.w900,
|
fontWeight: FontWeight.w900,
|
||||||
color: Color(0xFF90B0D5),
|
color: Color(0xFF90B0D5),
|
||||||
),
|
),
|
||||||
@ -1074,7 +1094,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
apiService.formatAmount(
|
apiService.formatAmount(
|
||||||
data['secondLastYearValue']),
|
data['secondLastYearValue']),
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: Color(0xFFD83731),
|
color: Color(0xFFD83731),
|
||||||
),
|
),
|
||||||
@ -1084,7 +1104,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
Text(
|
Text(
|
||||||
'(${data['secondLastYear'] ?? 'NA'})',
|
'(${data['secondLastYear'] ?? 'NA'})',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 8,
|
fontSize: 9,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
color: Colors.grey),
|
color: Colors.grey),
|
||||||
),
|
),
|
||||||
@ -1120,37 +1140,42 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
const SizedBox(height: 5),
|
const SizedBox(height: 5),
|
||||||
Flexible(
|
Flexible(
|
||||||
fit: FlexFit.loose,
|
fit: FlexFit.loose,
|
||||||
child: FittedBox(
|
// child: FittedBox(
|
||||||
child: Text(
|
child: Text(
|
||||||
'${chart_heading ?? 'NA'}',
|
'${chart_heading ?? 'NA'}',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
maxLines: 2, // Limit to 2 lines
|
maxLines: 2, // Limit to 2 lines
|
||||||
softWrap:
|
softWrap:
|
||||||
true, // Enable soft wrapping
|
true, // Enable soft wrapping
|
||||||
// overflow: TextOverflow.ellipsis, // Handle overflow gracefully
|
// overflow: TextOverflow.ellipsis, // Handle overflow gracefully
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 11,
|
fontSize: 9,
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
// ),
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 1),
|
||||||
Text(
|
Text(
|
||||||
'(${data['firstYear'] ?? 'NA'} - ${data['lastYear'] ?? 'NA'})',
|
'(${data['firstYear'] ?? 'NA'} - ${data['lastYear'] ?? 'NA'})',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 10, color: Colors.grey),
|
fontSize: 10, color: Colors.grey),
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 1),
|
||||||
Flexible(
|
Flexible(
|
||||||
fit: FlexFit.loose,
|
fit: FlexFit.loose,
|
||||||
child: FittedBox(
|
child: SizedBox(
|
||||||
fit: BoxFit.contain,
|
height: 50.0,
|
||||||
child: Text(
|
child: FittedBox(
|
||||||
'${data['roundedAverage'] ?? 'NA'}',
|
fit: BoxFit.contain,
|
||||||
style: const TextStyle(
|
child: Text(
|
||||||
fontSize: 26,
|
'${data['roundedAverage'] ?? 'NA'}',
|
||||||
fontWeight: FontWeight.w900,
|
style: const TextStyle(
|
||||||
color: Color(0xFF90B0D5),
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w900,
|
||||||
|
color: Color(0xFF90B0D5),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -538,6 +538,7 @@ class ChartWidget extends StatelessWidget {
|
|||||||
color: groupColorMap[group],
|
color: groupColorMap[group],
|
||||||
),
|
),
|
||||||
SizedBox(width: 6),
|
SizedBox(width: 6),
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
group,
|
group,
|
||||||
style: TextStyle(fontSize: 14),
|
style: TextStyle(fontSize: 14),
|
||||||
@ -789,12 +790,26 @@ class ChartWidget extends StatelessWidget {
|
|||||||
bottomTitles: AxisTitles(
|
bottomTitles: AxisTitles(
|
||||||
sideTitles: SideTitles(
|
sideTitles: SideTitles(
|
||||||
showTitles: true,
|
showTitles: true,
|
||||||
|
interval: 1,
|
||||||
getTitlesWidget: (value, meta) {
|
getTitlesWidget: (value, meta) {
|
||||||
if (value.toInt() < xAxisData.length) {
|
if (value.toInt() < xAxisData.length) {
|
||||||
|
String title = xAxisData[value.toInt()];
|
||||||
|
String displayTitle = title.length > 10 ? title.substring(0, 10) + '...' : title;
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(top: 8.0),
|
padding: const EdgeInsets.only(top: 8.0),
|
||||||
child: Text(xAxisData[value.toInt()]),
|
child: SizedBox(
|
||||||
);
|
width: 60, // Limit width to force wrapping
|
||||||
|
child: Transform.rotate(
|
||||||
|
angle: -0.5,
|
||||||
|
child:Tooltip(
|
||||||
|
message: title,
|
||||||
|
child: Text(
|
||||||
|
displayTitle,
|
||||||
|
softWrap: true,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
)),)
|
||||||
|
));
|
||||||
}
|
}
|
||||||
return Container();
|
return Container();
|
||||||
},
|
},
|
||||||
@ -994,19 +1009,36 @@ class ChartWidget extends StatelessWidget {
|
|||||||
bottomTitles: AxisTitles(
|
bottomTitles: AxisTitles(
|
||||||
sideTitles: SideTitles(
|
sideTitles: SideTitles(
|
||||||
showTitles: true,
|
showTitles: true,
|
||||||
reservedSize: 20, // Added space for rotated titles
|
reservedSize: 40, // Added space for rotated titles
|
||||||
getTitlesWidget: (value, meta) {
|
getTitlesWidget: (value, meta) {
|
||||||
if (value < groupByValues.length) {
|
if (value < groupByValues.length) {
|
||||||
String title =
|
String title =
|
||||||
groupByValues.elementAt(value.toInt());
|
groupByValues.elementAt(value.toInt());
|
||||||
return Transform.rotate(
|
|
||||||
angle:
|
String displayTitle = title.length > 10 ? title.substring(0, 10) + '...' : title;
|
||||||
-0.5, // Rotation in radians (~ -30 degrees)
|
|
||||||
child: Text(
|
return Padding(
|
||||||
title,
|
padding: const EdgeInsets.only(top: 8.0),
|
||||||
style: const TextStyle(fontSize: 12),
|
child: SizedBox(
|
||||||
),
|
width: 60, // Limit width to force wrapping
|
||||||
);
|
child: Transform.rotate(
|
||||||
|
angle: -0.5,
|
||||||
|
child:Tooltip(
|
||||||
|
message: title,
|
||||||
|
child: Text(
|
||||||
|
displayTitle,
|
||||||
|
softWrap: true,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
)),)
|
||||||
|
));
|
||||||
|
// return Transform.rotate(
|
||||||
|
// angle:
|
||||||
|
// -0.5, // Rotation in radians (~ -30 degrees)
|
||||||
|
// child: Text(
|
||||||
|
// title,
|
||||||
|
// style: const TextStyle(fontSize: 12),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
},
|
},
|
||||||
@ -1150,152 +1182,341 @@ class ChartWidget extends StatelessWidget {
|
|||||||
SizedBox(height: 10),
|
SizedBox(height: 10),
|
||||||
// Chart
|
// Chart
|
||||||
Expanded(
|
Expanded(
|
||||||
child: BarChart(
|
child: BarChart(
|
||||||
BarChartData(
|
BarChartData(
|
||||||
maxY: 400000,
|
maxY: 400000,
|
||||||
rotationQuarterTurns: rotationTurns,
|
rotationQuarterTurns: rotationTurns,
|
||||||
barTouchData: BarTouchData(
|
barTouchData: BarTouchData(
|
||||||
touchTooltipData: BarTouchTooltipData(
|
touchTooltipData: BarTouchTooltipData(
|
||||||
tooltipHorizontalAlignment: FLHorizontalAlignment.center,
|
tooltipHorizontalAlignment: FLHorizontalAlignment.center,
|
||||||
// Only show tooltip when touched
|
tooltipRoundedRadius: 8,
|
||||||
getTooltipItem: (group, groupIndex, rod, rodIndex) {
|
fitInsideHorizontally: true, // Ensure it fits within the screen
|
||||||
if (rod.toY == 0 || touchedGroupIndex == -1) {
|
fitInsideVertically: true,
|
||||||
return null; // Don't show the tooltip if the value is 0 or there's no touch
|
tooltipPadding: EdgeInsets.all(8),
|
||||||
}
|
tooltipMargin: 16,
|
||||||
|
// Only show tooltip when touched
|
||||||
if (groupIndex == touchedGroupIndex) {
|
getTooltipItem: (group, groupIndex, rod, rodIndex) {
|
||||||
// print('Group Index: $groupIndex, Group : $group');
|
if (rod.toY == 0 || touchedGroupIndex == -1) {
|
||||||
|
return null; // Don't show the tooltip if the value is 0 or there's no touch
|
||||||
// Get the group label dynamically
|
|
||||||
String groupLabel = groupByValues.elementAt(groupIndex);
|
|
||||||
|
|
||||||
// Fetch the crop for the current group from groupedCrops
|
|
||||||
String cropType = groupByValues.elementAt(groupIndex);
|
|
||||||
String crop = groupedCrops[cropType]![rodIndex];
|
|
||||||
double value = rod.toY;
|
|
||||||
|
|
||||||
String formattedValue;
|
|
||||||
if (value >= 1000000) {
|
|
||||||
formattedValue =
|
|
||||||
(value / 1000000).toStringAsFixed(1) + 'M';
|
|
||||||
} else if (value >= 1000) {
|
|
||||||
formattedValue =
|
|
||||||
(value / 1000).toStringAsFixed(1) + 'K';
|
|
||||||
} else {
|
|
||||||
formattedValue = value
|
|
||||||
.toStringAsFixed(0); // for values smaller than 1000
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return BarTooltipItem(
|
if (groupIndex == touchedGroupIndex) {
|
||||||
'$groupLabel\n$crop',
|
// print('Group Index: $groupIndex, Group : $group');
|
||||||
const TextStyle(
|
|
||||||
color: Colors.white,
|
// Get the group label dynamically
|
||||||
fontWeight: FontWeight.bold,
|
String groupLabel = groupByValues.elementAt(groupIndex);
|
||||||
),
|
|
||||||
children: [
|
// Fetch the crop for the current group from groupedCrops
|
||||||
TextSpan(
|
String cropType = groupByValues.elementAt(groupIndex);
|
||||||
text: ' Value: $formattedValue',
|
String crop = groupedCrops[cropType]![rodIndex];
|
||||||
style: const TextStyle(
|
double value = rod.toY;
|
||||||
color: Colors.yellow,
|
|
||||||
fontWeight: FontWeight.w500,
|
String formattedValue;
|
||||||
|
if (value >= 1000000) {
|
||||||
|
formattedValue =
|
||||||
|
(value / 1000000).toStringAsFixed(1) + 'M';
|
||||||
|
} else if (value >= 1000) {
|
||||||
|
formattedValue =
|
||||||
|
(value / 1000).toStringAsFixed(1) + 'K';
|
||||||
|
} else {
|
||||||
|
formattedValue = value.toStringAsFixed(
|
||||||
|
0); // for values smaller than 1000
|
||||||
|
}
|
||||||
|
|
||||||
|
return BarTooltipItem(
|
||||||
|
'$groupLabel\n$crop',
|
||||||
|
const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
TextSpan(
|
||||||
|
text: ' Value: $formattedValue',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.yellow,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
touchCallback: (event, response) {
|
|
||||||
if (event.isInterestedForInteractions &&
|
|
||||||
response != null &&
|
|
||||||
response.spot != null) {
|
|
||||||
// setState(() {
|
|
||||||
touchedGroupIndex = response.spot!.touchedBarGroupIndex;
|
|
||||||
// });
|
|
||||||
} else {
|
|
||||||
// setState(() {
|
|
||||||
touchedGroupIndex = -1; // Reset if no interaction
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
titlesData: FlTitlesData(
|
|
||||||
leftTitles: AxisTitles(
|
|
||||||
sideTitles: SideTitles(
|
|
||||||
showTitles: false,
|
|
||||||
reservedSize: 20,
|
|
||||||
interval: 100000,
|
|
||||||
getTitlesWidget: (value, meta) {
|
|
||||||
return Text(
|
|
||||||
value.toInt().toString(),
|
|
||||||
style: const TextStyle(fontSize: 12),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
bottomTitles: AxisTitles(
|
|
||||||
sideTitles: SideTitles(
|
|
||||||
showTitles: true,
|
|
||||||
reservedSize: 80, // Added space for rotated titles
|
|
||||||
getTitlesWidget: (value, meta) {
|
|
||||||
if (value < groupByValues.length) {
|
|
||||||
String title = groupByValues.elementAt(value.toInt());
|
|
||||||
return Transform.rotate(
|
|
||||||
angle: -1.58, // Rotation in radians (~ -30 degrees)
|
|
||||||
child: Center(
|
|
||||||
child: SizedBox(
|
|
||||||
width: 80,
|
|
||||||
child: Text(
|
|
||||||
title,
|
|
||||||
style: const TextStyle(fontSize: 12),
|
|
||||||
softWrap: true,
|
|
||||||
maxLines: 2,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return const SizedBox.shrink();
|
return null;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
touchCallback: (event, response) {
|
||||||
|
if (event.isInterestedForInteractions &&
|
||||||
|
response != null &&
|
||||||
|
response.spot != null) {
|
||||||
|
// setState(() {
|
||||||
|
touchedGroupIndex = response.spot!.touchedBarGroupIndex;
|
||||||
|
// });
|
||||||
|
} else {
|
||||||
|
// setState(() {
|
||||||
|
touchedGroupIndex = -1; // Reset if no interaction
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
rightTitles:
|
titlesData: FlTitlesData(
|
||||||
AxisTitles(sideTitles: SideTitles(showTitles: false)),
|
leftTitles: AxisTitles(
|
||||||
topTitles:
|
sideTitles: SideTitles(
|
||||||
AxisTitles(sideTitles: SideTitles(showTitles: false)),
|
showTitles: false,
|
||||||
),
|
reservedSize: 20,
|
||||||
borderData: FlBorderData(
|
interval: 100000,
|
||||||
show: true,
|
getTitlesWidget: (value, meta) {
|
||||||
border: const Border(
|
return Text(
|
||||||
// left: BorderSide(color: Colors.grey),
|
value.toInt().toString(),
|
||||||
bottom: BorderSide(color: Colors.white),
|
style: const TextStyle(fontSize: 12),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
bottomTitles: AxisTitles(
|
||||||
|
sideTitles: SideTitles(
|
||||||
|
showTitles: true,
|
||||||
|
reservedSize: 80, // Added space for rotated titles
|
||||||
|
getTitlesWidget: (value, meta) {
|
||||||
|
if (value < groupByValues.length) {
|
||||||
|
String title = groupByValues.elementAt(value.toInt());
|
||||||
|
return Transform.rotate(
|
||||||
|
angle: -1.58, // Rotation in radians (~ -30 degrees)
|
||||||
|
child: Center(
|
||||||
|
child: SizedBox(
|
||||||
|
width: 80,
|
||||||
|
child: Text(
|
||||||
|
title,
|
||||||
|
style: const TextStyle(fontSize: 12),
|
||||||
|
softWrap: true,
|
||||||
|
maxLines: 2,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
rightTitles:
|
||||||
|
AxisTitles(sideTitles: SideTitles(showTitles: false)),
|
||||||
|
topTitles:
|
||||||
|
AxisTitles(sideTitles: SideTitles(showTitles: false)),
|
||||||
),
|
),
|
||||||
|
borderData: FlBorderData(
|
||||||
|
show: true,
|
||||||
|
border: const Border(
|
||||||
|
// left: BorderSide(color: Colors.grey),
|
||||||
|
bottom: BorderSide(color: Colors.white),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
gridData: FlGridData(
|
||||||
|
show: false,
|
||||||
|
drawVerticalLine: true,
|
||||||
|
verticalInterval: 1,
|
||||||
|
horizontalInterval: 100000,
|
||||||
|
getDrawingHorizontalLine: (value) {
|
||||||
|
return FlLine(
|
||||||
|
color: Colors.grey.withOpacity(0.5),
|
||||||
|
strokeWidth: 1,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
getDrawingVerticalLine: (value) {
|
||||||
|
return FlLine(
|
||||||
|
color: Colors.grey.withOpacity(0.5),
|
||||||
|
strokeWidth: 1,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
barGroups:
|
||||||
|
_buildHorizontalRotateBarGroups(chartData, groupByValues),
|
||||||
|
alignment: BarChartAlignment.spaceAround,
|
||||||
),
|
),
|
||||||
gridData: FlGridData(
|
|
||||||
show: false,
|
|
||||||
drawVerticalLine: true,
|
|
||||||
verticalInterval: 1,
|
|
||||||
horizontalInterval: 100000,
|
|
||||||
getDrawingHorizontalLine: (value) {
|
|
||||||
return FlLine(
|
|
||||||
color: Colors.grey.withOpacity(0.5),
|
|
||||||
strokeWidth: 1,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
getDrawingVerticalLine: (value) {
|
|
||||||
return FlLine(
|
|
||||||
color: Colors.grey.withOpacity(0.5),
|
|
||||||
strokeWidth: 1,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
barGroups:
|
|
||||||
_buildHorizontalRotateBarGroups(chartData, groupByValues),
|
|
||||||
alignment: BarChartAlignment.spaceAround,
|
|
||||||
),
|
),
|
||||||
))
|
)
|
||||||
|
// Expanded(
|
||||||
|
// child: Stack(
|
||||||
|
// children:[
|
||||||
|
// BarChart(
|
||||||
|
// BarChartData(
|
||||||
|
// maxY: 400000,
|
||||||
|
// rotationQuarterTurns: rotationTurns,
|
||||||
|
// barTouchData: BarTouchData(
|
||||||
|
// touchTooltipData: BarTouchTooltipData(
|
||||||
|
// tooltipHorizontalAlignment: FLHorizontalAlignment.center,
|
||||||
|
// // Only show tooltip when touched
|
||||||
|
// getTooltipItem: (group, groupIndex, rod, rodIndex) {
|
||||||
|
// if (rod.toY == 0 || touchedGroupIndex == -1) {
|
||||||
|
// return null; // Don't show the tooltip if the value is 0 or there's no touch
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (groupIndex == touchedGroupIndex) {
|
||||||
|
// // print('Group Index: $groupIndex, Group : $group');
|
||||||
|
//
|
||||||
|
// // Get the group label dynamically
|
||||||
|
// String groupLabel = groupByValues.elementAt(groupIndex);
|
||||||
|
//
|
||||||
|
// // Fetch the crop for the current group from groupedCrops
|
||||||
|
// String cropType = groupByValues.elementAt(groupIndex);
|
||||||
|
// String crop = groupedCrops[cropType]![rodIndex];
|
||||||
|
// double value = rod.toY;
|
||||||
|
//
|
||||||
|
// String formattedValue;
|
||||||
|
// if (value >= 1000000) {
|
||||||
|
// formattedValue =
|
||||||
|
// (value / 1000000).toStringAsFixed(1) + 'M';
|
||||||
|
// } else if (value >= 1000) {
|
||||||
|
// formattedValue =
|
||||||
|
// (value / 1000).toStringAsFixed(1) + 'K';
|
||||||
|
// } else {
|
||||||
|
// formattedValue = value
|
||||||
|
// .toStringAsFixed(0); // for values smaller than 1000
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return BarTooltipItem(
|
||||||
|
// '$groupLabel\n$crop',
|
||||||
|
// const TextStyle(
|
||||||
|
// color: Colors.white,
|
||||||
|
// fontWeight: FontWeight.bold,
|
||||||
|
// ),
|
||||||
|
// children: [
|
||||||
|
// TextSpan(
|
||||||
|
// text: ' Value: $formattedValue',
|
||||||
|
// style: const TextStyle(
|
||||||
|
// color: Colors.yellow,
|
||||||
|
// fontWeight: FontWeight.w500,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// return null;
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// touchCallback: (event, response) {
|
||||||
|
// if (event.isInterestedForInteractions &&
|
||||||
|
// response != null &&
|
||||||
|
// response.spot != null) {
|
||||||
|
// // setState(() {
|
||||||
|
// touchedGroupIndex = response.spot!.touchedBarGroupIndex;
|
||||||
|
// // });
|
||||||
|
// } else {
|
||||||
|
// // setState(() {
|
||||||
|
// touchedGroupIndex = -1; // Reset if no interaction
|
||||||
|
// // });
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// titlesData: FlTitlesData(
|
||||||
|
// leftTitles: AxisTitles(
|
||||||
|
// sideTitles: SideTitles(
|
||||||
|
// showTitles: false,
|
||||||
|
// reservedSize: 20,
|
||||||
|
// interval: 100000,
|
||||||
|
// getTitlesWidget: (value, meta) {
|
||||||
|
// return Text(
|
||||||
|
// value.toInt().toString(),
|
||||||
|
// style: const TextStyle(fontSize: 12),
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// bottomTitles: AxisTitles(
|
||||||
|
// sideTitles: SideTitles(
|
||||||
|
// showTitles: true,
|
||||||
|
// reservedSize: 80, // Added space for rotated titles
|
||||||
|
// getTitlesWidget: (value, meta) {
|
||||||
|
// if (value < groupByValues.length) {
|
||||||
|
// String title = groupByValues.elementAt(value.toInt());
|
||||||
|
// return Transform.rotate(
|
||||||
|
// angle: -1.58, // Rotation in radians (~ -30 degrees)
|
||||||
|
// child: Center(
|
||||||
|
// child: SizedBox(
|
||||||
|
// width: 80,
|
||||||
|
// child: Text(
|
||||||
|
// title,
|
||||||
|
// style: const TextStyle(fontSize: 12),
|
||||||
|
// softWrap: true,
|
||||||
|
// maxLines: 2,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// return const SizedBox.shrink();
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// rightTitles:
|
||||||
|
// AxisTitles(sideTitles: SideTitles(showTitles: false)),
|
||||||
|
// topTitles:
|
||||||
|
// AxisTitles(sideTitles: SideTitles(showTitles: false)),
|
||||||
|
// ),
|
||||||
|
// borderData: FlBorderData(
|
||||||
|
// show: true,
|
||||||
|
// border: const Border(
|
||||||
|
// // left: BorderSide(color: Colors.grey),
|
||||||
|
// bottom: BorderSide(color: Colors.white),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// gridData: FlGridData(
|
||||||
|
// show: false,
|
||||||
|
// drawVerticalLine: true,
|
||||||
|
// verticalInterval: 1,
|
||||||
|
// horizontalInterval: 100000,
|
||||||
|
// getDrawingHorizontalLine: (value) {
|
||||||
|
// return FlLine(
|
||||||
|
// color: Colors.grey.withOpacity(0.5),
|
||||||
|
// strokeWidth: 1,
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// getDrawingVerticalLine: (value) {
|
||||||
|
// return FlLine(
|
||||||
|
// color: Colors.grey.withOpacity(0.5),
|
||||||
|
// strokeWidth: 1,
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// barGroups:
|
||||||
|
// _buildHorizontalRotateBarGroups(chartData, groupByValues),
|
||||||
|
// alignment: BarChartAlignment.spaceAround,
|
||||||
|
// ),
|
||||||
|
//
|
||||||
|
// ),
|
||||||
|
// // Overlay Texts
|
||||||
|
// ..._buildHorizontalRotateBarGroups(chartData, groupByValues)
|
||||||
|
// .asMap()
|
||||||
|
// .entries
|
||||||
|
// .expand((entry) {
|
||||||
|
// int groupIndex = entry.key;
|
||||||
|
// BarChartGroupData groupData = entry.value;
|
||||||
|
// return groupData.barRods.asMap().entries.map((rodEntry) {
|
||||||
|
// int rodIndex = rodEntry.key;
|
||||||
|
// BarChartRodData rodData = rodEntry.value;
|
||||||
|
//
|
||||||
|
// // Position calculation
|
||||||
|
// double barHeight = rodData.toY / 400000 * MediaQuery.of(context).size.height;
|
||||||
|
//
|
||||||
|
// return Positioned(
|
||||||
|
// left: (groupIndex * 80).toDouble() + 20, // Adjust based on spacing
|
||||||
|
// bottom: barHeight / 2, // Centered inside the bar
|
||||||
|
// child: Transform.rotate(
|
||||||
|
// angle: -0.1,
|
||||||
|
// child: Text(
|
||||||
|
// // '${rodData.toY.toInt()}',
|
||||||
|
// "123",
|
||||||
|
// style: TextStyle(
|
||||||
|
// color: Colors.black,
|
||||||
|
// fontWeight: FontWeight.bold,
|
||||||
|
// fontSize: 12,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }).toList();
|
||||||
|
// }).toList(),
|
||||||
|
// ]))
|
||||||
]);
|
]);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return Center(child: Text('Unknown chart type'));
|
return Center(child: Text('Unknown chart type'));
|
||||||
}
|
}
|
||||||
@ -1778,12 +1999,11 @@ class ChartWidget extends StatelessWidget {
|
|||||||
toY: value, // Use the parsed value
|
toY: value, // Use the parsed value
|
||||||
color: barColor, // Dynamic color
|
color: barColor, // Dynamic color
|
||||||
width: 20,
|
width: 20,
|
||||||
// backDrawRodData: BackgroundBarChartRodData(
|
// backDrawRodData: BackgroundBarChartRodData(
|
||||||
// show: true,
|
// show: true,
|
||||||
// toY: 400000,
|
// toY: 400000,
|
||||||
// color: Colors.grey.shade300,
|
// color: Colors.grey.shade300,
|
||||||
// ),
|
// ),
|
||||||
//
|
|
||||||
);
|
);
|
||||||
}).toList();
|
}).toList();
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import 'package:external_repos/external_repos.dart';
|
import 'package:external_repos/external_repos.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
@ -17,7 +18,7 @@ import 'package:uae_stat/presentation/components/my_bottom_nav_bar.dart';
|
|||||||
import 'package:uae_stat/presentation/components/space.dart';
|
import 'package:uae_stat/presentation/components/space.dart';
|
||||||
import 'package:uae_stat/presentation/components/themed_text_field.dart';
|
import 'package:uae_stat/presentation/components/themed_text_field.dart';
|
||||||
import 'package:uae_stat/presentation/routes/bottom_bar_routes/tab_routes/home_route.dart';
|
import 'package:uae_stat/presentation/routes/bottom_bar_routes/tab_routes/home_route.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
import '../../Screens/auth_verification/registration.dart';
|
import '../../Screens/auth_verification/registration.dart';
|
||||||
import 'package:pocketbase/pocketbase.dart';
|
import 'package:pocketbase/pocketbase.dart';
|
||||||
|
|
||||||
@ -27,7 +28,9 @@ import '../../components/my_toggle.dart';
|
|||||||
class LoginRoute extends HookConsumerWidget {
|
class LoginRoute extends HookConsumerWidget {
|
||||||
final pb = PocketBase('https://pb.venbait.in');
|
final pb = PocketBase('https://pb.venbait.in');
|
||||||
// final _pb = PocketBase('http://127.0.0.1:8090');
|
// final _pb = PocketBase('http://127.0.0.1:8090');
|
||||||
LoginRoute({super.key});
|
final bool isLoginScreen; // Pass `true` if this is the login screen
|
||||||
|
LoginRoute({Key? key, required this.isLoginScreen}) : super(key: key);
|
||||||
|
// LoginRoute({super.key});
|
||||||
dynamic userData;
|
dynamic userData;
|
||||||
String? role;
|
String? role;
|
||||||
|
|
||||||
@ -253,6 +256,22 @@ class LoginRoute extends HookConsumerWidget {
|
|||||||
if (!context.mounted || session == null) return;
|
if (!context.mounted || session == null) return;
|
||||||
final userId = session.id;
|
final userId = session.id;
|
||||||
if (userId.isNotEmpty) {
|
if (userId.isNotEmpty) {
|
||||||
|
final url =
|
||||||
|
Uri.parse("https://pb.venbait.in/api/login_success?id=$userId");
|
||||||
|
|
||||||
|
try {
|
||||||
|
final response = await http.get(url);
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
print("Login success API call successful: ${response.body}");
|
||||||
|
} else {
|
||||||
|
print(
|
||||||
|
"Failed to call login success API. Status code: ${response.statusCode}");
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
print("Error calling login success API: $e");
|
||||||
|
}
|
||||||
|
|
||||||
await saveUserId(userId);
|
await saveUserId(userId);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -340,7 +359,10 @@ class LoginRoute extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
6.horizontalSpace,
|
6.horizontalSpace,
|
||||||
const Icon(Icons.chevron_right_outlined),
|
const Icon(
|
||||||
|
Icons.chevron_right_outlined,
|
||||||
|
color: Colors.white, // Set your desired color here
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -368,8 +390,7 @@ class LoginRoute extends HookConsumerWidget {
|
|||||||
validator: (text) {
|
validator: (text) {
|
||||||
if (text == null || text.isEmpty) {
|
if (text == null || text.isEmpty) {
|
||||||
return context.translate('Required', 'مطلوب');
|
return context.translate('Required', 'مطلوب');
|
||||||
}
|
} else if (text.length < 8) {
|
||||||
else if (text.length < 8) {
|
|
||||||
return 'The password must be at least 8 characters';
|
return 'The password must be at least 8 characters';
|
||||||
}
|
}
|
||||||
return FieldValidator.password(minLength: 8)(text);
|
return FieldValidator.password(minLength: 8)(text);
|
||||||
@ -411,7 +432,7 @@ class LoginRoute extends HookConsumerWidget {
|
|||||||
10.verticalSpace,
|
10.verticalSpace,
|
||||||
Text(
|
Text(
|
||||||
context.translate(
|
context.translate(
|
||||||
'Please login to access UAE’s key official statistics',
|
'Please login to access \n UAE’s key official statistics',
|
||||||
'يرجى تسجيل الدخول للوصول إلى الإحصاءات الرسمية الرئيسية لدولة الإمارات العربية المتحدة',
|
'يرجى تسجيل الدخول للوصول إلى الإحصاءات الرسمية الرئيسية لدولة الإمارات العربية المتحدة',
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
@ -422,7 +443,7 @@ class LoginRoute extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
color: const Color(0xff898C81),
|
color: const Color(0xff898C81),
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -466,61 +487,61 @@ class LoginRoute extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
final continueAsGuestBtn = SizedBox(
|
// final continueAsGuestBtn = SizedBox(
|
||||||
width: double.infinity,
|
// width: double.infinity,
|
||||||
child: ElevatedButton(
|
// child: ElevatedButton(
|
||||||
onPressed: () async {
|
// onPressed: () async {
|
||||||
final prefs = await SharedPreferences.getInstance();
|
// final prefs = await SharedPreferences.getInstance();
|
||||||
prefs.clear();
|
// prefs.clear();
|
||||||
final userId = 'guest';
|
// final userId = 'guest';
|
||||||
if (userId.isNotEmpty) {
|
// if (userId.isNotEmpty) {
|
||||||
await saveUserId(userId);
|
// await saveUserId(userId);
|
||||||
}
|
// }
|
||||||
context.go('/myhomepage');
|
// context.go('/myhomepage');
|
||||||
//context.go('/${context.language}/${BottomNavBarItem.home.routePath}'),
|
// //context.go('/${context.language}/${BottomNavBarItem.home.routePath}'),
|
||||||
},
|
// },
|
||||||
//context.go('/${context.language}/${BottomNavBarItem.home.routePath}'),
|
// //context.go('/${context.language}/${BottomNavBarItem.home.routePath}'),
|
||||||
style: ButtonStyle(
|
// style: ButtonStyle(
|
||||||
shape: WidgetStatePropertyAll(
|
// shape: WidgetStatePropertyAll(
|
||||||
RoundedRectangleBorder(
|
// RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(10),
|
// borderRadius: BorderRadius.circular(10),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
padding: const WidgetStatePropertyAll(
|
// padding: const WidgetStatePropertyAll(
|
||||||
EdgeInsets.symmetric(vertical: 10.5),
|
// EdgeInsets.symmetric(vertical: 10.5),
|
||||||
),
|
// ),
|
||||||
textStyle: WidgetStatePropertyAll(
|
// textStyle: WidgetStatePropertyAll(
|
||||||
TextStyle(
|
// TextStyle(
|
||||||
fontFamily: context.translate(
|
// fontFamily: context.translate(
|
||||||
'Roboto',
|
// 'Roboto',
|
||||||
'NotoKufi',
|
// 'NotoKufi',
|
||||||
),
|
// ),
|
||||||
fontSize: 16,
|
// fontSize: 16,
|
||||||
fontWeight: FontWeight.w600,
|
// fontWeight: FontWeight.w600,
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
backgroundColor: WidgetStatePropertyAll(
|
// backgroundColor: WidgetStatePropertyAll(
|
||||||
MyTheme.topicColor(IndicatorTopic.environment),
|
// MyTheme.topicColor(IndicatorTopic.environment),
|
||||||
),
|
// ),
|
||||||
foregroundColor: const WidgetStatePropertyAll(
|
// foregroundColor: const WidgetStatePropertyAll(
|
||||||
Colors.white,
|
// Colors.white,
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
child: Row(
|
// child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
// mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
// children: [
|
||||||
Text(
|
// Text(
|
||||||
context.translate(
|
// context.translate(
|
||||||
'Continue as Guest',
|
// 'Continue as Guest',
|
||||||
'استمر كضيف',
|
// 'استمر كضيف',
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
6.horizontalSpace,
|
// 6.horizontalSpace,
|
||||||
const Icon(Icons.chevron_right_outlined),
|
// const Icon(Icons.chevron_right_outlined),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
final fcscBanner = Image.asset(
|
final fcscBanner = Image.asset(
|
||||||
BannerAssetPath.fcsc,
|
BannerAssetPath.fcsc,
|
||||||
height: 40,
|
height: 40,
|
||||||
@ -554,15 +575,46 @@ class LoginRoute extends HookConsumerWidget {
|
|||||||
20.verticalSpace,
|
20.verticalSpace,
|
||||||
dontHaveAnAccountRegisterBtn,
|
dontHaveAnAccountRegisterBtn,
|
||||||
20.verticalSpace,
|
20.verticalSpace,
|
||||||
continueAsGuestBtn,
|
// continueAsGuestBtn,
|
||||||
25.verticalSpace,
|
25.verticalSpace,
|
||||||
fcscBanner,
|
fcscBanner,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
final bgScaffold = Scaffold(
|
// final bgScaffold = Scaffold(
|
||||||
backgroundColor: Colors.white,
|
// backgroundColor: Colors.white,
|
||||||
body: SafeArea(child: scaffoldBody),
|
// body: SafeArea(child: scaffoldBody),
|
||||||
|
// );
|
||||||
|
// return bgScaffold;
|
||||||
|
return PopScope(
|
||||||
|
canPop: !isLoginScreen, // Allow back navigation only if not login screen
|
||||||
|
onPopInvokedWithResult: (didPop, result) {
|
||||||
|
if (didPop) return;
|
||||||
|
_showExitConfirmation(context); // Show exit confirmation dialog
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
body: SafeArea(child: scaffoldBody),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _showExitConfirmation(BuildContext context) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => AlertDialog(
|
||||||
|
title: Text("Exit App"),
|
||||||
|
content: Text("Are you sure you want to exit?"),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(), // Close dialog
|
||||||
|
child: Text("Cancel"),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => SystemNavigator.pop(), // Exit the app
|
||||||
|
child: Text("Exit"),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
return bgScaffold;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -165,6 +165,8 @@ import 'dart:convert';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:pocketbase/pocketbase.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:uae_stat/presentation/components/indicators/locale_provider.dart';
|
import 'package:uae_stat/presentation/components/indicators/locale_provider.dart';
|
||||||
import 'package:tutorial_coach_mark/tutorial_coach_mark.dart';
|
import 'package:tutorial_coach_mark/tutorial_coach_mark.dart';
|
||||||
import 'package:uae_stat/presentation/Screens/app_tour/Target_content.dart';
|
import 'package:uae_stat/presentation/Screens/app_tour/Target_content.dart';
|
||||||
@ -205,7 +207,7 @@ class EconomyStatsWidget extends ConsumerStatefulWidget {
|
|||||||
|
|
||||||
class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
||||||
List<dynamic> data = [];
|
List<dynamic> data = [];
|
||||||
|
final _pb = PocketBase('https://pb.venbait.in');
|
||||||
bool isLoading = true;
|
bool isLoading = true;
|
||||||
|
|
||||||
final GlobalKey cardTopicKey = GlobalKey();
|
final GlobalKey cardTopicKey = GlobalKey();
|
||||||
@ -213,11 +215,12 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
late TutorialCoachMark tutorialCoachMark;
|
late TutorialCoachMark tutorialCoachMark;
|
||||||
late List<TargetFocus> homeTargets;
|
late List<TargetFocus> homeTargets;
|
||||||
late List<TargetFocus> previousHomeTargets;
|
late List<TargetFocus> previousHomeTargets;
|
||||||
Offset _imageCardPosition =Offset.zero;
|
Offset _imageCardPosition = Offset.zero;
|
||||||
Offset _imageTopicPosition =Offset.zero;
|
Offset _imageTopicPosition = Offset.zero;
|
||||||
|
|
||||||
void _calculateCardPosition() {
|
void _calculateCardPosition() {
|
||||||
final RenderBox cardRenderBox = cardsKey.currentContext!.findRenderObject() as RenderBox;
|
final RenderBox cardRenderBox =
|
||||||
|
cardsKey.currentContext!.findRenderObject() as RenderBox;
|
||||||
final Offset cardPosition = cardRenderBox.localToGlobal(Offset.zero);
|
final Offset cardPosition = cardRenderBox.localToGlobal(Offset.zero);
|
||||||
final Size cardSize = cardRenderBox.size;
|
final Size cardSize = cardRenderBox.size;
|
||||||
|
|
||||||
@ -233,10 +236,10 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
void handleSkip() {
|
void handleSkip() {
|
||||||
tutorialCoachMark.skip();
|
tutorialCoachMark.skip();
|
||||||
debugPrint('Skip clicked');
|
debugPrint('Skip clicked');
|
||||||
ref.read(chartsTourProvider.notifier).state = true;
|
ref.read(chartsTourProvider.notifier).state = true;
|
||||||
ref.read(previousChartsTourProvider.notifier).state = true;
|
ref.read(previousChartsTourProvider.notifier).state = true;
|
||||||
ref.read(homeTourProvider.notifier).state = true;
|
ref.read(homeTourProvider.notifier).state = true;
|
||||||
ref.read( previousHomeTourProvider.notifier).state = true;
|
ref.read(previousHomeTourProvider.notifier).state = true;
|
||||||
ref.read(scaffoldTourProvider.notifier).state = true;
|
ref.read(scaffoldTourProvider.notifier).state = true;
|
||||||
ref.read(previousScaffoldTourProvider.notifier).state = true;
|
ref.read(previousScaffoldTourProvider.notifier).state = true;
|
||||||
}
|
}
|
||||||
@ -288,11 +291,10 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
},
|
},
|
||||||
)..show(context: context);
|
)..show(context: context);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _initTarget(){
|
void _initTarget() {
|
||||||
homeTargets=[
|
homeTargets = [
|
||||||
TargetFocus(
|
TargetFocus(
|
||||||
identify: 'cardTopicKey',
|
identify: 'cardTopicKey',
|
||||||
keyTarget: cardTopicKey,
|
keyTarget: cardTopicKey,
|
||||||
@ -308,7 +310,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
align: ContentAlign.bottom,
|
align: ContentAlign.bottom,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: MediaQuery.of(context).size.height*0.69,
|
height: MediaQuery.of(context).size.height * 0.69,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Positioned(
|
Positioned(
|
||||||
@ -353,12 +355,14 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: Color(0xFF7DAFBC),
|
color: Color(0xFF7DAFBC),
|
||||||
border: Border.all(color: Color(0xFF7DAFBC), width: 1),
|
border: Border.all(
|
||||||
|
color: Color(0xFF7DAFBC), width: 1),
|
||||||
),
|
),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
iconSize: 20,
|
iconSize: 20,
|
||||||
icon: const Icon(Icons.arrow_forward, color: Colors.white),
|
icon: const Icon(Icons.arrow_forward,
|
||||||
|
color: Colors.white),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
tutorialCoachMark.next();
|
tutorialCoachMark.next();
|
||||||
},
|
},
|
||||||
@ -379,21 +383,18 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
align: ContentAlign.bottom,
|
align: ContentAlign.bottom,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: MediaQuery.of(context).size.width,
|
width: MediaQuery.of(context).size.width,
|
||||||
height:MediaQuery.of(context).size.height*0.69 ,
|
height: MediaQuery.of(context).size.height * 0.69,
|
||||||
child: Stack(
|
child: Stack(children: [
|
||||||
children: [
|
Positioned(
|
||||||
Positioned(
|
left: MediaQuery.of(context).size.width * 0.4,
|
||||||
left: MediaQuery.of(context).size.width*0.4,
|
top: _imageCardPosition.dy - 29,
|
||||||
top: _imageCardPosition.dy-29,
|
child: Image.asset(
|
||||||
child: Image.asset(
|
'assets/app_tour/down_right.png',
|
||||||
'assets/app_tour/down_right.png',
|
width: 40,
|
||||||
width: 40,
|
height: 90,
|
||||||
height: 90,
|
),
|
||||||
),
|
),
|
||||||
),
|
]),
|
||||||
]
|
|
||||||
),
|
|
||||||
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -404,17 +405,17 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
shape: ShapeLightFocus.RRect,
|
shape: ShapeLightFocus.RRect,
|
||||||
contents: [
|
contents: [
|
||||||
createTargetContent(
|
createTargetContent(
|
||||||
text:AppLocalizations.of(context)!.economy,
|
text: AppLocalizations.of(context)!.economy,
|
||||||
alignment: ContentAlign.bottom,
|
alignment: ContentAlign.bottom,
|
||||||
gap: 0,
|
gap: 0,
|
||||||
space: 40,),
|
space: 40,
|
||||||
|
),
|
||||||
TargetContent(
|
TargetContent(
|
||||||
align: ContentAlign.bottom,
|
align: ContentAlign.bottom,
|
||||||
child:
|
child: SizedBox(
|
||||||
SizedBox(
|
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: MediaQuery.of(context).size.height *0.5, // Set an appropriate height for the Stack
|
height: MediaQuery.of(context).size.height *
|
||||||
|
0.5, // Set an appropriate height for the Stack
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Positioned(
|
Positioned(
|
||||||
@ -425,7 +426,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () =>handleSkip,
|
onPressed: () => handleSkip,
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
@ -457,11 +458,13 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
Container(
|
Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
border: Border.all(color: Colors.white, width: 2.0),
|
border: Border.all(
|
||||||
|
color: Colors.white, width: 2.0),
|
||||||
),
|
),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
iconSize: 20,
|
iconSize: 20,
|
||||||
icon: const Icon(Icons.arrow_back, color: Colors.white),
|
icon: const Icon(Icons.arrow_back,
|
||||||
|
color: Colors.white),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
tutorialCoachMark.previous();
|
tutorialCoachMark.previous();
|
||||||
},
|
},
|
||||||
@ -472,11 +475,13 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: Color(0xFF7DAFBC),
|
color: Color(0xFF7DAFBC),
|
||||||
border: Border.all(color: Color(0xFF7DAFBC), width: 1),
|
border: Border.all(
|
||||||
|
color: Color(0xFF7DAFBC), width: 1),
|
||||||
),
|
),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
iconSize: 20,
|
iconSize: 20,
|
||||||
icon: const Icon(Icons.arrow_forward, color: Colors.white),
|
icon: const Icon(Icons.arrow_forward,
|
||||||
|
color: Colors.white),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
tutorialCoachMark.next();
|
tutorialCoachMark.next();
|
||||||
},
|
},
|
||||||
@ -496,22 +501,19 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
TargetContent(
|
TargetContent(
|
||||||
align: ContentAlign.bottom,
|
align: ContentAlign.bottom,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: MediaQuery.of(context).size.width ,
|
width: MediaQuery.of(context).size.width,
|
||||||
height:MediaQuery.of(context).size.height*0.69 ,
|
height: MediaQuery.of(context).size.height * 0.69,
|
||||||
child: Stack(
|
child: Stack(children: [
|
||||||
children: [
|
Positioned(
|
||||||
Positioned(
|
left: MediaQuery.of(context).size.width * 0.40,
|
||||||
left: MediaQuery.of(context).size.width*0.40,
|
top: _imageTopicPosition.dy - 29,
|
||||||
top: _imageTopicPosition.dy-29,
|
child: Image.asset(
|
||||||
child: Image.asset(
|
'assets/app_tour/down_right.png',
|
||||||
'assets/app_tour/down_right.png',
|
width: 40,
|
||||||
width: 40,
|
height: 90,
|
||||||
height: 90,
|
),
|
||||||
),
|
),
|
||||||
),
|
]),
|
||||||
]
|
|
||||||
),
|
|
||||||
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -519,24 +521,25 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
void _initPreviousTarget(){
|
void _initPreviousTarget() {
|
||||||
previousHomeTargets=[
|
previousHomeTargets = [
|
||||||
TargetFocus(
|
TargetFocus(
|
||||||
identify: 'cardsKey',
|
identify: 'cardsKey',
|
||||||
keyTarget: cardsKey,
|
keyTarget: cardsKey,
|
||||||
shape: ShapeLightFocus.RRect,
|
shape: ShapeLightFocus.RRect,
|
||||||
contents: [
|
contents: [
|
||||||
createTargetContent(
|
createTargetContent(
|
||||||
text:AppLocalizations.of(context)!.economy,
|
text: AppLocalizations.of(context)!.economy,
|
||||||
alignment: ContentAlign.bottom,
|
alignment: ContentAlign.bottom,
|
||||||
gap: 0,
|
gap: 0,
|
||||||
space: 40,),
|
space: 40,
|
||||||
|
),
|
||||||
TargetContent(
|
TargetContent(
|
||||||
align: ContentAlign.bottom,
|
align: ContentAlign.bottom,
|
||||||
child:
|
child: SizedBox(
|
||||||
SizedBox(
|
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: MediaQuery.of(context).size.height *0.5, // Set an appropriate height for the Stack
|
height: MediaQuery.of(context).size.height *
|
||||||
|
0.5, // Set an appropriate height for the Stack
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Positioned(
|
Positioned(
|
||||||
@ -547,7 +550,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () =>handleSkip(),
|
onPressed: () => handleSkip(),
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
@ -579,10 +582,12 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
Container(
|
Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
border: Border.all(color: Colors.white, width: 2.0),
|
border: Border.all(
|
||||||
|
color: Colors.white, width: 2.0),
|
||||||
),
|
),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
icon: const Icon(Icons.arrow_back, color: Colors.white),
|
icon: const Icon(Icons.arrow_back,
|
||||||
|
color: Colors.white),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
tutorialCoachMark.next();
|
tutorialCoachMark.next();
|
||||||
},
|
},
|
||||||
@ -593,14 +598,21 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: Color(0xFF7DAFBC),
|
color: Color(0xFF7DAFBC),
|
||||||
border: Border.all(color: Color(0xFF7DAFBC), width: 1.5),
|
border: Border.all(
|
||||||
|
color: Color(0xFF7DAFBC), width: 1.5),
|
||||||
),
|
),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
iconSize: 20,
|
iconSize: 20,
|
||||||
icon: const Icon(Icons.arrow_forward, color: Colors.white),
|
icon: const Icon(Icons.arrow_forward,
|
||||||
|
color: Colors.white),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
ref.read(previousHomeTourProvider.notifier).state=true;
|
ref
|
||||||
ref.read(chartsTourProvider.notifier).state=false;
|
.read(
|
||||||
|
previousHomeTourProvider.notifier)
|
||||||
|
.state = true;
|
||||||
|
ref
|
||||||
|
.read(chartsTourProvider.notifier)
|
||||||
|
.state = false;
|
||||||
tutorialCoachMark.finish();
|
tutorialCoachMark.finish();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -620,21 +632,18 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
align: ContentAlign.bottom,
|
align: ContentAlign.bottom,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: MediaQuery.of(context).size.width,
|
width: MediaQuery.of(context).size.width,
|
||||||
height:MediaQuery.of(context).size.height*0.69 ,
|
height: MediaQuery.of(context).size.height * 0.69,
|
||||||
child: Stack(
|
child: Stack(children: [
|
||||||
children: [
|
Positioned(
|
||||||
Positioned(
|
left: MediaQuery.of(context).size.width * 0.40,
|
||||||
left: MediaQuery.of(context).size.width*0.40,
|
top: _imageTopicPosition.dy - 29,
|
||||||
top: _imageTopicPosition.dy-29,
|
child: Image.asset(
|
||||||
child: Image.asset(
|
'assets/app_tour/down_right.png',
|
||||||
'assets/app_tour/down_right.png',
|
width: 40,
|
||||||
width: 40,
|
height: 90,
|
||||||
height: 90,
|
),
|
||||||
),
|
),
|
||||||
),
|
]),
|
||||||
]
|
|
||||||
),
|
|
||||||
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -645,7 +654,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
shape: ShapeLightFocus.RRect,
|
shape: ShapeLightFocus.RRect,
|
||||||
contents: [
|
contents: [
|
||||||
createTargetContent(
|
createTargetContent(
|
||||||
text:AppLocalizations.of(context)!.home_topic,
|
text: AppLocalizations.of(context)!.home_topic,
|
||||||
alignment: ContentAlign.bottom,
|
alignment: ContentAlign.bottom,
|
||||||
gap: 45,
|
gap: 45,
|
||||||
space: 40,
|
space: 40,
|
||||||
@ -654,7 +663,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
align: ContentAlign.bottom,
|
align: ContentAlign.bottom,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: MediaQuery.of(context).size.height*0.69,
|
height: MediaQuery.of(context).size.height * 0.69,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Positioned(
|
Positioned(
|
||||||
@ -702,11 +711,13 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: Color(0xFF7DAFBC),
|
color: Color(0xFF7DAFBC),
|
||||||
border: Border.all(color: Color(0xFF7DAFBC), width: 1.5),
|
border: Border.all(
|
||||||
|
color: Color(0xFF7DAFBC), width: 1.5),
|
||||||
),
|
),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
iconSize: 20,
|
iconSize: 20,
|
||||||
icon: const Icon(Icons.arrow_forward, color: Colors.white),
|
icon: const Icon(Icons.arrow_forward,
|
||||||
|
color: Colors.white),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
tutorialCoachMark.previous();
|
tutorialCoachMark.previous();
|
||||||
},
|
},
|
||||||
@ -727,21 +738,18 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
align: ContentAlign.bottom,
|
align: ContentAlign.bottom,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: MediaQuery.of(context).size.width,
|
width: MediaQuery.of(context).size.width,
|
||||||
height:MediaQuery.of(context).size.height*0.69 ,
|
height: MediaQuery.of(context).size.height * 0.69,
|
||||||
child: Stack(
|
child: Stack(children: [
|
||||||
children: [
|
Positioned(
|
||||||
Positioned(
|
left: MediaQuery.of(context).size.width * 0.4,
|
||||||
left: MediaQuery.of(context).size.width*0.4,
|
top: _imageCardPosition.dy - 29,
|
||||||
top: _imageCardPosition.dy-29,
|
child: Image.asset(
|
||||||
child: Image.asset(
|
'assets/app_tour/down_right.png',
|
||||||
'assets/app_tour/down_right.png',
|
width: 40,
|
||||||
width: 40,
|
height: 90,
|
||||||
height: 90,
|
),
|
||||||
),
|
),
|
||||||
),
|
]),
|
||||||
]
|
|
||||||
),
|
|
||||||
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -749,15 +757,12 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
final locale = ref.read(localeProvider);
|
final locale = ref.read(localeProvider);
|
||||||
fetchData(locale?.languageCode ?? 'en');
|
fetchData(locale?.languageCode ?? 'en');
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
_fetchUserData();
|
||||||
_starTourRender();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @override
|
// @override
|
||||||
@ -768,6 +773,37 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
// fetchData(locale); // Pass the locale to the fetchData method
|
// fetchData(locale); // Pass the locale to the fetchData method
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
Future<String?> getUserId() async {
|
||||||
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
return prefs.getString('userId'); // Retrieve the userId
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _fetchUserData() async {
|
||||||
|
try {
|
||||||
|
final userId = await getUserId();
|
||||||
|
print('EDIT PROFILE isPageLoad');
|
||||||
|
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(
|
||||||
|
userId!,
|
||||||
|
headers: {
|
||||||
|
'Authorization': 'Bearer $adminToken',
|
||||||
|
},
|
||||||
|
);
|
||||||
|
final loginCount = userDetailsResponse.data['login_count'];
|
||||||
|
print(loginCount);
|
||||||
|
if (loginCount == 1) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
_starTourRender();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
print('Error fetching user details: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> fetchData(locale) async {
|
Future<void> fetchData(locale) async {
|
||||||
const baseUrl = 'https://pb.venbait.in/api/getHomePageData';
|
const baseUrl = 'https://pb.venbait.in/api/getHomePageData';
|
||||||
try {
|
try {
|
||||||
@ -875,7 +911,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
RoundedCornerContainer(
|
RoundedCornerContainer(
|
||||||
key: mainTopic['main_topic'] =='ECONOMY'
|
key: mainTopic['main_topic'] == 'ECONOMY'
|
||||||
? cardTopicKey
|
? cardTopicKey
|
||||||
: null,
|
: null,
|
||||||
text: mainTopic['main_topic'],
|
text: mainTopic['main_topic'],
|
||||||
@ -889,7 +925,7 @@ 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'
|
key: mainTopic['main_topic'] == 'ECONOMY'
|
||||||
? 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
|
||||||
@ -1111,7 +1147,6 @@ class InfoCard extends StatelessWidget {
|
|||||||
final encodedTitle = Uri.encodeComponent(title);
|
final encodedTitle = Uri.encodeComponent(title);
|
||||||
final encodedKey = Uri.encodeQueryComponent('home');
|
final encodedKey = Uri.encodeQueryComponent('home');
|
||||||
|
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
context.go(
|
context.go(
|
||||||
|
|||||||
@ -2,7 +2,7 @@ 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: 0.5.10
|
#version: 0.5.10
|
||||||
version: 1.0.5+6
|
version: 1.0.6+7
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.2.3 <4.0.0"
|
sdk: ">=3.2.3 <4.0.0"
|
||||||
@ -117,6 +117,9 @@ flutter:
|
|||||||
- assets/app_tour/
|
- assets/app_tour/
|
||||||
- assets/icons/uae_numbers/bookmarks.png
|
- assets/icons/uae_numbers/bookmarks.png
|
||||||
- assets/icons/uae_numbers/share.png
|
- assets/icons/uae_numbers/share.png
|
||||||
|
- assets/icons/misc/vector.png
|
||||||
|
- assets/icons/misc/visible_on.png
|
||||||
|
- assets/icons/misc/visibility_off.png
|
||||||
|
|
||||||
fonts:
|
fonts:
|
||||||
- family: Segoe
|
- family: Segoe
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user