اريد تقليل المسافة بين الرصيد العددي وكلمة الرصيد: Row( mainAxisSize: MainAxisSize.min,…
- User
اريد تقليل المسافة بين الرصيد العددي وكلمة الرصيد: Row( mainAxisSize: MainAxisSize.min, textDirection: TextDirection.rtl, children: [ Text( textDirection: TextDirection.rtl, 'الرصيد: ', style: TextStyle( fontSize: 16, fontWeight: FontWeight.w600, fontFamily: tajawalFont, color: lightColorScheme.onSurface, ), ), Container( width: 60, // ضبط العرض هنا مثال (يمكنك تغييره) child: Text( _formatWithThousandsSeparator(_currentBalance), style: TextStyle( fontSize: 16, fontWeight: FontWeight.bold, fontFamily: tajawalFont, color: lightColorScheme.onSurface, ), maxLines: 1, overflow: TextOverflow.ellipsis, textDirection: TextDirection.ltr, ), ), ], ),
- Assistant
- User
اريد اضافة مسافة من الاعلى Row( mainAxisSize: MainAxisSize.min, textDirection: TextDirection.rtl, children: [ Text( textDirection: TextDirection.rtl, 'الرصيد: ', style: TextStyle( fontSize: 16, fontWeight: FontWeight.w600, fontFamily: tajawalFont, color: lightColorScheme.onSurface, ), ), SizedBox( width: 49, // تقليل العرض لتقليل المسافة child: Text( _formatWithThousandsSeparator(_currentBalance), style: TextStyle( fontSize: 15, fontWeight: FontWeight.bold, fontFamily: tajawalFont, color: lightColorScheme.onSurface, ), maxLines: 1, overflow: TextOverflow.ellipsis, textDirection: TextDirection.ltr, ), ), ], ),
- Assistant
لإضافة مسافة من الأعلى للـ
Rowفي Flutter، يمكنك استخدام إحدى الطرق التالية:1. استخدام
PaddingمعEdgeInsets.only(top: ...)غلف الـ
RowبـPaddingوحدد المسافة التي تريدها من الأعلى، مثلاً:dart - User
اريد دالة للتعامل مع الارقام الكبيرة واختصارها الى رقم مع حرف Container( padding: const EdgeInsets.only(top: 5.5), child: Row( mainAxisSize: MainAxisSize.min, textDirection: TextDirection.rtl, children: [ Text( textDirection: TextDirection.rtl, 'الرصيد: ', style: TextStyle( fontSize: 16, fontWeight: FontWeight.w600, fontFamily: tajawalFont, color: lightColorScheme.onSurface, ), ), SizedBox( width: 49, // تقليل العرض لتقليل المسافة child: Text( _formatWithThousandsSeparator( _currentBalance, ), style: TextStyle( fontSize: 15, fontWeight: FontWeight.bold, fontFamily: tajawalFont, color: lightColorScheme.onSurface, ), maxLines: 1, overflow: TextOverflow.ellipsis, textDirection: TextDirection.ltr, ), ), ], ), ),
- Assistant
يمكنك كتابة دالة في Dart تقوم بتحويل الأرقام الكبيرة إلى صيغة مختصرة مع حرف يشير للوحدة (مثل K للألف، M للمليون، B للمليار) بالشكل التالي:
dartString formatNumberWithSuffix(num number) { if (number >= 1000000000) { return (number / 1000000000).toStringAsFixed(1).replaceAll(RegExp(r"\.0$"), "") + "B"; } else if (number >= 1000000) { return (number / 1000000).toStringAsFixed(1).replaceAll(RegExp(r"\.0$"), "") + "M"; } else if (number >= 1000) { return (number / 1000).toStringAsFixed(1).replaceAll(RegExp(r"\.0$"), "") + "K"; } else { return number.toString(); } }