Home > Enterprise >  Flutter add bottom margin to Stack
Flutter add bottom margin to Stack

Time:11-25

I am trying to extend Stack a little bit down to create room for "All caught up" text.

Here is my code;

  return Stack(
        children: [
          buildListView(scrollController),
          buildBackToTop(scrollController, backtoTop),
          buildBottomReached(isLastIndex),
        ],
      );
Widget buildBackToTop(ScrollController scrollController, bool backtoTop) {
  if (backtoTop) {
    return Align(
      alignment: Alignment.topCenter,
      child: Padding(
        padding: const EdgeInsets.all(8.0),
        child: FloatingActionButton.extended(
          onPressed: () {
            scrollController.animateTo(0,
                duration: const Duration(milliseconds: 200),
                curve: Curves.linear);
          },
          label: const Text("Back to Top"),
        ),
      ),
    );
  } else {
    return const SizedBox();
  }
}
Widget buildBottomReached(bool isLastIndex) {
  if (isLastIndex) {
    return const Align(
      alignment: Alignment.bottomCenter,
      child: Text(
        "All caught up            
  • Related