buildBody method

Widget buildBody(
  1. BuildContext context
)

Implementation

Widget buildBody(BuildContext context) {
  return Consumer<DashboardNotifier>(
    builder: (context, provider, child) {
      if (provider.getAllResponsesState == RequestState.loading) {
        return const Center(
          child: CircularProgressIndicator(),
        );
      }
      if (provider.getAllResponses.isEmpty) {
        return const Center(
          child: Text('No Http Activities'),
        );
      }
      return ListView.builder(
        itemCount: provider.getAllResponses.length,
        itemBuilder: (context, index) {
          var data = provider.getAllResponses[index];
          return InkWell(
              onTap: () {
                Navigator.push<void>(
                  context,
                  MaterialPageRoute(
                    builder: (context) => DetailPage(
                      data: data,
                    ),
                  ),
                );
              },
              child: ItemResponseWidget(data: data));
        },
      );
    },
  );
}