Repository: flutter
Issue: [flutter_markdown] "scrollController.position.maxScrollExtent"  is not a fixed value
Labels: package,team-ecosystem,has reproducible steps,P3,p: flutter_markdown,found in release: 2.10,found in release: 2.11,triaged-ecosystem

I was using flutter_markdown in my app and i want to get the markdown height with a ScrollController, but the scrollController.position.maxScrollExtent is  not a fixed value. Here are my codes:

<details>
<summary>code sample</summary>

```dart
import 'package:codind/entity/schedule.dart';
import 'package:codind/utils/utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:url_launcher/url_launcher.dart';

enum DataFrom { net, asset, string, file }

// ignore: must_be_immutable
class BaseMarkdownPreviewPage extends StatefulWidget {
  BaseMarkdownPreviewPage(
      {Key? key, this.mdData, required this.from, this.tip, this.schedule})
      : super(key: key);
  final DataFrom from;
  String? mdData;
  String? tip;
  Schedule? schedule;

  @override
  State<BaseMarkdownPreviewPage> createState() =>
      _BaseMarkdownPreviewPageState();
}

class _BaseMarkdownPreviewPageState extends State<BaseMarkdownPreviewPage> {
  late String markdownData;
  // ignore: prefer_typing_uninitialized_variables
  var _loadDataFuture;

  ScrollController scrollController = ScrollController();
  GlobalKey<State<Markdown>> _globalKey = GlobalKey();

  @override
  void initState() {
    super.initState();
    if (widget.from == DataFrom.string) {
      _loadDataFuture = loadDataFromString();
    } else if (widget.from == DataFrom.asset) {
      _loadDataFuture = loadDataFromAsset();
    } else if (widget.from == DataFrom.net) {
      _loadDataFuture = justAMoment();
    } else {}

    scrollController.addListener(() {
      print("maxScrollExtent:" +
          scrollController.position.maxScrollExtent.toString());
      print("offset:" + scrollController.offset.toString());
    });

    WidgetsBinding.instance!.addPostFrameCallback((timeStamp) {
      print(CommonUtils.screenH());
      print(context.size?.height);
    });
  }

  justAMoment() async {
    await Future.delayed(const Duration(milliseconds: 1));
  }

  loadDataFromAsset() async {
    var _data = await rootBundle.loadString(widget.mdData!);
    setState(() {
      markdownData = _data;
    });
  }

  loadDataFromString() async {
    await Future.delayed(const Duration(milliseconds: 1)).then((value) {
      if (widget.mdData != null) {
        setState(() {
          markdownData = widget.mdData!;
        });
      } else {
        setState(() {
          markdownData = FlutterI18n.translate(context, "label.errorMdStr");
        });
      }
    });
  }

  @override
  void dispose() {
    scrollController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: null,
      // ignore: avoid_unnecessary_containers
      body: FutureBuilder(
        future: _loadDataFuture,
        builder: (context, snap) {
          if (snap.connectionState == ConnectionState.done) {
            if (widget.from != DataFrom.net) {
              return Markdown(
                key: _globalKey,
                controller: scrollController,
                data: markdownData,
                onTapLink: (text, href, title) async {
                  if (await canLaunch(href!)) {
                    await launch(href);
                  } else {
                    showToastMessage(
                        FlutterI18n.translate(context, "label.cannotLaunch"),
                        context);
                  }
                },
              );
            } else {
              return TextButton(
                  onPressed: () async {
                    if (await canLaunch(widget.mdData!)) {
                      await launch(widget.mdData!);
                    } else {
                      showToastMessage(
                          FlutterI18n.translate(context, "label.cannotLaunch"),
                          context);
                    }
                  },
                  child: Text(
                      FlutterI18n.translate(context, "label.clickToLaunch")));
            }
          } else {
            return Center(
              child: Text(FlutterI18n.translate(context, "label.loadingStr")),
            );
          }
        },
      ),
    );
  }
}
```
</details> 

I add a listener in scrollercontroller to get the maxScrollExtent,but the result is not  fixed.

![code_find_05](https://user-images.githubusercontent.com/33513462/154824662-f03376ce-ae97-4442-a6da-536a7f413b4d.gif)