init static method

void init(
  1. BuildContext context, {
  2. String widgetCode = '',
  3. String fcmServerKey = '',
  4. Color backgroundColor = Colors.white,
  5. String appBarTitle = 'Chat With Us',
  6. Color appBarBackgroundColor = Colors.blueAccent,
  7. Color appBarTitleColor = Colors.white,
  8. Color appBarBackButtonColor = Colors.white,
})

Implementation

static void init(
  BuildContext context, {
  String widgetCode = '',
  String fcmServerKey = '',
  Color backgroundColor = Colors.white, // Default background color
  String appBarTitle = 'Chat With Us', // Default app bar title
  Color appBarBackgroundColor = Colors.blueAccent, // Default background color
  Color appBarTitleColor = Colors.white, // Default title color
  Color appBarBackButtonColor = Colors.white, // Default back button color
}) async {
  NotificationHandler.initialize(context);
  PreferencesManager preferencesManager = PreferencesManager();

  await preferencesManager.savePreferences(
    widgetCode: widgetCode,
    fcmServerKey: fcmServerKey,
    backgroundColor: backgroundColor,
    appBarTitle: appBarTitle,
    appBarBackgroundColor: appBarBackgroundColor,
    appBarTitleColor: appBarTitleColor,
    appBarBackButtonColor: appBarBackgroundColor,
  );
    Navigator.of(context).push(
      MaterialPageRoute(
        builder: (context) => QuickChatWidget(
            widgetCode: widgetCode,
            fcmServerKey: fcmServerKey,
            appBarTitle: appBarTitle,
            appBarBackgroundColor: appBarBackgroundColor,
            appBarTitleColor: appBarTitleColor,
            appBarBackButtonColor: appBarBackButtonColor,
            backgroundColor: backgroundColor),
      ),
    );
}