Skip to content

Commit 865d5d3

Browse files
committed
update example
1 parent 2665dcb commit 865d5d3

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

example/code.dart

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter/services.dart';
33
import 'package:flutter_constraintlayout/flutter_constraintlayout.dart';
4+
import 'package:flutter_markdown/flutter_markdown.dart';
45

56
import 'custom_app_bar.dart';
67

@@ -42,37 +43,36 @@ class CodeViewState extends State<CodeViewWidget> {
4243
Widget build(BuildContext context) {
4344
return Scaffold(
4445
appBar: const CustomAppBar(),
45-
body: ConstraintLayout(
46-
children: [
47-
if (loading)
48-
const CircularProgressIndicator().applyConstraint(
49-
size: 30,
50-
centerTo: parent,
51-
),
52-
if (!loading && code == null)
53-
const Text('Code loading failed').applyConstraint(
54-
centerTo: parent,
55-
),
56-
if (code != null)
57-
SingleChildScrollView(
58-
child: Padding(
59-
child: Text(
60-
code ?? '',
61-
style: const TextStyle(
62-
color: Colors.black,
63-
fontSize: 16,
64-
),
65-
),
66-
padding: const EdgeInsets.only(
67-
left: 20,
68-
top: 20,
46+
body: ConstraintLayout().open(() {
47+
if (loading) {
48+
const CircularProgressIndicator().applyConstraint(
49+
size: 30,
50+
centerTo: parent,
51+
);
52+
} else if (code == null) {
53+
const Text('Code loading failed').applyConstraint(
54+
centerTo: parent,
55+
);
56+
} else {
57+
SingleChildScrollView(
58+
child: Padding(
59+
child: Text(
60+
code ?? '',
61+
style: const TextStyle(
62+
color: Colors.black,
63+
fontSize: 16,
6964
),
7065
),
71-
).applyConstraint(
72-
size: matchParent,
73-
)
74-
],
75-
),
66+
padding: const EdgeInsets.only(
67+
left: 20,
68+
top: 20,
69+
),
70+
),
71+
).applyConstraint(
72+
size: matchParent,
73+
);
74+
}
75+
}),
7676
);
7777
}
7878
}

0 commit comments

Comments
 (0)