اريد جعل جهات الاتصال تدعم rtl Future<String?> askUserForPhoneNumber() async { String?…
- User
اريد جعل جهات الاتصال تدعم rtl
Future<String?> _askUserForPhoneNumber() async { String? phoneNumber; await showModalBottomSheet( context: context, isScrollControlled: true, backgroundColor: Colors.transparent, builder: (context) { final controller = TextEditingController(); String localSearchQuery = '';
return StatefulBuilder( builder: (context, setStateDialog) { List<Contact> filteredContacts = _contacts.where((contact) { final name = contact.displayName.toLowerCase(); final query = localSearchQuery.toLowerCase(); final matchesName = name.contains(query); final matchesNumber = contact.phones.any( (phone) => phone.number.toLowerCase().contains(query), ); return matchesName || matchesNumber; }).toList(); return Container( decoration: BoxDecoration( color: cardColor, borderRadius: const BorderRadius.vertical( top: Radius.circular(24), ), ), padding: const EdgeInsets.all(20), height: MediaQuery.of(context).size.height * 0.85, child: Column( children: [ Container( width: 40, height: 4, margin: const EdgeInsets.only(bottom: 16), decoration: BoxDecoration( color: borderColor, borderRadius: BorderRadius.circular(2), ), ), Text( 'اختر جهة اتصال', style: TextStyle( fontSize: 20, fontWeight: FontWeight.bold, color: primaryColor, fontFamily: tajawalFont, ), ), const SizedBox(height: 16), Container( decoration: BoxDecoration( color: backgroundColor, borderRadius: BorderRadius.circular(12), ), child: TextField( controller: controller, decoration: InputDecoration( hintText: 'ابحث بالاسم أو رقم الهاتف', hintStyle: TextStyle( color: lightTextColor, fontFamily: tajawalFont, ), prefixIcon: Icon(Icons.search, color: lightTextColor), border: InputBorder.none, contentPadding: const EdgeInsets.symmetric( vertical: 16, ), ), onChanged: (val) => setStateDialog(() => localSearchQuery = val), ), ), const SizedBox(height: 16), Expanded( child: filteredContacts.isEmpty ? Center( child: Text( 'لا توجد جهات اتصال', style: TextStyle( color: lightTextColor, fontFamily: tajawalFont, ), ), ) : ListView.builder( itemCount: filteredContacts.length, itemBuilder: (_, index) { final contact = filteredContacts[index]; return _buildContactItem(contact, controller); }, ), ), const SizedBox(height: 16), Row( children: [ Expanded( child: OutlinedButton( onPressed: () => Navigator.pop(context), style: OutlinedButton.styleFrom( padding: const EdgeInsets.symmetric(vertical: 16), side: BorderSide(color: accentColor), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), ), child: Text( 'إلغاء', style: TextStyle( color: accentColor, fontFamily: tajawalFont, fontWeight: FontWeight.bold, ), ), ), ), const SizedBox(width: 12), Expanded( child: ElevatedButton( onPressed: () { phoneNumber = controller.text.trim(); Navigator.pop(context); }, style: ElevatedButton.styleFrom( backgroundColor: primaryColor, foregroundColor: Colors.white, padding: const EdgeInsets.symmetric(vertical: 16), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), elevation: 0, ), child: Text( 'تأكيد', style: TextStyle( fontFamily: tajawalFont, fontWeight: FontWeight.bold, ), ), ), ), ], ), ], ), ); }, ); }, ); return phoneNumber; - Assistant
- User
اعطيني الكود الكامل لاقوم باستخدامة مباشرة
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.