class AboutUsItem { final int id; final String title; final String disctiption; final DateTime timestmp; AboutUsItem({ required this.id, required this.title, required this.disctiption, required this.timestmp, }); factory AboutUsItem.fromJson(Map json) { return AboutUsItem( id: json['id'], title: _cleanText(json['title'] ?? ''), disctiption: _cleanText(json['disctiption'] ?? ''), timestmp: DateTime.fromMillisecondsSinceEpoch(json['timestmp']), ); } // Helper method to clean and properly format text static String _cleanText(String text) { if (text.isEmpty) return text; // Remove extra whitespace and clean the text text = text.trim(); // Fix common encoding issues for Arabic text text = text.replaceAll('Ø©', 'ة'); text = text.replaceAll('ا', 'ا'); text = text.replaceAll('Ù„', 'ل'); return text; } // Check if the content is primarily Arabic bool get isArabicContent { return _isArabic(title) || _isArabic(disctiption); } static bool _isArabic(String text) { return RegExp( r'[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]') .hasMatch(text); } }