import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';

import '../../injection.dart';
import '../constant/local_storage_key.dart';

void dismissKeyboard(BuildContext context) {
  final currentFocus = FocusScope.of(context);
  if (!currentFocus.hasPrimaryFocus && currentFocus.focusedChild != null) {
    FocusManager.instance.primaryFocus?.unfocus();
  }
}

Map<String, dynamic> getAuthorizationHeader() {
  return {
    'Authorization':
        'Bearer ${getIt<SharedPreferences>().getString(LocalStorageKey.token)}',
  };
}
