why the height of columns in columns is only for the content?

Issue

This Content is from Stack Overflow. Question asked by hime_chann____

I wrote the following small piece of code to better understand Flutter’s layout system.

class FavoritePage extends HookConsumerWidget {
  const FavoritePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("favorite"),
      ),
      body: Column(
        children: [
          Column(
            children: [Text("hogehoge")],
          ),
        ],
      ),
    );
  }
}

The tree structure of the layout is as follows

enter image description here

enter image description here

However, a question has been raised here.

According to the documentation, the default value of Column’s MainAxisSize is max, so I would expect the height constraint for Column to be the height of the entire screen, but here, the size of the nested interior columns is only for the text display.

Why do these problems occur?



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?