1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 22:09:06 +00:00

Add workflow to deploy the sample index (#791)

* Add workflow to build and deploy the sample index

* update gh-pages action

* fix yaml

* create web/ directory in build

* grammar

* add ignored directories

* revert pubspec.lock files

* add job to run _tool/verify_samples.dart

* Update filipino_cuisine for Flutter 2

* remove timeflow demo.

The unnamed List constructor is now deprecated, refactoring
this code to use add() requires more knowledge about the code for
this demo.
https://dart.dev/null-safety/understanding-null-safety#no-unnamed-list-constructor

* update slide_puzzle

* ensure stable channel is used to verify

* move verify web demos action into separate yaml file - avoid running
on each flutter version.

* add on: pull_request

* update slide_puzzle

* Update gh-pages.yml

* Add copyright header
This commit is contained in:
John Ryan
2021-05-06 10:26:15 -07:00
committed by GitHub
parent b26f2cccc1
commit 3f5ab56485
24 changed files with 140 additions and 1307 deletions

View File

@@ -60,7 +60,7 @@ class CatmullInterpolator implements Interpolator {
}
static void test() {
List<Point2D> controlPoints = List<Point2D>();
List<Point2D> controlPoints = <Point2D>[];
controlPoints.add(Point2D(-1, 1));
controlPoints.add(Point2D(0, 1));
controlPoints.add(Point2D(1, -1));

View File

@@ -47,12 +47,12 @@ class LayeredChartState extends State<LayeredChart> {
graphHeight = MathUtils.clampedMap(screenRatio, 0.5, 2.5, 50, 150);
int m = dataToPlot.length;
paths = List<Path>(m);
capPaths = List<Path>(m);
maxValues = List<double>(m);
paths = <Path>[];
capPaths = <Path>[];
maxValues = <double>[];
for (int i = 0; i < m; i++) {
int n = dataToPlot[i].series.length;
maxValues[i] = 0;
maxValues.add(0);
for (int j = 0; j < n; j++) {
double v = dataToPlot[i].series[j].toDouble();
if (v > maxValues[i]) {
@@ -69,11 +69,11 @@ class LayeredChartState extends State<LayeredChart> {
double xWidth = (endX - startX) / numPoints;
double capRangeX = capSize * cos(capTheta);
double tanCapTheta = tan(capTheta);
List<double> curvePoints = List<double>(numPoints);
List<double> curvePoints = <double>[];
for (int i = 0; i < m; i++) {
List<int> series = dataToPlot[i].series;
int n = series.length;
List<Point2D> controlPoints = List<Point2D>();
List<Point2D> controlPoints = <Point2D>[];
controlPoints.add(Point2D(-1, 0));
double last = 0;
for (int j = 0; j < n; j++) {
@@ -88,11 +88,11 @@ class LayeredChartState extends State<LayeredChart> {
cpv.value = MathUtils.map(
j.toDouble(), 0, (numPoints - 1).toDouble(), 0, (n - 1).toDouble());
curve.progressiveGet(cpv);
curvePoints[j] = MathUtils.map(
max(0, cpv.value), 0, maxValues[i].toDouble(), 0, graphHeight);
curvePoints.add(MathUtils.map(
max(0, cpv.value), 0, maxValues[i].toDouble(), 0, graphHeight));
}
paths[i] = Path();
capPaths[i] = Path();
paths.add(Path());
capPaths.add(Path());
paths[i].moveTo(startX, startY);
capPaths[i].moveTo(startX, startY);
for (int j = 0; j < numPoints; j++) {
@@ -133,7 +133,7 @@ class LayeredChartState extends State<LayeredChart> {
capPaths[i].lineTo(startX, startY + 1);
capPaths[i].close();
}
labelPainter = List<TextPainter>();
labelPainter = <TextPainter>[];
for (int i = 0; i < dataToPlot.length; i++) {
TextSpan span = TextSpan(
style: TextStyle(
@@ -146,7 +146,7 @@ class LayeredChartState extends State<LayeredChart> {
tp.layout();
labelPainter.add(tp);
}
milestonePainter = List<TextPainter>();
milestonePainter = <TextPainter>[];
for (int i = 0; i < milestones.length; i++) {
TextSpan span = TextSpan(
style: TextStyle(

View File

@@ -46,7 +46,7 @@ class _MainLayoutState extends State<MainLayout> with TickerProviderStateMixin {
createAnimation(0);
weekLabels = List();
weekLabels = <WeekLabel>[];
weekLabels.add(WeekLabel.forDate(DateTime(2019, 2, 26), "v1.2"));
weekLabels.add(WeekLabel.forDate(DateTime(2018, 12, 4), "v1.0"));
// weekLabels.add(WeekLabel.forDate(new DateTime(2018, 9, 19), "Preview 2"));
@@ -79,9 +79,9 @@ class _MainLayoutState extends State<MainLayout> with TickerProviderStateMixin {
@override
Widget build(BuildContext context) {
// Combined contributions data
List<DataSeries> dataToPlot = List();
List<DataSeries> dataToPlot = [];
if (contributions != null) {
List<int> series = List();
List<int> series = [];
for (UserContribution userContrib in contributions) {
for (int i = 0; i < userContrib.contributions.length; i++) {
ContributionData data = userContrib.contributions[i];
@@ -228,7 +228,7 @@ class _MainLayoutState extends State<MainLayout> with TickerProviderStateMixin {
List<StatForWeek> summarizeWeeksFromTSV(
String statByWeekStr, int numWeeksTotal) {
List<StatForWeek> loadedStats = List();
List<StatForWeek> loadedStats = [];
HashMap<int, StatForWeek> statMap = HashMap();
statByWeekStr.split("\n").forEach((s) {
List<String> split = s.split("\t");
@@ -237,7 +237,8 @@ class _MainLayoutState extends State<MainLayout> with TickerProviderStateMixin {
statMap[weekNum] = StatForWeek(weekNum, int.parse(split[1]));
}
});
print("Laoded ${statMap.length} weeks.");
print("Loaded ${statMap.length} weeks.");
// Convert into a list by week, but fill in empty weeks with 0
for (int i = 0; i < numWeeksTotal; i++) {
StatForWeek starsForWeek = statMap[i];

View File

@@ -7,7 +7,7 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.5"
version: "1.1.0"
charcode:
dependency: transitive
description:
@@ -21,7 +21,7 @@ packages:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0-nullsafety.5"
version: "1.15.0"
flutter:
dependency: "direct main"
description: flutter
@@ -54,7 +54,7 @@ packages:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0-nullsafety.6"
version: "1.3.0"
path:
dependency: transitive
description:
@@ -101,13 +101,13 @@ packages:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0-nullsafety.5"
version: "1.3.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.5"
version: "2.1.0"
sdks:
dart: ">=2.12.0-0 <3.0.0"