File tree Expand file tree Collapse file tree 1 file changed +29
-29
lines changed Expand file tree Collapse file tree 1 file changed +29
-29
lines changed Original file line number Diff line number Diff line change 11import 'package:flutter/material.dart' ;
22import 'package:flutter/services.dart' ;
33import 'package:flutter_constraintlayout/flutter_constraintlayout.dart' ;
4+ import 'package:flutter_markdown/flutter_markdown.dart' ;
45
56import '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}
You can’t perform that action at this time.
0 commit comments