booleanbites / houzi-support

Support forum repo for issues & bugs reported for Houzi Flutter App.
4 stars 0 forks source link

Set a language default #2

Closed infitech8813 closed 1 year ago

infitech8813 commented 1 year ago

I used this method but the app freezes and won't open.

import 'dart:ui'; import 'package:houzi_package/files/hive_storage_files/hive_storage_manager.dart';

if (HiveStorageManager.readLanguageSelection() == null) { HiveStorageManager.storeLanguageSelection(locale: Locale("ar")); }

AdilSoomro commented 1 year ago

Where did you put this snippet in your files? Can you share the relevant file content here please.

infitech8813 commented 1 year ago

Could you please add the correct form here?

import 'package:houzi_package/houzi_main.dart' as houzi_package; import 'Hooks.dart';

Future main() async {

Map<String,dynamic> hooksMap = { "headers" : IconHooks.getHeaderMap(), "propertyDetailPageIcons" : IconHooks.getPropertyDetailPageIconsMap(), "elegantHomeTermsIcons" : IconHooks.getElegantHomeTermsIconMap(), "drawerItems" : CustomDrawerHooks.getDrawerItems(), "widgetItems" : CustomWidgetHooks.getWidgetHook(), "fonts" : CustomFontsHooks.getFontHook(), "propertyItem" : CustomItemDesignHooks.getPropertyItemHook(), "termItem" : CustomItemDesignHooks.getTermItemHook(), "agentItem" : CustomItemDesignHooks.getAgentItemHook(), "agencyItem" : CustomItemDesignHooks.getAgencyItemHook(), "languageNameAndCode" : CustomLanguageHooks.getLanguageCodeAndName(),

};

return houzi_package.main(hooksMap,configurationsFilePath: "assets/configurations/configurations.json");

}

Hassan6197 commented 1 year ago

Hello @infitech8813 Go to PROJECT_HOME\houzi_package\lib\houzi_main.dart

And paste this code snippet here, For example:

Future<void> main(Map<String,dynamic> hooksMap, {@required String configurationsFilePath}) async {
  WidgetsFlutterBinding.ensureInitialized();
  Firebase.initializeApp();
  await HiveStorageManager.openHiveBox();
  await SystemChrome.setPreferredOrientations([
    DeviceOrientation.portraitUp,
    DeviceOrientation.portraitDown,
  ]);

  // Paste here
  if (HiveStorageManager.readLanguageSelection() == null) {
    HiveStorageManager.storeLanguageSelection(locale: Locale("ar"));
  }

  GenericMethods.setHooks(hooksMap);

}
infitech8813 commented 1 year ago

Thanks problem solved