Skip to content

Commit

Permalink
修改演示代码展示高度
Browse files Browse the repository at this point in the history
  • Loading branch information
Luozf12345 committed Jan 31, 2023
1 parent 00fae22 commit 5a6133d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion example/lib/base/example_widget.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:math';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
Expand Down Expand Up @@ -372,6 +374,11 @@ class _CodeWrapperState extends State<CodeWrapper> {
child: const TDText('暂无演示代码'),
);
}


var lines = codeString.split('\n');
print('lines: ${lines.length}');
double height = max(300, lines.length * 17 + 32);
var mdText = '''
```dart
${codeString}
Expand All @@ -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,
Expand Down

0 comments on commit 5a6133d

Please sign in to comment.