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

Update ex9-4.md #51

Merged
merged 1 commit into from
Dec 16, 2022
Merged
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
48 changes: 24 additions & 24 deletions ch09/ex9-4.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,46 @@
```dart
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);

static const String _title = 'Example';

@override
Widget build(BuildContext context) {
return const MaterialApp(
title: _title,
home: MyStatelessWidget(),
const title = 'Expanded Widget';
return MaterialApp(
title: title,
home: Scaffold(
appBar: AppBar(
title: const Text(title),
),
body: const MyExpandedWidget(),
),
);
}
}

class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);

class MyExpandedWidget extends StatelessWidget {
const MyExpandedWidget();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Placeholder Example')),
body: _buildPlaceholderWidget(),
);
}

Widget _buildPlaceholderWidget() {
return Column(
children: const <Widget> [
Placeholder(fallbackHeight: 400, strokeWidth: 10, color: Colors.red),
children: const [
Expanded(
child: Placeholder(
fallbackHeight: 400, strokeWidth: 10, color: Colors.red),
),
Expanded(
child: Text("Expanded Text")
child: Placeholder(
fallbackHeight: 400, strokeWidth: 10, color: Colors.white),
),
Placeholder(fallbackHeight: 200, strokeWidth: 5, color: Colors.green),
Expanded(
child: Text("Expanded Text")
child: Placeholder(
fallbackHeight: 400, strokeWidth: 10, color: Colors.blue),
),
Placeholder(fallbackHeight: 100, strokeWidth: 1, color: Colors.blue),
]
],
);
}
}
Expand Down