init static method

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

Implementation

static void init(
  BuildContext context, {
  String widgetCode = '',
  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 {
  debugPrint("Quick chat ---------- start chat");
  PreferencesManager preferencesManager = PreferencesManager();

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