Skip to content

Rework of "Lay out a widget" + use of code-excerpts #2235

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 23, 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
5 changes: 5 additions & 0 deletions examples/layout/base/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';

void main() => runApp(MyApp());

// #docregion MyApp
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
Expand All @@ -11,9 +12,13 @@ class MyApp extends StatelessWidget {
appBar: AppBar(
title: Text('Flutter layout demo'),
),
// #docregion centered-text
body: Center(
// #docregion text
child: Text('Hello World'),
// #enddocregion text
),
// #enddocregion centered-text
),
);
}
Expand Down
4 changes: 4 additions & 0 deletions examples/layout/lakes/step5/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ class MyApp extends StatelessWidget {
),
),
/*3*/
// #docregion Icon
Icon(
Icons.star,
color: Colors.red[500],
),
// #enddocregion Icon
Text('41'),
],
),
Expand Down Expand Up @@ -79,12 +81,14 @@ class MyApp extends StatelessWidget {
),
body: Column(
children: [
// #docregion Image-asset
Image.asset(
'images/lake.jpg',
width: 600.0,
height: 240.0,
fit: BoxFit.cover,
),
// #enddocregion Image-asset
titleSection,
buttonSection,
textSection,
Expand Down
1 change: 1 addition & 0 deletions examples/layout/non_material/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// This app doesn't use any material widgets, such as Scaffold.
// This app doesn't use any Material widgets, such as Scaffold.
// Normally, an app that doesn't use Scaffold has a black background
// and the default text color is black. This app changes its background
// to white and its text color to dark grey to mimic a material app.

import 'package:flutter/material.dart';

void main() {
runApp(MyApp());
}
void main() => runApp(MyApp());

// #docregion MyApp
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(color: Colors.white),
child: Center(
child: Text('Hello World',
textDirection: TextDirection.ltr,
style: TextStyle(fontSize: 40.0, color: Colors.black87)),
child: Text(
'Hello World',
textDirection: TextDirection.ltr,
style: TextStyle(
fontSize: 32.0,
color: Colors.black87,
),
),
),
);
}
Expand Down
19 changes: 19 additions & 0 deletions examples/layout/non_material/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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
12 changes: 12 additions & 0 deletions examples/layout/non_material/test/widget_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Basic Flutter widget test. Learn more at https://flutter.io/docs/testing.

import 'package:flutter_test/flutter_test.dart';

import 'package:layout/main.dart';

void main() {
testWidgets('Codelab smoke test', (WidgetTester tester) async {
await tester.pumpWidget(new MyApp());
expect(find.text('Hello World'), findsOneWidget);
});
}
9 changes: 0 additions & 9 deletions src/_includes/code/layout/widgets-only/.gitignore

This file was deleted.

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

This file was deleted.

Loading