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 Container(
    width: double.infinity,
    margin: EdgeInsets.only(top: 50.dp),
    child: Column(
      children: [

            Image.asset(
              'assets/flight_search/empty_results.png',
              width: 90,
              height: 157,
            ),
            Text(
             "No Flights Found!".tr,
              textAlign: TextAlign.center,
              style: const TextStyle(
                color: ColorHelper.neutralMediumText,
                fontSize: 18,
                fontWeight: FontWeight.w600,
                height: 1.5,
              ),
            ),
            8.dp.SpaceX,
            // if(controller.isSelectingReturn)...{
            //   33.SpaceX,
            //   Text(
            //     "We’ve successfully found an available departure flight for your selected dates and destination.${context.isMobile? ' ':'\n'}However, we were unable to locate a matching return flight at this time. This may be due to:"
            //         .tr,
            //     textAlign: TextAlign.center,
            //     style: const TextStyle(
            //       color: ColorHelper.neutralMediumText,
            //       fontSize: 14,
            //       fontWeight: FontWeight.w400,
            //     ),
            //   ),
            //   15.SpaceX,
            //    SizedBox(
            //   width: double.infinity,
            //   child: Wrap(
            //     alignment: WrapAlignment.center,
            //     spacing: 38,
            //     runSpacing: 10,
            //     children: [
            //       _bulletPoint('Limited seat availability on your preferred return date', isWarning: true),
            //       _bulletPoint('Airline restrictions', isWarning: true),
            //       _bulletPoint('Or changes in live inventory', isWarning: true),
            //     ],
            //   ),
            // ),
            // 33.SpaceX,
            // Text(
            //   "You can try the following options:".tr,
            //   textAlign: TextAlign.center,
            //   style: const TextStyle(
            //     color: ColorHelper.neutralMediumText,
            //     fontSize: 16,
            //     fontWeight: FontWeight.w500,
            //   ),
            // ),
            // 12.SpaceX,
            // SizedBox(
            //   width: double.infinity,
            //   child: Wrap(
            //     alignment: WrapAlignment.center,
            //     spacing: 38,
            //     runSpacing: 10,
            //     children: [
            //       _bulletPoint('Adjust your return date by 1–2 days,'),
            //       _bulletPoint('Or proceed with a one-way booking for now.'),
            //     ],
            //   ),
            // ),
            //   24.SpaceX,
            //   Container(
            //     height: 0.5,
            //     color: ColorHelper.genericBorderColor,
            //     width: 700,
            //   ),
            //   20.SpaceX,
            //   const SizedBox(
            //     width: 700,
            //     child: Text('Your journey doesn’t have to wait — we’re here to help find your best option.',
            //     textAlign: TextAlign.center,
            //         style: TextStyle(
            //           color: ColorHelper.neutralMediumText,
            //           fontSize: 16,
            //           fontWeight: FontWeight.w400,
            //         ),
            //     ),
            //   ),
            //   20.SpaceX,
            //   Wrap(
            //     alignment: WrapAlignment.center,
            //     spacing: 13,
            //     runSpacing: 20,
            //     children: [
            //       CustomButton(
            //         padding: const EdgeInsets.symmetric(vertical: 8),
            //         btnWidth: context.isMobile? double.infinity :180,
            //         btnHeight: 40,
            //         btnText: 'Book One-Way',
            //         fontSize: 18,
            //         fontWeight: FontWeight.w500,
            //         btnclr: ColorHelper.white,
            //         btnTextColor: ColorHelper.neutralLightText,
            //         border: Border.all(
            //           width: 1,
            //           color: ColorHelper.neutralLightText,
            //         ),
            //         onTap: controller.backToDeparture,
            //       ),
            //       CustomButton(
            //         padding: const EdgeInsets.symmetric(vertical: 8),
            //         btnWidth: context.isMobile? double.infinity :180,
            //         btnHeight: 40,
            //         btnText: 'Modify Search',
            //         fontSize: 18,
            //         fontWeight: FontWeight.w500,
            //          onTap: () {
            //             controller.modifySearch();
            //           },
            //         )
            //     ],
            //   )
            // }
            // else...{
              Text(
                "We couldn’t find any flights that match your search criteria."
                    .tr,
                textAlign: TextAlign.center,
                style: const TextStyle(
                  color: ColorHelper.neutralMediumText,
                  fontSize: 14,
                  fontWeight: FontWeight.w400,
                ),
              ),

            12.dp.SpaceX,
            Text(
              "Try Adjusting Your Search:".tr,
              textAlign: TextAlign.center,
              style: const TextStyle(
                color: ColorHelper.neutralMediumText,
                fontSize: 16,
                fontWeight: FontWeight.w500,
              ),
            ),
            12.dp.SpaceX,
            SizedBox(
              width: double.infinity,
              child: Wrap(
                alignment: WrapAlignment.center,
                spacing: 38,
                runSpacing: 10,
                children: [
                  _bulletPoint('Change your travel dates or times.'),
                  _bulletPoint('Explore nearby airports.'),
                  _bulletPoint('Remove filters or search preferences.'),
                ],
              ),
            ),
          28.SpaceX,
          Container(
            height: 0.5,
            color: ColorHelper.genericBorderColor,
            width: 700,
          ),
          20.SpaceX,
          const SizedBox(
            width: 700,
            child: Text('Let’s find your next exclusive-rated flight, focused on Business & First Class. Secure it fast and save using decentralized or traditional payments—your choice.',
             textAlign: TextAlign.center,
                style: TextStyle(
                  color: ColorHelper.neutralMediumText,
                  fontSize: 16,
                  fontWeight: FontWeight.w400,
                ),
            ),
          ),
        24.SpaceX,
        InkWell(
          onTap: () {
            context.isMobile? _showModifySearchMobile(context) :
            scrollToTop();
          },
          child: const Text('MODIFY SEARCH',
             textAlign: TextAlign.center,
                style: TextStyle(
                  color: ColorHelper.primaryColor2,
                  fontSize: 14,
                  fontWeight: FontWeight.w500,
                ),
            ),
        ),
      // }
      ],
    ),
  );
}