diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml deleted file mode 100644 index c6a27fbad..000000000 --- a/.github/workflows/gh-pages.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Deploy to GitHub Pages - -# Declare default permissions as read only. -permissions: read-all - -on: - push: - branches: - - main -jobs: - build-and-deploy: - permissions: - contents: write - runs-on: ubuntu-latest - if: github.repository == 'flutter/samples' - - steps: - - name: Checkout - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - with: - submodules: true - fetch-depth: 0 - - - uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046 - - - name: Init scripts - run: dart pub get - working-directory: web/_tool - - - name: Build - run: dart run _tool/build_ci.dart - working-directory: web - - - name: Deploy - uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: web/samples_index/public diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 450ddc57d..df7dead6c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,17 +37,6 @@ jobs: channel: ${{ matrix.flutter_version }} - run: ./tool/flutter_ci_script_${{ matrix.flutter_version }}.sh - web-samples-index: - name: web/samples_index config check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046 - - run: | - dart pub get - dart run grinder generate - working-directory: web/samples_index - # android-build: # runs-on: ubuntu-latest # if: github.repository == 'flutter/samples' diff --git a/.github/workflows/verify-web-demos.yml b/.github/workflows/verify-web-demos.yml deleted file mode 100644 index 5534f61c9..000000000 --- a/.github/workflows/verify-web-demos.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Verify web demos - -# Declare default permissions as read only. -permissions: read-all - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - verify-web-demos: - runs-on: ubuntu-latest - if: github.repository == 'flutter/samples' - strategy: - matrix: - flutter_version: - - stable - # TODO(johnpryan): https://github.com/flutter/samples/issues/1469 - # - beta - steps: - - name: Checkout - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - with: - submodules: true - fetch-depth: 0 - - uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046 - with: - channel: ${{ matrix.flutter_version }} - - name: Init scripts - run: dart pub get - working-directory: web/_tool - - name: Verify packages - run: dart run _tool/verify_packages.dart - working-directory: web diff --git a/tool/flutter_ci_script_beta.sh b/tool/flutter_ci_script_beta.sh index eb62c1bf6..f9211ba4f 100755 --- a/tool/flutter_ci_script_beta.sh +++ b/tool/flutter_ci_script_beta.sh @@ -64,9 +64,6 @@ declare -ar PROJECT_NAMES=( "testing_app" "veggieseasons" "web_embedding/element_embedding_demo" - "web/_tool" - # TODO(ewindmill): dart:html is deprecated. Delete samples_index - # "web/samples_index" ) ci_projects "beta" "${PROJECT_NAMES[@]}" diff --git a/tool/flutter_ci_script_master.sh b/tool/flutter_ci_script_master.sh index d393d2992..7983cad0c 100755 --- a/tool/flutter_ci_script_master.sh +++ b/tool/flutter_ci_script_master.sh @@ -67,9 +67,6 @@ declare -ar PROJECT_NAMES=( "testing_app" "veggieseasons" "web_embedding/element_embedding_demo" - "web/_tool" - # TODO(ewindmill): dart:html is deprecated. Delete samples_index - # "web/samples_index" ) ci_projects "master" "${PROJECT_NAMES[@]}" diff --git a/tool/flutter_ci_script_stable.sh b/tool/flutter_ci_script_stable.sh index caba5e131..353b07058 100755 --- a/tool/flutter_ci_script_stable.sh +++ b/tool/flutter_ci_script_stable.sh @@ -61,9 +61,6 @@ declare -ar PROJECT_NAMES=( "testing_app" "veggieseasons" "web_embedding/element_embedding_demo" - "web/_tool" - # TODO(ewindmill): dart:html is deprecated. Delete samples_index - # "web/samples_index" ) ci_projects "stable" "${PROJECT_NAMES[@]}" diff --git a/tool/flutter_clean_packages b/tool/flutter_clean_packages index d3096b068..6823b428f 100644 --- a/tool/flutter_clean_packages +++ b/tool/flutter_clean_packages @@ -57,8 +57,6 @@ declare -ar PROJECT_NAMES=( "testing_app" "veggieseasons" "web_embedding/element_embedding_demo" - "web/_tool" - "web/samples_index" ) echo "--- Running flutter clean and flutter pub get for each sample ---" diff --git a/web/.gitignore b/web/.gitignore deleted file mode 100644 index 5c644e171..000000000 --- a/web/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*/build diff --git a/web/_packages/web_startup_analyzer/.gitignore b/web/_packages/web_startup_analyzer/.gitignore deleted file mode 100644 index ac5aa9893..000000000 --- a/web/_packages/web_startup_analyzer/.gitignore +++ /dev/null @@ -1,29 +0,0 @@ -# Miscellaneous -*.class -*.log -*.pyc -*.swp -.DS_Store -.atom/ -.buildlog/ -.history -.svn/ -migrate_working_dir/ - -# IntelliJ related -*.iml -*.ipr -*.iws -.idea/ - -# The .vscode folder contains launch configuration and tasks you configure in -# VS Code which you may wish to be included in version control, so this line -# is commented out by default. -#.vscode/ - -# Flutter/Dart/Pub related -# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. -/pubspec.lock -**/doc/api/ -.dart_tool/ -build/ diff --git a/web/_packages/web_startup_analyzer/.metadata b/web/_packages/web_startup_analyzer/.metadata deleted file mode 100644 index d8c07e3ff..000000000 --- a/web/_packages/web_startup_analyzer/.metadata +++ /dev/null @@ -1,10 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled and should not be manually edited. - -version: - revision: "f5fb61b953a631f47191124a31169701911ee1f4" - channel: "main" - -project_type: package diff --git a/web/_packages/web_startup_analyzer/analysis_options.yaml b/web/_packages/web_startup_analyzer/analysis_options.yaml deleted file mode 100644 index a5744c1cf..000000000 --- a/web/_packages/web_startup_analyzer/analysis_options.yaml +++ /dev/null @@ -1,4 +0,0 @@ -include: package:flutter_lints/flutter.yaml - -# Additional information about this file can be found at -# https://dart.dev/guides/language/analysis-options diff --git a/web/_packages/web_startup_analyzer/example/.gitignore b/web/_packages/web_startup_analyzer/example/.gitignore deleted file mode 100644 index 29a3a5017..000000000 --- a/web/_packages/web_startup_analyzer/example/.gitignore +++ /dev/null @@ -1,43 +0,0 @@ -# Miscellaneous -*.class -*.log -*.pyc -*.swp -.DS_Store -.atom/ -.buildlog/ -.history -.svn/ -migrate_working_dir/ - -# IntelliJ related -*.iml -*.ipr -*.iws -.idea/ - -# The .vscode folder contains launch configuration and tasks you configure in -# VS Code which you may wish to be included in version control, so this line -# is commented out by default. -#.vscode/ - -# Flutter/Dart/Pub related -**/doc/api/ -**/ios/Flutter/.last_build_id -.dart_tool/ -.flutter-plugins -.flutter-plugins-dependencies -.pub-cache/ -.pub/ -/build/ - -# Symbolication related -app.*.symbols - -# Obfuscation related -app.*.map.json - -# Android Studio will place build artifacts here -/android/app/debug -/android/app/profile -/android/app/release diff --git a/web/_packages/web_startup_analyzer/example/.metadata b/web/_packages/web_startup_analyzer/example/.metadata deleted file mode 100644 index 0ff836c25..000000000 --- a/web/_packages/web_startup_analyzer/example/.metadata +++ /dev/null @@ -1,45 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled and should not be manually edited. - -version: - revision: "f5fb61b953a631f47191124a31169701911ee1f4" - channel: "main" - -project_type: app - -# Tracks metadata for the flutter migrate command -migration: - platforms: - - platform: root - create_revision: f5fb61b953a631f47191124a31169701911ee1f4 - base_revision: f5fb61b953a631f47191124a31169701911ee1f4 - - platform: android - create_revision: f5fb61b953a631f47191124a31169701911ee1f4 - base_revision: f5fb61b953a631f47191124a31169701911ee1f4 - - platform: ios - create_revision: f5fb61b953a631f47191124a31169701911ee1f4 - base_revision: f5fb61b953a631f47191124a31169701911ee1f4 - - platform: linux - create_revision: f5fb61b953a631f47191124a31169701911ee1f4 - base_revision: f5fb61b953a631f47191124a31169701911ee1f4 - - platform: macos - create_revision: f5fb61b953a631f47191124a31169701911ee1f4 - base_revision: f5fb61b953a631f47191124a31169701911ee1f4 - - platform: web - create_revision: f5fb61b953a631f47191124a31169701911ee1f4 - base_revision: f5fb61b953a631f47191124a31169701911ee1f4 - - platform: windows - create_revision: f5fb61b953a631f47191124a31169701911ee1f4 - base_revision: f5fb61b953a631f47191124a31169701911ee1f4 - - # User provided section - - # List of Local paths (relative to this file) that should be - # ignored by the migrate tool. - # - # Files that are not part of the templates will be ignored by default. - unmanaged_files: - - 'lib/main.dart' - - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/web/_packages/web_startup_analyzer/example/analysis_options.yaml b/web/_packages/web_startup_analyzer/example/analysis_options.yaml deleted file mode 100644 index 57346b583..000000000 --- a/web/_packages/web_startup_analyzer/example/analysis_options.yaml +++ /dev/null @@ -1,3 +0,0 @@ -include: package:flutter_lints/flutter.yaml -linter: - rules: diff --git a/web/_packages/web_startup_analyzer/example/lib/main.dart b/web/_packages/web_startup_analyzer/example/lib/main.dart deleted file mode 100644 index ed3c9181b..000000000 --- a/web/_packages/web_startup_analyzer/example/lib/main.dart +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright 2021 The Flutter team. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// ignore_for_file: avoid_print - -import 'dart:convert'; - -import 'package:flutter/material.dart'; -import 'package:web_startup_analyzer/web_startup_analyzer.dart'; - -main() async { - var analyzer = WebStartupAnalyzer(additionalFrameCount: 10); - print(json.encode(analyzer.startupTiming)); - analyzer.onFirstFrame.addListener(() { - print(json.encode({'firstFrame': analyzer.onFirstFrame.value})); - }); - analyzer.onFirstPaint.addListener(() { - print( - json.encode({ - 'firstPaint': analyzer.onFirstPaint.value?.$1, - 'firstContentfulPaint': analyzer.onFirstPaint.value?.$2, - }), - ); - }); - analyzer.onAdditionalFrames.addListener(() { - print(json.encode({'additionalFrames': analyzer.onAdditionalFrames.value})); - }); - runApp(WebStartupAnalyzerSample(analyzer: analyzer)); -} - -class WebStartupAnalyzerSample extends StatelessWidget { - final WebStartupAnalyzer analyzer; - const WebStartupAnalyzerSample({super.key, required this.analyzer}); - - @override - Widget build(BuildContext context) { - return MaterialApp( - title: 'Flutter web app timing', - theme: ThemeData( - colorScheme: ColorScheme.fromSeed(seedColor: Colors.green.shade100), - ), - home: WebStartupAnalyzerScreen(analyzer: analyzer), - ); - } -} - -class WebStartupAnalyzerScreen extends StatefulWidget { - final WebStartupAnalyzer analyzer; - - const WebStartupAnalyzerScreen({super.key, required this.analyzer}); - - @override - State createState() => - _WebStartupAnalyzerScreenState(); -} - -class _WebStartupAnalyzerScreenState extends State { - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: Colors.amber.shade50, - body: Align( - alignment: Alignment.topCenter, - child: Container( - margin: const EdgeInsets.all(8.0), - constraints: const BoxConstraints(maxWidth: 400), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8.0), - ), - child: ListenableBuilder( - listenable: widget.analyzer.onChange, - builder: (BuildContext context, child) { - return ListView( - shrinkWrap: true, - children: [ - TimingWidget( - name: 'DCL', - timingMs: widget.analyzer.domContentLoaded, - ), - TimingWidget( - name: 'Load entrypoint', - timingMs: widget.analyzer.loadEntrypoint, - ), - TimingWidget( - name: 'Initialize engine', - timingMs: widget.analyzer.initializeEngine, - ), - TimingWidget( - name: 'Run app', - timingMs: widget.analyzer.appRunnerRunApp, - ), - if (widget.analyzer.firstFrame != null) - TimingWidget( - name: 'First frame', - timingMs: widget.analyzer.firstFrame!, - ), - if (widget.analyzer.firstPaint != null) - TimingWidget( - name: 'First paint', - timingMs: widget.analyzer.firstPaint!, - ), - if (widget.analyzer.firstContentfulPaint != null) - TimingWidget( - name: 'First contentful paint', - timingMs: widget.analyzer.firstContentfulPaint!, - ), - if (widget.analyzer.additionalFrames != null) ...[ - for (var i in widget.analyzer.additionalFrames!) - TimingWidget(name: 'Frame', timingMs: i.toDouble()), - ] else - TextButton( - child: const Text('Trigger frames'), - onPressed: () {}, - ), - ], - ); - }, - ), - ), - ), - ); - } -} - -class TimingWidget extends StatelessWidget { - final String name; - final double timingMs; - - const TimingWidget({super.key, required this.name, required this.timingMs}); - - @override - Widget build(BuildContext context) { - return ListTile( - title: Text( - name, - style: const TextStyle(fontSize: 18), - overflow: TextOverflow.ellipsis, - ), - trailing: Text( - '${timingMs.truncate()}ms', - style: const TextStyle(fontSize: 18), - ), - ); - } -} diff --git a/web/_packages/web_startup_analyzer/example/pubspec.yaml b/web/_packages/web_startup_analyzer/example/pubspec.yaml deleted file mode 100644 index 9ca345183..000000000 --- a/web/_packages/web_startup_analyzer/example/pubspec.yaml +++ /dev/null @@ -1,19 +0,0 @@ -name: example -description: "flutter_web_startup_analyzer example" -publish_to: 'none' # Remove this line if you wish to publish to pub.dev -version: 1.0.0+1 -environment: - sdk: ^3.7.0-0 - flutter: ^3.16.0 -dependencies: - flutter: - sdk: flutter - cupertino_icons: ^1.0.6 - web_startup_analyzer: - path: ../ -dev_dependencies: - flutter_test: - sdk: flutter - flutter_lints: ^5.0.0 -flutter: - uses-material-design: true diff --git a/web/_packages/web_startup_analyzer/example/web/favicon.png b/web/_packages/web_startup_analyzer/example/web/favicon.png deleted file mode 100644 index 8aaa46ac1..000000000 Binary files a/web/_packages/web_startup_analyzer/example/web/favicon.png and /dev/null differ diff --git a/web/_packages/web_startup_analyzer/example/web/icons/Icon-192.png b/web/_packages/web_startup_analyzer/example/web/icons/Icon-192.png deleted file mode 100644 index b749bfef0..000000000 Binary files a/web/_packages/web_startup_analyzer/example/web/icons/Icon-192.png and /dev/null differ diff --git a/web/_packages/web_startup_analyzer/example/web/icons/Icon-512.png b/web/_packages/web_startup_analyzer/example/web/icons/Icon-512.png deleted file mode 100644 index 88cfd48df..000000000 Binary files a/web/_packages/web_startup_analyzer/example/web/icons/Icon-512.png and /dev/null differ diff --git a/web/_packages/web_startup_analyzer/example/web/icons/Icon-maskable-192.png b/web/_packages/web_startup_analyzer/example/web/icons/Icon-maskable-192.png deleted file mode 100644 index eb9b4d76e..000000000 Binary files a/web/_packages/web_startup_analyzer/example/web/icons/Icon-maskable-192.png and /dev/null differ diff --git a/web/_packages/web_startup_analyzer/example/web/icons/Icon-maskable-512.png b/web/_packages/web_startup_analyzer/example/web/icons/Icon-maskable-512.png deleted file mode 100644 index d69c56691..000000000 Binary files a/web/_packages/web_startup_analyzer/example/web/icons/Icon-maskable-512.png and /dev/null differ diff --git a/web/_packages/web_startup_analyzer/example/web/index.html b/web/_packages/web_startup_analyzer/example/web/index.html deleted file mode 100644 index 0160c6e1e..000000000 --- a/web/_packages/web_startup_analyzer/example/web/index.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - web_perf_metrics example - - - - - - - - - - diff --git a/web/_packages/web_startup_analyzer/example/web/manifest.json b/web/_packages/web_startup_analyzer/example/web/manifest.json deleted file mode 100644 index 096edf8fe..000000000 --- a/web/_packages/web_startup_analyzer/example/web/manifest.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "example", - "short_name": "example", - "start_url": ".", - "display": "standalone", - "background_color": "#0175C2", - "theme_color": "#0175C2", - "description": "A new Flutter project.", - "orientation": "portrait-primary", - "prefer_related_applications": false, - "icons": [ - { - "src": "icons/Icon-192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "icons/Icon-512.png", - "sizes": "512x512", - "type": "image/png" - }, - { - "src": "icons/Icon-maskable-192.png", - "sizes": "192x192", - "type": "image/png", - "purpose": "maskable" - }, - { - "src": "icons/Icon-maskable-512.png", - "sizes": "512x512", - "type": "image/png", - "purpose": "maskable" - } - ] -} diff --git a/web/_packages/web_startup_analyzer/lib/src/frame_analyzer.dart b/web/_packages/web_startup_analyzer/lib/src/frame_analyzer.dart deleted file mode 100644 index 257dc6fbf..000000000 --- a/web/_packages/web_startup_analyzer/lib/src/frame_analyzer.dart +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2021 The Flutter team. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'dart:async'; - -import 'package:flutter/scheduler.dart'; -import 'package:flutter/widgets.dart'; - -class FrameAnalyzer { - final WidgetsBinding _binding; - final Completer _onDone = Completer(); - int _remainingFrames; - - final int additionalFrames; - List additionalFrameTimes = []; - - FrameAnalyzer(this._binding, {this.additionalFrames = 10}) - : _remainingFrames = additionalFrames; - - Future captureAdditionalFrames() { - _binding.addTimingsCallback(_timingsCallback); - return _onDone.future; - } - - void _reportFrame(FrameTiming frameTiming) { - additionalFrameTimes.add(frameTiming.totalSpan.inMilliseconds); - } - - void _timingsCallback(List timings) { - int i = 0; - while (_remainingFrames > 0 && i < timings.length) { - _reportFrame(timings[i]); - i++; - _remainingFrames--; - } - if (_remainingFrames <= 0) { - _binding.removeTimingsCallback(_timingsCallback); - - _onDone.complete(); - } - } -} diff --git a/web/_packages/web_startup_analyzer/lib/src/startup_analyzer.dart b/web/_packages/web_startup_analyzer/lib/src/startup_analyzer.dart deleted file mode 100644 index 3f4913b19..000000000 --- a/web/_packages/web_startup_analyzer/lib/src/startup_analyzer.dart +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2021 The Flutter team. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'dart:js_interop'; - -@JS() -@staticInterop -external FlutterWebStartupAnalyzer get flutterWebStartupAnalyzer; - -@JS() -@staticInterop -class FlutterWebStartupAnalyzer { - external factory FlutterWebStartupAnalyzer(); -} - -extension FlutterWebStartupAnalyzerExtensions on FlutterWebStartupAnalyzer { - external JSObject get timings; - external void markStart(String name); - external void markFinished(String name); - external void capture(String name); - external void captureAll(); - external void capturePaint(); - external void report(); -} diff --git a/web/_packages/web_startup_analyzer/lib/src/web_startup_analyzer.dart b/web/_packages/web_startup_analyzer/lib/src/web_startup_analyzer.dart deleted file mode 100644 index c20e23392..000000000 --- a/web/_packages/web_startup_analyzer/lib/src/web_startup_analyzer.dart +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright 2021 The Flutter team. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'dart:async'; -import 'dart:js_interop'; -import 'dart:js_interop_unsafe'; - -import 'package:flutter/widgets.dart'; -import 'package:web_startup_analyzer/src/web_startup_analyzer_base.dart'; - -import 'frame_analyzer.dart'; -import 'startup_analyzer.dart'; - -class WebStartupAnalyzer extends WebStartupAnalyzerBase { - final WidgetsBinding _widgetsBinding; - late final FrameAnalyzer _frameAnalyzer; - List? _additionalFrames; - - @override - Map startupTiming = {}; - - @override - double get domContentLoaded => - (flutterWebStartupAnalyzer.timings['domContentLoaded'] as JSNumber) - .toDartDouble; - @override - double get loadEntrypoint => - (flutterWebStartupAnalyzer.timings['loadEntrypoint'] as JSNumber) - .toDartDouble; - @override - double get initializeEngine => - (flutterWebStartupAnalyzer.timings['initializeEngine'] as JSNumber) - .toDartDouble; - @override - double get appRunnerRunApp => - (flutterWebStartupAnalyzer.timings['appRunnerRunApp'] as JSNumber) - .toDartDouble; - @override - double? get firstFrame => - (flutterWebStartupAnalyzer.timings['firstFrame'] as JSNumber?) - ?.toDartDouble; - @override - double? get firstPaint => - (flutterWebStartupAnalyzer.timings['first-paint'] as JSNumber?) - ?.toDartDouble; - @override - double? get firstContentfulPaint => - (flutterWebStartupAnalyzer.timings['first-contentful-paint'] as JSNumber?) - ?.toDartDouble; - @override - List? get additionalFrames => _additionalFrames; - - WebStartupAnalyzer({int additionalFrameCount = 5}) - : _widgetsBinding = WidgetsFlutterBinding.ensureInitialized() { - _frameAnalyzer = FrameAnalyzer( - _widgetsBinding, - additionalFrames: additionalFrameCount, - ); - _captureStartupMetrics(); - startupTiming = { - 'domContentLoaded': domContentLoaded, - 'loadEntrypoint': loadEntrypoint, - 'initializeEngine': initializeEngine, - 'appRunnerRunApp': appRunnerRunApp, - }; - _captureFirstFrame().then((value) { - flutterWebStartupAnalyzer.captureAll(); - onFirstFrame.value = firstFrame; - - // Capture first-paint and first-contentful-paint - Future.delayed(const Duration(milliseconds: 200)).then((_) { - flutterWebStartupAnalyzer.capturePaint(); - onFirstPaint.value = (firstPaint!, firstContentfulPaint!); - }); - }); - captureFlutterFrameData().then((value) { - _additionalFrames = value; - onAdditionalFrames.value = value; - }); - onChange = Listenable.merge([ - onFirstFrame, - onFirstPaint, - onAdditionalFrames, - ]); - } - - _captureStartupMetrics() { - flutterWebStartupAnalyzer.markFinished('appRunnerRunApp'); - flutterWebStartupAnalyzer.captureAll(); - } - - Future _captureFirstFrame() { - final completer = Completer(); - flutterWebStartupAnalyzer.markStart('firstFrame'); - _widgetsBinding.addPostFrameCallback((timeStamp) { - flutterWebStartupAnalyzer.markFinished('firstFrame'); - flutterWebStartupAnalyzer.capture('firstFrame'); - completer.complete(); - }); - return completer.future; - } - - Future> captureFlutterFrameData() async { - await _frameAnalyzer.captureAdditionalFrames(); - return _frameAnalyzer.additionalFrameTimes; - } -} diff --git a/web/_packages/web_startup_analyzer/lib/src/web_startup_analyzer_base.dart b/web/_packages/web_startup_analyzer/lib/src/web_startup_analyzer_base.dart deleted file mode 100644 index ea3a08a91..000000000 --- a/web/_packages/web_startup_analyzer/lib/src/web_startup_analyzer_base.dart +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2021 The Flutter team. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'package:flutter/foundation.dart'; - -// Base class for the web (real) implementation and dart:io (stub) -// implementation. -abstract class WebStartupAnalyzerBase { - late final Listenable onChange; - ValueNotifier onFirstFrame = ValueNotifier(null); - ValueNotifier<(double, double)?> onFirstPaint = ValueNotifier(null); - ValueNotifier?> onAdditionalFrames = ValueNotifier(null); - - double get domContentLoaded; - double get loadEntrypoint; - double get initializeEngine; - double get appRunnerRunApp; - double? get firstFrame; - double? get firstPaint; - double? get firstContentfulPaint; - List? get additionalFrames; - - Map get startupTiming; -} diff --git a/web/_packages/web_startup_analyzer/lib/src/web_startup_analyzer_io.dart b/web/_packages/web_startup_analyzer/lib/src/web_startup_analyzer_io.dart deleted file mode 100644 index 51461ed5e..000000000 --- a/web/_packages/web_startup_analyzer/lib/src/web_startup_analyzer_io.dart +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2021 The Flutter team. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'web_startup_analyzer_base.dart'; - -// This class is a stub so that unit tests can run without importing -// dart:js_interop and related packages. -class WebStartupAnalyzer extends WebStartupAnalyzerBase { - WebStartupAnalyzer({int additionalFrameCount = 0}); - - @override - List? get additionalFrames => []; - - @override - double get appRunnerRunApp => 0.0; - - @override - double get domContentLoaded => 0.0; - - @override - double? get firstContentfulPaint => 0.0; - - @override - double? get firstFrame => 0.0; - - @override - double? get firstPaint => 0.0; - - @override - double get initializeEngine => 0.0; - - @override - double get loadEntrypoint => 0.0; - - @override - Map get startupTiming => {}; -} diff --git a/web/_packages/web_startup_analyzer/lib/web_startup_analyzer.dart b/web/_packages/web_startup_analyzer/lib/web_startup_analyzer.dart deleted file mode 100644 index 8d7e8a549..000000000 --- a/web/_packages/web_startup_analyzer/lib/web_startup_analyzer.dart +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright 2021 The Flutter team. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -export 'src/web_startup_analyzer_io.dart' - if (dart.library.js_interop) 'src/web_startup_analyzer.dart'; diff --git a/web/_packages/web_startup_analyzer/lib/web_startup_analyzer.js b/web/_packages/web_startup_analyzer/lib/web_startup_analyzer.js deleted file mode 100644 index a88ad0f20..000000000 --- a/web/_packages/web_startup_analyzer/lib/web_startup_analyzer.js +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Flutter team. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Helper class to capture Flutter web app startup timing information -class FlutterWebStartupAnalyzer { - timings; - - constructor() { - this.timings = {}; - } - - markStart(name) { - this.timings[name] = null; - performance.mark('flt-' + name + '-started'); - } - markFinished(name) { - performance.mark('flt-' + name + '-finished'); - } - capture(name) { - var timingName = 'flt-' + name; - var started = 'flt-' + name + 'started'; - try { - var measurement = performance.measure('flt-' + name, 'flt-' + name + '-started', 'flt-' + name + '-finished'); - } catch(e) { - // ignore errors if the mark doesn't exist - return; - } - this.timings[name] = measurement.duration; - } - captureAll() { - for (var [key, value] of Object.entries(this.timings)) { - this.capture(key); - } - // Capture - this.timings['load'] = performance.timing.loadEventEnd - performance.timing.domContentLoadedEventEnd; - this.timings['domContentLoaded'] = performance.timing.domContentLoadedEventEnd - performance.timing.navigationStart; - } - - capturePaint() { - const entries = performance.getEntriesByType("paint"); - // Collect first-paint and first-contentful-paint entries - entries.forEach((entry) => { - this.timings[entry.name] = entry.startTime; - }); - } -} diff --git a/web/_packages/web_startup_analyzer/pubspec.yaml b/web/_packages/web_startup_analyzer/pubspec.yaml deleted file mode 100644 index 68184fe85..000000000 --- a/web/_packages/web_startup_analyzer/pubspec.yaml +++ /dev/null @@ -1,19 +0,0 @@ -name: web_startup_analyzer -description: "Captures web startup timing data in a Flutter web app" -version: 0.1.0-wip - -environment: - sdk: ^3.7.0-0 - flutter: ^3.16.0 - -dependencies: - flutter: - sdk: flutter - -dev_dependencies: - flutter_test: - sdk: flutter - flutter_lints: ^5.0.0 -flutter: - assets: - - lib/web_startup_analyzer.js diff --git a/web/_tool/.copyright b/web/_tool/.copyright deleted file mode 100644 index 3ee5e79c6..000000000 --- a/web/_tool/.copyright +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright {{ year }} The Flutter team. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file diff --git a/web/_tool/analysis_options.yaml b/web/_tool/analysis_options.yaml deleted file mode 100644 index 572dd239d..000000000 --- a/web/_tool/analysis_options.yaml +++ /dev/null @@ -1 +0,0 @@ -include: package:lints/recommended.yaml diff --git a/web/_tool/build_ci.dart b/web/_tool/build_ci.dart deleted file mode 100644 index 967114849..000000000 --- a/web/_tool/build_ci.dart +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2021 The Flutter team. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file - -import 'dart:io'; - -import 'package:path/path.dart' as p; - -import 'common.dart'; -import 'fix_base_tags.dart'; - -const ignoredDirectories = [ - '_tool', - '_packages/web_startup_analyzer', - '_packages/web_startup_analyzer/example', - 'samples_index', -]; - -void main() async { - final packageDirs = [ - ...listPackageDirs(Directory.current) - .map((path) => p.relative(path, from: Directory.current.path)) - .where((path) => !ignoredDirectories.contains(path)), - ]; - - print('Building the sample index...'); - await _run('samples_index', 'flutter', ['pub', 'get']); - await _run('samples_index', 'flutter', ['pub', 'run', 'grinder', 'deploy']); - - // Create the directory each Flutter Web sample lives in - Directory( - p.join(Directory.current.path, 'samples_index', 'public', 'web'), - ).createSync(recursive: true); - - for (var i = 0; i < packageDirs.length; i++) { - var directory = packageDirs[i]; - - logWrapped(ansiMagenta, '\n$directory (${i + 1} of ${packageDirs.length})'); - - // Create the target directory - var directoryName = p.basename(directory); - var sourceBuildDir = p.join( - Directory.current.path, - directory, - 'build', - 'web', - ); - var targetDirectory = p.join( - Directory.current.path, - 'samples_index', - 'public', - 'web', - directoryName, - ); - - // Build the sample and copy the files - await _run(directory, 'flutter', ['pub', 'get']); - await _run(directory, 'flutter', ['build', 'web', '--wasm']); - await _run(directory, 'mv', [sourceBuildDir, targetDirectory]); - } - - // Update the tags in each index.html file - await fixBaseTags(); -} - -// Invokes run() and exits if the sub-process failed. -Future _run( - String workingDir, - String commandName, - List args, -) async { - var success = await run(workingDir, commandName, args); - if (!success) { - exit(1); - } -} diff --git a/web/_tool/common.dart b/web/_tool/common.dart deleted file mode 100644 index 7ae66a54c..000000000 --- a/web/_tool/common.dart +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2020 The Flutter team. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file - -import 'dart:io'; - -const ansiGreen = 32; -const ansiRed = 31; -const ansiMagenta = 35; - -Future run( - String workingDir, - String commandName, - List args, -) async { - var commandDescription = '`${([commandName, ...args]).join(' ')}`'; - - logWrapped(ansiMagenta, ' Running $commandDescription'); - - var proc = await Process.start( - commandName, - args, - workingDirectory: '${Directory.current.path}/$workingDir', - mode: ProcessStartMode.inheritStdio, - ); - - var exitCode = await proc.exitCode; - - if (exitCode != 0) { - logWrapped( - ansiRed, - ' Failed! ($exitCode) – $workingDir – $commandDescription', - ); - return false; - } else { - logWrapped(ansiGreen, ' Success! – $workingDir – $commandDescription'); - return true; - } -} - -void logWrapped(int code, String message) { - print('\x1B[${code}m$message\x1B[0m'); -} - -Iterable listPackageDirs(Directory dir) sync* { - if (File('${dir.path}/pubspec.yaml').existsSync()) { - yield dir.path; - } else { - for (var subDir in dir - .listSync(followLinks: true) - .whereType() - .where((d) => !Uri.file(d.path).pathSegments.last.startsWith('.'))) { - yield* listPackageDirs(subDir); - } - } -} diff --git a/web/_tool/fix_base_tags.dart b/web/_tool/fix_base_tags.dart deleted file mode 100644 index 291ed5877..000000000 --- a/web/_tool/fix_base_tags.dart +++ /dev/null @@ -1,62 +0,0 @@ -import 'dart:io'; - -import 'package:path/path.dart' as p; - -Future main() async { - await fixBaseTags(); -} - -/// Changes each sample's `` tag in index.html to -/// `` -/// -/// For example, after building using `build_ci.dart, -/// `../samples_index/public/web/navigation_and_routing/index.html` should -/// contain `` -Future fixBaseTags() async { - print('currentDir = ${Directory.current.path}'); - var builtSamplesDir = Directory( - p.joinAll([ - // Parent directory - ...p.split(Directory.current.path), - // path to built samples - ...p.split('samples_index/public/web'), - ]), - ); - if (!await builtSamplesDir.exists()) { - print('${builtSamplesDir.path} does not exist.'); - exit(1); - } - - await for (var builtSample in builtSamplesDir.list()) { - if (builtSample is Directory) { - var index = File(p.join(builtSample.path, 'index.html')); - if (!await index.exists()) { - throw ('no index.html file found in ${builtSample.path}'); - } - - var sampleDirName = p.split(builtSample.path).last; - - if (await index.exists()) { - final regex = RegExp(''); - var contents = await index.readAsString(); - if (!contents.contains(regex)) { - continue; - } - var newContents = contents.replaceFirst( - regex, - '', - ); - await index.writeAsString(newContents); - } - - // Since all of the web examples use the hosted canvaskit bits - // There is no need to deploy these - final canvasKitDirectory = Directory( - p.join(builtSample.path, 'canvaskit'), - ); - if (canvasKitDirectory.existsSync()) { - canvasKitDirectory.deleteSync(recursive: true); - } - } - } -} diff --git a/web/_tool/peanut_post_build.dart b/web/_tool/peanut_post_build.dart deleted file mode 100644 index b7b72239f..000000000 --- a/web/_tool/peanut_post_build.dart +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2020 The Flutter team. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file - -// Called by https://pub.dartlang.org/packages/peanut to generate example pages -// for hosting. -// -// Requires at least v3.2.0 of `package:peanut` - -import 'dart:convert'; -import 'dart:io'; - -import 'package:path/path.dart' as p; - -import 'common.dart'; - -void main(List args) async { - final buildDir = args[0]; - final fileMap = - (jsonDecode(args[1]) as Map).cast(); - - if (fileMap.length < 2) { - throw StateError('We are assuming there is more than one sample!'); - } - - // This is USUALLY the case – where we have more than one demo - for (var exampleDir in fileMap.values) { - for (var htmlFile in Directory(p.join(buildDir, exampleDir)) - .listSync() - .whereType() - .where((f) => p.extension(f.path) == '.html')) { - _updateHtml(htmlFile, buildDir, exampleDir); - } - } - - // Move each sample into a subdirectory, 'web' - for (var exampleDir in fileMap.values) { - var oldDirectory = Directory(p.join(buildDir, exampleDir)); - Directory(p.join(buildDir, 'web')).createSync(); - oldDirectory.renameSync(p.join(buildDir, 'web', exampleDir)); - } - - // Build the sample index and copy the files into this directory - print('building the sample index...'); - await run('samples_index', 'flutter', ['pub', 'get']); - await run('samples_index', 'flutter', ['pub', 'run', 'grinder', 'deploy']); - - // Copy the contents of the samples_index/public directory to the build - // directory - logWrapped(ansiMagenta, ' Copying samples_index/public to build directory'); - var contents = Directory(p.join('samples_index', 'public')).listSync(); - for (var entity in contents) { - var newPath = p.join(buildDir, p.basename(entity.path)); - entity.renameSync(newPath); - } -} - -void _updateHtml(File htmlFile, String buildDir, String exampleDir) { - final content = htmlFile.readAsStringSync(); - - final filePath = p.relative(htmlFile.path, from: buildDir); - - if (!content.contains(_standardMeta)) { - print('!!! missing standard meta! - $filePath'); - } - - final newContent = content - .replaceFirst('', '\n$_analytics') - .replaceFirst( - _emptyTitle, - '${_prettyName(exampleDir)} - Flutter web sample', - ); - - if (newContent == content) { - print('!!! Did not replace contents in $filePath'); - } else { - print('Replaced contents in $filePath'); - htmlFile.writeAsStringSync(newContent, flush: true); - } -} - -final _underscoreOrSlash = RegExp('_|/'); - -String _prettyName(String input) => input - .split(_underscoreOrSlash) - .where((e) => e.isNotEmpty) - .map((e) { - return e.substring(0, 1).toUpperCase() + e.substring(1); - }) - .join(' '); - -// flutter.github.io -const _analyticsId = 'UA-67589403-8'; - -const _analytics = ''' - -'''; - -const _emptyTitle = ''; - -const _standardMeta = ''' - - - $_emptyTitle'''; diff --git a/web/_tool/pubspec.yaml b/web/_tool/pubspec.yaml deleted file mode 100644 index 774df566c..000000000 --- a/web/_tool/pubspec.yaml +++ /dev/null @@ -1,12 +0,0 @@ -name: tool -publish_to: none - -environment: - sdk: ^3.7.0-0 - -dependencies: - markdown: ^7.0.0 - path: ^1.8.0 - -dev_dependencies: - lints: ^5.0.0 diff --git a/web/_tool/verify_packages.dart b/web/_tool/verify_packages.dart deleted file mode 100644 index 1da0c70f2..000000000 --- a/web/_tool/verify_packages.dart +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2020 The Flutter team. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file - -import 'dart:io'; - -import 'package:path/path.dart' as p; - -import 'common.dart'; - -void main() async { - final packageDirs = - listPackageDirs(Directory.current) - .map((path) => p.relative(path, from: Directory.current.path)) - .where((path) => !p.dirname(path).startsWith('_')) - .toList(); - - print('Package dirs:\n${packageDirs.map((path) => ' $path').join('\n')}'); - - final results = []; - for (var i = 0; i < packageDirs.length; i++) { - final dir = packageDirs[i]; - logWrapped(ansiMagenta, '\n$dir (${i + 1} of ${packageDirs.length})'); - - final upgradeResult = await run(dir, 'flutter', [ - 'pub', - 'pub', - 'upgrade', - '--no-precompile', - ]); - - results.add(upgradeResult); - if (!upgradeResult) { - // skipping analyze when `pub upgrade` fails. - results.add(false); - continue; - } - results.add( - await run(dir, 'dart', [ - 'analyze', - '--fatal-infos', - '--fatal-warnings', - '.', - ]), - ); - _printStatus(results); - } - - if (results.any((v) => !v)) { - exitCode = 1; - } -} - -void _printStatus(List results) { - var successCount = results.where((t) => t).length; - var success = (successCount == results.length); - var pct = 100 * successCount / results.length; - - logWrapped( - success ? ansiGreen : ansiRed, - '$successCount of ${results.length} (${pct.toStringAsFixed(2)}%)', - ); -} diff --git a/web/animations b/web/animations deleted file mode 120000 index adc148a7e..000000000 --- a/web/animations +++ /dev/null @@ -1 +0,0 @@ -../animations \ No newline at end of file diff --git a/web/form_app b/web/form_app deleted file mode 120000 index 665168be1..000000000 --- a/web/form_app +++ /dev/null @@ -1 +0,0 @@ -../form_app \ No newline at end of file diff --git a/web/game_template b/web/game_template deleted file mode 120000 index 987a86f6f..000000000 --- a/web/game_template +++ /dev/null @@ -1 +0,0 @@ -../game_template \ No newline at end of file diff --git a/web/material_3_demo b/web/material_3_demo deleted file mode 120000 index 85b51c5ce..000000000 --- a/web/material_3_demo +++ /dev/null @@ -1 +0,0 @@ -../material_3_demo \ No newline at end of file diff --git a/web/navigation_and_routing b/web/navigation_and_routing deleted file mode 120000 index fc308d8e0..000000000 --- a/web/navigation_and_routing +++ /dev/null @@ -1 +0,0 @@ -../navigation_and_routing \ No newline at end of file diff --git a/web/peanut.yaml b/web/peanut.yaml deleted file mode 100644 index 557a34fce..000000000 --- a/web/peanut.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Configuration for https://pub.dartlang.org/packages/peanut - -directories: -- animations/web -- provider_shopper/web -- charts/web -- filipino_cuisine/web -- github_dataviz/web -- particle_background/web -- slide_puzzle/web -- form_app/web -- web_dashboard/web -- place_tracker/web - -post-build-dart-script: _tool/peanut_post_build.dart diff --git a/web/place_tracker b/web/place_tracker deleted file mode 120000 index 696a250a0..000000000 --- a/web/place_tracker +++ /dev/null @@ -1 +0,0 @@ -../place_tracker \ No newline at end of file diff --git a/web/provider_shopper b/web/provider_shopper deleted file mode 120000 index ffb1f231d..000000000 --- a/web/provider_shopper +++ /dev/null @@ -1 +0,0 @@ -../provider_shopper \ No newline at end of file diff --git a/web/readme.md b/web/readme.md deleted file mode 100644 index f6d678af1..000000000 --- a/web/readme.md +++ /dev/null @@ -1,57 +0,0 @@ -# Sample Index and Web Demos - -This directory contains the index hosted at [flutter.github.io/samples][samples] -and web demos hosted with it. - -## See the demos in action - -Compiled versions of the samples are hosted at -https://flutter.github.io/samples/#?platform=web. - -## Building samples code - -Run the demo using the `chrome` device type: - -```console -$ cd charts -$ flutter packages get -$ flutter run -d chrome -``` - -You should see a message printing the URL to access: `http://localhost:8080` - -## Deploying to GitHub Pages - -This project uses a GitHub action to deploy update the `gh-pages` branch. To -do this manually, you can also use `package:peanut`: - -```console -$ flutter pub global activate peanut -``` - -Verify `pub get` has been run on each demo: - -```console -$ dart run _tool/verify_packages.dart -``` - -Build all demos, along with the sample index: - -```console -$ flutter pub global run peanut -``` - -Deploy to GitHub Pages: - -```console -$ git push origin gh-pages:gh-pages -``` - -## Building the sample index - -See sample_index/README.md for details - -[web]: https://flutter.dev/web -[samples]: https://flutter.github.io/samples/ -[peanut]: https://github.com/kevmoo/peanut.dart - diff --git a/web/samples_index/.gitignore b/web/samples_index/.gitignore deleted file mode 100644 index 99161f407..000000000 --- a/web/samples_index/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -# firebase public directory -public/ - -# Files and directories created by pub -.dart_tool/ -# Remove the following pattern if you wish to check in your lock file -pubspec.lock - -# Conventional directory for build outputs -build/ - -# Directory created by dartdoc -doc/api/ - -# All HTML files are generated by `grind generate` -web/*.html - -# Any thumbnails should be ignored -web/images/**/*_thumb.png diff --git a/web/samples_index/README.md b/web/samples_index/README.md deleted file mode 100644 index c3356d6a5..000000000 --- a/web/samples_index/README.md +++ /dev/null @@ -1,35 +0,0 @@ -# Flutter samples index generator - -This tool is used to generate the visual -[samples index for Flutter samples](https://flutter.github.io/samples/). - -## Generating the index - -We use [grinder](https://pub.dev/packages/grinder) to run the build tasks: - -```bash -$ dart pub get -$ dart run grinder generate -``` - -This will generate the index into `./web` - -## Serving the index locally - -If you want to serve the index locally, you can use -[webdev](https://pub.dev/packages/webdev): - -```bash -$ dart pub global activate grinder -$ webdev serve -``` - -## Publishing the index - -You can build the complete index into a publishable directory using Grinder: - -```bash -$ dart run grinder build-release -``` - -This outputs the completely built index to `./public`. diff --git a/web/samples_index/analysis_options.yaml b/web/samples_index/analysis_options.yaml deleted file mode 100644 index 55e017eec..000000000 --- a/web/samples_index/analysis_options.yaml +++ /dev/null @@ -1,26 +0,0 @@ -include: package:lints/recommended.yaml - -analyzer: - exclude: - - lib/src/data.g.dart - language: - strict-casts: true - strict-inference: true - strict-raw-types: true - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_prefixed_library_names: true - prefer_final_in_for_each: true - prefer_single_quotes: true - test_types_in_equals: true - throw_in_finally: true - unawaited_futures: true - unnecessary_statements: true - use_enums: true - use_super_parameters: true diff --git a/web/samples_index/lib/browser.dart b/web/samples_index/lib/browser.dart deleted file mode 100644 index e4de0a262..000000000 --- a/web/samples_index/lib/browser.dart +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2020 The Flutter team. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file - -export 'src/search.dart'; diff --git a/web/samples_index/lib/samples_index.dart b/web/samples_index/lib/samples_index.dart deleted file mode 100644 index fd7130ee9..000000000 --- a/web/samples_index/lib/samples_index.dart +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2020 The Flutter team. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file - -import 'dart:io'; -import 'package:checked_yaml/checked_yaml.dart'; - -import 'src/data.dart'; - -export 'src/data.dart'; - -Future> getSamples() async { - var yamlFile = File('lib/src/samples.yaml'); - var contents = await yamlFile.readAsString(); - var index = checkedYamlDecode( - contents, (m) => m != null ? Index.fromJson(m) : null, - sourceUrl: yamlFile.uri); - if (index == null) throw ('unable to get load from ${yamlFile.uri}'); - return index.samples; -} diff --git a/web/samples_index/lib/src/carousel.dart b/web/samples_index/lib/src/carousel.dart deleted file mode 100644 index cea1c397c..000000000 --- a/web/samples_index/lib/src/carousel.dart +++ /dev/null @@ -1,250 +0,0 @@ -// Copyright 2020 The Flutter team. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file - -// TODO(kevmoo): https://github.com/flutter/samples/issues/2582 -// ignore: deprecated_member_use -import 'dart:html'; - -class Carousel { - final bool withArrowKeyControl; - - final Element container = querySelector('.slider-container')!; - final List slides = querySelectorAll('.slider-single'); - - late int currentSlideIndex; - late final int lastSlideIndex; - - late Element prevSlide, currentSlide, nextSlide; - - late num x0; - bool touched = false; - - Carousel.init({this.withArrowKeyControl = false}) { - lastSlideIndex = slides.length - 1; - currentSlideIndex = -1; - - // Remove container empty space when no images are available - if (lastSlideIndex == -1) { - container.classes.clear(); - return; - } - - // Skip carousel decoration when only one image is available - if (lastSlideIndex == 0) { - currentSlide = slides[currentSlideIndex + 1]; - currentSlide.classes.add('active'); - return; - } - - _hideSlides(); - _initBullets(); - _initArrows(); - _initGestureListener(); - - if (withArrowKeyControl) { - _initArrowKeyControl(); - } - - // Move to the first slide after init - // This is responsible for creating a smooth animation - Future.delayed(const Duration(milliseconds: 500)) - .then((value) => _slideRight()); - } - - void _hideSlides() { - for (final s in slides) { - s.classes.add('next-hidden'); - } - } - - void _initBullets() { - final bulletContainer = DivElement(); - bulletContainer.classes.add('bullet-container'); - - for (var i = 0; i < slides.length; i++) { - final bullet = DivElement(); - bullet.classes.add('bullet'); - bullet.id = 'bullet-index-$i'; - bullet.onClick.listen((e) => _goToIndexSlide(i)); - bulletContainer.append(bullet); - } - - container.append(bulletContainer); - } - - void _initArrows() { - final prevArrow = AnchorElement(); - final iPrev = DivElement(); - iPrev.classes.addAll(['fa', 'fa-chevron-left', 'fa-lg']); - prevArrow.classes.add('slider-left'); - prevArrow.append(iPrev); - prevArrow.onClick.listen((e) => _slideLeft()); - - final nextArrow = AnchorElement(); - final iNext = DivElement(); - iNext.classes.addAll(['fa', 'fa-chevron-right', 'fa-lg']); - nextArrow.classes.add('slider-right'); - nextArrow.append(iNext); - nextArrow.onClick.listen((e) => _slideRight()); - - container.append(prevArrow); - container.append(nextArrow); - } - - void _touchStartListener(TouchEvent e) { - x0 = e.changedTouches!.first.client.x; - touched = true; - } - - void _touchEndListener(TouchEvent e) { - if (touched) { - int dx = (e.changedTouches!.first.client.x - x0) as int; - - // dx==0 case is ignored - if (dx > 0 && currentSlideIndex > 0) { - _slideLeft(); - } else if (dx < 0 && currentSlideIndex < lastSlideIndex) { - _slideRight(); - } - touched = false; - } - } - - void _initGestureListener() { - container.onTouchStart.listen(_touchStartListener); - container.onTouchEnd.listen(_touchEndListener); - } - - void _updateBullets() { - final bullets = - querySelector('.bullet-container')!.querySelectorAll('.bullet'); - for (var i = 0; i < bullets.length; i++) { - bullets[i].classes.remove('active'); - if (i == currentSlideIndex) { - bullets[i].classes.add('active'); - } - } - _checkRepeat(); - } - - void _checkRepeat() { - var prevArrow = querySelector('.slider-left') as AnchorElement; - var nextArrow = querySelector('.slider-right') as AnchorElement; - - if (currentSlideIndex == slides.length - 1) { - slides[0].classes.add('hidden'); - slides[slides.length - 1].classes.remove('hidden'); - prevArrow.classes.remove('hidden'); - nextArrow.classes.add('hidden'); - } else if (currentSlideIndex == 0) { - slides[slides.length - 1].classes.add('hidden'); - slides[0].classes.remove('hidden'); - prevArrow.classes.add('hidden'); - nextArrow.classes.remove('hidden'); - } else { - slides[slides.length - 1].classes.remove('hidden'); - slides[0].classes.remove('hidden'); - prevArrow.classes.remove('hidden'); - nextArrow.classes.remove('hidden'); - } - } - - void _slideRight() { - if (currentSlideIndex < lastSlideIndex) { - currentSlideIndex++; - } else { - currentSlideIndex = 0; - } - - if (currentSlideIndex > 0) { - prevSlide = slides[currentSlideIndex - 1]; - } else { - prevSlide = slides[lastSlideIndex]; - } - - currentSlide = slides[currentSlideIndex]; - - if (currentSlideIndex < lastSlideIndex) { - nextSlide = slides[currentSlideIndex + 1]; - } else { - nextSlide = slides[0]; - } - - for (final e in slides) { - _removeSlideClasses([e]); - if (e.classes.contains('prev-hidden')) e.classes.add('next-hidden'); - if (e.classes.contains('prev')) e.classes.add('prev-hidden'); - } - - _removeSlideClasses([prevSlide, currentSlide, nextSlide]); - - prevSlide.classes.add('prev'); - currentSlide.classes.add('active'); - nextSlide.classes.add('next'); - - _updateBullets(); - } - - void _slideLeft() { - if (currentSlideIndex > 0) { - currentSlideIndex--; - } else { - currentSlideIndex = lastSlideIndex; - } - - if (currentSlideIndex < lastSlideIndex) { - nextSlide = slides[currentSlideIndex + 1]; - } else { - nextSlide = slides[0]; - } - - currentSlide = slides[currentSlideIndex]; - - if (currentSlideIndex > 0) { - prevSlide = slides[currentSlideIndex - 1]; - } else { - prevSlide = slides[lastSlideIndex]; - } - - for (final e in slides) { - _removeSlideClasses([e]); - if (e.classes.contains('next')) e.classes.add('next-hidden'); - if (e.classes.contains('next-hidden')) e.classes.add('prev-hidden'); - } - - _removeSlideClasses([prevSlide, currentSlide, nextSlide]); - - prevSlide.classes.add('prev'); - currentSlide.classes.add('active'); - nextSlide.classes.add('next'); - - _updateBullets(); - } - - void _goToIndexSlide(int index) { - final sliding = - (currentSlideIndex < index) ? () => _slideRight() : () => _slideLeft(); - while (currentSlideIndex != index) { - sliding(); - } - } - - void _removeSlideClasses(List slides) { - for (final s in slides) { - s.classes - .removeAll(['prev-hidden', 'prev', 'active', 'next', 'next-hidden']); - } - } - - void _initArrowKeyControl() { - Element.keyUpEvent.forTarget(document.body).listen((e) { - if (e.keyCode == KeyCode.LEFT && currentSlideIndex > 0) { - _slideLeft(); - } - if (e.keyCode == KeyCode.RIGHT && currentSlideIndex < lastSlideIndex) { - _slideRight(); - } - }); - } -} diff --git a/web/samples_index/lib/src/data.dart b/web/samples_index/lib/src/data.dart deleted file mode 100644 index 34706170b..000000000 --- a/web/samples_index/lib/src/data.dart +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright 2020 The Flutter team. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file - -/// Defines the data types for this project. -library; - -import 'package:json_annotation/json_annotation.dart'; -import 'package:path/path.dart' as path; -import 'package:samples_index/src/util.dart' as util; - -part 'data.g.dart'; - -/// The full list of samples -@JsonSerializable( - // Use anyMap and checked for more useful YAML parsing errors. See - // package:checked_yaml docs for details. - anyMap: true, - checked: true) -class Index { - final List samples; - - Index(this.samples); - - factory Index.fromJson(Map json) => _$IndexFromJson(json); - - Map toJson() => _$IndexToJson(this); -} - -/// A sample to be displayed in the app. -@JsonSerializable(anyMap: true, checked: true) -class Sample { - /// The name of the sample. - final String name; - - /// The author of the sample. Typically "Flutter" - final String? author; - - /// Screenshots of the sample. At least 1 screenshot is required. - final List screenshots; - - /// A link to the source code. - final String source; - - /// A link to this sample running in the browser. - final String? web; - - /// 3-5 sentences describing the sample. - final String description; - - /// The difficulty level. Values are either 'beginner', 'intermediate', or - /// 'advanced'. - final String? difficulty; - - /// List of widgets or Flutter APIs used by the sample. e.g. "AnimatedBuilder" - /// or "ChangeNotifier". - final List widgets; - - /// List of packages or Flutter libraries used by the sample. third-party - /// packages. - final List packages; - - /// Arbitrary tags to associate with this sample. - final List tags; - - /// Supported platforms. Values are either 'ios', 'android', 'desktop', and - /// 'web' - final List platforms; - - /// The type of the sample. Supported values are either 'sample' or - /// 'demo'. - final String type; - - /// The date this sample was created. - final DateTime? date; - - /// The Flutter channel this sample runs on. Either 'stable', 'dev' or - /// 'master'. - final String? channel; - - Sample({ - required this.name, - this.author = 'Flutter', - required this.screenshots, - required this.source, - this.web, - required this.description, - this.difficulty = 'beginner', - this.widgets = const [], - this.packages = const [], - this.tags = const [], - this.platforms = const [], - required this.type, - this.date, - this.channel, - }); - - factory Sample.fromJson(Map json) => _$SampleFromJson(json); - - Map toJson() => _$SampleToJson(this); - - String get thumbnail { - var screenshotUrl = screenshots.first.url; - var prefix = path.dirname(screenshotUrl); - var filename = path.basenameWithoutExtension(screenshotUrl); - return path.join(prefix, '${filename}_thumb.png'); - } - - String get searchAttributes { - var buf = StringBuffer(); - buf.write(name.toLowerCase()); - buf.write(' '); - - for (final tag in tags) { - buf.write('tag:${tag.toLowerCase()} '); - - // Allow tags to be searched without the tag: prefix - buf.write('${tag.toLowerCase()} '); - } - - for (final platform in platforms) { - buf.write('platform:$platform '); - - // Allow platforms to be searched without the tag: prefix - buf.write('$platform '); - } - - for (final widget in widgets) { - buf.write('widget:$widget '); - } - - for (final package in packages) { - buf.write('package:$package '); - } - - buf.write('type:$type '); - - return buf.toString().trim(); - } - - String get filename { - var nameWithoutChars = name.replaceAll(RegExp(r'[^A-Za-z0-9\-\_\ ]'), ''); - var nameWithUnderscores = nameWithoutChars.replaceAll(' ', '_'); - var snake = util.snakeCase(nameWithUnderscores); - var s = snake.replaceAll('__', '_'); - return s; - } - - String get shortDescription { - if (description.length < 64) { - return description; - } - return '${description.substring(0, 64)}...'; - } -} - -/// A screenshot of a sample -@JsonSerializable(anyMap: true, checked: true) -class Screenshot { - final String url; - final String alt; - - Screenshot(this.url, this.alt); - - factory Screenshot.fromJson(Map json) => - _$ScreenshotFromJson(json); - - Map toJson() => _$ScreenshotToJson(this); -} diff --git a/web/samples_index/lib/src/data.g.dart b/web/samples_index/lib/src/data.g.dart deleted file mode 100644 index 752603bad..000000000 --- a/web/samples_index/lib/src/data.g.dart +++ /dev/null @@ -1,107 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'data.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -Index _$IndexFromJson(Map json) => $checkedCreate( - 'Index', - json, - ($checkedConvert) { - final val = Index( - $checkedConvert( - 'samples', - (v) => (v as List) - .map((e) => Sample.fromJson(e as Map)) - .toList()), - ); - return val; - }, - ); - -Map _$IndexToJson(Index instance) => { - 'samples': instance.samples, - }; - -Sample _$SampleFromJson(Map json) => $checkedCreate( - 'Sample', - json, - ($checkedConvert) { - final val = Sample( - name: $checkedConvert('name', (v) => v as String), - author: $checkedConvert('author', (v) => v as String? ?? 'Flutter'), - screenshots: $checkedConvert( - 'screenshots', - (v) => (v as List) - .map((e) => Screenshot.fromJson(e as Map)) - .toList()), - source: $checkedConvert('source', (v) => v as String), - web: $checkedConvert('web', (v) => v as String?), - description: $checkedConvert('description', (v) => v as String), - difficulty: - $checkedConvert('difficulty', (v) => v as String? ?? 'beginner'), - widgets: $checkedConvert( - 'widgets', - (v) => - (v as List?)?.map((e) => e as String).toList() ?? - const []), - packages: $checkedConvert( - 'packages', - (v) => - (v as List?)?.map((e) => e as String).toList() ?? - const []), - tags: $checkedConvert( - 'tags', - (v) => - (v as List?)?.map((e) => e as String).toList() ?? - const []), - platforms: $checkedConvert( - 'platforms', - (v) => - (v as List?)?.map((e) => e as String).toList() ?? - const []), - type: $checkedConvert('type', (v) => v as String), - date: $checkedConvert( - 'date', (v) => v == null ? null : DateTime.parse(v as String)), - channel: $checkedConvert('channel', (v) => v as String?), - ); - return val; - }, - ); - -Map _$SampleToJson(Sample instance) => { - 'name': instance.name, - 'author': instance.author, - 'screenshots': instance.screenshots, - 'source': instance.source, - 'web': instance.web, - 'description': instance.description, - 'difficulty': instance.difficulty, - 'widgets': instance.widgets, - 'packages': instance.packages, - 'tags': instance.tags, - 'platforms': instance.platforms, - 'type': instance.type, - 'date': instance.date?.toIso8601String(), - 'channel': instance.channel, - }; - -Screenshot _$ScreenshotFromJson(Map json) => $checkedCreate( - 'Screenshot', - json, - ($checkedConvert) { - final val = Screenshot( - $checkedConvert('url', (v) => v as String), - $checkedConvert('alt', (v) => v as String), - ); - return val; - }, - ); - -Map _$ScreenshotToJson(Screenshot instance) => - { - 'url': instance.url, - 'alt': instance.alt, - }; diff --git a/web/samples_index/lib/src/samples.yaml b/web/samples_index/lib/src/samples.yaml deleted file mode 100644 index baf533b2c..000000000 --- a/web/samples_index/lib/src/samples.yaml +++ /dev/null @@ -1,513 +0,0 @@ -samples: - - name: Material 3 - author: Flutter - screenshots: - - url: images/material_3_components.png - alt: Components tab of the Material 3 demo - - url: images/material_3_color.png - alt: Colors tab of the Material 3 demo - - url: images/material_3_typography.png - alt: Typography tab of the Material 3 demo - - url: images/material_3_elevation.png - alt: Elevation tab of the Material 3 demo - - url: images/material_3_green.png - alt: Elevation tab of the Material 3 demo with seed color of green - source: https://github.com/flutter/samples/tree/main/material_3_demo - description: > - Showcases Material 3 features in the Flutter Material library. - These features include updated components, typography, color system and elevation support. - difficulty: beginner - widgets: - - Theme - - TextButton - - ElevatedButton - - OutlinedButton - - Text - - Card - - AppBar - packages: [ ] - tags: [ "material", "design", "gallery" ] - platforms: [ "ios", "android", "web", "windows", "macos", "linux" ] - type: demo - web: web/material_3_demo - - - name: Rich Text Editor - author: Flutter - screenshots: - - url: images/simple_editor_active.png - alt: Advanced text editing with activity - - url: images/simple_editor_initial.png - alt: Advanced text editing in initial state - source: https://github.com/flutter/samples/tree/main/simplistic_editor - description: > - This is a fancy text editor sample which shows how to consume fine-grain - text editing and selection details from the framework's TextEditingDeltas - APIs. - difficulty: advanced - widgets: - - TextInput - packages: [] - tags: ["demo", "text"] - platforms: ["ios", "android", "web", "windows", "macos", "linux"] - type: demo - web: web/simplistic_editor - - - name: Web Embedding - author: Flutter and Angular - screenshots: - - url: images/web_embedding1.png - alt: A Flutter app embedded in an Angular app - - url: images/web_embedding2.png - alt: A Flutter app embedded in an Angular app - source: https://github.com/flutter/samples/tree/main/web_embedding - description: > - An example app showing how to embed Flutter in a web application using Angular - difficulty: advanced - widgets: [] - packages: [] - platforms: ['web'] - tags: ['demo', 'web', 'add-to-app', 'embedding'] - web: https://flutter-angular.web.app/ - type: demo - - - name: Add to App - author: Flutter - screenshots: - - url: images/add_to_app1.png - alt: Add_to_app screenshot - - url: images/add_to_app2.png - alt: Add_to_app screenshot - source: https://github.com/flutter/samples/tree/main/add_to_app - description: > - Android and iOS projects that each import a standalone Flutter module. - difficulty: advanced - widgets: - - WidgetsFlutterBinding - - MethodChannel - packages: - - flutter/material - - flutter/services - - provider - tags: ['advanced', 'sample', 'add-to-app', 'android', 'ios', 'native', 'embedding'] - platforms: ['ios', 'android'] - type: sample - - - name: Code Sharing - author: Flutter - screenshots: - - url: images/code_sharing.jpg - alt: Counter app communicating with server - source: https://github.com/flutter/samples/tree/main/code_sharing - description: > - Demonstrates simple way to share business logic between a Flutter app and - a server running Dart. - difficulty: intermediate - packages: - - freezed - - shelf - tags: ['intermediate', 'sample', 'code-sharing', 'dart', 'server'] - platforms: ['android', 'ios', 'linux', 'macos', 'web', 'windows'] - type: sample - - - name: Animations - author: Flutter - screenshots: - - url: images/animations1.png - alt: Animations sample screenshot - - url: images/animations2.png - alt: Animations sample screenshot - - url: images/animations3.png - alt: Animations sample screenshot - source: https://github.com/flutter/samples/tree/main/animations - description: > - Sample apps that showcasing Flutter's animation features. - difficulty: advanced - widgets: - - AnimatedContainer - - PageRouteBuilder - - AnimationController - - SingleTickerProviderStateMixin - - Tween - - AnimatedBuilder - - TweenSequence - - TweenSequenceItem - packages: - - flutter/material - tags: ['intermediate', 'sample', 'animation'] - platforms: ['ios', 'android', 'web'] - type: sample - web: web/animations - - - name: Flutter Maps Firestore - author: Flutter - screenshots: - - url: images/flutter_maps_firestore1.png - alt: Flutter maps firestore screenshot - - url: images/flutter_maps_firestore2.png - alt: Flutter maps firestore screenshot - source: https://github.com/flutter/samples/tree/main/flutter_maps_firestore - description: > - A Flutter sample app that shows the end product of the Cloud Next '19 talk - Build Mobile Apps With Flutter and Google Maps. - difficulty: advanced - widgets: - - GoogleMap - packages: - - flutter/material - - cloud_firestore - - google_maps_flutter - - google_maps_webservice - tags: ['intermediate', 'sample', 'firebase', 'maps'] - platforms: ['ios', 'android'] - type: sample - - - name: Isolate Example - author: Flutter - screenshots: - - url: images/isolate1.png - alt: Isolate example screenshot - - url: images/isolate2.png - alt: Isolate example screenshot - - url: images/isolate3.png - alt: Isolate example screenshot - source: https://github.com/flutter/samples/tree/main/isolate_example - description: > - A sample application that demonstrate best practices when using - isolates. - difficulty: intermediate - widgets: - - FutureBuilder - - AnimationController - packages: - - dart:isolate - - dart:math - tags: ['intermediate', 'sample', 'isolates', 'concurrency'] - platforms: ['ios', 'android'] - type: sample - - - name: Place Tracker - author: Flutter - screenshots: - - url: images/place_tracker1.png - alt: Place Tracker screenshot - - url: images/place_tracker2.png - alt: Place Tracker screenshot - - url: images/place_tracker3.png - alt: Place Tracker screenshot - - url: images/place_tracker4.png - alt: Place Tracker screenshot - source: https://github.com/flutter/samples/tree/main/place_tracker - description: > - A sample place tracking app that uses the google_maps_flutter plugin. Keep - track of your favorite places, places you've visited, and places you want - to go. View details about these places, show them on a map, and get - directions to them. - difficulty: intermediate - widgets: - - GoogleMap - packages: - - google_maps_flutter - tags: ['intermediate', 'sample', 'json', 'serialization'] - platforms: ['android'] - type: sample - - - name: Platform Design - author: Flutter - screenshots: - - url: images/platform_design1.png - alt: Platform Design screenshot - - url: images/platform_design2.png - alt: Platform Design screenshot - - url: images/platform_design3.png - alt: Platform Design screenshot - - url: images/platform_design4.png - alt: Platform Design screenshot - - url: images/platform_design5.png - alt: Platform Design screenshot - - url: images/platform_design6.png - alt: Platform Design screenshot - - url: images/platform_design7.png - alt: Platform Design screenshot - source: https://github.com/flutter/samples/tree/main/platform_design - description: > - A Flutter app that maximizes application code reuse while adhering to - different design patterns on Android and iOS - difficulty: advanced - widgets: - - TargetPlatform - packages: - - flutter/material - - flutter/cupertino - tags: ['advanced', 'sample', 'ios'] - platforms: ['ios', 'android'] - type: sample - - - name: Platform View Swift - author: Flutter - screenshots: - - url: images/platform_view_swift1.png - alt: Platform View Swift screenshot - - url: images/platform_view_swift2.png - alt: Platform View Swift screenshot - source: https://github.com/flutter/samples/tree/main/platform_view_swift - description: > - A Flutter sample app that combines a native iOS UIViewController with a - full-screen Flutter view. - difficulty: intermediate - widgets: - - MethodChannel - packages: - - flutter/material - - flutter/services - tags: ['advanced', 'sample', 'ios'] - platforms: ['ios'] - type: sample - - - name: Infinite List - author: Flutter - screenshots: - - url: images/infinite_list.png - alt: Infinite List screenshot - source: https://github.com/flutter/samples/tree/main/infinite_list - description: > - A Flutter sample app that shows an implementation of the "infinite list" UX pattern. - That is, a list is shown to the user as if it was continuous although it is internally - paginated. This is a common feature of mobile apps, from shopping catalogs - through search engines to social media clients. - difficulty: intermediate - widgets: - - Selector - - AppBar - - ListTile - - ListView - packages: - - provider - - meta - tags: ['sample', 'material', 'design', 'android', 'ios'] - platforms: ['ios', 'android'] - type: sample - - - name: IOS App Clip - author: Flutter - screenshots: - - url: images/ios_app_clip.png - alt: IOS App Clip screenshot - source: https://github.com/flutter/samples/tree/main/ios_app_clip - description: > - A Flutter sample app that shows the demonstrating integration with iOS 14's App Clip, - the App Clip target is rendered by Flutter and uses a plugin. - difficulty: intermediate - widgets: - - CupertinoApp - - AppBar - - FlutterLogo - packages: - - device_info - tags: ['sample', 'Device Info', 'ios'] - platforms: ['ios'] - type: sample - - - name: Testing App - author: Flutter - screenshots: - - url: images/testing_app1.png - alt: Testing App screenshot - - url: images/testing_app2.png - alt: Testing App screenshot - source: https://github.com/flutter/samples/tree/main/testing_app - description: > - A Flutter sample app that shows different types of testing in Flutter. - difficulty: intermediate - widgets: - - AppBar - - ListTile - - ListView - - Snackbar - packages: - - provider - tags: ['sample', 'material', 'android', 'ios'] - platforms: ['ios', 'android'] - type: sample - - - name: Provider Shopper - author: Flutter - screenshots: - - url: images/provider_shopper1.png - alt: Provider Shopper screenshot - - url: images/provider_shopper2.png - alt: Provider Shopper screenshot - - url: images/provider_shopper3.png - alt: Provider Shopper screenshot - source: https://github.com/flutter/samples/tree/main/provider_shopper - description: > - A Flutter sample app that shows a state management approach using the Provider package. - difficulty: intermediate - widgets: - - Provider - - MultiProvider - - ChangeNotifier - packages: - - provider - tags: ['intermediate', 'sample', 'provider'] - platforms: ['ios', 'android', 'web'] - type: sample - web: web/provider_shopper - - - name: Web Dashboard - author: Flutter - screenshots: - - url: images/web_dashboard1.png - alt: Web Dashboard screenshot - - url: images/web_dashboard2.png - alt: Web Dashboard screenshot - - url: images/web_dashboard3.png - alt: Web Dashboard screenshot - source: https://github.com/flutter/samples/tree/main/experimental/web_dashboard - description: > - A dashboard app that displays daily entries. Demonstrates AdaptiveScaffold and NavigationRail. Showcases how to - use Firebase, but uses a mock backend by default. - difficulty: advanced - widgets: - - AdaptiveScaffold - - NavigationRail - - FutureBuilder - - StreamBuilder - packages: - - firebase - tags: ['intermediate', 'sample', 'firebase'] - platforms: ['ios', 'android', 'web'] - type: sample - web: web/web_dashboard - - - name: Form App - author: Flutter - screenshots: - - url: images/form_app1.png - alt: Form App screenshot - - url: images/form_app2.png - alt: Form App screenshot - - url: images/form_app3.png - alt: Form App screenshot - source: https://github.com/flutter/samples/tree/main/form_app - description: > - A Flutter sample app that shows how to use Forms. - difficulty: intermediate - widgets: - - Form - packages: [] - tags: ['intermediate', 'sample', 'forms'] - platforms: ['ios', 'android', 'web'] - type: sample - web: web/form_app - - - name: Navigation and Routing - author: Flutter - screenshots: - - url: images/navigation_and_routing1.png - alt: Navigation and Routing screenshot - - url: images/navigation_and_routing2.png - alt: Navigation and Routing screenshot - - url: images/navigation_and_routing3.png - alt: Navigation and Routing screenshot - - url: images/navigation_and_routing4.png - alt: Navigation and Routing screenshot - source: https://github.com/flutter/samples/tree/main/navigation_and_routing - description: > - A Flutter sample app that shows how to use how to use the Router API to - handle common navigation scenarios. - difficulty: advanced - widgets: - - Router - packages: [] - tags: ['advanced', 'sample', 'navigation', 'router'] - platforms: ['ios', 'android', 'web'] - type: sample - web: web/navigation_and_routing - - - name: Photo Search app - author: Flutter - screenshots: - - url: images/desktop_photo_search-fluent_ui.png - alt: Desktop Photo Search with FluentUI widgets - - url: images/desktop_photo_search-material.png - alt: Desktop Photo Search with Material widgets - source: https://github.com/flutter/samples/tree/main/desktop_photo_search - description: > - This is the Photo Search app, built out with two different widget sets, - `material` shows the Photo Search app built with Material widgets, and - `fluent_ui` shows the Photo Search app built with Fluent UI widgets. - difficulty: medium - widgets: [] - packages: - - built_collection - - built_value - - file_selector - - fluent_ui - - flutter/material - - provider - - url_launcher - tags: ['desktop', 'rest-api'] - platforms: ['windows', 'macos', 'linux'] - type: sample - - - name: Slide Puzzle - author: Very Good Ventures - screenshots: - - url: images/slide_puzzle1.png - alt: Slide Puzzle screenshot - source: https://github.com/VGVentures/slide_puzzle - description: > - A slide puzzle built for Flutter Challenge. - difficulty: advanced - widgets: [] - packages: [] - platforms: ['web'] - tags: ['demo', 'game'] - type: demo - - - name: Game Template - author: Flutter - screenshots: - - url: images/loading_screen.png - alt: Loading screen - - url: images/level_selector.png - alt: Level selection screen - source: https://github.com/flutter/samples/tree/main/game_template - description: > - This is a game template that shows how to build much of the dressing - around an actual game. The game itself is very simple - the value in this - sample is everything around the game. - difficulty: beginner - widgets: - - GoRouter - - AppLifecycleObserver - packages: - - audioplayers - - firebase_crashlytics - - games_services - - go_router - - google_mobile_ads - - in_app_purchase - - logging - - provider - - shared_preferences - tags: ["games", "firebase", "ads", "crashlytics", "routing"] - platforms: ["ios", "android", "web", "windows", "macos", "linux"] - type: demo - web: web/game_template - - - name: Dice - author: Jaime Blasco - screenshots: - - url: images/dice.png - alt: Dice screenshot - source: https://github.com/jamesblasco/zflutter/blob/master/zflutter/example/lib/examples/dice/dice.dart - description: > - A demo of 3d animation using dice - difficulty: advanced - widgets: [] - packages: [] - platforms: ['web'] - tags: ['demo', 'animation'] - web: https://z.flutter.gallery/#/dice - type: demo diff --git a/web/samples_index/lib/src/search.dart b/web/samples_index/lib/src/search.dart deleted file mode 100644 index 7f57e7794..000000000 --- a/web/samples_index/lib/src/search.dart +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2020 The Flutter team. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file - -bool matchesQuery(String query, String sampleAttributes) { - if (query.isEmpty) { - return true; - } - - var queryWords = query.toLowerCase().split(' ') - ..removeWhere((s) => s.isEmpty); - var attributes = sampleAttributes.toLowerCase().split(' ') - ..removeWhere((s) => s.isEmpty); - - // Test for type filter - // This will check whether a type parameter is present in the - // search query, and return false if the self type mismatches - // the query type - for (final word in queryWords) { - if ((word.contains('type:') && !attributes.contains(word)) || - (word.contains('platform:') && !attributes.contains('type:demo'))) { - return false; - } - } - - // Test for exact matches - if (attributes.contains(query)) { - return true; - } - - // Test for exact matches for keywords - var matches = 0; - for (final word in queryWords) { - if (attributes.contains(word)) { - matches++; - } - if (matches == queryWords.length) { - return true; - } - } - - // Test for queries whose keywords are a substring of any attribute - // e.g. searching "kitten tag:cats" is a match for a sample with the - // attributes "kittens tag:cats" - matches = 0; - for (final attribute in attributes) { - for (final queryWord in queryWords) { - if (attribute.startsWith(queryWord)) { - matches++; - } - } - // Only return true if each search term was matched - if (matches == queryWords.length) { - return true; - } - } - - return false; -} - -Map parseHash(String hash) => - Uri.parse(hash.substring(hash.indexOf('#') + 1)).queryParameters; - -String formatHash(Map parameters) => - Uri().replace(queryParameters: parameters).toString(); - -String searchQueryFromParams(Map params) { - var buf = StringBuffer(); - if (params.containsKey('search')) { - buf.write(params['search']); - } - if (params.containsKey('type')) { - if (buf.isNotEmpty) buf.write(' '); - var value = params['type']; - if (value != null) buf.write('type:$value'); - } - if (params.containsKey('platform')) { - if (buf.isNotEmpty) buf.write(' '); - var value = params['platform']; - if (value != null) buf.write('platform:$value'); - } - - return buf.toString(); -} diff --git a/web/samples_index/lib/src/templates.dart b/web/samples_index/lib/src/templates.dart deleted file mode 100644 index 1e3c22d02..000000000 --- a/web/samples_index/lib/src/templates.dart +++ /dev/null @@ -1,233 +0,0 @@ -// Copyright 2020 The Flutter team. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -import 'dart:convert'; - -import 'data.dart'; -import 'util.dart' as util; - -String _escapeAttribute(String s) => - const HtmlEscape(HtmlEscapeMode.attribute).convert(s); -String _escapeElement(String s) => - const HtmlEscape(HtmlEscapeMode.element).convert(s); - -String description(Sample sample) => ''' - - -$_descriptionHeader -${_descriptionPage(sample)} -$_footer - -'''; - -String index(List samples) => ''' - - -$_indexHeader -${_indexBody(samples)} -$_footer - - '''; - -const String _indexHeader = ''' - - - Flutter samples - - - - - - - $_googleAnalytics - -'''; - -const String _descriptionHeader = ''' - - - Flutter samples - - - - - - - - $_googleAnalytics - -'''; - -const String _navbar = ''' - -'''; - -String _footer = ''' - -'''; - -String _indexBody(List samples) => ''' - -
- ${util.indent(_navbar, 4)} -
-
-

