Skip to content

Commit

Permalink
Add OverflowBox example and update existing examples under `basic.d…
Browse files Browse the repository at this point in the history
…art` (#121213)

Add `OverflowBox` example and update existing examples under `basic.dart`
  • Loading branch information
TahaTesser authored Feb 27, 2023
1 parent 5c334d1 commit 9a4e897
Show file tree
Hide file tree
Showing 35 changed files with 811 additions and 287 deletions.
17 changes: 7 additions & 10 deletions examples/api/lib/widgets/basic/absorb_pointer.0.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,26 @@

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
const MyApp({super.key});

static const String _title = 'Flutter Code Sample';
class AbsorbPointerApp extends StatelessWidget {
const AbsorbPointerApp({super.key});

@override
Widget build(BuildContext context) {
return MaterialApp(
title: _title,
home: Scaffold(
appBar: AppBar(title: const Text(_title)),
appBar: AppBar(title: const Text('AbsorbPointer Sample')),
body: const Center(
child: MyStatelessWidget(),
child: AbsorbPointerExample(),
),
),
);
}
}

class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({super.key});
class AbsorbPointerExample extends StatelessWidget {
const AbsorbPointerExample({super.key});

@override
Widget build(BuildContext context) {
Expand Down
17 changes: 7 additions & 10 deletions examples/api/lib/widgets/basic/aspect_ratio.0.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,24 @@

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
const MyApp({super.key});

static const String _title = 'Flutter Code Sample';
class AspectRatioApp extends StatelessWidget {
const AspectRatioApp({super.key});

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

class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({super.key});
class AspectRatioExample extends StatelessWidget {
const AspectRatioExample({super.key});

@override
Widget build(BuildContext context) {
Expand Down
17 changes: 7 additions & 10 deletions examples/api/lib/widgets/basic/aspect_ratio.1.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,24 @@

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
const MyApp({super.key});

static const String _title = 'Flutter Code Sample';
class AspectRatioApp extends StatelessWidget {
const AspectRatioApp({super.key});

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

class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({super.key});
class AspectRatioExample extends StatelessWidget {
const AspectRatioExample({super.key});

@override
Widget build(BuildContext context) {
Expand Down
17 changes: 7 additions & 10 deletions examples/api/lib/widgets/basic/aspect_ratio.2.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,24 @@

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
const MyApp({super.key});

static const String _title = 'Flutter Code Sample';
class AspectRatioApp extends StatelessWidget {
const AspectRatioApp({super.key});

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

class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({super.key});
class AspectRatioExample extends StatelessWidget {
const AspectRatioExample({super.key});

@override
Widget build(BuildContext context) {
Expand Down
63 changes: 30 additions & 33 deletions examples/api/lib/widgets/basic/expanded.0.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,49 @@

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
const MyApp({super.key});

static const String _title = 'Flutter Code Sample';
class ExpandedApp extends StatelessWidget {
const ExpandedApp({super.key});

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

class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({super.key});
class ExpandedExample extends StatelessWidget {
const ExpandedExample({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Expanded Column Sample'),
),
body: Center(
child: Column(
children: <Widget>[
Container(
color: Colors.blue,
height: 100,
return Center(
child: Column(
children: <Widget>[
Container(
color: Colors.blue,
height: 100,
width: 100,
),
Expanded(
child: Container(
color: Colors.amber,
width: 100,
),
Expanded(
child: Container(
color: Colors.amber,
width: 100,
),
),
Container(
color: Colors.blue,
height: 100,
width: 100,
),
],
),
),
Container(
color: Colors.blue,
height: 100,
width: 100,
),
],
),
);
}
Expand Down
65 changes: 31 additions & 34 deletions examples/api/lib/widgets/basic/expanded.1.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,51 @@

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
const MyApp({super.key});

static const String _title = 'Flutter Code Sample';
class ExpandedApp extends StatelessWidget {
const ExpandedApp({super.key});

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

class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({super.key});
class ExpandedExample extends StatelessWidget {
const ExpandedExample({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Expanded Row Sample'),
),
body: Center(
child: Row(
children: <Widget>[
Expanded(
flex: 2,
child: Container(
color: Colors.amber,
height: 100,
),
),
Container(
color: Colors.blue,
return Center(
child: Row(
children: <Widget>[
Expanded(
flex: 2,
child: Container(
color: Colors.amber,
height: 100,
width: 50,
),
Expanded(
child: Container(
color: Colors.amber,
height: 100,
),
),
Container(
color: Colors.blue,
height: 100,
width: 50,
),
Expanded(
child: Container(
color: Colors.amber,
height: 100,
),
],
),
),
],
),
);
}
Expand Down
20 changes: 9 additions & 11 deletions examples/api/lib/widgets/basic/fitted_box.0.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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',
),
),
);
}
Expand Down
17 changes: 7 additions & 10 deletions examples/api/lib/widgets/basic/fractionally_sized_box.0.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,24 @@

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
const MyApp({super.key});

static const String _title = 'Flutter Code Sample';
class FractionallySizedBoxApp extends StatelessWidget {
const FractionallySizedBoxApp({super.key});

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

class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({super.key});
class FractionallySizedBoxExample extends StatelessWidget {
const FractionallySizedBoxExample({super.key});

@override
Widget build(BuildContext context) {
Expand Down
Loading

0 comments on commit 9a4e897

Please sign in to comment.