create static method

AppBarGeneralFrameworkWidget create({
  1. Key? key,
  2. required Widget? leadingBuilder(
    1. BuildContext context,
    2. Widget? child
    ),
  3. required BuildContext context,
  4. required String title,
  5. DecorationBuilderGeneralFrameworkWidget? decorationBuilder,
  6. required GeneralLibFlutterStatefulWidget<StatefulWidget> pageState,
  7. bool isAddChangeTheme = true,
  8. bool isHideAppBarContent = false,
  9. required bool isShowApplicationIconAndtitle,
  10. required bool isApplicationFullScreen,
  11. required String applicationTitle,
  12. required dynamic applicationIcon,
  13. Widget? backIcon,
  14. required GeneralLibFlutterApp generalLibFlutterApp,
  15. required Iterable<Widget> actions(
    1. BuildContext context,
    2. GeneralLibFlutterStatefulWidget<StatefulWidget> pageState
    ),
  16. required Iterable<Widget> builder(
    1. BuildContext context,
    2. GeneralLibFlutterStatefulWidget<StatefulWidget> pageState
    ),
  17. required Widget appBarBuilder(
    1. BuildContext context,
    2. Widget appBar
    ),
})

Implementation

static AppBarGeneralFrameworkWidget create({
  Key? key,
  required Widget? Function(BuildContext context, Widget? child)
      leadingBuilder,
  required BuildContext context,
  required String title,
  DecorationBuilderGeneralFrameworkWidget? decorationBuilder,
  required GeneralLibFlutterStatefulWidget pageState,
  bool isAddChangeTheme = true,
  bool isHideAppBarContent = false,
  required bool isShowApplicationIconAndtitle,
  required bool isApplicationFullScreen,
  required String applicationTitle,
  required dynamic applicationIcon,
  Widget? backIcon,
  required GeneralLibFlutterApp generalLibFlutterApp,
  required Iterable<Widget> Function(
          BuildContext context, GeneralLibFlutterStatefulWidget pageState)
      actions,
  required Iterable<Widget> Function(
          BuildContext context, GeneralLibFlutterStatefulWidget pageState)
      builder,
  required Widget Function(BuildContext context, Widget appBar) appBarBuilder,
}) {
  return AppBarGeneralFrameworkWidget.raw(
    key: key,
    context: context,
    isShowApplicationIconAndtitle: isShowApplicationIconAndtitle,
    decorationBuilder: decorationBuilder,
    pageState: pageState,
    isApplicationFullScreen: isApplicationFullScreen,
    applicationIcon: applicationIcon,
    applicationTitle: applicationTitle,
    generalLibFlutterApp: generalLibFlutterApp,
    builder: (context, GeneralLibFlutterStatefulWidget pageState) sync* {
      if (isHideAppBarContent == false) {
        yield appBarBuilder(
          context,
          MediaQuery.removePadding(
            context: context,
            removeBottom: true,
            removeLeft: true,
            removeRight: true,
            removeTop: true,
            child: AppBar(
              centerTitle: true,
              leading: () {
                return leadingBuilder(context, () {
                  if (context.navigator().canPop()) {
                    return backButtonWidget(
                      context: context,
                      generalLibFlutterStatefulWidget: pageState,
                      backIcon: backIcon ?? const Icon(Icons.arrow_back),
                      onPressed: () {
                        context.navigator().pop();
                      },
                    );
                  }
                  return null;
                }());
              }(),
              title: SkeletonizerGeneralFramework(
                enabled: pageState.isLoading,
                child: Text(
                  title,
                  style: context.theme.textTheme.titleLarge,
                ),
              ),
              actions: [
                if (isAddChangeTheme) ...[
                  SkeletonizerGeneralFramework(
                    enabled: pageState.isLoading,
                    child: AppBarGeneralFrameworkWidget.themeChangeWidget(
                      generalLibFlutterApp: generalLibFlutterApp,
                    ),
                  ),
                ],
                for (final element in actions(context, pageState)) ...[
                  element,
                ]
              ],
            ),
          ),
        );
      }
      yield* builder(context, pageState);
      return;
    },
  );
}