All Samples

-

A curated list of Flutter samples and apps

-
-
- -
-
-
-
-
-
- - All - -
-
-
- - Sample - -
-
-
- - Web Demos - -
-
-
-
-
-
- ${util.indent(_indexCards(samples), 6)} -
-
-
- -'''; - -String _backgroundImage(String url) => - _escapeAttribute('background-image: url(\'$url\');'); -String _indexCards(List samples) => samples.map(_indexCard).join(); -String _indexCard(Sample sample) => ''' -
-
-
-
${_escapeElement(sample.type)}
-
-

${_escapeElement(sample.name)}

-
-
${sample.shortDescription}
-
-
-'''; - -String _descriptionPage(Sample sample) => ''' - -
- ${util.indent(_navbar, 4)} -
-
-

${sample.name}

-
${sample.type}
-
-

By ${sample.author}

-
-
- ${util.indent(_descriptionButtons(sample), 6)} -
-
-
- local_offer - Tags -
-
- ${util.indent(_tags(sample), 8)} -
-
-
-
-
- ${util.indent(_descriptionScreenshots(sample), 4)} -
-
-
- ${util.indent(_descriptionText(sample), 4)} -
-
-
- -'''; - -String _descriptionButtons(Sample sample) { - var buf = StringBuffer(); - var sampleLink = sample.web; - if (sampleLink != null && sampleLink.isNotEmpty) { - buf.write( - ''''''); - } - - if (sample.type == 'app' || - sample.type == 'sample' || - sample.type == 'demo') { - buf.write( - ''''''); - } - return buf.toString(); -} - -String _tags(Sample sample) { - var buf = StringBuffer(); - for (final tag in sample.tags) { - buf.write('$tag\n'); - } - return buf.toString(); -} - -String _descriptionScreenshots(Sample sample) { - var buf = StringBuffer(); - for (final screenshot in sample.screenshots) { - buf.write( - '''
${screenshot.alt}
\n'''); - } - return buf.toString(); -} - -String _descriptionText(Sample sample) { - return '

${sample.description}

'; -} - -const String _googleAnalytics = """ - - """; diff --git a/web/samples_index/lib/src/util.dart b/web/samples_index/lib/src/util.dart deleted file mode 100644 index 9a9c5e5ee..000000000 --- a/web/samples_index/lib/src/util.dart +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2020 The Flutter team. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file - -import 'dart:convert'; - -String indent(String content, int spaces) => - LineSplitter.split(content).join('\n${' ' * spaces}'); - -String kebabCase(String input) => _fixCase(input, '-'); - -String snakeCase(String input) => _fixCase(input, '_'); - -final _upperCase = RegExp('[A-Z]'); - -String pascalCase(String input) { - if (input.isEmpty) { - return ''; - } - - return input[0].toUpperCase() + input.substring(1); -} - -String _fixCase(String input, String separator) => - input.replaceAllMapped(_upperCase, (match) { - var group = match.group(0); - if (group == null) return input; - var lower = group.toLowerCase(); - - if (match.start > 0) { - lower = '$separator$lower'; - } - - return lower; - }); diff --git a/web/samples_index/pubspec.yaml b/web/samples_index/pubspec.yaml deleted file mode 100644 index 92d065156..000000000 --- a/web/samples_index/pubspec.yaml +++ /dev/null @@ -1,40 +0,0 @@ -name: samples_index -description: A visual index of Flutter samples. -homepage: https://github.com/flutter/samples/tree/main/web/samples_index -version: 0.0.1 -publish_to: none - -environment: - sdk: ^3.5.0 - -dependencies: - checked_yaml: ^2.0.3 - json_annotation: ^4.8.1 - mdc_web: ^0.6.0 - path: ^1.8.3 - sass_builder: ^2.2.1 - web: ^1.1.0 - yaml: ^3.1.2 - -dev_dependencies: - build: ^2.4.0 - build_runner: ^2.4.2 - build_web_compilers: ^4.0.3 - grinder: ^0.9.4 - image: ^4.1.3 - json_serializable: ^6.6.2 - lints: ^5.0.0 - test: ^1.24.2 - -# package:mdc_web needs to upgrade the version of material-components-web 12.0.0 -# or above, which includes this fix for the division operator: - -# https://github.com/material-components/material-components-web/pull/7158 -# -# Until then, dart-sass produces a warning that this operator is being removed -# in favor of calc(). -# -# See this issue for details: -# https://github.com/dart-lang/dart-pad/issues/2388 -dependency_overrides: - sass: ^1.62.0 \ No newline at end of file diff --git a/web/samples_index/test/samples_index_test.dart b/web/samples_index/test/samples_index_test.dart deleted file mode 100644 index e7eda6779..000000000 --- a/web/samples_index/test/samples_index_test.dart +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright 2020 The Flutter team. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file - -import 'dart:io'; - -import 'package:checked_yaml/checked_yaml.dart'; -import 'package:samples_index/browser.dart'; -import 'package:samples_index/samples_index.dart'; -import 'package:test/test.dart'; - -void main() { - group('YAML', () { - test('parsing', () async { - var file = File('test/yaml/single.yaml'); - var contents = await file.readAsString(); - expect(contents, isNotEmpty); - - var index = checkedYamlDecode( - contents, (m) => m != null ? Index.fromJson(m) : null, - sourceUrl: file.uri); - if (index == null) { - throw ('unable to load YAML from $file'); - } - expect(index.samples, isNotEmpty); - - var sample = index.samples.first; - expect(sample, isNotNull); - expect(sample.name, 'Kittens'); - expect(sample.screenshots, hasLength(2)); - expect(sample.source, 'https://github.com/johnpryan/kittens'); - expect(sample.description, 'A sample kitten app'); - expect(sample.difficulty, 'beginner'); - expect(sample.widgets, hasLength(2)); - expect(sample.widgets.first, 'AnimatedBuilder'); - expect(sample.packages, hasLength(2)); - expect(sample.packages.first, 'json_serializable'); - expect(sample.tags, hasLength(3)); - expect(sample.tags[1], 'kittens'); - expect(sample.platforms, hasLength(3)); - expect(sample.type, 'sample'); - expect(sample.date, DateTime.parse('2019-12-15T02:59:43.1Z')); - expect(sample.channel, 'stable'); - }); - }); - - group('searching', () { - test('search attributes', () async { - var file = File('test/yaml/single.yaml'); - var contents = await file.readAsString(); - expect(contents, isNotEmpty); - - var index = checkedYamlDecode( - contents, (m) => m != null ? Index.fromJson(m) : null, - sourceUrl: file.uri); - if (index == null) { - throw ('unable to load YAML from $file'); - } - var sample = index.samples.first; - expect( - sample.searchAttributes.split(' '), - containsAll(const [ - 'kittens', - 'tag:beginner', - 'tag:kittens', - 'tag:cats', - - // Verify tags are searchable without the prefix - 'beginner', - 'kittens', - 'cats', - - 'platform:web', - 'platform:ios', - 'platform:android', - - // Verify platforms are searchable without the prefix - 'web', - 'ios', - 'android', - - 'widget:AnimatedBuilder', - 'widget:FutureBuilder', - 'package:json_serializable', - 'package:path', - - 'type:sample', - ])); - }); - - test('matchesQuery', () { - var attributes = 'kittens ' - 'tag:beginner ' - 'tag:kittens ' - 'tag:cats ' - 'platform:web ' - 'platform:ios ' - 'platform:android ' - 'widget:AnimatedBuilder ' - 'widget:FutureBuilder ' - 'package:json_serializable ' - 'package:path ' - 'type:sample'; - - // Test if various queries match these attributes - expect(matchesQuery('foo', attributes), false); - expect(matchesQuery('Foo', attributes), false); - expect(matchesQuery('kittens', attributes), true); - expect(matchesQuery('Kittens', attributes), true); - expect(matchesQuery('tag:cats', attributes), true); - expect(matchesQuery('tag:dogs', attributes), false); - expect(matchesQuery('package:path', attributes), true); - - // Test if partial queries match these attributes - expect(matchesQuery('kitten', attributes), true); - - // Test if multiple keywords match - expect(matchesQuery('kittens tag:cats', attributes), true); - expect(matchesQuery('kitten tag:cats', attributes), true); - expect(matchesQuery('tag:beginner dogs', attributes), false); - expect(matchesQuery('asdf ', attributes), false); - - // Test if queries match by type - expect(matchesQuery('type:sample', attributes), true); - expect(matchesQuery('type:demo', attributes), false); - expect(matchesQuery('kittens type:demo', attributes), false); - }); - }); - - group('Hash parameters', () { - test('can be parsed', () { - expect(parseHash('#?search=kittens&platform=web'), - containsPair('search', 'kittens')); - expect(parseHash('#?search=kittens&platform=web'), - containsPair('platform', 'web')); - expect(parseHash('#?type=sample'), containsPair('type', 'sample')); - expect(parseHash('#?type=demo'), containsPair('type', 'demo')); - }); - - test('can be set', () { - expect( - formatHash({ - 'search': 'kittens', - 'platform': 'web', - }), - equals('?search=kittens&platform=web')); - }); - - test('creates search attributes', () { - expect( - searchQueryFromParams({ - 'search': 'kittens', - 'platform': 'web', - 'type': 'sample', - }), - equals('kittens type:sample platform:web')); - expect( - searchQueryFromParams({ - 'search': 'kittens', - }), - equals('kittens')); - expect(searchQueryFromParams({}), equals('')); - }); - }); -} diff --git a/web/samples_index/test/yaml/bad.yaml b/web/samples_index/test/yaml/bad.yaml deleted file mode 100644 index f40769e08..000000000 --- a/web/samples_index/test/yaml/bad.yaml +++ /dev/null @@ -1,27 +0,0 @@ -samples: - # Bad type, should be string, but it's a number. - - name: 42 - screenshots: - - url: https://placekitten.com/500/500 - alt: a kitten - - url: https://placekitten.com/400/400 - alt: another kitten - source: http://github.com/johnpryan/kittens - description: A sample kitten app - difficulty: beginner - widgets: - - AnimatedBuilder - - FutureBuilder - packages: - - json_serializable - - path - tags: ['beginner', 'kittens', 'cats'] - platforms: ['web', 'ios', 'android'] - links: - - text: inspiration - href: https://apps.apple.com/us/app/neko-atsume-kitty-collector/id923917775 - - text: author - href: http://jpryan.me - type: sample # sample or app - date: 2019-12-15T02:59:43.1Z - channel: stable diff --git a/web/samples_index/test/yaml/single.yaml b/web/samples_index/test/yaml/single.yaml deleted file mode 100644 index ad298dd6b..000000000 --- a/web/samples_index/test/yaml/single.yaml +++ /dev/null @@ -1,21 +0,0 @@ -samples: - - name: Kittens - screenshots: - - url: https://placekitten.com/500/500 - alt: a kitten - - url: https://placekitten.com/400/400 - alt: another kitten - source: https://github.com/johnpryan/kittens - description: A sample kitten app - difficulty: beginner - widgets: - - AnimatedBuilder - - FutureBuilder - packages: - - json_serializable - - path - tags: ['beginner', 'kittens', 'cats'] - platforms: ['web', 'ios', 'android'] - type: sample # sample or app - date: 2019-12-15T02:59:43.1Z - channel: stable diff --git a/web/samples_index/tool/grind.dart b/web/samples_index/tool/grind.dart deleted file mode 100644 index db585ae61..000000000 --- a/web/samples_index/tool/grind.dart +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright 2020 The Flutter team. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file - -import 'dart:io'; - -import 'package:grinder/grinder.dart'; -import 'package:image/image.dart' as image; -import 'package:path/path.dart' as path; -import 'package:samples_index/samples_index.dart'; -import 'package:samples_index/src/templates.dart' as templates; - -Future main(List args) => grind(args); - -@Task('Run tests in the VM') -Future testCli() async => - await TestRunner().testAsync(platformSelector: 'vm'); - -@Task() -void analyze() { - run('dart', arguments: const ['analyze', '--fatal-infos', '.']); -} - -@Task('deploy') -@Depends(analyze, testCli, generate, buildRelease) -void deploy() { - log('All tasks completed. '); - log(''); -} - -@Task('Run build_runner to public/ directory') -@Depends(createThumbnails) -Future buildRelease() async { - var app = PubApp.local('build_runner'); - await app.runAsync( - 'build --release --output web:public --delete-conflicting-outputs' - .split(' ') - .toList()); -} - -@DefaultTask('Build the project.') -@Depends(clean) -Future generate() async { - var samples = await getSamples(); - log('Generating index for ${samples.length} samples...'); - var outputFile = File('web/index.html'); - await outputFile.create(recursive: true); - await outputFile.writeAsString(templates.index(samples)); - var futures = >[]; - for (final sample in samples) { - var file = File('web/${sample.filename}.html'); - var future = file.create(recursive: true).then((_) async { - await file.writeAsString(templates.description(sample)); - }); - futures.add(future); - } - await Future.wait(futures); - log('Generated index for ${samples.length} samples.'); -} - -@Task('creates thumbnail images in web/images') -Future createThumbnails() async { - await _createThumbnails(Directory('web/images')); -} - -// Creates a thumbnail image for each png file -Future _createThumbnails(Directory directory) async { - var files = await directory.list().toList(); - var filesToWrite = >{}; - - for (final entity in files) { - var extension = path.extension(entity.path); - var filename = path.basenameWithoutExtension(entity.path); - if (extension != '.png' || entity is! File || filename.endsWith('_thumb')) { - continue; - } - - var pathPrefix = path.dirname(entity.path); - var thumbnailFile = File(path.join(pathPrefix, '${filename}_thumb.png')); - - var img = image.decodeImage(await entity.readAsBytes()); - var resized = image.copyResize(img!, width: 640); - filesToWrite.add(thumbnailFile.writeAsBytes(image.encodePng(resized))); - } - - await Future.wait(filesToWrite); -} - -@Task('remove generated HTML files') -Future clean() async { - var tasks = >[]; - await for (final file in Directory('web').list(recursive: true)) { - if (path.extension(file.path) == '.html') { - tasks.add(file.delete()); - } - } - await Future.wait(tasks); -} diff --git a/web/samples_index/web/description.dart b/web/samples_index/web/description.dart deleted file mode 100644 index ccdc4f7b6..000000000 --- a/web/samples_index/web/description.dart +++ /dev/null @@ -1,15 +0,0 @@ -// TODO(kevmoo): https://github.com/flutter/samples/issues/2582 -// ignore: deprecated_member_use -import 'dart:html'; - -import 'package:mdc_web/mdc_web.dart'; -import 'package:samples_index/src/carousel.dart'; - -void main() { - querySelectorAll('.mdc-card__primary-action').forEach((el) => MDCRipple(el)); - - // Initialize carousel - // This carousel will use the div slider-container as the base - // withArrowKeyControl is used to listen for arrow key up events - Carousel.init(withArrowKeyControl: true); -} diff --git a/web/samples_index/web/images/add_to_app1.png b/web/samples_index/web/images/add_to_app1.png deleted file mode 100644 index 88a37e52e..000000000 Binary files a/web/samples_index/web/images/add_to_app1.png and /dev/null differ diff --git a/web/samples_index/web/images/add_to_app2.png b/web/samples_index/web/images/add_to_app2.png deleted file mode 100644 index 941b5dd59..000000000 Binary files a/web/samples_index/web/images/add_to_app2.png and /dev/null differ diff --git a/web/samples_index/web/images/animations1.png b/web/samples_index/web/images/animations1.png deleted file mode 100644 index 8a8f55f26..000000000 Binary files a/web/samples_index/web/images/animations1.png and /dev/null differ diff --git a/web/samples_index/web/images/animations2.png b/web/samples_index/web/images/animations2.png deleted file mode 100644 index 851f53ce3..000000000 Binary files a/web/samples_index/web/images/animations2.png and /dev/null differ diff --git a/web/samples_index/web/images/animations3.png b/web/samples_index/web/images/animations3.png deleted file mode 100644 index b2e0b088c..000000000 Binary files a/web/samples_index/web/images/animations3.png and /dev/null differ diff --git a/web/samples_index/web/images/charts1.png b/web/samples_index/web/images/charts1.png deleted file mode 100644 index 4292241a7..000000000 Binary files a/web/samples_index/web/images/charts1.png and /dev/null differ diff --git a/web/samples_index/web/images/code_sharing.jpg b/web/samples_index/web/images/code_sharing.jpg deleted file mode 100644 index e1acb731c..000000000 Binary files a/web/samples_index/web/images/code_sharing.jpg and /dev/null differ diff --git a/web/samples_index/web/images/desktop_photo_search-fluent_ui.png b/web/samples_index/web/images/desktop_photo_search-fluent_ui.png deleted file mode 100644 index 40ad6c81f..000000000 Binary files a/web/samples_index/web/images/desktop_photo_search-fluent_ui.png and /dev/null differ diff --git a/web/samples_index/web/images/desktop_photo_search-material.png b/web/samples_index/web/images/desktop_photo_search-material.png deleted file mode 100644 index f2ed47820..000000000 Binary files a/web/samples_index/web/images/desktop_photo_search-material.png and /dev/null differ diff --git a/web/samples_index/web/images/dice.png b/web/samples_index/web/images/dice.png deleted file mode 100644 index 1e4aebf03..000000000 Binary files a/web/samples_index/web/images/dice.png and /dev/null differ diff --git a/web/samples_index/web/images/flutter_maps_firestore1.png b/web/samples_index/web/images/flutter_maps_firestore1.png deleted file mode 100644 index bfbaa960b..000000000 Binary files a/web/samples_index/web/images/flutter_maps_firestore1.png and /dev/null differ diff --git a/web/samples_index/web/images/flutter_maps_firestore2.png b/web/samples_index/web/images/flutter_maps_firestore2.png deleted file mode 100644 index 971846164..000000000 Binary files a/web/samples_index/web/images/flutter_maps_firestore2.png and /dev/null differ diff --git a/web/samples_index/web/images/form_app1.png b/web/samples_index/web/images/form_app1.png deleted file mode 100644 index 96b0ec645..000000000 Binary files a/web/samples_index/web/images/form_app1.png and /dev/null differ diff --git a/web/samples_index/web/images/form_app2.png b/web/samples_index/web/images/form_app2.png deleted file mode 100644 index b8dadde46..000000000 Binary files a/web/samples_index/web/images/form_app2.png and /dev/null differ diff --git a/web/samples_index/web/images/form_app3.png b/web/samples_index/web/images/form_app3.png deleted file mode 100644 index 8f6be8403..000000000 Binary files a/web/samples_index/web/images/form_app3.png and /dev/null differ diff --git a/web/samples_index/web/images/gallery1.png b/web/samples_index/web/images/gallery1.png deleted file mode 100644 index 7a4dec499..000000000 Binary files a/web/samples_index/web/images/gallery1.png and /dev/null differ diff --git a/web/samples_index/web/images/gallery2.png b/web/samples_index/web/images/gallery2.png deleted file mode 100644 index b203fc3d7..000000000 Binary files a/web/samples_index/web/images/gallery2.png and /dev/null differ diff --git a/web/samples_index/web/images/gallery3.png b/web/samples_index/web/images/gallery3.png deleted file mode 100644 index eeb092de6..000000000 Binary files a/web/samples_index/web/images/gallery3.png and /dev/null differ diff --git a/web/samples_index/web/images/gallery4.png b/web/samples_index/web/images/gallery4.png deleted file mode 100644 index 5113a51b1..000000000 Binary files a/web/samples_index/web/images/gallery4.png and /dev/null differ diff --git a/web/samples_index/web/images/gallery5.png b/web/samples_index/web/images/gallery5.png deleted file mode 100644 index 5b3e755d5..000000000 Binary files a/web/samples_index/web/images/gallery5.png and /dev/null differ diff --git a/web/samples_index/web/images/github_dataviz1.png b/web/samples_index/web/images/github_dataviz1.png deleted file mode 100644 index 5d63f68a4..000000000 Binary files a/web/samples_index/web/images/github_dataviz1.png and /dev/null differ diff --git a/web/samples_index/web/images/infinite_list.png b/web/samples_index/web/images/infinite_list.png deleted file mode 100644 index 0ff118358..000000000 Binary files a/web/samples_index/web/images/infinite_list.png and /dev/null differ diff --git a/web/samples_index/web/images/ios_app_clip.png b/web/samples_index/web/images/ios_app_clip.png deleted file mode 100644 index a4e002163..000000000 Binary files a/web/samples_index/web/images/ios_app_clip.png and /dev/null differ diff --git a/web/samples_index/web/images/isolate1.png b/web/samples_index/web/images/isolate1.png deleted file mode 100644 index 520ebd307..000000000 Binary files a/web/samples_index/web/images/isolate1.png and /dev/null differ diff --git a/web/samples_index/web/images/isolate2.png b/web/samples_index/web/images/isolate2.png deleted file mode 100644 index 1b02db5a4..000000000 Binary files a/web/samples_index/web/images/isolate2.png and /dev/null differ diff --git a/web/samples_index/web/images/isolate3.png b/web/samples_index/web/images/isolate3.png deleted file mode 100644 index 2a44d493f..000000000 Binary files a/web/samples_index/web/images/isolate3.png and /dev/null differ diff --git a/web/samples_index/web/images/level_selector.png b/web/samples_index/web/images/level_selector.png deleted file mode 100644 index d3bf92a04..000000000 Binary files a/web/samples_index/web/images/level_selector.png and /dev/null differ diff --git a/web/samples_index/web/images/loading_screen.png b/web/samples_index/web/images/loading_screen.png deleted file mode 100644 index 17b68d181..000000000 Binary files a/web/samples_index/web/images/loading_screen.png and /dev/null differ diff --git a/web/samples_index/web/images/logos/logo_flutter_1080px_clr.png b/web/samples_index/web/images/logos/logo_flutter_1080px_clr.png deleted file mode 100644 index 00357cb9c..000000000 Binary files a/web/samples_index/web/images/logos/logo_flutter_1080px_clr.png and /dev/null differ diff --git a/web/samples_index/web/images/logos/logo_flutter_96px_clr.png b/web/samples_index/web/images/logos/logo_flutter_96px_clr.png deleted file mode 100644 index d388a0370..000000000 Binary files a/web/samples_index/web/images/logos/logo_flutter_96px_clr.png and /dev/null differ diff --git a/web/samples_index/web/images/logos/logo_lockup_flutter_horizontal_wht.png b/web/samples_index/web/images/logos/logo_lockup_flutter_horizontal_wht.png deleted file mode 100644 index 08011179b..000000000 Binary files a/web/samples_index/web/images/logos/logo_lockup_flutter_horizontal_wht.png and /dev/null differ diff --git a/web/samples_index/web/images/logos/logo_lockup_flutter_horizontal_wht_96.png b/web/samples_index/web/images/logos/logo_lockup_flutter_horizontal_wht_96.png deleted file mode 100644 index 12338de79..000000000 Binary files a/web/samples_index/web/images/logos/logo_lockup_flutter_horizontal_wht_96.png and /dev/null differ diff --git a/web/samples_index/web/images/material_3_color.png b/web/samples_index/web/images/material_3_color.png deleted file mode 100644 index 0a566f60c..000000000 Binary files a/web/samples_index/web/images/material_3_color.png and /dev/null differ diff --git a/web/samples_index/web/images/material_3_components.png b/web/samples_index/web/images/material_3_components.png deleted file mode 100644 index f3e190cb1..000000000 Binary files a/web/samples_index/web/images/material_3_components.png and /dev/null differ diff --git a/web/samples_index/web/images/material_3_elevation.png b/web/samples_index/web/images/material_3_elevation.png deleted file mode 100644 index 3a8cade86..000000000 Binary files a/web/samples_index/web/images/material_3_elevation.png and /dev/null differ diff --git a/web/samples_index/web/images/material_3_green.png b/web/samples_index/web/images/material_3_green.png deleted file mode 100644 index 7064abb2d..000000000 Binary files a/web/samples_index/web/images/material_3_green.png and /dev/null differ diff --git a/web/samples_index/web/images/material_3_typography.png b/web/samples_index/web/images/material_3_typography.png deleted file mode 100644 index b55243549..000000000 Binary files a/web/samples_index/web/images/material_3_typography.png and /dev/null differ diff --git a/web/samples_index/web/images/navigation_and_routing1.png b/web/samples_index/web/images/navigation_and_routing1.png deleted file mode 100644 index e046ce97c..000000000 Binary files a/web/samples_index/web/images/navigation_and_routing1.png and /dev/null differ diff --git a/web/samples_index/web/images/navigation_and_routing2.png b/web/samples_index/web/images/navigation_and_routing2.png deleted file mode 100644 index d39977486..000000000 Binary files a/web/samples_index/web/images/navigation_and_routing2.png and /dev/null differ diff --git a/web/samples_index/web/images/navigation_and_routing3.png b/web/samples_index/web/images/navigation_and_routing3.png deleted file mode 100644 index d806038a3..000000000 Binary files a/web/samples_index/web/images/navigation_and_routing3.png and /dev/null differ diff --git a/web/samples_index/web/images/navigation_and_routing4.png b/web/samples_index/web/images/navigation_and_routing4.png deleted file mode 100644 index 50765fe87..000000000 Binary files a/web/samples_index/web/images/navigation_and_routing4.png and /dev/null differ diff --git a/web/samples_index/web/images/place_tracker1.png b/web/samples_index/web/images/place_tracker1.png deleted file mode 100644 index 17cdad10e..000000000 Binary files a/web/samples_index/web/images/place_tracker1.png and /dev/null differ diff --git a/web/samples_index/web/images/place_tracker2.png b/web/samples_index/web/images/place_tracker2.png deleted file mode 100644 index b378e3646..000000000 Binary files a/web/samples_index/web/images/place_tracker2.png and /dev/null differ diff --git a/web/samples_index/web/images/place_tracker3.png b/web/samples_index/web/images/place_tracker3.png deleted file mode 100644 index 9980e2511..000000000 Binary files a/web/samples_index/web/images/place_tracker3.png and /dev/null differ diff --git a/web/samples_index/web/images/place_tracker4.png b/web/samples_index/web/images/place_tracker4.png deleted file mode 100644 index 56bff3013..000000000 Binary files a/web/samples_index/web/images/place_tracker4.png and /dev/null differ diff --git a/web/samples_index/web/images/platform_design1.png b/web/samples_index/web/images/platform_design1.png deleted file mode 100644 index cb73a5250..000000000 Binary files a/web/samples_index/web/images/platform_design1.png and /dev/null differ diff --git a/web/samples_index/web/images/platform_design2.png b/web/samples_index/web/images/platform_design2.png deleted file mode 100644 index c78675f9b..000000000 Binary files a/web/samples_index/web/images/platform_design2.png and /dev/null differ diff --git a/web/samples_index/web/images/platform_design3.png b/web/samples_index/web/images/platform_design3.png deleted file mode 100644 index 444dd429b..000000000 Binary files a/web/samples_index/web/images/platform_design3.png and /dev/null differ diff --git a/web/samples_index/web/images/platform_design4.png b/web/samples_index/web/images/platform_design4.png deleted file mode 100644 index 87a8b0af6..000000000 Binary files a/web/samples_index/web/images/platform_design4.png and /dev/null differ diff --git a/web/samples_index/web/images/platform_design5.png b/web/samples_index/web/images/platform_design5.png deleted file mode 100644 index 08dfc7504..000000000 Binary files a/web/samples_index/web/images/platform_design5.png and /dev/null differ diff --git a/web/samples_index/web/images/platform_design6.png b/web/samples_index/web/images/platform_design6.png deleted file mode 100644 index 66d0ff31a..000000000 Binary files a/web/samples_index/web/images/platform_design6.png and /dev/null differ diff --git a/web/samples_index/web/images/platform_design7.png b/web/samples_index/web/images/platform_design7.png deleted file mode 100644 index 7c3a674d8..000000000 Binary files a/web/samples_index/web/images/platform_design7.png and /dev/null differ diff --git a/web/samples_index/web/images/platform_view_swift1.png b/web/samples_index/web/images/platform_view_swift1.png deleted file mode 100644 index f3fa9f4c9..000000000 Binary files a/web/samples_index/web/images/platform_view_swift1.png and /dev/null differ diff --git a/web/samples_index/web/images/platform_view_swift2.png b/web/samples_index/web/images/platform_view_swift2.png deleted file mode 100644 index a8d15691a..000000000 Binary files a/web/samples_index/web/images/platform_view_swift2.png and /dev/null differ diff --git a/web/samples_index/web/images/provider_shopper1.png b/web/samples_index/web/images/provider_shopper1.png deleted file mode 100644 index 13be39c11..000000000 Binary files a/web/samples_index/web/images/provider_shopper1.png and /dev/null differ diff --git a/web/samples_index/web/images/provider_shopper2.png b/web/samples_index/web/images/provider_shopper2.png deleted file mode 100644 index cc4a446f1..000000000 Binary files a/web/samples_index/web/images/provider_shopper2.png and /dev/null differ diff --git a/web/samples_index/web/images/provider_shopper3.png b/web/samples_index/web/images/provider_shopper3.png deleted file mode 100644 index 9255e223a..000000000 Binary files a/web/samples_index/web/images/provider_shopper3.png and /dev/null differ diff --git a/web/samples_index/web/images/simple_editor_active.png b/web/samples_index/web/images/simple_editor_active.png deleted file mode 100644 index 45cf808ff..000000000 Binary files a/web/samples_index/web/images/simple_editor_active.png and /dev/null differ diff --git a/web/samples_index/web/images/simple_editor_initial.png b/web/samples_index/web/images/simple_editor_initial.png deleted file mode 100644 index 4e4c0b769..000000000 Binary files a/web/samples_index/web/images/simple_editor_initial.png and /dev/null differ diff --git a/web/samples_index/web/images/slide_puzzle1.png b/web/samples_index/web/images/slide_puzzle1.png deleted file mode 100644 index 7d050a525..000000000 Binary files a/web/samples_index/web/images/slide_puzzle1.png and /dev/null differ diff --git a/web/samples_index/web/images/testing_app1.png b/web/samples_index/web/images/testing_app1.png deleted file mode 100644 index 2d7bc4145..000000000 Binary files a/web/samples_index/web/images/testing_app1.png and /dev/null differ diff --git a/web/samples_index/web/images/testing_app2.png b/web/samples_index/web/images/testing_app2.png deleted file mode 100644 index 6041f7297..000000000 Binary files a/web/samples_index/web/images/testing_app2.png and /dev/null differ diff --git a/web/samples_index/web/images/timeflow1.png b/web/samples_index/web/images/timeflow1.png deleted file mode 100644 index 654c606e9..000000000 Binary files a/web/samples_index/web/images/timeflow1.png and /dev/null differ diff --git a/web/samples_index/web/images/web_dashboard1.png b/web/samples_index/web/images/web_dashboard1.png deleted file mode 100644 index be8fff2f2..000000000 Binary files a/web/samples_index/web/images/web_dashboard1.png and /dev/null differ diff --git a/web/samples_index/web/images/web_dashboard2.png b/web/samples_index/web/images/web_dashboard2.png deleted file mode 100644 index 6119e00d4..000000000 Binary files a/web/samples_index/web/images/web_dashboard2.png and /dev/null differ diff --git a/web/samples_index/web/images/web_dashboard3.png b/web/samples_index/web/images/web_dashboard3.png deleted file mode 100644 index 59423b424..000000000 Binary files a/web/samples_index/web/images/web_dashboard3.png and /dev/null differ diff --git a/web/samples_index/web/images/web_embedding1.png b/web/samples_index/web/images/web_embedding1.png deleted file mode 100644 index d6f85bb91..000000000 Binary files a/web/samples_index/web/images/web_embedding1.png and /dev/null differ diff --git a/web/samples_index/web/images/web_embedding2.png b/web/samples_index/web/images/web_embedding2.png deleted file mode 100644 index 0e684e316..000000000 Binary files a/web/samples_index/web/images/web_embedding2.png and /dev/null differ diff --git a/web/samples_index/web/main.dart b/web/samples_index/web/main.dart deleted file mode 100644 index 2f066c246..000000000 --- a/web/samples_index/web/main.dart +++ /dev/null @@ -1,153 +0,0 @@ -// TODO(kevmoo): https://github.com/flutter/samples/issues/2582 -// ignore: deprecated_member_use -import 'dart:html'; - -import 'package:mdc_web/mdc_web.dart'; -import 'package:samples_index/browser.dart'; - -/// The Material text input for searching -late final MDCTextField searchBar; -late final MDCChipSet chipSet; - -/// The current set of query parameters that determine how the cards are -/// filtered. e.g. {'search': 'kittens', 'platform': 'ios'} -final queryParams = {}; -const searchKey = 'search'; -const typeKey = 'type'; -const platformKey = 'platform'; - -void main() { - // Initialize Material components - MDCFloatingLabel(querySelector('.mdc-floating-label')!); - searchBar = MDCTextField(querySelector('#search-bar')!); - MDCRipple(querySelector('#clear-button')!); - - // Listen for hash changes - window.onHashChange.listen((_) { - queryParams.clear(); - queryParams.addAll(parseHash(window.location.hash)); - setSearchBarText(); - setSelectedChips(); - filterCards(); - }); - - // Use a ripple effect on all cards - querySelectorAll('.mdc-card__primary-action').forEach((el) => MDCRipple(el) - // Navigate to the description page when tapped - ..listen('click', (e) { - window.location.href = el.attributes['href']!; - })); - - // Filter cards on each keypress - searchBar.listen('keydown', (e) async { - await Future(() {}); - handleSearch(); - }); - - // Update the URL only when the user is done typing in the search bar - searchBar.listen('change', (e) { - queryParams[searchKey] = searchBar.value!; - updateHash(); - }); - - // Update the hash, cards, and text input when the clear button is pressed - querySelector('#clear-button')!.onClick.listen((e) { - queryParams.remove('search'); - updateHash(); - setSearchBarText(); - filterCards(); - }); - - // Initialize chips - chipSet = MDCChipSet(querySelector('.mdc-chip-set')!); - chipSet.listen('MDCChip:selection', (e) { - // Get the query parameters for this chip - var selectedChipIndex = chipSet.chips.indexWhere((chip) => chip.selected!); - var chipParams = paramsForChip(selectedChipIndex); - - // Overwrite query parameters with new ones - queryParams.remove(typeKey); - queryParams.remove(platformKey); - queryParams.addAll(chipParams); - updateHash(); - filterCards(); - }); - - // Apply the search from the hash in the URL - queryParams.addAll(parseHash(window.location.hash)); - setSearchBarText(); - setSelectedChips(); - - // Filter cards if a filter is being applied - if (queryParams.isNotEmpty) { - filterCards(); - } -} - -void setSearchBarText() { - var search = queryParams[searchKey] ?? ''; - searchBar.value = search; -} - -void setSelectedChips() { - var type = queryParams.containsKey(typeKey) ? queryParams[typeKey] : ''; - if (type!.isNotEmpty) { - if (type == 'sample') { - chipSet.chips[1].selected = true; - } - } - - // Apply the platform from the hash in the URL - var platform = - queryParams.containsKey(platformKey) ? queryParams[platformKey] : ''; - if (platform!.isNotEmpty) { - if (platform == 'web') { - chipSet.chips[2].selected = true; - } - } - if (platform.isEmpty && type.isEmpty) { - chipSet.chips[0].selected = true; - } -} - -void handleSearch() { - var search = searchBar.value; - queryParams[searchKey] = search!; - filterCards(); -} - -void updateHash() { - if (queryParams.isEmpty) { - _replaceHash(''); - return; - } - _replaceHash(formatHash(queryParams)); -} - -void _replaceHash(String hash) { - var currentUri = Uri.parse(window.location.href); - window.history - .replaceState(null, '', currentUri.replace(fragment: hash).toString()); -} - -void filterCards() { - // The search query, e.g. 'kittens platform:web' - var searchQuery = searchQueryFromParams(queryParams); - - // Filter out all elements with non-matching search-attrs - var elements = querySelectorAll('[search-attrs]'); - for (final element in elements) { - var searchAttributes = element.attributes['search-attrs']; - if (matchesQuery(searchQuery, searchAttributes!)) { - element.hidden = false; - } else { - element.hidden = true; - } - } -} - -Map paramsForChip(int index) => switch (index) { - 1 => {typeKey: 'sample'}, - 2 => {platformKey: 'web'}, - _ => {} - }; diff --git a/web/samples_index/web/styles.scss b/web/samples_index/web/styles.scss deleted file mode 100644 index 1320585b2..000000000 --- a/web/samples_index/web/styles.scss +++ /dev/null @@ -1,559 +0,0 @@ -// Copyright 2020 The Flutter team. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file - -// Flutter brand colors -$flutter-grey-900-color: #202124; -$flutter-grey-800-color: #3C4043; -$flutter-grey-700-color: #5F6368; -$flutter-grey-500-color: #5F6368; -$flutter-grey-300-color: #DADCE0; -$flutter-blue-700-color: #02569B; -$flutter-blue-600-color: #0175C2; -$flutter-secondary-400-color: #13B9FD; -$flutter-yellow: #FFC108; - -// Material Design Web theme colors. Must be imported before importing -// material-components-web.scss. -$mdc-theme-primary: $flutter-grey-500-color; -$mdc-theme-secondary: $flutter-blue-700-color; - -@import 'package:mdc_web/material-components-web'; - -// App colors -$navbar-background-color: #3D4043; -$dark-text-color: #202124; -$light-text-color: #3D4043; -$background-color: #F8F9FA; -$text-color: $dark-text-color; -$card-border-color: #DBDCE0; -$type-label-border-color: #82868A; - -// Sizes -$font-size-small: 0.875rem; -$card-width: 300px; -$mobile-width: 960px; -$container-width: 960px; -$footer-height: 96px; - -// Fonts -$font: Roboto, sans-serif; -$title-font: Google Sans Display, Roboto, sans-serif; -$subtitle-font: Google Sans, Roboto, sans-serif; - -// Carousel Animation Configs -$time: 500ms; -$delay: $time/2; -$mode: cubic-bezier(0.17, 0.67, 0.55, 1.43); - -@keyframes heartbeat { - 0% { - transform: scale(0); - } - 25% { - transform: scale(1.2); - } - 50% { - transform: scale(1); - } - 75% { - transform: scale(1.2); - } - 100% { - transform: scale(1); - } -} - -// CSS Reset -html, body { - height: 100%; - margin: 0; - @media screen and (max-width: $mobile-width) { - max-width: 100%; - overflow-x: hidden; - } -} - -body { - background-color: $background-color; - margin: 0; -} - -h1, h2, h3, h4, h5, h6 { - color: $text-color; - font-family: $title-font; - margin: 0; -} - -h1 { - font-size: 28px; - font-weight: bold; -} - -h2 { - font-size: 22px; - font-weight: bold; -} - -h3 { - font-size: 22px; -} - -h4 { - font-size: 22px; -} - -h5 { - font-size: 18px; -} - -h6 { - font-size: 14px; -} - -* { - font-family: $font; -} - -a { - text-decoration: none; -} - - -[hidden] { - display: none; -} - - -// Custom Styles -.content { - min-height: 100%; - - > .container { - padding-bottom: $footer-height; - } -} - -.navbar { - display: flex; - flex-direction: row; - justify-content: space-between; - align-items: center; - - background-color: $navbar-background-color; - color: white; - padding: 16px 125px 16px 125px; - margin-bottom: 48px; - @media screen and (max-width: $mobile-width) { - padding: 8px 16px 8px 16px; - margin-bottom: 16px; - } - - .leading { - &:hover { - opacity: 0.8; - } - } - - .leading, .nav-items { - display: flex; - flex-direction: row; - align-items: center; - - > * { - margin: 0 8px 3px 8px; // adjusted vertically to align flutter logo text with "Samples" text - } - } - - .nav-items { - font-family: 'Google Sans', 'Roboto', sans-serif; - @media screen and (max-width: $mobile-width) { - display: none; - } - } - - span.title { - font-family: 'Google Sans Display', 'Roboto', sans-serif; - font-size: 26px; - letter-spacing: 0.5px; - margin: 0; - color: #13B9FD; - } - - img { - height: 32px; - } - - a { - color: white; - - &:active { - color: white; - } - } -} - -.footer { - display: flex; - flex-direction: row; - justify-content: center; - align-items: center; - - background-color: $dark-text-color; - color: white; - //padding: 36px 125px 36px 125px; - height: $footer-height; - margin-top: -$footer-height; -} - -.container { - width: 100%; - margin-left: auto; - margin-right: auto; - padding: 8px; - @media screen and (min-width: $mobile-width) { - max-width: $container-width; - } -} - -.toolbar { - display: flex; - flex-direction: row; - justify-content: space-between; - align-items: start; - margin-bottom: 12px; - @media screen and (max-width: $mobile-width) { - flex-direction: column; - } - - .buttons { - button { - margin-right: 12px; - margin-bottom: 8px; - } - } -} - -.index-header { - margin-left: 8px; - margin-right: 8px; -} - -.search-container { - display: flex; - flex-direction: row; - align-items: flex-start; - margin-bottom: 12px; - max-width: 640px; - margin-right: 8px; - margin-left: 8px; -} - -.mdc-chip-set { - justify-content: center; -} - -.mdc-chip { - @include mdc-chip-fill-color(transparent); - @include mdc-chip-ink-color($flutter-grey-500-color); - @include mdc-chip-selected-ink-color($flutter-grey-500-color); -} - -.mdc-chip--selected { - font-weight: bold; - text-decoration: underline; - @include mdc-chip-fill-color(transparent); - @include mdc-chip-ink-color($flutter-grey-500-color); - @include mdc-chip-selected-ink-color($flutter-grey-500-color); -} - -.mdc-card__media { - background-position: top; -} - -.mdc-chip__text, .mdc-text-field__icon { - outline: 0; -} - -#search-bar { - flex: 1; - @include mdc-text-field-fill-color($background-color); - @include mdc-text-field-line-ripple-color($flutter-blue-600-color); - - @include mdc-states-hover-opacity(0.0); - @include mdc-states-focus-opacity(0.0); -} - -.grid { - display: grid; - grid-template-columns: repeat(auto-fill, $card-width); - grid-gap: 8px; - @media screen and (max-width: $mobile-width) { - display: block; - } -} - -.demo-card { - width: $card-width; - margin: 12px; - border: 1px solid $card-border-color; - @media screen and (max-width: $mobile-width) { - margin-left: auto; - margin-right: auto; - width: 100%; - max-width: $card-width; - } -} - -.demo-card__title { - font-family: $font; - color: $dark-text-color; - margin: 0; -} - -.demo-card__primary { - padding: 1rem; -} - -.demo-card__primary-action { - height: 100%; -} - -.demo-card__secondary { - font-family: $font; - padding: 0 1rem 8px; - color: $light-text-color; -} - -.demo-card__label { - position: absolute; - top: 0; - right: 0; -} - -.type-label { - font-family: $font; - font-size: $font-size-small; - text-transform: capitalize; - color: $dark-text-color; - background-color: rgba(255, 255, 255, .95); - border-radius: 8px; - padding: 7px; - margin: 4px; -} - -.type-label-bordered { - color: $type-label-border-color; - border: 1px solid $type-label-border-color; - background-color: transparent; - padding: 4px; - font-size: $font-size-small; -} - -.description-title-row { - display: flex; - flex-direction: row; - align-items: center; - - h1 { - margin-right: 8px; - } -} - -.tags-container { - max-width: 400px; - - .tags-label { - color: $dark-text-color; - display: flex; - flex-direction: row; - align-items: center; - justify-content: start; - text-transform: uppercase; - font-weight: bold; - margin-bottom: 6px; - - > span { - margin-left: 4px; - } - } - - .tags { - color: $light-text-color; - line-height: 1.6em; - - a { - margin-left: 8px; - margin-right: 8px; - text-decoration: underline; - - color: $flutter-grey-900-color; - - &:active { - color: $flutter-grey-900-color; - } - - &:hover { - color: lighten($flutter-grey-900-color, 25%); - } - } - } -} - -// Carousel Container -.slider-container { - position: relative; - margin: 12px auto 24px auto; - width: 800px; - height: 500px; - max-width: 95%; - @media screen and (max-width: $mobile-width) { - margin: 12px 4px; - } - - .bullet-container { - position: absolute; - bottom: 0; - width: 100%; - display: flex; - align-items: center; - justify-content: center; - - .bullet { - margin-right: 8px; - - &:last-child { - margin-right: 0; - } - - height: 8px; - width: 18px; - border-radius: 8px; - background-color: black; - opacity: 0.2; - cursor: pointer; - transition: 200ms ease; - - &.active { - opacity: 1; - } - } - } - - .slider-content { - position: relative; - left: 50%; - top: 50%; - width: 70%; - height: 85%; - transform: translate(-50%, -50%); - @media screen and (max-width: $mobile-width) { - width: 100%; - } - - .slider-single { - position: absolute; - z-index: 0; - left: 0; - top: 0; - width: 100%; - height: 100%; - transition: z-index 0ms $delay; - - .slider-single-image { - position: relative; - left: 0; - top: 0; - width: 100%; - height: 100%; - object-fit: contain; - transition: $time $mode; - transform: scale(0); - opacity: 0; - } - - &.prev-hidden { - .slider-single-image { - transform: translateX(-50%) scale(0); - } - - @media screen and (max-width: $mobile-width) { - display: none; - } - } - - &.prev { - z-index: 1; - - .slider-single-image { - opacity: 0.2; - transform: translateX(-25%) scale(0.8); - } - } - - &.next { - z-index: 1; - - .slider-single-image { - opacity: 0.2; - transform: translateX(25%) scale(0.8); - } - } - - &.next-hidden { - .slider-single-image { - transform: translateX(50%) scale(0); - } - - @media screen and (max-width: $mobile-width) { - display: none; - } - } - - &.active { - z-index: 2; - - .slider-single-image { - opacity: 1; - transform: translateX(0%) scale(1); - } - } - } - } - - .slider-left { - position: absolute; - z-index: 3; - display: block; - right: 100%; - top: 50%; - color: black; - transform: translateY(-50%); - padding: 20px 20px; - margin-right: -2px; - cursor: pointer; - @media screen and (max-width: $mobile-width) { - display: none; - } - } - - .slider-right { - position: absolute; - z-index: 3; - display: block; - left: 100%; - top: 50%; - color: black; - transform: translateY(-50%); - padding: 20px 20px; - margin-left: -2px; - cursor: pointer; - @media screen and (max-width: $mobile-width) { - display: none; - } - } - - .hidden { - display: none !important; - } -} diff --git a/web/simplistic_editor b/web/simplistic_editor deleted file mode 120000 index 149b640c6..000000000 --- a/web/simplistic_editor +++ /dev/null @@ -1 +0,0 @@ -../simplistic_editor \ No newline at end of file diff --git a/web/web_dashboard b/web/web_dashboard deleted file mode 120000 index b253e1d7f..000000000 --- a/web/web_dashboard +++ /dev/null @@ -1 +0,0 @@ -../experimental/web_dashboard \ No newline at end of file