Skip to content

Layout row app + tests #2294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/layout/row/README.md
Binary file added examples/layout/row/images/pic1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/layout/row/images/pic2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/layout/row/images/pic3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions examples/layout/row/lib/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart' show debugPaintSizeEnabled;

void main() {
debugPaintSizeEnabled = true; // Remove to suppress visual layout
runApp(MyApp());
}

// #docregion MyApp
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter layout demo',
home: MyHomePage(title: 'Flutter layout demo'),
);
}
}

class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);

final String title;

@override
_MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Image.asset('images/pic1.jpg'),
Image.asset('images/pic2.jpg'),
Image.asset('images/pic3.jpg'),
],
),
),
);
}
}
23 changes: 23 additions & 0 deletions examples/layout/row/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: layout
description: >
Sample app from "Building Layouts", https://flutter.io/docs/development/ui/layout.
version: 1.0.0

environment:
sdk: '>=2.0.0-dev.68.0 <3.0.0'

dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2

dev_dependencies:
flutter_test:
sdk: flutter

flutter:
uses-material-design: true
assets:
- images/pic1.jpg
- images/pic2.jpg
- images/pic3.jpg
19 changes: 19 additions & 0 deletions examples/layout/row/test/widget_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.

import 'package:flutter_test/flutter_test.dart';

import 'package:layout/main.dart';

void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());

expect(find.text('Flutter layout demo'), findsOneWidget);
});
}