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 SingleChildScrollView(
    child: Padding(
      padding: const EdgeInsets.all(8.0),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          // Profile Section
          Container(
              padding: EdgeInsets.all(3.w),
              decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
                boxShadow: [
                  // BoxShadow(
                  //   color: Colors.black.withOpacity(0.1),
                  //   blurRadius: 12,
                  //   offset: const Offset(0, 6),
                  // ),
                ],
              ),
              child: Row(
                children: [
                  Expanded(
                    flex: 1,
                    child: Container(
                      width: 20.w,
                      height: 20.w,
                      decoration: BoxDecoration(
                        color: Colors.grey[300],
                        borderRadius: BorderRadius.circular(8),
                        boxShadow: [
                          BoxShadow(
                            color: Colors.black.withOpacity(0.1),
                            blurRadius: 8,
                            offset: const Offset(0, 4),
                          ),
                        ],
                      ),
                      child: InkWell(
                          onTap: () {
                            // showDialog(
                            //   context: context,
                            //   barrierDismissible: true,
                            //   builder: (context) => new BackdropFilter(
                            //     filter: ImageFilter.blur(
                            //       sigmaX: 10,
                            //       sigmaY: 10,
                            //     ),
                            //     child: AlertDialog(
                            //       contentPadding: EdgeInsets.zero,
                            //       backgroundColor: Colors.transparent,
                            //       insetPadding: const EdgeInsets.all(8),
                            //       content: WidgetZoom(
                            //         heroAnimationTag: "profileImage",
                            //         zoomWidget: CircleAvatar(
                            //           radius: 150,
                            //           child: ClipRRect(
                            //               borderRadius: BorderRadius.circular(500),
                            //               child: getProfilePhoto(height: 500, width: 500, profilePhoto: profilePhoto)),
                            //         ),
                            //       ),
                            //     ),
                            //   ),
                            // );
                          },
                          child: WidgetZoom(
                              heroAnimationTag: "image", zoomWidget: getProfilePhoto(height: 100, width: 100, profilePhoto: profilePhoto))),
                    ),
                  ),
                  SizedBox(width: 3.w),
                  Expanded(
                    flex: 3,
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        GNBoldTextWidget(
                          overflow: TextOverflow.clip,
                          title: studentName != "" && studentName != "null" ? studentName : "",
                          fontsize: 12.sp,
                        ),
                        SizedBox(
                          height: 0.5.h,
                        ),
                        ...[
                          Row(
                            children: [
                              if (enrollmentNo != "" && enrollmentNo != "null")
                                GNMediumTextWidget(
                                  title: enrollmentNo != "" && enrollmentNo != "null" ? enrollmentNo : "",
                                  fontsize: 11.sp,
                                ),
                              if (enrollmentNo != "" && enrollmentNo != "null") GNDotSeparator(),
                              if (rollNo != "" && rollNo != "null")
                                GNMediumTextWidget(
                                  title: "$rollNoTitle $rollNo",
                                  fontsize: 11.sp,
                                ),
                            ],
                          )
                        ],
                        SizedBox(
                          height: 0.5.h,
                        ),
                        Container(
                          padding: const EdgeInsets.symmetric(horizontal: NumberConst.INDEX_6_00, vertical: NumberConst.INDEX_2_00),
                          decoration: BoxDecoration(
                              borderRadius: BorderRadius.circular(NumberConst.INDEX_6_00),
                              color: status.toLowerCase() == StringConst.ON_ROLL || status.toLowerCase() == StringConst.ACTIVE
                                  ? AppColors.academicCalenderIsAfterIconColor
                                  : (status.toLowerCase() == StringConst.OFF_ROLL ? Colors.red.shade700 : Colors.cyan.shade700)),
                          child: GNBoldTextWidget(
                            title: status,
                            fontsize: NumberConst.REGULAR_FONT_SIZE - 1.sp,
                            fontcolor: Colors.white,
                          ),
                        )
                      ],
                    ),
                  ),
                ],
              )),
          // SizedBox(height: 1.h),
          GNCustomCard(
            margin: EdgeInsets.zero,
            borderRadius: BorderRadius.circular(0),
            elevation: 0,
            child: Column(
              children: [
                IntrinsicHeight(
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      studentDetailTile(
                          icon: Icons.cake_outlined, iconColor: Colors.pink, title: "Birth Date", value: birthDate ?? "-"),
                      VerticalDivider(),
                      studentDetailTile(
                          icon: Icons.bloodtype_outlined, iconColor: Colors.red, title: "Blood Group", value: bloodGroup ?? "-"),
                      // mentoringDetailCard(title: "Birth Date", details: birthDate, icon:Icons.cake_outlined, iconColor: Colors.red),
                      // mentoringDetailCard(title: "Birth Date", details: birthDate, icon:Icons.cake_outlined, iconColor: Colors.red),
                    ],
                  ),
                )
              ],
            ),
          ),
          // SizedBox(height: 1.h),
          GNCustomCard(
            margin: EdgeInsets.zero,
            padding: EdgeInsets.all(10),
            borderRadius: BorderRadius.vertical(bottom: Radius.circular(16)),
            elevation: 0,
            child: Column(
              children: [
                IntrinsicHeight(
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      studentDetailTile(
                          icon: FontAwesomeIcons.codeBranch, iconColor: Colors.green, title: branchSpecializationTitle, value: branch ?? "-"),
                      VerticalDivider(),

                      studentDetailTile(
                          icon: FontAwesomeIcons.graduationCap,
                          iconColor: Colors.indigo,
                          title: semesterHeaderTitle.toLowerCase() == "sem" ? "Semester" : semesterHeaderTitle,
                          value: (semester ?? "-")),
                      // mentoringDetailCard(title: "Birth Date", details: birthDate, icon:Icons.cake_outlined, iconColor: Colors.red),
                      // mentoringDetailCard(title: "Birth Date", details: birthDate, icon:Icons.cake_outlined, iconColor: Colors.red),
                    ],
                  ),
                ),
                SizedBox(
                  height: 2.h,
                ),
                IntrinsicHeight(
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      studentDetailTile(icon: Icons.person_2_rounded, iconColor: Colors.amber, title: divisionTitle, value: division ?? "-"),
                      VerticalDivider(),
                      studentDetailTile(icon: Icons.lightbulb, iconColor: Colors.blue, title: currentBatchTitle, value: (batch ?? "-")),
                      // mentoringDetailCard(title: "Birth Date", details: birthDate, icon:Icons.cake_outlined, iconColor: Colors.red),
                      // mentoringDetailCard(title: "Birth Date", details: birthDate, icon:Icons.cake_outlined, iconColor: Colors.red),
                    ],
                  ),
                ),
              ],
            ),
          ),
          SizedBox(height: 2.h),
          // SingleChildScrollView(
          //   scrollDirection: Axis.horizontal,
          //   child: Row(
          //     mainAxisAlignment: MainAxisAlignment.spaceBetween,
          //     mainAxisSize: MainAxisSize.max,
          //     children: [
          //       SizedBox(
          //         width: 1.5.w,
          //       ),
          //       _buildInfoCard(
          //         title: branchSpecializationTitle != "" && branchSpecializationTitle != "null" ? branchSpecializationTitle : "",
          //         value: branch != "" && branch != "null" ? branch : "-",
          //         icon: Icons.school,
          //         color: Colors.teal,
          //       ),
          //       SizedBox(
          //         width: 1.5.w,
          //       ),
          //       _buildInfoCard(
          //         title: semesterHeaderTitle != "" && semesterHeaderTitle != "null" ? semesterHeaderTitle : "",
          //         value: semester != "" && semester != "null" ? semester : "-",
          //         icon: Icons.calendar_today,
          //         color: Colors.deepPurple,
          //       ),
          //       SizedBox(
          //         width: 1.5.w,
          //       ),
          //       _buildInfoCard(
          //         title: divisionTitle != "" && divisionTitle != "null" ? divisionTitle : "",
          //         value: division != "" && division != "null" ? division : "-",
          //         icon: Icons.group,
          //         color: Colors.amber,
          //       ),
          //       SizedBox(
          //         width: 1.5.w,
          //       ),
          //       _buildInfoCard(
          //         title: rollNoTitle != "" && rollNoTitle != "null" ? rollNoTitle : "",
          //         value: rollNo != "" && rollNo != "null" ? rollNo : "",
          //         icon: Icons.confirmation_number,
          //         color: Colors.redAccent,
          //       ),
          //       SizedBox(
          //         width: 1.5.w,
          //       ),
          //       _buildInfoCard(
          //         title: currentBatchTitle != "" && currentBatchTitle != "null" ? currentBatchTitle : "",
          //         value: batch != "" && batch != "null" ? batch : "",
          //         icon: Icons.batch_prediction,
          //         color: Colors.orangeAccent,
          //       ),
          //     ],
          //   ),
          // ),
          SizedBox(height: 1.h),
          studentPhoneNo1.toLowerCase() != 'null' || studentPhoneNo2.toLowerCase() != 'null' || studentEmail1.toLowerCase() != 'null'
              ? Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Padding(
                padding: EdgeInsets.only(bottom: 1.h),
                child: GNBoldTextWidget(
                  title: "Student Contact",
                  fontsize: HEADER_FONT_SIZE + 2.sp,
                ),
              ),
              SizedBox(height: 1.h),
              studentPhoneNo1.toLowerCase() != 'null' && studentPhoneNo1 != ""
                  ? _buildContactCard(
                iconColor: Colors.blue,
                icon: Icons.phone,
                contact: studentPhoneNo1,
                onTap: () => Utils().launchCallUrl(studentPhoneNo1),
              )
                  : Container(),
              if (studentPhoneNo1.toLowerCase() != 'null' && studentPhoneNo1 != "") SizedBox(height: 1.h),
              studentPhoneNo2.toLowerCase() != 'null' && studentPhoneNo2 != ""
                  ? _buildContactCard(
                iconColor: Colors.blue,
                icon: Icons.phone,
                contact: studentPhoneNo2,
                onTap: () => Utils().launchCallUrl(studentPhoneNo2),
              )
                  : Container(),
              if (studentPhoneNo2.toLowerCase() != 'null' && studentPhoneNo2 != "") SizedBox(height: 1.h),
              studentEmail1.toLowerCase() != 'null'
                  ? _buildContactCard(
                iconColor: Colors.black87,
                icon: Icons.email,
                contact: studentEmail1,
                onTap: () => Utils().launchMailUrl(studentEmail1),
              )
                  : Container(),
              SizedBox(height: 1.h),
              (studentEmail2 != "" && studentEmail2.toLowerCase() != 'null')
                  ? _buildContactCard(
                iconColor: Colors.black87,
                icon: Icons.email,
                contact: studentEmail2.toString(),
                onTap: () => Utils().launchMailUrl(studentEmail2.toString()),
              )
                  : Container(),
              SizedBox(height: 2.h),
            ],
          )
              : Container(),
          fatherPhoneNo.toLowerCase() != 'null' || fatherEmail.toLowerCase() != 'null'
              ? Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Padding(
                padding: EdgeInsets.only(bottom: 1.h),
                child: GNBoldTextWidget(
                  title: "Father Contact",
                  fontsize: HEADER_FONT_SIZE + 2.sp,
                ),
              ),
              SizedBox(height: 1.h),
              fatherPhoneNo.toLowerCase() != 'null' && fatherPhoneNo.toLowerCase() != ""
                  ? _buildContactCard(
                iconColor: Colors.blue,
                icon: Icons.phone,
                contact: fatherPhoneNo,
                onTap: () => Utils().launchCallUrl(fatherPhoneNo),
              )
                  : Container(),
              SizedBox(height: 1.h),
              fatherEmail.toLowerCase() != 'null' && fatherEmail.toLowerCase() != ""
                  ? _buildContactCard(
                iconColor: Colors.black87,
                icon: Icons.email,
                contact: fatherEmail,
                onTap: () => Utils().launchMailUrl(fatherEmail),
              )
                  : Container(),
              SizedBox(height: 2.h),
            ],
          )
              : Container(),
          motherPhoneNo.toLowerCase() != 'null' || motherEmail.toLowerCase() != 'null'
              ? Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Padding(
                padding: EdgeInsets.only(bottom: 1.h),
                child: GNBoldTextWidget(
                  title: "Mother Contact",
                  fontsize: HEADER_FONT_SIZE + 2.sp,
                ),
              ),
              SizedBox(height: 1.h),
              motherPhoneNo.toLowerCase() != 'null' && motherPhoneNo != ""
                  ? _buildContactCard(
                iconColor: Colors.blue,
                icon: Icons.phone,
                contact: motherPhoneNo,
                onTap: () => Utils().launchCallUrl(motherPhoneNo),
              )
                  : Container(),
              SizedBox(height: 1.h),
              motherEmail.toLowerCase() != 'null' && motherEmail != ""
                  ? _buildContactCard(
                iconColor: Colors.black87,
                icon: Icons.email,
                contact: motherEmail,
                onTap: () => Utils().launchMailUrl(motherEmail),
              )
                  : Container(),
              SizedBox(height: 2.h),
            ],
          )
              : Container(),
          guardianPhoneNo.toLowerCase() != 'null' || guardianEmail.toLowerCase() != 'null'
              ? Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Padding(
                padding: EdgeInsets.only(bottom: 1.h),
                child: GNBoldTextWidget(
                  title: "Guardian Contact",
                  fontsize: HEADER_FONT_SIZE + 2.sp,
                ),
              ),
              SizedBox(height: 1.h),
              guardianPhoneNo.toLowerCase() != 'null' && guardianPhoneNo != ""
                  ? _buildContactCard(
                iconColor: Colors.blue,
                icon: Icons.phone,
                contact: guardianPhoneNo,
                onTap: () => Utils().launchCallUrl(guardianPhoneNo),
              )
                  : Container(),
              SizedBox(height: 1.h),
              guardianEmail.toLowerCase() != 'null' && guardianEmail != ""
                  ? _buildContactCard(
                iconColor: Colors.black87,
                icon: Icons.email,
                contact: guardianEmail,
                onTap: () => Utils().launchMailUrl(guardianEmail),
              )
                  : Container(),
              SizedBox(height: 2.h),
            ],
          )
              : Container(),
        ],
      ),
    ),
  );
}