import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:taxglide/controller/api_contoller.dart'; class PolicyScreen extends ConsumerStatefulWidget { const PolicyScreen({super.key}); @override ConsumerState createState() => _PolicyScreenState(); } class _PolicyScreenState extends ConsumerState { @override Widget build(BuildContext context) { final policyAsync = ref.watch(policyProvider); return Scaffold( backgroundColor: const Color.fromARGB(255, 230, 229, 229), body: SafeArea( child: policyAsync.when( data: (policy) => SingleChildScrollView( padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 24), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ // 🔹 Header Row with Back Arrow + Centered Title Row( children: [ GestureDetector( onTap: () => Navigator.pop(context), child: const Icon( Icons.arrow_back_ios_new, color: Colors.black, size: 22, ), ), Expanded( child: Center( child: Text( policy.data?.title ?? 'Privacy Policy', style: const TextStyle( fontSize: 20, fontWeight: FontWeight.w700, color: Colors.black, ), ), ), ), // Invisible icon to balance the layout const Opacity( opacity: 0, child: Icon(Icons.arrow_back_ios_new, size: 22), ), ], ), const SizedBox(height: 24), // 🔹 Policy Content Text( policy.data?.content ?? '', textAlign: TextAlign.start, style: const TextStyle( fontSize: 16, height: 1.6, color: Colors.black87, ), ), ], ), ), loading: () => const Center(child: CircularProgressIndicator()), error: (err, _) => Center( child: Text( 'Error: $err', style: const TextStyle(color: Colors.red), ), ), ), ), ); } }