import 'dart:developer'; import 'package:wanisclient/config/custom_text.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:shared_preferences/shared_preferences.dart'; import '../../../routes/app_routes.dart'; import '../../../services/SystemInsetsService.dart'; import '../../../utils/colors.dart'; import '../../../widgets/custom_button.dart'; class OnboardingScreen extends StatefulWidget { const OnboardingScreen({super.key}); @override State createState() => _OnboardingScreenState(); } class _OnboardingScreenState extends State { double _systembottompadding = 0.0; @override void initState() { super.initState(); WidgetsBinding.instance.addPostFrameCallback((_) async { await _initializepad(); }); } void completeOnboarding() async { final prefs = await SharedPreferences.getInstance(); await prefs.setBool("set_onboarding_Completed", true); Get.offAllNamed(AppRoutes.startselectlangugeScreen); } Future _initializepad() async { log("[DEBUG] Initializing pad"); final pad = await SystemInsetsService.instance.bottomPadding(context); log("pad : $pad"); if (mounted) setState(() => _systembottompadding = pad); } @override Widget build(BuildContext context) { return Scaffold( body: Stack( children: [ // Full Background Image Positioned.fill( child: Image.asset( 'assets/images/taxiimageonbordingscreen.png', fit: BoxFit.cover, ), ), // Bottom Content Card Positioned( left: 0, right: 0, bottom: _systembottompadding, child: Container( padding: const EdgeInsets.all(28), decoration: BoxDecoration( color: Colors.white, borderRadius: const BorderRadius.only(topLeft: Radius.circular(24),topRight: Radius.circular(24) ), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.15), blurRadius: 20, offset: const Offset(0, 10), ), ], ), child: Column( mainAxisSize: MainAxisSize.min, children: [ // Title const Text( 'Request Ride', style: TextStyle( fontSize: 26, fontWeight: FontWeight.bold, color: Colors.black87, letterSpacing: -0.5, ), ), const SizedBox(height: 12), // Description Txt( text: 'Order the ride and pay \n the metered fare', textAlign: TextAlign.center, maxLines: 2, style: TextStyle( fontSize: 18, color: Colors.grey[600], height: 1.5, ), ), const SizedBox(height: 28), // Continue Button CustomButton( onClick: completeOnboarding, fontSize: 16, width: double.infinity, height: 56, borderRadius: 10, txtColor: Colors.white, title: 'Continue with phone', backgroundColor: AppNewColors.primaryBtnColor, borderColor: AppNewColors.primaryBtnColor, ), ], ), ), ), ], ), ); } }