1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 13:58:47 +00:00

Samples maintenance (#435)

This commit is contained in:
Brett Morgan
2020-05-13 09:18:26 +10:00
committed by GitHub
parent 941ebebfad
commit baa1f976b2
94 changed files with 492 additions and 349 deletions

View File

@@ -28,6 +28,6 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.4"
version: "1.7.0"
sdks:
dart: ">=2.3.0 <3.0.0"

View File

@@ -54,7 +54,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.4"
version: "1.7.0"
sky_engine:
dependency: transitive
description: flutter

View File

@@ -36,7 +36,7 @@ class CState extends State<Cook> {
title: Text(widget.nme,
style: Theme.of(ct)
.textTheme
.display2
.headline3
.copyWith(fontFamily: 'ark', color: Colors.black))),
margin: EdgeInsets.only(top: 40, bottom: 30, left: 20)),
Expanded(

View File

@@ -71,16 +71,16 @@ class HState extends State<Home> {
scale: .9)),
Text(fi['fn'],
style:
t.display3.copyWith(fontFamily: 'ark', color: Colors.black)),
t.headline2.copyWith(fontFamily: 'ark', color: Colors.black)),
Container(
child: Text(fi['cn'],
style: t.subhead.apply(color: Colors.red, fontFamily: 'opb')),
style: t.subtitle1.apply(color: Colors.red, fontFamily: 'opb')),
margin: EdgeInsets.only(top: 10, bottom: 30),
),
Container(
child: Text(fi['dc'],
textAlign: TextAlign.center,
style: t.subhead.copyWith(fontFamily: 'opr')),
style: t.subtitle1.copyWith(fontFamily: 'opr')),
margin: EdgeInsets.only(left: 10, right: 10)),
Expanded(
flex: 2,
@@ -101,7 +101,7 @@ class HState extends State<Home> {
children: <Widget>[
Text(fi['ig'][i]['n'],
style:
t.subtitle.copyWith(fontFamily: 'opb')),
t.subtitle2.copyWith(fontFamily: 'opb')),
Text(fi['ig'][i]['c'],
style:
t.caption.copyWith(fontFamily: 'opr'))

View File

@@ -1,13 +1,6 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.1"
charcode:
dependency: transitive
description:
@@ -47,7 +40,7 @@ packages:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.0+4"
version: "0.12.1"
http_parser:
dependency: transitive
description:
@@ -68,7 +61,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.4"
version: "1.7.0"
pedantic:
dependency: "direct dev"
description:

View File

@@ -10,7 +10,7 @@ dependencies:
http: ^0.12.0
dev_dependencies:
pedantic: ^1.8.0
pedantic: ^1.9.0
flutter_icons:

View File

@@ -191,15 +191,18 @@ class _MainLayoutState extends State<MainLayout> with TickerProviderStateMixin {
int numWeeksTotal = contributionList[0].contributions.length;
String starsByWeekStr = (await http.get("assets/github_data/stars.tsv")).body;
String starsByWeekStr =
(await http.get("assets/github_data/stars.tsv")).body;
List<StatForWeek> starsByWeekLoaded =
summarizeWeeksFromTSV(starsByWeekStr, numWeeksTotal);
String forksByWeekStr = (await http.get("assets/github_data/forks.tsv")).body;
String forksByWeekStr =
(await http.get("assets/github_data/forks.tsv")).body;
List<StatForWeek> forksByWeekLoaded =
summarizeWeeksFromTSV(forksByWeekStr, numWeeksTotal);
String commitsByWeekStr = (await http.get("assets/github_data/commits.tsv")).body;
String commitsByWeekStr =
(await http.get("assets/github_data/commits.tsv")).body;
List<StatForWeek> commitsByWeekLoaded =
summarizeWeeksFromTSV(commitsByWeekStr, numWeeksTotal);

View File

@@ -1,13 +1,6 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.1"
charcode:
dependency: transitive
description:
@@ -33,7 +26,7 @@ packages:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.0+4"
version: "0.12.1"
http_parser:
dependency: transitive
description:
@@ -61,7 +54,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.4"
version: "1.7.0"
pedantic:
dependency: transitive
description:

View File

@@ -40,7 +40,7 @@ class CookbookScraper {
var description = page.querySelectorAll('main>.container>p').first.text;
var urlSegments = Uri.parse(url).pathSegments;
var category = urlSegments[urlSegments.length-2];
var category = urlSegments[urlSegments.length - 2];
return Sample(
name: name,

View File

@@ -147,7 +147,7 @@ class Sample {
var nameWithoutChars = name.replaceAll(RegExp(r'[^A-Za-z0-9\-\_\ ]'), '');
var nameWithUnderscores = nameWithoutChars.replaceAll(' ', '_');
var snake = util.snakeCase(nameWithUnderscores);
var s = snake.replaceAll('__', '_');
var s = snake.replaceAll('__', '_');
return s;
}

View File

@@ -8,7 +8,8 @@ import 'util.dart' as util;
String _escapeAttribute(String s) =>
HtmlEscape(HtmlEscapeMode.attribute).convert(s);
String _escapeElement(String s) => HtmlEscape(HtmlEscapeMode.element).convert(s);
String _escapeElement(String s) =>
HtmlEscape(HtmlEscapeMode.element).convert(s);
String description(Sample sample) => '''
<!DOCTYPE html>
@@ -184,19 +185,24 @@ String _descriptionPage(Sample sample) => '''
String _descriptionButtons(Sample sample) {
var buf = StringBuffer();
if (sample?.web?.isNotEmpty == true) {
buf.write('''<button class="mdc-button mdc-button--outlined" onclick="window.location.href = '${sample.web}';"><span class="mdc-button__ripple"></span> Launch App</button>''');
buf.write(
'''<button class="mdc-button mdc-button--outlined" onclick="window.location.href = '${sample.web}';"><span class="mdc-button__ripple"></span> Launch App</button>''');
}
if (sample.type == 'app' || sample.type == 'sample' || sample.type == 'demo') {
buf.write('''<button class="mdc-button mdc-button--outlined" onclick="window.location.href = '${sample.source}';">
if (sample.type == 'app' ||
sample.type == 'sample' ||
sample.type == 'demo') {
buf.write(
'''<button class="mdc-button mdc-button--outlined" onclick="window.location.href = '${sample.source}';">
<div class="mdc-button__ripple"></div>
<i class="material-icons mdc-button__icon" aria-hidden="true">code</i>
<span class="mdc-button__label">Source Code</span>
</button>''');
}
if (sample.type =='cookbook') {
buf.write('''<button class="mdc-button mdc-button--outlined" onclick="window.location.href = '${sample.source}';"> <span class="mdc-button__ripple"></span>View Recipe</button>''');
if (sample.type == 'cookbook') {
buf.write(
'''<button class="mdc-button mdc-button--outlined" onclick="window.location.href = '${sample.source}';"> <span class="mdc-button__ripple"></span>View Recipe</button>''');
}
return buf.toString();
}
@@ -219,4 +225,4 @@ String _descriptionScreenshots(Sample sample) {
String _descriptionText(Sample sample) {
return '<p>${sample.description}</p>';
}
}

View File

@@ -30,4 +30,4 @@ String _fixCase(String input, String separator) =>
}
return lower;
});
});

View File

@@ -17,7 +17,7 @@ dependencies:
html: ^0.14.0
dev_dependencies:
grinder: ^0.8.3
pedantic: ^1.8.0
pedantic: ^1.9.0
test: ^1.6.0
json_serializable: ^3.2.0
build: ^1.2.0

View File

@@ -62,8 +62,8 @@ Future generate() async {
Future scrapeCookbook() async {
var driver = await Process.start(
'chromedriver', ['--port=4444', '--url-base=wd/hub', '--verbose']);
driver.stdout.pipe(stdout);
driver.stderr.pipe(stderr);
await driver.stdout.pipe(stdout);
await driver.stderr.pipe(stderr);
var scraper = CookbookScraper();
await scraper.init();
var links = await scraper.fetchCookbookLinks();

View File

@@ -160,9 +160,11 @@ class DecorationImagePlus implements DecorationImage {
@override
ImageErrorListener get onError => (error, stackTrace) {
developer.log('Failed to load image.\n'
developer.log(
'Failed to load image.\n'
'$error\n'
'$stackTrace', name: 'slide_puzzle.decoration_image_plus');
'$stackTrace',
name: 'slide_puzzle.decoration_image_plus');
};
}

View File

@@ -7,14 +7,14 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
version: "3.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "0.39.7"
version: "0.39.8"
archive:
dependency: transitive
description:
@@ -115,7 +115,7 @@ packages:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.0+4"
version: "0.12.1"
http_multi_server:
dependency: transitive
description:
@@ -199,7 +199,7 @@ packages:
name: node_io
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1+2"
version: "1.1.0"
node_preamble:
dependency: transitive
description:
@@ -351,7 +351,7 @@ packages:
name: test
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.2"
version: "1.14.3"
test_api:
dependency: transitive
description:
@@ -365,7 +365,7 @@ packages:
name: test_core
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.3"
version: "0.3.4"
typed_data:
dependency: transitive
description:
@@ -386,7 +386,7 @@ packages:
name: vm_service
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.1"
version: "4.0.2"
watcher:
dependency: transitive
description:
@@ -407,7 +407,7 @@ packages:
name: webkit_inspection_protocol
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.0+1"
version: "0.5.3"
xml:
dependency: transitive
description:
@@ -421,6 +421,6 @@ packages:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
version: "2.2.1"
sdks:
dart: ">=2.7.0 <3.0.0"

View File

@@ -186,9 +186,9 @@ class NumberPicker extends StatelessWidget {
}
Widget _integerListView(ThemeData themeData) {
TextStyle defaultStyle = themeData.textTheme.body1;
TextStyle defaultStyle = themeData.textTheme.bodyText2;
TextStyle selectedStyle =
themeData.textTheme.headline.copyWith(color: themeData.accentColor);
themeData.textTheme.headline5.copyWith(color: themeData.accentColor);
var listItemCount = integerItemCount + 2;
@@ -223,9 +223,9 @@ class NumberPicker extends StatelessWidget {
}
Widget _decimalListView(ThemeData themeData) {
TextStyle defaultStyle = themeData.textTheme.body1;
TextStyle defaultStyle = themeData.textTheme.bodyText2;
TextStyle selectedStyle =
themeData.textTheme.headline.copyWith(color: themeData.accentColor);
themeData.textTheme.headline5.copyWith(color: themeData.accentColor);
int decimalItemCount =
selectedIntValue == maxValue ? 3 : math.pow(10, decimalPlaces) + 2;
@@ -262,9 +262,9 @@ class NumberPicker extends StatelessWidget {
}
Widget _integerInfiniteListView(ThemeData themeData) {
TextStyle defaultStyle = themeData.textTheme.body1;
TextStyle defaultStyle = themeData.textTheme.bodyText2;
TextStyle selectedStyle =
themeData.textTheme.headline.copyWith(color: themeData.accentColor);
themeData.textTheme.headline5.copyWith(color: themeData.accentColor);
return new NotificationListener(
child: new Container(