Skip to content

Commit

Permalink
Remove non-migrated examples, replace with null_safety_examples (#5986)
Browse files Browse the repository at this point in the history
* Cleared up last use of old examples

* Adding integration_test to null safety examples

* Renamed null_safety_examples

* Partially refreshed.

* Correcting shell script syntax
  • Loading branch information
RedBrogdon committed Jul 7, 2021
1 parent 87d6e40 commit 443f839
Show file tree
Hide file tree
Showing 621 changed files with 334 additions and 7,352 deletions.
1 change: 0 additions & 1 deletion build.excerpt.yaml
Expand Up @@ -3,7 +3,6 @@ targets:
sources:
include:
- examples/**
- null_safety_examples/**
# Some default includes that aren't really used here but will prevent
# false-negative warnings:
- $package$
Expand Down
4 changes: 2 additions & 2 deletions examples/README.md
@@ -1,8 +1,8 @@
# Flutter example apps
# Flutter null safety example apps

To analyze, test and run individual apps, execute the following commands from
the repo root (`$PROJECT` represents the app project path, such as
`examples/layout/lakes/step6`):
`null_safety_examples/layout/lakes/step6`):

1. `flutter create --no-overwrite $PROJECT`
2. `cd $PROJECT`
Expand Down
2 changes: 1 addition & 1 deletion examples/_animation/basic_hero_animation/pubspec.yaml
Expand Up @@ -2,7 +2,7 @@ name: basic_hero_transition
description: Shows how to create a simple or Hero animation using the Hero class directly.

environment:
sdk: '>=2.10.0 <3.0.0'
sdk: '>=2.12.0 <3.0.0'

dependencies:
flutter:
Expand Down
16 changes: 8 additions & 8 deletions examples/_animation/basic_radial_hero_animation/main.dart
Expand Up @@ -11,11 +11,11 @@ import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart' show timeDilation;

class Photo extends StatelessWidget {
Photo({ Key key, this.photo, this.color, this.onTap }) : super(key: key);
Photo({ Key? key, required this.photo, this.color, this.onTap }) : super(key: key);

final String photo;
final Color color;
final VoidCallback onTap;
final Color? color;
final VoidCallback? onTap;

Widget build(BuildContext context) {
return Material(
Expand All @@ -35,15 +35,15 @@ class Photo extends StatelessWidget {

class RadialExpansion extends StatelessWidget {
RadialExpansion({
Key key,
this.maxRadius,
Key? key,
required this.maxRadius,
this.child,
}) : clipRectExtent = 2.0 * (maxRadius / math.sqrt2),
super(key: key);

final double maxRadius;
final clipRectExtent;
final Widget child;
final Widget? child;

@override
Widget build(BuildContext context) {
Expand All @@ -69,7 +69,7 @@ class RadialExpansionDemo extends StatelessWidget {
static const double kMaxRadius = 128.0;
static const opacityCurve = const Interval(0.0, 0.75, curve: Curves.fastOutSlowIn);

static RectTween _createRectTween(Rect begin, Rect end) {
static RectTween _createRectTween(Rect? begin, Rect? end) {
return MaterialRectCenterArcTween(begin: begin, end: end);
}

Expand Down Expand Up @@ -114,7 +114,7 @@ class RadialExpansionDemo extends StatelessWidget {
pageBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation) {
return AnimatedBuilder(
animation: animation,
builder: (BuildContext context, Widget child) {
builder: (BuildContext context, Widget? child) {
return Opacity(
opacity: opacityCurve.transform(animation.value),
child: _buildPage(context, imageName, description),
Expand Down
Expand Up @@ -2,7 +2,7 @@ name: basic_radial_hero_transition
description: Shows how to apply a radial transformation to the Hero as it animates to the new route.

environment:
sdk: '>=2.10.0 <3.0.0'
sdk: '>=2.12.0 <3.0.0'

dependencies:
flutter:
Expand Down
10 changes: 5 additions & 5 deletions examples/_animation/basic_staggered_animation/main.dart
Expand Up @@ -8,7 +8,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart' show timeDilation;

class StaggerAnimation extends StatelessWidget {
StaggerAnimation({ Key key, this.controller }) :
StaggerAnimation({ Key? key, required this.controller }) :

// Each animation defined here transforms its value during the subset
// of the controller's duration defined by the animation's interval.
Expand Down Expand Up @@ -101,12 +101,12 @@ class StaggerAnimation extends StatelessWidget {
final Animation<double> height;
final Animation<EdgeInsets> padding;
final Animation<BorderRadius> borderRadius;
final Animation<Color> color;
final Animation<Color?> color;

// This function is called each time the controller "ticks" a new frame.
// When it runs, all of the animation's values will have been
// updated to reflect the controller's current value.
Widget _buildAnimation(BuildContext context, Widget child) {
Widget _buildAnimation(BuildContext context, Widget? child) {
return Container(
padding: padding.value,
alignment: Alignment.bottomCenter,
Expand All @@ -118,7 +118,7 @@ class StaggerAnimation extends StatelessWidget {
decoration: BoxDecoration(
color: color.value,
border: Border.all(
color: Colors.indigo[300],
color: Colors.indigo[300]!,
width: 3.0,
),
borderRadius: borderRadius.value,
Expand All @@ -143,7 +143,7 @@ class StaggerDemo extends StatefulWidget {
}

class _StaggerDemoState extends State<StaggerDemo> with TickerProviderStateMixin {
AnimationController _controller;
late AnimationController _controller;

@override
void initState() {
Expand Down
2 changes: 1 addition & 1 deletion examples/_animation/basic_staggered_animation/pubspec.yaml
Expand Up @@ -2,7 +2,7 @@ name: basic_staggered
description: A new Flutter project.

environment:
sdk: '>=2.10.0 <3.0.0'
sdk: '>=2.12.0 <3.0.0'

dependencies:
flutter:
Expand Down
9 changes: 7 additions & 2 deletions examples/_animation/hero_animation/main.dart
Expand Up @@ -12,10 +12,15 @@ import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart' show timeDilation;

class PhotoHero extends StatelessWidget {
const PhotoHero({ Key key, this.photo, this.onTap, this.width }) : super(key: key);
const PhotoHero({
Key? key,
required this.photo,
this.onTap,
required this.width,
}) : super(key: key);

final String photo;
final VoidCallback onTap;
final VoidCallback? onTap;
final double width;

Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion examples/_animation/hero_animation/pubspec.yaml
Expand Up @@ -2,7 +2,7 @@ name: hero_animation
description: Shows how to create a simple Hero transition.

environment:
sdk: '>=2.10.0 <3.0.0'
sdk: '>=2.12.0 <3.0.0'

dependencies:
flutter:
Expand Down
15 changes: 7 additions & 8 deletions examples/_animation/radial_hero_animation/main.dart
Expand Up @@ -16,11 +16,10 @@ import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart' show timeDilation;

class Photo extends StatelessWidget {
Photo({ Key key, this.photo, this.color, this.onTap }) : super(key: key);
Photo({ Key? key, required this.photo, this.onTap }) : super(key: key);

final String photo;
final Color color;
final VoidCallback onTap;
final VoidCallback? onTap;

Widget build(BuildContext context) {
return Material(
Expand All @@ -43,15 +42,15 @@ class Photo extends StatelessWidget {

class RadialExpansion extends StatelessWidget {
RadialExpansion({
Key key,
this.maxRadius,
Key? key,
required this.maxRadius,
this.child,
}) : clipRectSize = 2.0 * (maxRadius / math.sqrt2),
super(key: key);

final double maxRadius;
final clipRectSize;
final Widget child;
final Widget? child;

@override
Widget build(BuildContext context) {
Expand All @@ -74,7 +73,7 @@ class RadialExpansionDemo extends StatelessWidget {
static const double kMaxRadius = 128.0;
static const opacityCurve = const Interval(0.0, 0.75, curve: Curves.fastOutSlowIn);

static RectTween _createRectTween(Rect begin, Rect end) {
static RectTween _createRectTween(Rect? begin, Rect? end) {
return MaterialRectCenterArcTween(begin: begin, end: end);
}

Expand Down Expand Up @@ -134,7 +133,7 @@ class RadialExpansionDemo extends StatelessWidget {
pageBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation) {
return AnimatedBuilder(
animation: animation,
builder: (BuildContext context, Widget child) {
builder: (BuildContext context, Widget? child) {
return Opacity(
opacity: opacityCurve.transform(animation.value),
child: _buildPage(context, imageName, description),
Expand Down
2 changes: 1 addition & 1 deletion examples/_animation/radial_hero_animation/pubspec.yaml
Expand Up @@ -2,7 +2,7 @@ name: radial_hero_animation
description: Shows how to apply a radial transformation to the Hero as it animates to the new route.

environment:
sdk: '>=2.10.0 <3.0.0'
sdk: '>=2.12.0 <3.0.0'

dependencies:
flutter:
Expand Down
Expand Up @@ -17,11 +17,10 @@ import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart' show timeDilation;

class Photo extends StatelessWidget {
Photo({ Key key, this.photo, this.color, this.onTap }) : super(key: key);
Photo({ Key? key, required this.photo, this.onTap }) : super(key: key);

final String photo;
final Color color;
final VoidCallback onTap;
final VoidCallback? onTap;

Widget build(BuildContext context) {
return Material(
Expand All @@ -44,9 +43,9 @@ class Photo extends StatelessWidget {

class RadialExpansion extends StatelessWidget {
RadialExpansion({
Key key,
this.minRadius,
this.maxRadius,
Key? key,
required this.minRadius,
required this.maxRadius,
this.child,
}) : clipTween = Tween<double>(
begin: 2.0 * minRadius,
Expand All @@ -57,7 +56,7 @@ class RadialExpansion extends StatelessWidget {
final double minRadius;
final double maxRadius;
final Tween<double> clipTween;
final Widget child;
final Widget? child;

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -86,7 +85,7 @@ class RadialExpansionDemo extends StatelessWidget {
static const double kMaxRadius = 128.0;
static const opacityCurve = const Interval(0.0, 0.75, curve: Curves.fastOutSlowIn);

static RectTween _createRectTween(Rect begin, Rect end) {
static RectTween _createRectTween(Rect? begin, Rect? end) {
return MaterialRectCenterArcTween(begin: begin, end: end);
}

Expand Down Expand Up @@ -148,7 +147,7 @@ class RadialExpansionDemo extends StatelessWidget {
pageBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation) {
return AnimatedBuilder(
animation: animation,
builder: (BuildContext context, Widget child) {
builder: (BuildContext context, Widget? child) {
return Opacity(
opacity: opacityCurve.transform(animation.value),
child: _buildPage(context, imageName, description),
Expand Down
Expand Up @@ -2,7 +2,7 @@ name: radial_hero_animation_animate_rectclip
description: Shows how to apply a radial transformation to the Hero as it animates to the new route.

environment:
sdk: '>=2.10.0 <3.0.0'
sdk: '>=2.12.0 <3.0.0'

dependencies:
flutter:
Expand Down
42 changes: 21 additions & 21 deletions examples/_animation/staggered_pic_selection/main.dart
Expand Up @@ -53,7 +53,7 @@ final List<List<PhotoFrame>> photoBlockFrames = [
];

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

@override
Widget build(BuildContext context) {
Expand All @@ -73,16 +73,16 @@ class PhotoCheck extends StatelessWidget {

class PhotoItem extends StatefulWidget {
PhotoItem({
Key key,
this.photo,
Key? key,
required this.photo,
this.color,
this.onTap,
this.selected,
required this.selected,
}) : super(key: key);

final Photo photo;
final Color color;
final VoidCallback onTap;
final Color? color;
final VoidCallback? onTap;
final bool selected;

@override
Expand All @@ -91,19 +91,19 @@ class PhotoItem extends StatefulWidget {

class _PhotoItemState extends State<PhotoItem> with TickerProviderStateMixin {

AnimationController _selectController;
Animation<double> _stackScaleAnimation;
Animation<RelativeRect> _imagePositionAnimation;
Animation<double> _checkScaleAnimation;
Animation<double> _checkSelectedOpacityAnimation;
late AnimationController _selectController;
late Animation<double> _stackScaleAnimation;
late Animation<RelativeRect> _imagePositionAnimation;
late Animation<double> _checkScaleAnimation;
late Animation<double> _checkSelectedOpacityAnimation;

AnimationController _replaceController;
Animation<Offset> _replaceNewPhotoAnimation;
Animation<Offset> _replaceOldPhotoAnimation;
Animation<double> _removeCheckAnimation;
late AnimationController _replaceController;
late Animation<Offset> _replaceNewPhotoAnimation;
late Animation<Offset> _replaceOldPhotoAnimation;
late Animation<double> _removeCheckAnimation;

Photo _oldPhoto;
Photo _newPhoto; // non-null during a remove animation
late Photo _oldPhoto;
Photo? _newPhoto; // non-null during a remove animation

@override
void initState() {
Expand Down Expand Up @@ -259,7 +259,7 @@ class _PhotoItemState extends State<PhotoItem> with TickerProviderStateMixin {
child: SlideTransition(
position: _replaceNewPhotoAnimation,
child: _newPhoto == null ? null : Image.asset(
_newPhoto.asset,
_newPhoto!.asset,
fit: BoxFit.cover,
),
),
Expand All @@ -278,7 +278,7 @@ class ImagesDemo extends StatefulWidget {
class _ImagesDemoState extends State<ImagesDemo> with SingleTickerProviderStateMixin {
static const double _photoBlockHeight = 576.0;

int _selectedPhotoIndex;
int? _selectedPhotoIndex;

void _selectPhoto(int photoIndex) {
setState(() {
Expand All @@ -290,7 +290,7 @@ class _ImagesDemoState extends State<ImagesDemo> with SingleTickerProviderStateM
if (_selectedPhotoIndex == null)
return;
setState(() {
allPhotos.removeAt(_selectedPhotoIndex);
allPhotos.removeAt(_selectedPhotoIndex!);
_selectedPhotoIndex = null;
});
}
Expand All @@ -299,7 +299,7 @@ class _ImagesDemoState extends State<ImagesDemo> with SingleTickerProviderStateM
final List<Widget> rows = [];

int startPhotoIndex = blockIndex * blockFrameCount;
final Color photoColor = Colors.grey[500];
final Color photoColor = Colors.grey[500]!;
for (int rowIndex = 0; rowIndex < photoBlockFrames.length; rowIndex += 1) {
final List<Widget> rowChildren = [];
final int rowLength = photoBlockFrames[rowIndex].length;
Expand Down
2 changes: 1 addition & 1 deletion examples/_animation/staggered_pic_selection/pubspec.yaml
Expand Up @@ -2,7 +2,7 @@ name: staggered_pic_selection
description: A new Flutter project.

environment:
sdk: '>=2.10.0 <3.0.0'
sdk: '>=2.12.0 <3.0.0'

dependencies:
flutter:
Expand Down

0 comments on commit 443f839

Please sign in to comment.