Skip to content

Commit

Permalink
Samples maintenance (flutter#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
domesticmouse authored May 12, 2020
1 parent 941ebeb commit baa1f97
Show file tree
Hide file tree
Showing 94 changed files with 492 additions and 349 deletions.
8 changes: 4 additions & 4 deletions add_to_app/flutter_module/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ packages:
name: espresso
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1+4"
version: "0.0.1+5"
file:
dependency: transitive
description:
Expand Down Expand Up @@ -167,7 +167,7 @@ packages:
name: provider
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.5"
version: "4.1.0"
pub_semver:
dependency: transitive
description:
Expand Down Expand Up @@ -279,5 +279,5 @@ packages:
source: hosted
version: "3.6.1"
sdks:
dart: ">=2.6.0 <3.0.0"
flutter: ">=1.12.1 <2.0.0"
dart: ">=2.7.0 <3.0.0"
flutter: ">=1.17.0 <2.0.0"
26 changes: 20 additions & 6 deletions add_to_app/flutter_module_using_plugin/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.12"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.1+1"
matcher:
dependency: transitive
description:
Expand All @@ -93,6 +100,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.8"
nested:
dependency: transitive
description:
name: nested
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.4"
path:
dependency: transitive
description:
Expand Down Expand Up @@ -120,7 +134,7 @@ packages:
name: provider
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.0"
version: "4.1.0"
quiver:
dependency: transitive
description:
Expand Down Expand Up @@ -188,14 +202,14 @@ packages:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "5.4.2"
version: "5.4.5"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1+4"
version: "0.0.1+5"
url_launcher_platform_interface:
dependency: transitive
description:
Expand All @@ -209,7 +223,7 @@ packages:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.1+1"
version: "0.1.1+4"
vector_math:
dependency: transitive
description:
Expand All @@ -225,5 +239,5 @@ packages:
source: hosted
version: "3.6.1"
sdks:
dart: ">=2.6.0 <3.0.0"
flutter: ">=1.12.8 <2.0.0"
dart: ">=2.7.0 <3.0.0"
flutter: ">=1.17.0 <2.0.0"
2 changes: 1 addition & 1 deletion add_to_app/flutter_module_using_plugin/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ environment:
dependencies:
flutter:
sdk: flutter
provider: ^3.1.0
provider: ^4.1.0
url_launcher: ^5.2.5

dev_dependencies:
Expand Down
2 changes: 1 addition & 1 deletion animations/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include: package:pedantic/analysis_options.1.8.0.yaml
include: package:pedantic/analysis_options.1.9.0.yaml

analyzer:
strong-mode:
Expand Down
3 changes: 3 additions & 0 deletions animations/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ final allRoutes = <String, WidgetBuilder>{
};

class AnimationSamples extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Animation Samples',
Expand All @@ -141,6 +142,7 @@ class AnimationSamples extends StatelessWidget {
}

class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final headerStyle = Theme.of(context).textTheme.headline6;
return Scaffold(
Expand All @@ -164,6 +166,7 @@ class DemoTile extends StatelessWidget {

DemoTile(this.demo);

@override
Widget build(BuildContext context) {
return ListTile(
title: Text(demo.name),
Expand Down
3 changes: 3 additions & 0 deletions animations/lib/src/basics/01_animated_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Color generateColor() => Color(0xFFFFFFFF & Random().nextInt(0xFFFFFFFF));
class AnimatedContainerDemo extends StatefulWidget {
static String routeName = '/basics/01_animated_container';

@override
_AnimatedContainerDemoState createState() => _AnimatedContainerDemoState();
}

Expand All @@ -21,6 +22,7 @@ class _AnimatedContainerDemoState extends State<AnimatedContainerDemo> {
double borderRadius;
double margin;

@override
void initState() {
super.initState();
color = Colors.deepPurple;
Expand All @@ -36,6 +38,7 @@ class _AnimatedContainerDemoState extends State<AnimatedContainerDemo> {
});
}

@override
Widget build(BuildContext context) {
// This widget is built using an AnimatedContainer, one of the easiest to use
// animated Widgets. Whenever the AnimatedContainer's properties, such as decoration,
Expand Down
2 changes: 2 additions & 0 deletions animations/lib/src/basics/02_page_route_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
class PageRouteBuilderDemo extends StatelessWidget {
static const String routeName = '/basics/page_route_builder';

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
Expand Down Expand Up @@ -38,6 +39,7 @@ Route _createRoute() {
}

class _Page2 extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
Expand Down
4 changes: 4 additions & 0 deletions animations/lib/src/basics/04_tweens.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
class TweenDemo extends StatefulWidget {
static const String routeName = '/basics/tweens';

@override
_TweenDemoState createState() => _TweenDemoState();
}

Expand All @@ -17,6 +18,7 @@ class _TweenDemoState extends State<TweenDemo>
AnimationController controller;
Animation<double> animation;

@override
void initState() {
super.initState();

Expand All @@ -28,11 +30,13 @@ class _TweenDemoState extends State<TweenDemo>
animation = Tween(begin: 0.0, end: accountBalance).animate(controller);
}

@override
void dispose() {
controller.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
Expand Down
4 changes: 4 additions & 0 deletions animations/lib/src/basics/05_animated_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
class AnimatedBuilderDemo extends StatefulWidget {
static const String routeName = '/basics/animated_builder';

@override
_AnimatedBuilderDemoState createState() => _AnimatedBuilderDemoState();
}

Expand All @@ -18,6 +19,7 @@ class _AnimatedBuilderDemoState extends State<AnimatedBuilderDemo>
AnimationController controller;
Animation<Color> animation;

@override
void initState() {
super.initState();

Expand All @@ -26,11 +28,13 @@ class _AnimatedBuilderDemoState extends State<AnimatedBuilderDemo>
ColorTween(begin: beginColor, end: endColor).animate(controller);
}

@override
void dispose() {
controller.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
Expand Down
5 changes: 5 additions & 0 deletions animations/lib/src/basics/06_custom_tween.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class TypewriterTween extends Tween<String> {
TypewriterTween({String begin = '', String end})
: super(begin: begin, end: end);

@override
String lerp(double t) {
var cutoff = (end.length * t).round();
return end.substring(0, cutoff);
Expand All @@ -17,6 +18,7 @@ class TypewriterTween extends Tween<String> {
class CustomTweenDemo extends StatefulWidget {
static const String routeName = '/basics/custom_tweens';

@override
_CustomTweenDemoState createState() => _CustomTweenDemoState();
}

Expand All @@ -27,18 +29,21 @@ class _CustomTweenDemoState extends State<CustomTweenDemo>
AnimationController controller;
Animation<String> animation;

@override
void initState() {
super.initState();

controller = AnimationController(vsync: this, duration: _duration);
animation = TypewriterTween(end: message).animate(controller);
}

@override
void dispose() {
controller.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
Expand Down
2 changes: 2 additions & 0 deletions animations/lib/src/basics/07_tween_sequence.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class _TweenSequenceDemoState extends State<TweenSequenceDemo>
Colors.purple,
];

@override
void initState() {
super.initState();

Expand All @@ -49,6 +50,7 @@ class _TweenSequenceDemoState extends State<TweenSequenceDemo>
animation = TweenSequence<Color>(sequenceItems).animate(controller);
}

@override
void dispose() {
controller.dispose();
super.dispose();
Expand Down
25 changes: 13 additions & 12 deletions animations/lib/src/misc/animated_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:flutter/widgets.dart';
class AnimatedListDemo extends StatefulWidget {
static String routeName = '/misc/animated_list';

@override
_AnimatedListDemoState createState() => _AnimatedListDemoState();
}

Expand All @@ -17,9 +18,9 @@ class _AnimatedListDemoState extends State<AnimatedListDemo> {

void addUser() {
setState(() {
int index = listData.length;
var index = listData.length;
listData.add(
UserModel(firstName: "New", lastName: "Person"),
UserModel(firstName: 'New', lastName: 'Person'),
);
_listKey.currentState
.insertItem(index, duration: Duration(milliseconds: 300));
Expand Down Expand Up @@ -96,23 +97,23 @@ class UserModel {

List<UserModel> initialListData = [
UserModel(
firstName: "Govind",
lastName: "Dixit",
firstName: 'Govind',
lastName: 'Dixit',
),
UserModel(
firstName: "Greta",
lastName: "Stoll",
firstName: 'Greta',
lastName: 'Stoll',
),
UserModel(
firstName: "Monty",
lastName: "Carlo",
firstName: 'Monty',
lastName: 'Carlo',
),
UserModel(
firstName: "Petey",
lastName: "Cruiser",
firstName: 'Petey',
lastName: 'Cruiser',
),
UserModel(
firstName: "Barry",
lastName: "Cade",
firstName: 'Barry',
lastName: 'Cade',
),
];
5 changes: 4 additions & 1 deletion animations/lib/src/misc/animated_positioned.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:flutter/material.dart';
class AnimatedPositionedDemo extends StatefulWidget {
static String routeName = '/basics/09_animated_positioned';

@override
_AnimatedPositionedDemoState createState() => _AnimatedPositionedDemoState();
}

Expand All @@ -20,6 +21,7 @@ class _AnimatedPositionedDemoState extends State<AnimatedPositionedDemo> {

double generateLeftPosition(double left) => Random().nextDouble() * left;

@override
void initState() {
super.initState();
topPosition = generateTopPosition(30);
Expand All @@ -33,6 +35,7 @@ class _AnimatedPositionedDemoState extends State<AnimatedPositionedDemo> {
});
}

@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size;
final appBar = AppBar();
Expand Down Expand Up @@ -60,7 +63,7 @@ class _AnimatedPositionedDemoState extends State<AnimatedPositionedDemo> {
width: 150,
height: 50,
child: Text(
"Click Me",
'Click Me',
style: TextStyle(
color:
Theme.of(context).buttonTheme.colorScheme.onPrimary,
Expand Down
Loading

0 comments on commit baa1f97

Please sign in to comment.