build method

  1. @override
Widget build(
  1. BuildContext context
)
override

Builds the base widget tree with platform-specific back button handling.

Wraps baseViewBuild in a PopScope that:

  • Allows back navigation on non-iOS platforms
  • Prevents automatic back navigation on iOS (requires explicit handling)

This is called automatically by the Flutter framework.

Implementation

@override
Widget build(BuildContext context) {
  if (controller.checkInternetConnectivity) {
    return Obx(() {
      return PopScope(
        canPop: GetPlatform.isIOS ? false : true,
        child: controller.isConnected.value
            ? baseViewBuild(context)
            : controller.errorWidget != null
                ? controller.errorWidget!
                : Container(
                    color: Colors.white,
                    child: Center(
                      child: Text(
                        'No Internet Connection',
                        style: TextStyle(fontSize: 18, color: Colors.black),
                      ),
                    ),
                  ),
      );
    });
  } else {
    return PopScope(
      canPop: GetPlatform.isIOS ? false : true,
      child: baseViewBuild(context),
    );
  }
}