refactor: remove the unused submitUserInfo method and enhance the searchable dropdown functionality
- Removed `submitUserInfo` from auth services and integrations. - Refined dropdown with new multi-select and searchable options. - Added `PersianFormatter` for better input handling. - Updated `local.properties` to set flutter build mode to debug.
This commit is contained in:
@@ -61,4 +61,9 @@ extension XString on String? {
|
||||
}
|
||||
|
||||
int get versionNumber => int.parse(this?.replaceAll(".", '') ?? '0');
|
||||
|
||||
bool get isDifferentDigits {
|
||||
final regex = RegExp(r'[۰-۹٠-٩]');
|
||||
return regex.hasMatch(this ?? '');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,3 +114,16 @@ Map<String, dynamic>? buildRawQueryParams({
|
||||
|
||||
return params.keys.isEmpty ? null : params;
|
||||
}
|
||||
|
||||
const Map<String, String> digitMap = {
|
||||
'۰': '0',
|
||||
'۱': '1',
|
||||
'۲': '2',
|
||||
'۳': '3',
|
||||
'۴': '4',
|
||||
'۵': '5',
|
||||
'۶': '6',
|
||||
'۷': '7',
|
||||
'۸': '8',
|
||||
'۹': '9',
|
||||
};
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../map_utils.dart';
|
||||
|
||||
class PersianFormatter extends TextInputFormatter {
|
||||
String _convert(String input) {
|
||||
final buffer = StringBuffer();
|
||||
for (var char in input.split('')) {
|
||||
buffer.write(digitMap[char] ?? char);
|
||||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
@override
|
||||
TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) {
|
||||
final fixed = _convert(newValue.text);
|
||||
|
||||
return newValue.copyWith(
|
||||
text: fixed,
|
||||
selection: TextSelection.collapsed(offset: fixed.length),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -14,4 +14,5 @@ export 'number_utils.dart';
|
||||
export 'parser.dart';
|
||||
export 'route_utils.dart';
|
||||
export 'separator_input_formatter.dart';
|
||||
export 'first_digit_decimal_formatter.dart';
|
||||
export 'text_input_formatter/first_digit_decimal_formatter.dart';
|
||||
export 'text_input_formatter/persian_formatter.dart';
|
||||
|
||||
Reference in New Issue
Block a user