Add OverflowBox example and update existing examples under basic.dart (#121213)
Add `OverflowBox` example and update existing examples under `basic.dart`
This commit is contained in:
@@ -6,29 +6,26 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main() => runApp(const MyApp());
|
||||
void main() => runApp(const FittedBoxApp());
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
|
||||
static const String _title = 'Flutter Code Sample';
|
||||
class FittedBoxApp extends StatelessWidget {
|
||||
const FittedBoxApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: _title,
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text(_title)),
|
||||
appBar: AppBar(title: const Text('FittedBox Sample')),
|
||||
body: const Center(
|
||||
child: MyStatelessWidget(),
|
||||
child: FittedBoxExample(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MyStatelessWidget extends StatelessWidget {
|
||||
const MyStatelessWidget({super.key});
|
||||
class FittedBoxExample extends StatelessWidget {
|
||||
const FittedBoxExample({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -39,7 +36,8 @@ class MyStatelessWidget extends StatelessWidget {
|
||||
child: FittedBox(
|
||||
fit: BoxFit.fill,
|
||||
child: Image.network(
|
||||
'https://flutter.github.io/assets-for-api-docs/assets/widgets/owl-2.jpg'),
|
||||
'https://flutter.github.io/assets-for-api-docs/assets/widgets/owl-2.jpg',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user