File tree 10 files changed +184
-168
lines changed
_includes/code/layout/widgets-only
docs/development/ui/layout 10 files changed +184
-168
lines changed Original file line number Diff line number Diff line change 1
- ../../../ README.md
1
+ ../../README.md
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
2
2
3
3
void main () => runApp (MyApp ());
4
4
5
+ // #docregion MyApp
5
6
class MyApp extends StatelessWidget {
6
7
@override
7
8
Widget build (BuildContext context) {
@@ -11,9 +12,13 @@ class MyApp extends StatelessWidget {
11
12
appBar: AppBar (
12
13
title: Text ('Flutter layout demo' ),
13
14
),
15
+ // #docregion centered-text
14
16
body: Center (
17
+ // #docregion text
15
18
child: Text ('Hello World' ),
19
+ // #enddocregion text
16
20
),
21
+ // #enddocregion centered-text
17
22
),
18
23
);
19
24
}
Original file line number Diff line number Diff line change @@ -34,10 +34,12 @@ class MyApp extends StatelessWidget {
34
34
),
35
35
),
36
36
/*3*/
37
+ // #docregion Icon
37
38
Icon (
38
39
Icons .star,
39
40
color: Colors .red[500 ],
40
41
),
42
+ // #enddocregion Icon
41
43
Text ('41' ),
42
44
],
43
45
),
@@ -79,12 +81,14 @@ class MyApp extends StatelessWidget {
79
81
),
80
82
body: Column (
81
83
children: [
84
+ // #docregion Image-asset
82
85
Image .asset (
83
86
'images/lake.jpg' ,
84
87
width: 600.0 ,
85
88
height: 240.0 ,
86
89
fit: BoxFit .cover,
87
90
),
91
+ // #enddocregion Image-asset
88
92
titleSection,
89
93
buttonSection,
90
94
textSection,
Original file line number Diff line number Diff line change
1
+ ../../README.md
Original file line number Diff line number Diff line change 1
- // Copyright 2017 The Chromium Authors. All rights reserved.
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- // This app doesn't use any material widgets, such as Scaffold.
1
+ // This app doesn't use any Material widgets, such as Scaffold.
6
2
// Normally, an app that doesn't use Scaffold has a black background
7
3
// and the default text color is black. This app changes its background
8
4
// to white and its text color to dark grey to mimic a material app.
5
+
9
6
import 'package:flutter/material.dart' ;
10
7
11
- void main () {
12
- runApp (MyApp ());
13
- }
8
+ void main () => runApp (MyApp ());
14
9
10
+ // #docregion MyApp
15
11
class MyApp extends StatelessWidget {
16
12
@override
17
13
Widget build (BuildContext context) {
18
14
return Container (
19
15
decoration: BoxDecoration (color: Colors .white),
20
16
child: Center (
21
- child: Text ('Hello World' ,
22
- textDirection: TextDirection .ltr,
23
- style: TextStyle (fontSize: 40.0 , color: Colors .black87)),
17
+ child: Text (
18
+ 'Hello World' ,
19
+ textDirection: TextDirection .ltr,
20
+ style: TextStyle (
21
+ fontSize: 32.0 ,
22
+ color: Colors .black87,
23
+ ),
24
+ ),
24
25
),
25
26
);
26
27
}
Original file line number Diff line number Diff line change
1
+ name : layout
2
+ description : >
3
+ Sample app from "Building Layouts", https://flutter.io/docs/development/ui/layout.
4
+ version : 1.0.0
5
+
6
+ environment :
7
+ sdk : ' >=2.0.0-dev.68.0 <3.0.0'
8
+
9
+ dependencies :
10
+ flutter :
11
+ sdk : flutter
12
+ cupertino_icons : ^0.1.2
13
+
14
+ dev_dependencies :
15
+ flutter_test :
16
+ sdk : flutter
17
+
18
+ flutter :
19
+ uses-material-design : true
Original file line number Diff line number Diff line change
1
+ // Basic Flutter widget test. Learn more at https://flutter.io/docs/testing.
2
+
3
+ import 'package:flutter_test/flutter_test.dart' ;
4
+
5
+ import 'package:layout/main.dart' ;
6
+
7
+ void main () {
8
+ testWidgets ('Codelab smoke test' , (WidgetTester tester) async {
9
+ await tester.pumpWidget (new MyApp ());
10
+ expect (find.text ('Hello World' ), findsOneWidget);
11
+ });
12
+ }
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments