import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:taxglide/controller/api_contoller.dart'; class TermsAndConditionScreen extends ConsumerStatefulWidget { const TermsAndConditionScreen({super.key}); @override ConsumerState createState() => _TermsAndConditionScreenState(); } class _TermsAndConditionScreenState extends ConsumerState { @override Widget build(BuildContext context) { final termsAsync = ref.watch(termsProvider); return Scaffold( backgroundColor: const Color.fromARGB(255, 230, 229, 229), body: SafeArea( child: termsAsync.when( data: (terms) => 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( terms.data?.title ?? 'Terms & Conditions', style: const TextStyle( fontSize: 20, fontWeight: FontWeight.w700, color: Colors.black, ), ), ), ), // To balance layout so title stays centered const Opacity( opacity: 0, child: Icon(Icons.arrow_back_ios_new, size: 22), ), ], ), const SizedBox(height: 24), // 🔹 Terms Content Text( terms.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), ), ), ), ), ); } }