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 packages and linter rules #26

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include: package:pedantic/analysis_options.yaml
include: package:flutter_lints/flutter.yaml

analyzer:
exclude:
Expand Down
284 changes: 141 additions & 143 deletions example/example_03/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import 'dart:async';
import 'dart:core';
import 'dart:ui';
import 'package:drawing_animation/drawing_animation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart';

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

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom]);
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: [SystemUiOverlay.bottom]);
return MaterialApp(
theme: ThemeData(
primarySwatch: Colors.blue,
Expand Down Expand Up @@ -157,7 +156,7 @@ class HomePageState extends State<HomePage> with TickerProviderStateMixin {

Widget createPage(int i, BuildContext context) {
var isLandscape =
(MediaQuery.of(context).orientation == Orientation.portrait);
(MediaQuery.of(context).orientation == Orientation.portrait);
if (previousScreen != i) {
isRunning = false;
showStartButton = true;
Expand All @@ -172,11 +171,11 @@ class HomePageState extends State<HomePage> with TickerProviderStateMixin {
(isLandscape) ? Expanded(flex: 3, child: Container()) : Container(),
(isLandscape)
? Expanded(
flex: 6,
child: Center(
child: Padding(
padding: EdgeInsets.all(24.0),
child: createInstructions(i))))
flex: 6,
child: Center(
child: Padding(
padding: EdgeInsets.all(24.0),
child: createInstructions(i))))
: Container(),
Flexible(
flex: 12,
Expand All @@ -186,32 +185,32 @@ class HomePageState extends State<HomePage> with TickerProviderStateMixin {
child: Stack(children: <Widget>[
(!isRunning && showStartButton)
? Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
'Start animation',
style: TextStyle(
color: (assets[i][4] == Colors.black)
? Colors.white
: Colors.black,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
'Start animation',
style: TextStyle(
color: (assets[i][4] == Colors.black)
? Colors.white
: Colors.black,
),
),
),
IconButton(
icon: Icon(
Icons.touch_app,
color: (assets[i][4] == Colors.black)
? Colors.white
: Colors.black,
),
onPressed: () {
setState(() {
startAnimation(i);
});
},
)
]))
IconButton(
icon: Icon(
Icons.touch_app,
color: (assets[i][4] == Colors.black)
? Colors.white
: Colors.black,
),
onPressed: () {
setState(() {
startAnimation(i);
});
},
)
]))
: Container(),
GestureDetector(
onTap: () => startAnimation(i),
Expand Down Expand Up @@ -260,29 +259,28 @@ class HomePageState extends State<HomePage> with TickerProviderStateMixin {
]),
(isLandscape)
? Column(children: <Widget>[
AnimatedSize(
curve: Curves.bounceInOut,
vsync: this,
duration: Duration(milliseconds: 800),
child: Card(
margin: EdgeInsets.all(20.0),
color: Colors.grey[250],
child: Container(
padding: EdgeInsets.all(10.0),
child: Column(children: <Widget>[
Row(children: <Widget>[
Flexible(
flex: 2,
child: Column(
children: createCardOptions(i),
))
]),
])))),
Expanded(
flex: 4,
child: Container(),
) //TODO Fix, Find Expanded in the Card Widget tree
])
AnimatedSize(
curve: Curves.bounceInOut,
duration: Duration(milliseconds: 800),
child: Card(
margin: EdgeInsets.all(20.0),
color: Colors.grey[250],
child: Container(
padding: EdgeInsets.all(10.0),
child: Column(children: <Widget>[
Row(children: <Widget>[
Flexible(
flex: 2,
child: Column(
children: createCardOptions(i),
))
]),
])))),
Expanded(
flex: 4,
child: Container(),
) //TODO Fix, Find Expanded in the Card Widget tree
])
: Container(),
]);
}
Expand All @@ -292,17 +290,17 @@ class HomePageState extends State<HomePage> with TickerProviderStateMixin {
Row(children: <Widget>[
(cardExpanded)
? Expanded(
flex: 1,
child: Text('Asset: ',
style: TextStyle(fontWeight: FontWeight.bold)))
flex: 1,
child: Text('Asset: ',
style: TextStyle(fontWeight: FontWeight.bold)))
: Text('${assets[i][8]}',
style: TextStyle(fontWeight: FontWeight.bold)),
style: TextStyle(fontWeight: FontWeight.bold)),
(cardExpanded)
? Expanded(
flex: 1,
child: Align(
alignment: Alignment.centerLeft,
child: Text('${assets[i][0]}')))
flex: 1,
child: Align(
alignment: Alignment.centerLeft,
child: Text('${assets[i][0]}')))
: Container(),
Expanded(
flex: 1,
Expand Down Expand Up @@ -332,28 +330,28 @@ class HomePageState extends State<HomePage> with TickerProviderStateMixin {
style: TextStyle(fontWeight: FontWeight.bold))),
Expanded(
child: ChoiceChip(
label: Text('allAtOnce'),
selected: assets[i][1] == LineAnimation.allAtOnce,
onSelected: (bool selected) {
setState(() {
assets[i][1] = selected
? LineAnimation.allAtOnce
: LineAnimation.oneByOne;
});
},
)),
label: Text('allAtOnce'),
selected: assets[i][1] == LineAnimation.allAtOnce,
onSelected: (bool selected) {
setState(() {
assets[i][1] = selected
? LineAnimation.allAtOnce
: LineAnimation.oneByOne;
});
},
)),
Expanded(
child: ChoiceChip(
label: Text('oneByOne'),
selected: assets[i][1] == LineAnimation.oneByOne,
onSelected: (bool selected) {
setState(() {
assets[i][1] = selected
? LineAnimation.oneByOne
: LineAnimation.allAtOnce;
});
},
)),
label: Text('oneByOne'),
selected: assets[i][1] == LineAnimation.oneByOne,
onSelected: (bool selected) {
setState(() {
assets[i][1] = selected
? LineAnimation.oneByOne
: LineAnimation.allAtOnce;
});
},
)),
])),
]),
Row(children: <Widget>[
Expand All @@ -366,24 +364,24 @@ class HomePageState extends State<HomePage> with TickerProviderStateMixin {
style: TextStyle(fontWeight: FontWeight.bold))),
Expanded(
child: ChoiceChip(
label: Text('Once'),
selected: assets[i][5] == false,
onSelected: (bool selected) {
setState(() {
assets[i][5] = !selected;
});
},
)),
label: Text('Once'),
selected: assets[i][5] == false,
onSelected: (bool selected) {
setState(() {
assets[i][5] = !selected;
});
},
)),
Expanded(
child: ChoiceChip(
label: Text('Infinite'),
selected: assets[i][5] == true,
onSelected: (bool selected) {
setState(() {
assets[i][5] = selected;
});
},
)),
label: Text('Infinite'),
selected: assets[i][5] == true,
onSelected: (bool selected) {
setState(() {
assets[i][5] = selected;
});
},
)),
])),
]),
Row(children: <Widget>[
Expand Down Expand Up @@ -535,53 +533,53 @@ class HomePageState extends State<HomePage> with TickerProviderStateMixin {
Widget createChoiceChip(int i, int j, String text, Object object) {
return Expanded(
child: ChoiceChip(
label: Text(text),
selected: assets[i][j] == object,
onSelected: (bool selected) {
if (selected) {
setState(() {
//Restart animation - Pause
isRunning = false;
showStartButton = false;
});
label: Text(text),
selected: assets[i][j] == object,
onSelected: (bool selected) {
if (selected) {
setState(() {
//Restart animation - Pause
isRunning = false;
showStartButton = false;
});

Timer(Duration(milliseconds: 10), () {
setState(() {
assets[i][j] = object;
isRunning = true;
});
});
}
},
));
Timer(Duration(milliseconds: 10), () {
setState(() {
assets[i][j] = object;
isRunning = true;
});
});
}
},
));
}

Widget createChoiceChipMulti(
int i, List<int> jj, String text, List<Object> objects) {
return Expanded(
child: ChoiceChip(
label: Text(text),
selected: assets[i][jj.first] ==
objects.first, //boolean depends on first object
onSelected: (bool selected) {
if (selected) {
setState(() {
//Restart animation - Pause
isRunning = false;
showStartButton = false;
});
label: Text(text),
selected: assets[i][jj.first] ==
objects.first, //boolean depends on first object
onSelected: (bool selected) {
if (selected) {
setState(() {
//Restart animation - Pause
isRunning = false;
showStartButton = false;
});

Timer(Duration(milliseconds: 10), () {
setState(() {
for (var m = 0; m < objects.length; m++) {
assets[i][jj[m]] = objects[m];
}
isRunning = true;
});
});
}
},
));
Timer(Duration(milliseconds: 10), () {
setState(() {
for (var m = 0; m < objects.length; m++) {
assets[i][jj[m]] = objects[m];
}
isRunning = true;
});
});
}
},
));
}

Widget wrap(List<Widget> widgets) {
Expand All @@ -598,8 +596,8 @@ class HomePageState extends State<HomePage> with TickerProviderStateMixin {

void launchURL(int i) async {
var url = assets[i][7] as String;
if (await canLaunch(url)) {
await launch(url);
if (await canLaunchUrlString(url)) {
await launchUrlString(url);
} else {
throw 'Could not launch $url';
}
Expand Down
1 change: 0 additions & 1 deletion lib/src/abstract_drawing_state.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'dart:ui';
import 'drawing_widget.dart';
import 'debug.dart';
import 'line_animation.dart';
Expand Down
Loading