build method

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

Describes the part of the user interface represented by this widget.

The framework calls this method when this widget is inserted into the tree in a given BuildContext and when the dependencies of this widget change (e.g., an InheritedWidget referenced by this widget changes). This method can potentially be called in every frame and should not have any side effects beyond building a widget.

The framework replaces the subtree below this widget with the widget returned by this method, either by updating the existing subtree or by removing the subtree and inflating a new subtree, depending on whether the widget returned by this method can update the root of the existing subtree, as determined by calling Widget.canUpdate.

Typically implementations return a newly created constellation of widgets that are configured with information from this widget's constructor and from the given BuildContext.

The given BuildContext contains information about the location in the tree at which this widget is being built. For example, the context provides the set of inherited widgets for this location in the tree. A given widget might be built with multiple different BuildContext arguments over time if the widget is moved around the tree or if the widget is inserted into the tree in multiple places at once.

The implementation of this method must only depend on:

If a widget's build method is to depend on anything else, use a StatefulWidget instead.

See also:

  • StatelessWidget, which contains the discussion on performance considerations.

Implementation

@override
Widget build(BuildContext context) {
  return Scaffold(
    backgroundColor: Colors.white,
    appBar: AppBar(
      backgroundColor: Colors.white,
      leading: InkWell(
          onTap: () {
            Get.find<AadhaarSdkController>().failureCallback(803);
            closeSdk();
          },
          child: Icon(Icons.arrow_back_ios, color: CustomColors().textColor)),
      title: Text(
        "How To upload Paperless Aadhaar",
        style: TextStyle(color: CustomColors().textColor, fontSize: 34.iY),
      ),
    ),
    body: Stack(
      children: [
        Column(
          children: [
            Flexible(
                flex: 1,
                child: Container(
                  color: CustomColors().initialScreenBgColor,
                  child: Center(
                    child: Get.find<AadhaarSdkController>().imageUrl != null
                        ? ImageProcessor().loadImageWithUrl(
                            imageUrl:
                                Get.find<AadhaarSdkController>().imageUrl!,
                            height: 350.iY)
                        : ImageProcessor().loadImageFromAssets(
                            resId: "icon/1.png", height: 350.iY),
                  ),
                )),
            const Divider(),
            SizedBox(height: 20.iY),
            Flexible(
                flex: 2,
                child: Container(
                  padding: EdgeInsets.symmetric(horizontal: 30.iX),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Row(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: [
                          Text(
                            "Powered By",
                            style: TextStyle(fontSize: 20.iY),
                          ),
                          SizedBox(
                            width: 10.iX,
                          ),
                          ImageProcessor().loadImageFromAssets(
                            resId: "icon/9.png",
                            width: 150.iX,
                          ),
                        ],
                      ),
                      SizedBox(height: 40.iY),
                      Text(
                        "Upload your Paperless aadhaar in simple steps:",
                        style: TextStyle(
                          fontSize: 30.iY,
                          color: CustomColors().textColor,
                        ),
                      ),
                      SizedBox(height: 40.iY),
                      Text(
                        "⦁ On the next page, enter your Aadhaar Number and the security code displayed. Click on send OTP.",
                        style: TextStyle(
                          fontSize: 26.iY,
                          color: CustomColors().textColor,
                          fontWeight: FontWeight.w300,
                        ),
                      ),
                      SizedBox(height: 40.iY),
                      Text(
                        "⦁ Enter the OTP received on your Aadhaar linked mobile number and click on submit.",
                        style: TextStyle(
                          fontSize: 26.iY,
                          color: CustomColors().textColor,
                          fontWeight: FontWeight.w300,
                        ),
                      ),
                      SizedBox(height: 40.iY),
                      Text(
                        "⦁ Enter any 4 digit share code /Password for securing your Aadhaar Document.",
                        style: TextStyle(
                          fontSize: 26.iY,
                          color: CustomColors().textColor,
                          fontWeight: FontWeight.w300,
                        ),
                      ),
                    ],
                  ),
                )),
            Flexible(
                flex: 1,
                child: Container(
                    padding: EdgeInsets.symmetric(
                      horizontal: 30.iX,
                    ),
                    child: Column(
                      children: [
                        Container(
                          padding: EdgeInsets.symmetric(
                            horizontal: 20.iX,
                            vertical: 20.iY,
                          ),
                          decoration: BoxDecoration(
                            border: Border.all(
                              color: CustomColors().textColor,
                              width: 1.iY,
                            ),
                            borderRadius: BorderRadius.circular(8.0),
                          ),
                          child: Row(
                            children: [
                              ImageProcessor().loadImageFromAssets(
                                resId: "icon/7.png",
                                height: 60.iY,
                              ),
                              SizedBox(
                                width: 20.iX,
                              ),
                              Expanded(
                                child: Text(
                                  "To proceed with this option you need to have access to your aadhaar Linked mobile Number",
                                  style: TextStyle(
                                    fontSize: 24.iY,
                                    color: CustomColors().textColor,
                                    fontWeight: FontWeight.w300,
                                  ),
                                ),
                              ),
                            ],
                          ),
                        ),
                        SizedBox(
                          height: 40.iY,
                        ),
                        SizedBox(
                          width: double.infinity,
                          child: ElevatedButton(
                            onPressed: () async {
                              Get.off(() => MainPage());
                              // Get.off(() => CameraPage());
                            },
                            child: const Text("Continue"),
                          ),
                        ),
                      ],
                    ))),
          ],
        ),
        Obx(() {
          return Visibility(
              visible: controller.loader.value,
              child: Container(
                color: Colors.black54,
                child: Center(
                  child: Container(
                      decoration: BoxDecoration(
                          color: Colors.white,
                          borderRadius: BorderRadius.circular(8.0)),
                      padding: EdgeInsets.all(40.iX),
                      child: const CircularProgressIndicator()),
                ),
              ));
        })
      ],
    ),
  );
}