appBarCenterTitle method

bool? appBarCenterTitle(
  1. bool? centerTitle, {
  2. List<Widget>? actions,
})

Whether the title should be centered. Overrides or returns the default value for AppBar.centerTitle.

Implementation

bool? appBarCenterTitle(bool? centerTitle, {List<Widget>? actions}) {
  if (centerTitle != null) return centerTitle;
  if (appBarTheme.centerTitle != null) return appBarTheme.centerTitle;
  switch (Get.platform) {
    case TargetPlatform.iOS:
    case TargetPlatform.macOS:
      return actions == null || actions.length < 2;
    default:
      return false;
  }
}