File tree Expand file tree Collapse file tree 2 files changed +52
-10
lines changed
src/content/get-started/fundamentals Expand file tree Collapse file tree 2 files changed +52
-10
lines changed Original file line number Diff line number Diff line change @@ -126,5 +126,55 @@ sitemap: false
126126<ProgressRing progress="0.3" large />
127127<ProgressRing progress="0.95" large />
128128
129+ ## Foldable Code Block
130+
131+ ```dart foldable showLineNumbers
132+ [* -
133+ import 'package:flutter/material.dart';
134+ import 'package:flutter/services.dart';
135+ *]
136+
137+ void main() => runApp(const MyApp());
138+
139+ class MyApp extends StatelessWidget {
140+ const MyApp({super.key});
141+
142+ @override
143+ Widget build(BuildContext context) {
144+ [* -
145+ return MaterialApp( // Root widget
146+ home: Scaffold(
147+ appBar: AppBar(
148+ title: const Text('My Home Page'),
149+ ),
150+ body: Center(
151+ [*
152+ child: Builder(
153+ builder: (context) {
154+ return Column(
155+ children: [
156+ const Text('Hello, World!'),
157+ [* -
158+ const SizedBox(height: 20),
159+ ElevatedButton(
160+ onPressed: () {
161+ print('Click!');
162+ },
163+ child: const Text('A button'),
164+ ),
165+ *]
166+ ],
167+ );
168+ },
169+ ),
170+ *]
171+ ),
172+ ),
173+ );
174+ *]
175+ }
176+ }
177+ ```
178+
129179''' ,
130180);
Original file line number Diff line number Diff line change @@ -38,11 +38,9 @@ can receive context from the parent.
3838This structure carries all the way up to the root
3939widget, as this trivial example shows:
4040
41- ``` dart foldable showLineNumbers
42- [* -
43- import 'package:flutter/material.dart';
41+ ``` dart
42+ import 'package:flutter/material.dart';
4443import 'package:flutter/services.dart';
45- *]
4644
4745void main() => runApp(const MyApp());
4846
@@ -51,37 +49,31 @@ class MyApp extends StatelessWidget {
5149
5250 @override
5351 Widget build(BuildContext context) {
54- [* -
5552 return MaterialApp( // Root widget
5653 home: Scaffold(
5754 appBar: AppBar(
5855 title: const Text('My Home Page'),
5956 ),
6057 body: Center(
61- [*
6258 child: Builder(
6359 builder: (context) {
6460 return Column(
6561 children: [
6662 const Text('Hello, World!'),
67- [* -
6863 const SizedBox(height: 20),
6964 ElevatedButton(
7065 onPressed: () {
7166 print('Click!');
7267 },
7368 child: const Text('A button'),
7469 ),
75- *]
7670 ],
7771 );
7872 },
7973 ),
80- *]
8174 ),
8275 ),
8376 );
84- *]
8577 }
8678}
8779```
You can’t perform that action at this time.
0 commit comments