Skip to content
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

Layout sizing example app #2301

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/sizing/README.md
72 changes: 72 additions & 0 deletions examples/layout/sizing/lib/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart' show debugPaintSizeEnabled;

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

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter layout demo',
home: Scaffold(
appBar: AppBar(
title: Text('Flutter layout demo'),
),
// Change to buildFoo() for the other examples
body: Center(child: buildExpandedImages()),
),
);
}

Widget buildOverflowingRow() =>
// #docregion overflowing-row
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Image.asset('images/pic1.jpg'),
Image.asset('images/pic2.jpg'),
Image.asset('images/pic3.jpg'),
],
);
// #enddocregion overflowing-row

Widget buildExpandedImages() =>
// #docregion expanded-images
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Image.asset('images/pic1.jpg'),
),
Expanded(
child: Image.asset('images/pic2.jpg'),
),
Expanded(
child: Image.asset('images/pic3.jpg'),
),
],
);
// #enddocregion expanded-images

Widget buildExpandedImagesWithFlex() =>
// #docregion expanded-images-with-flex
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Image.asset('images/pic1.jpg'),
),
Expanded(
flex: 2,
child: Image.asset('images/pic2.jpg'),
),
Expanded(
child: Image.asset('images/pic3.jpg'),
),
],
);
// #enddocregion expanded-images-with-flex
}
23 changes: 23 additions & 0 deletions examples/layout/sizing/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
20 changes: 20 additions & 0 deletions examples/layout/sizing/test/widget_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// 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);
// TODO: test more app features.
});
}
Binary file modified src/_assets/image/ui/layout/layout-too-large.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 0 additions & 45 deletions src/_includes/code/layout/hello-world/main.dart

This file was deleted.

9 changes: 0 additions & 9 deletions src/_includes/code/layout/hello-world/pubspec.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions src/_includes/code/layout/row-expanded-2/.gitignore

This file was deleted.

61 changes: 0 additions & 61 deletions src/_includes/code/layout/row-expanded-2/main.dart

This file was deleted.

13 changes: 0 additions & 13 deletions src/_includes/code/layout/row-expanded-2/pubspec.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions src/_includes/code/layout/row-expanded/.gitignore

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
62 changes: 0 additions & 62 deletions src/_includes/code/layout/row-expanded/main.dart

This file was deleted.

13 changes: 0 additions & 13 deletions src/_includes/code/layout/row-expanded/pubspec.yaml

This file was deleted.

Loading