From 5a6133dd51a5f84fe319e131fb8366c440c3e1c6 Mon Sep 17 00:00:00 2001 From: zflyluo Date: Tue, 31 Jan 2023 15:10:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=BC=94=E7=A4=BA=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=B1=95=E7=A4=BA=E9=AB=98=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/lib/base/example_widget.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/example/lib/base/example_widget.dart b/example/lib/base/example_widget.dart index 2bd6dfc4f..04f7b716c 100644 --- a/example/lib/base/example_widget.dart +++ b/example/lib/base/example_widget.dart @@ -1,3 +1,5 @@ +import 'dart:math'; + import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; @@ -372,6 +374,11 @@ class _CodeWrapperState extends State { child: const TDText('暂无演示代码'), ); } + + + var lines = codeString.split('\n'); + print('lines: ${lines.length}'); + double height = max(300, lines.length * 17 + 32); var mdText = ''' ```dart ${codeString} @@ -382,7 +389,7 @@ ${codeString} decoration: BoxDecoration( color: TDTheme.of(context).grayColor1, borderRadius: BorderRadius.vertical(top: Radius.circular(TDTheme.of(context).radiusDefault))), - height:700, + height:height, child: Markdown( physics: const BouncingScrollPhysics(), padding: EdgeInsets.zero,