2025-08-27 12:43:25 +07:00
|
|
|
import 'package:flutter/material.dart';
|
2025-09-18 10:39:54 +07:00
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
|
|
|
|
|
|
import '../../injection.dart';
|
|
|
|
|
import '../constant/local_storage_key.dart';
|
2025-08-27 12:43:25 +07:00
|
|
|
|
|
|
|
|
void dismissKeyboard(BuildContext context) {
|
|
|
|
|
final currentFocus = FocusScope.of(context);
|
|
|
|
|
if (!currentFocus.hasPrimaryFocus && currentFocus.focusedChild != null) {
|
|
|
|
|
FocusManager.instance.primaryFocus?.unfocus();
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-09-18 08:01:49 +07:00
|
|
|
|
|
|
|
|
String getNormalizePhone(String phoneNumber) {
|
|
|
|
|
final normalizedPhone = phoneNumber.startsWith('08')
|
|
|
|
|
? phoneNumber.replaceFirst('0', '')
|
|
|
|
|
: phoneNumber;
|
|
|
|
|
return '62$normalizedPhone';
|
|
|
|
|
}
|
2025-09-18 10:39:54 +07:00
|
|
|
|
|
|
|
|
Map<String, dynamic> getAuthorizationHeader() {
|
|
|
|
|
return {
|
|
|
|
|
'Authorization':
|
|
|
|
|
'Bearer ${getIt<SharedPreferences>().getString(LocalStorageKey.token)}',
|
|
|
|
|
};
|
|
|
|
|
}
|