import 'package:wanisdriver/utils/colors.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../Provider/language_provider.dart'; import '../config/language/language_enum.dart'; import '../models/ItemModel.dart'; import '../widgets/SettingItemWidget.dart'; import '../widgets/custom_text.dart'; class Navigationscreen extends StatefulWidget { const Navigationscreen({super.key}); @override State createState() => _NavigationscreenState(); } class _NavigationscreenState extends State { bool isAutoNavigationSwitched = false; bool isRealTimeTrafficSwitched = false; int selectedIndex = 0; final List> navigationOptions = [ {"title": "Wanis Navigation", "subtitle": "Recommended stay in the app"}, {"title": "Google Maps", "subtitle": "Launched in separate app"}, {"title": "Apple Maps", "subtitle": "Launched in separate app"}, ]; @override Widget build(BuildContext context) { final isDarkMode = Theme.of(context).brightness == Brightness.dark; final languageProvider = context.watch(); bool isArabic = languageProvider.currentLangCode == Language.ar; return Scaffold( body: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ // Header with back button Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16), child: Row( children: [ GestureDetector( onTap: () => Navigator.pop(context), child: Container( width: 32, height: 32, decoration: BoxDecoration( color: AppColors.lightgray, borderRadius: BorderRadius.circular(16), boxShadow: [ BoxShadow( color: AppColors.black.withOpacity(.1), blurRadius: 1, offset: const Offset(2, 1), ), ], ), child: const Icon( Icons.arrow_back, color: AppColors.black, size: 16, ), ), ), Expanded( child: Center( child: Txt( text: 'Navigation', style: TextStyle( color: isDarkMode ? AppColors.whiteBackgroundColor : AppColors.blackBackgroundColor, fontSize: 18, fontFamily: isArabic ? "Readex_Pro" : 'Inter', fontWeight: FontWeight.w600, height: 1.23, ), ), ), ), const SizedBox(width: 32), // For balance only ], ), ), // Navigation options Expanded( child: ListView( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), children: [ // Navigation options list for (int index = 0; index < navigationOptions.length; index++) Padding( padding: const EdgeInsets.only(bottom: 8.0), child: SettingTile( item: SettingItem.SelectItem( title: navigationOptions[index]["title"]!, subtitle: navigationOptions[index]["subtitle"], color: isDarkMode ? AppColors.white : AppColors.black, onTap: () { setState(() { selectedIndex = index; }); }, ), isSelected: index == selectedIndex, isInSelectionMode: true,isDarkMode: isDarkMode, ), ), // Navigation settings header const Padding( padding: EdgeInsets.only(top: 16, bottom: 8, left: 8), child: Txt( text: "Navigation settings", style: TextStyle( fontSize: 17, color: Colors.grey, fontWeight: FontWeight.w700, ), ), ), // Settings options Container( decoration: BoxDecoration( color: Theme.of(context).cardColor, borderRadius: BorderRadius.circular(12), ), child: Column( children: [ SettingTile( item: SettingItem.switchItem( title: "Auto-Navigation", subtitle: "Recommended stay in the app", color: AppColors.secondaryColor, value: isAutoNavigationSwitched, onChanged: (value) => setState(() => isAutoNavigationSwitched = value), ), isDarkMode: isDarkMode, ), const SizedBox(height: 16,), SettingTile( item: SettingItem.navigationItem( title: "Real-time traffic", switchValue: isRealTimeTrafficSwitched, color: AppColors.secondaryColor, onSwitchChanged: (value) => setState(() => isRealTimeTrafficSwitched = value), ),isDarkMode: isDarkMode, ), ], ), ), ], ), ), ], ), ); } }