build method

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

Implementation

@override
Widget build(BuildContext context) {
  return Theme(
    data: Theme.of(context).copyWith(
      tabBarTheme: AppStyleConfig.addParticipantsPageStyle.tabBarTheme,
      appBarTheme: AppStyleConfig.addParticipantsPageStyle.appBarTheme,
    ),
    child: CustomSafeArea(
      child: DefaultTabController(
        length: 2,
        child: Builder(builder: (ctx) {
          return Scaffold(
              body: NestedScrollView(
                  headerSliverBuilder:
                      (BuildContext context, bool innerBoxIsScrolled) {
                    return [
                      Obx(() {
                        return SliverAppBar(
                          snap: false,
                          pinned: true,
                          leading: IconButton(
                            icon: Icon(Icons.arrow_back,
                                color: AppStyleConfig.addParticipantsPageStyle
                                    .appBarTheme.iconTheme?.color),
                            onPressed: () {
                              if (controller.isSearching.value) {
                                controller.getBackFromSearch();
                              } else {
                                NavUtils.back();
                              }
                            },
                          ),
                          title: controller.isSearching.value
                              ? TextField(
                                  focusNode: controller.searchFocusNode,
                                  onChanged: (text) =>
                                      controller.searchListener(text),
                                  controller: controller.searchQuery,
                                  autofocus: true,
                                  style: AppStyleConfig
                                      .addParticipantsPageStyle
                                      .searchTextFieldStyle
                                      .editTextStyle,
                                  decoration: InputDecoration(
                                      hintText:
                                          getTranslated("searchPlaceholder"),
                                      border: InputBorder.none,
                                      hintStyle: AppStyleConfig
                                          .addParticipantsPageStyle
                                          .searchTextFieldStyle
                                          .editTextHintStyle),
                                )
                              : null,
                          bottom: TabBar(
                              controller: controller.tabController,
                              tabs: [
                                tabItem(
                                    title: getTranslated("participants")
                                        .toUpperCase(),
                                    count: "0",
                                    style: AppStyleConfig
                                        .addParticipantsPageStyle
                                        .tabItemStyle),
                                tabItem(
                                    title: getTranslated("addParticipants")
                                        .toUpperCase(),
                                    count: "0",
                                    style: AppStyleConfig
                                        .addParticipantsPageStyle
                                        .tabItemStyle)
                              ]),
                          actions: [
                            Visibility(
                              visible: controller.currentTab.value == 1,
                              child: IconButton(
                                onPressed: () {
                                  if (controller.isSearching.value) {
                                    controller.clearSearch();
                                  } else {
                                    controller.onSearchPressed();
                                  }
                                },
                                icon: !controller.isSearching.value
                                    ? AppUtils.svgIcon(
                                        icon: searchIcon,
                                        width: 18,
                                        height: 18,
                                        fit: BoxFit.contain,
                                        colorFilter: ColorFilter.mode(
                                            Theme.of(context)
                                                    .appBarTheme
                                                    .actionsIconTheme
                                                    ?.color ??
                                                Colors.black,
                                            BlendMode.srcIn),
                                      )
                                    : Icon(
                                        Icons.clear,
                                        color: Theme.of(context)
                                                .appBarTheme
                                                .actionsIconTheme
                                                ?.color ??
                                            Colors.black,
                                      ),
                                tooltip: 'Search',
                              ),
                            ),
                          ],
                        );
                      }),
                    ];
                  },
                  body: TabBarView(
                      controller: controller.tabController,
                      children: [
                        callParticipantsView(
                            context,
                            AppStyleConfig.addParticipantsPageStyle
                                .participantItemStyle),
                        addParticipants(
                            context,
                            AppStyleConfig
                                .addParticipantsPageStyle.contactItemStyle,
                            AppStyleConfig
                                .addParticipantsPageStyle.noDataTextStyle,
                            AppStyleConfig
                                .addParticipantsPageStyle.copyMeetLinkStyle)
                      ])));
        }),
      ),
    ),
  );
}