Skip to content

Commit d646d2a

Browse files
committed
Layout row app + tests
Contributes to #2233
1 parent ba7574d commit d646d2a

File tree

7 files changed

+91
-0
lines changed

7 files changed

+91
-0
lines changed

examples/layout/row/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../README.md

examples/layout/row/images/pic1.jpg

9.18 KB
Loading

examples/layout/row/images/pic2.jpg

16.3 KB
Loading

examples/layout/row/images/pic3.jpg

13.3 KB
Loading

examples/layout/row/lib/main.dart

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:flutter/rendering.dart' show debugPaintSizeEnabled;
3+
4+
void main() {
5+
debugPaintSizeEnabled = true; // Remove to suppress visual layout
6+
runApp(MyApp());
7+
}
8+
9+
// #docregion MyApp
10+
class MyApp extends StatelessWidget {
11+
@override
12+
Widget build(BuildContext context) {
13+
return MaterialApp(
14+
title: 'Flutter layout demo',
15+
home: MyHomePage(title: 'Flutter layout demo'),
16+
);
17+
}
18+
}
19+
20+
class MyHomePage extends StatefulWidget {
21+
MyHomePage({Key key, this.title}) : super(key: key);
22+
23+
final String title;
24+
25+
@override
26+
_MyHomePageState createState() => _MyHomePageState();
27+
}
28+
29+
class _MyHomePageState extends State<MyHomePage> {
30+
@override
31+
Widget build(BuildContext context) {
32+
return Scaffold(
33+
appBar: AppBar(
34+
title: Text(widget.title),
35+
),
36+
body: Center(
37+
child: Row(
38+
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
39+
children: [
40+
Image.asset('images/pic1.jpg'),
41+
Image.asset('images/pic2.jpg'),
42+
Image.asset('images/pic3.jpg'),
43+
],
44+
),
45+
),
46+
);
47+
}
48+
}

examples/layout/row/pubspec.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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
20+
assets:
21+
- images/pic1.jpg
22+
- images/pic2.jpg
23+
- images/pic3.jpg
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// This is a basic Flutter widget test.
2+
//
3+
// To perform an interaction with a widget in your test, use the WidgetTester
4+
// utility that Flutter provides. For example, you can send tap and scroll
5+
// gestures. You can also use WidgetTester to find child widgets in the widget
6+
// tree, read text, and verify that the values of widget properties are correct.
7+
8+
import 'package:flutter_test/flutter_test.dart';
9+
10+
import 'package:layout/main.dart';
11+
12+
void main() {
13+
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
14+
// Build our app and trigger a frame.
15+
await tester.pumpWidget(MyApp());
16+
17+
expect(find.text('Flutter layout demo'), findsOneWidget);
18+
});
19+
}

0 commit comments

Comments
 (0)