last 16-10-2025
This commit is contained in:
commit
7546b7348c
269 files changed
+36404
No files matched your search
@@ -0,0 +1,49 @@
|
||||
import 'package:bookmywages/consts_widgets/app_assets.dart';
|
||||
import 'package:bookmywages/consts_widgets/app_colors.dart';
|
||||
import 'package:bookmywages/routers/consts_router.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get_core/src/get_main.dart';
|
||||
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class FlashScreen extends StatefulWidget {
|
||||
const FlashScreen({super.key});
|
||||
|
||||
@override
|
||||
State<FlashScreen> createState() => _FlashScreenState();
|
||||
}
|
||||
|
||||
class _FlashScreenState extends State<FlashScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_navigateUser();
|
||||
}
|
||||
|
||||
Future<void> _navigateUser() async {
|
||||
await Future.delayed(const Duration(seconds: 2));
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
final userId = prefs.getString('userId');
|
||||
final isVerified = prefs.getString('is_verified');
|
||||
|
||||
if (!mounted) return;
|
||||
|
||||
if (userId != null && userId.isNotEmpty && isVerified == '1') {
|
||||
Get.toNamed(RouterConts.homescreen);
|
||||
} else {
|
||||
Get.toNamed(RouterConts.welcomepage);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.flashscreen,
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Center(child: Image.asset(AppAssets.flashscreen)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
|
||||
import 'package:bookmywages/consts_widgets/app_assets.dart';
|
||||
import 'package:bookmywages/consts_widgets/app_colors.dart';
|
||||
import 'package:bookmywages/routers/consts_router.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class VendorWelcomePage extends ConsumerStatefulWidget {
|
||||
const VendorWelcomePage({super.key});
|
||||
|
||||
@override
|
||||
ConsumerState<VendorWelcomePage> createState() => _VendorWelcomePageState();
|
||||
}
|
||||
|
||||
class _VendorWelcomePageState extends ConsumerState<VendorWelcomePage> {
|
||||
bool _isLoading = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_checkProfileStatus();
|
||||
}
|
||||
|
||||
Future<void> _checkProfileStatus() async {
|
||||
try {
|
||||
setState(() => _isLoading = true);
|
||||
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
final vendorId = prefs.getString('vendor_id');
|
||||
final vendorStatus = prefs.getString('vendor_status');
|
||||
|
||||
print('Stored vendor_id: $vendorId');
|
||||
print('Stored vendor_status: $vendorStatus');
|
||||
|
||||
await Future.delayed(const Duration(seconds: 2));
|
||||
|
||||
if (!mounted) return;
|
||||
|
||||
if (vendorId == null || vendorId.isEmpty) {
|
||||
// Case 1: vendor_id is null or empty
|
||||
Get.offNamed(RouterConts.vendorresgister);
|
||||
} else if (vendorStatus == '0') {
|
||||
// Case 2: vendor_id present but vendor_status is null
|
||||
_showVerificationDialog(context);
|
||||
} else {
|
||||
// Case 3: both are present
|
||||
Get.offNamed(RouterConts.vendorhomepage);
|
||||
}
|
||||
} catch (e) {
|
||||
// ignore: avoid_print
|
||||
print('Error checking profile status: $e');
|
||||
if (mounted) {
|
||||
_showVerificationDialog(context);
|
||||
}
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() => _isLoading = false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
backgroundColor: AppColors.secondprimary,
|
||||
body: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
return Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 33.0,
|
||||
top: 48,
|
||||
right: 59,
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Text.rich(
|
||||
TextSpan(
|
||||
children: [
|
||||
TextSpan(
|
||||
text: "Welcome back to ",
|
||||
style: TextStyle(
|
||||
fontFamily: 'Gilroy-Medium',
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 32,
|
||||
height: 1.5,
|
||||
letterSpacing: 0.26,
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: "VENDOR LOGIN",
|
||||
style: TextStyle(
|
||||
fontFamily: 'Gilroy-ExtraBold',
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 32,
|
||||
height: 1.5,
|
||||
letterSpacing: 0.26,
|
||||
color: Color(0xFF3A47C9),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Image.asset(
|
||||
AppAssets.vendorwelcome,
|
||||
fit: BoxFit.contain,
|
||||
width: constraints.maxWidth * 0.8,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _showVerificationDialog(BuildContext context) {
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false, // Prevent closing by tapping outside
|
||||
builder: (BuildContext context) {
|
||||
return Dialog(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
side: const BorderSide(color: Colors.white, width: 1),
|
||||
),
|
||||
elevation: 10,
|
||||
backgroundColor: Colors.white,
|
||||
child: Container(
|
||||
width: 365,
|
||||
height: 305,
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Text(
|
||||
'Verification',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Gilroy-Bold',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 32,
|
||||
height: 1.0,
|
||||
letterSpacing: 0.32,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
const Text(
|
||||
'Still your account will not verify by Admin, please wait with us.',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Gilroy-Bold',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 20.23,
|
||||
height: 1.74,
|
||||
letterSpacing: 0.2023,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color(0xFF0066FF),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(29.36),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 50,
|
||||
vertical: 15,
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(); // Close dialog
|
||||
Get.offNamed(RouterConts.homescreen);
|
||||
},
|
||||
child: const Text(
|
||||
'OK',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Gilroy-Black',
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 20.29,
|
||||
height: 1.0,
|
||||
letterSpacing: 0.4058,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
import 'package:bookmywages/consts_widgets/app_assets.dart';
|
||||
import 'package:bookmywages/consts_widgets/app_colors.dart';
|
||||
import 'package:bookmywages/consts_widgets/comman_button.dart';
|
||||
import 'package:bookmywages/routers/consts_router.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get_core/src/get_main.dart';
|
||||
|
||||
class WelcomePage extends StatefulWidget {
|
||||
const WelcomePage({super.key});
|
||||
|
||||
@override
|
||||
State<WelcomePage> createState() => _WelcomePageState();
|
||||
}
|
||||
|
||||
class _WelcomePageState extends State<WelcomePage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final Size screenSize = MediaQuery.of(context).size;
|
||||
final double textScale = MediaQuery.of(context).textScaleFactor;
|
||||
|
||||
final bool isMobile = screenSize.width < 600;
|
||||
final bool isTablet = screenSize.width >= 600 && screenSize.width < 1200;
|
||||
final bool isDesktop = screenSize.width >= 1200;
|
||||
|
||||
final double headingFontSize =
|
||||
(isMobile ? 25 : (isTablet ? 28 : 32)) * textScale;
|
||||
final double buttonFontSize =
|
||||
(isMobile ? 18 : (isTablet ? 22 : 25)) * textScale;
|
||||
final double horizontalPadding = screenSize.width * 0.05;
|
||||
final double topPadding = screenSize.height * 0.05;
|
||||
final double verticalSpacing = screenSize.height * 0.03;
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.secondprimary,
|
||||
body: SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
child: Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 800),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: horizontalPadding.clamp(16.0, 32.0),
|
||||
vertical: topPadding,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: 250),
|
||||
child: RichText(
|
||||
textAlign: TextAlign.start,
|
||||
text: TextSpan(
|
||||
style: TextStyle(
|
||||
fontFamily: 'Gilroy',
|
||||
fontWeight: FontWeight.w900,
|
||||
fontSize: headingFontSize,
|
||||
height: 1.65,
|
||||
letterSpacing: headingFontSize * 0.01,
|
||||
),
|
||||
children: const [
|
||||
TextSpan(
|
||||
text: "Explore The All Types Of ",
|
||||
style: TextStyle(color: AppColors.thridprimary),
|
||||
),
|
||||
TextSpan(
|
||||
text: "Service",
|
||||
style: TextStyle(color: Color(0xFF3A47C9)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: verticalSpacing),
|
||||
Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: isDesktop
|
||||
? screenSize.width * 0.5
|
||||
: (isTablet
|
||||
? screenSize.width * 0.7
|
||||
: screenSize.width * 0.85),
|
||||
),
|
||||
child: Image.asset(
|
||||
AppAssets.welcome,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: verticalSpacing * 1.6),
|
||||
Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: isDesktop
|
||||
? screenSize.width * 0.3
|
||||
: (isTablet
|
||||
? screenSize.width * 0.5
|
||||
: screenSize.width * 0.85),
|
||||
),
|
||||
child: CommanButton(
|
||||
text: 'Sign in',
|
||||
textStyle: TextStyle(
|
||||
fontFamily: 'Gilroy-Black',
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: buttonFontSize,
|
||||
height: 1.0,
|
||||
letterSpacing: buttonFontSize * 0.02,
|
||||
color: AppColors.secondprimary,
|
||||
),
|
||||
|
||||
onPressed: () => Get.toNamed(RouterConts.loginpage),
|
||||
isPrimary: true,
|
||||
backgroundColor: AppColors.primary,
|
||||
textColor: AppColors.secondprimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: verticalSpacing),
|
||||
Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: isDesktop
|
||||
? screenSize.width * 0.3
|
||||
: (isTablet
|
||||
? screenSize.width * 0.5
|
||||
: screenSize.width * 0.85),
|
||||
),
|
||||
child: CommanButton(
|
||||
text: 'Sign up',
|
||||
textStyle: TextStyle(
|
||||
fontFamily: 'Gilroy-Black',
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: buttonFontSize,
|
||||
height: 1.0,
|
||||
letterSpacing: buttonFontSize * 0.02,
|
||||
color: AppColors.hittext,
|
||||
),
|
||||
|
||||
onPressed: () => Get.toNamed(RouterConts.siguppage),
|
||||
isPrimary: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: verticalSpacing),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user