Skip to content

Commit

Permalink
Minor cleanup and updates to case_study directory (flutter#7044)
Browse files Browse the repository at this point in the history
  • Loading branch information
parlough authored Jan 16, 2024
1 parent ccc0b17 commit 5e4cde2
Show file tree
Hide file tree
Showing 31 changed files with 58 additions and 510 deletions.
15 changes: 1 addition & 14 deletions case_study/code_size/optimized/code_size_images/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
# code_size_images

A flutter project demonstrating code size issues with images

## Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)

For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
A Flutter project demonstrating code size issues with images
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);

@override
_MyHomePageState createState() => _MyHomePageState();
State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
Expand Down
52 changes: 3 additions & 49 deletions case_study/code_size/optimized/code_size_images/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,9 @@
name: code_size_images
description: A flutter project demonstrating code size issues with images

# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
description: A Flutter project demonstrating code size issues with images.
publish_to: none

environment:
sdk: '>=2.12.0 <4.0.0'
sdk: ^3.0.0

dependencies:
flutter:
Expand All @@ -28,38 +13,7 @@ dev_dependencies:
flutter_test:
sdk: flutter

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:
uses-material-design: true
# The assets are compressed in this version of code_size_images.
assets:
- assets/

# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.

# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages

# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
15 changes: 1 addition & 14 deletions case_study/code_size/optimized/code_size_package/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
# code_size_package

A flutter project demonstrating code size issues with packages.

## Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)

For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
A Flutter project demonstrating code size issues with packages.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class MyHomePage extends StatefulWidget {
final String title;

@override
_MyHomePageState createState() => _MyHomePageState();
State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
Expand Down
9 changes: 3 additions & 6 deletions case_study/code_size/optimized/code_size_package/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: code_size_package
description: A new Flutter project.

publish_to: "none"

version: 1.0.0+1
description: A Flutter project demonstrating code size issues with packages.
publish_to: none

environment:
sdk: ">=2.12.0 <3.0.0"
sdk: ^3.0.0

dependencies:
flutter:
Expand Down
15 changes: 1 addition & 14 deletions case_study/code_size/unoptimized/code_size_images/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
# code_size_images

A flutter project demonstrating code size issues with images

## Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)

For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
A Flutter project demonstrating code size issues with images
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);

@override
_MyHomePageState createState() => _MyHomePageState();
State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
Expand Down
53 changes: 4 additions & 49 deletions case_study/code_size/unoptimized/code_size_images/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,9 @@
name: code_size_images
description: A flutter project demonstrating code size issues with images

# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
description: A Flutter project demonstrating code size issues with images.
publish_to: none

environment:
sdk: '>=2.12.0 <4.0.0'
sdk: ^3.0.0

dependencies:
flutter:
Expand All @@ -28,38 +13,8 @@ dev_dependencies:
flutter_test:
sdk: flutter

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:
uses-material-design: true
# The assets are not compressed in this version of code_size_images.
assets:
- assets/

# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.

# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages

# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
- assets/
15 changes: 1 addition & 14 deletions case_study/code_size/unoptimized/code_size_package/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
# code_size_package

A flutter project demonstrating code size issues with packages.

## Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)

For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
A Flutter project demonstrating code size issues with packages.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class MyHomePage extends StatefulWidget {
final String title;

@override
_MyHomePageState createState() => _MyHomePageState();
State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: code_size_package
description: A new Flutter project.

publish_to: "none"

version: 1.0.0+1
description: A Flutter project demonstrating code size issues with packages.
publish_to: none

environment:
sdk: '>=2.12.0 <4.0.0'
sdk: ^3.0.0

dependencies:
flutter:
Expand Down
8 changes: 2 additions & 6 deletions case_study/memory_leaks/images_1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Press the Snapshot button to collect information about all objects in the Dart V

<img src="readme_images/snapshot.png" />

When complete a Heat Map will appear. Turn off the Heat Map swtich:
When complete a Heat Map will appear. Turn off the Heat Map switch:

<img src="readme_images/heatmap_off.png" />

Expand All @@ -44,7 +44,7 @@ Press the Analyze button to analyze the current Snapshot

<img src="readme_images/analyze.png" />

After the snashot analysis a child row inside of > Analysis will be added titled "Snapshot ..." with the timetime stamp of the snapshot e.g., "Snapshot Jun 09 12:23:44".
After the snapshot analysis a child row inside of > Analysis will be added titled "Snapshot ..." with the timestamp of the snapshot e.g., "Snapshot Jun 09 12:23:44".

<img src="readme_images/analysis_1.png" />

Expand Down Expand Up @@ -153,7 +153,3 @@ The parameters cacheWidth or cacheHeight indicates to the engine that the image
Read [[Image.network Documentation](https://api.flutter.dev/flutter/widgets/Image/Image.network.html)].

<img src="readme_images/leak_app.png" height="600em" />

## Getting Started

For help getting started with Flutter, view online [documentation](http://flutter.io/).
28 changes: 0 additions & 28 deletions case_study/memory_leaks/images_1/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
10 changes: 5 additions & 5 deletions case_study/memory_leaks/images_1/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ void main() {
}

class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
const MyApp({super.key});
// This widget is the root of your application.

@override
Expand All @@ -29,12 +29,12 @@ class MyApp extends StatelessWidget {
}

class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, this.title = ""}) : super(key: key);
const MyHomePage({super.key, this.title = ""});

final String title;

@override
MyHomePageState createState() => MyHomePageState();
State<MyHomePage> createState() => MyHomePageState();
}

int globalObjectId = 0;
Expand Down Expand Up @@ -97,7 +97,7 @@ class MyHomePageState extends State<MyHomePage>

developer.log('$loadingState, $imageUrl');

// Progress spinnger.
// Progress spinner.
return Center(
child: CircularProgressIndicator(
value: expectedTotalBytes != null
Expand Down Expand Up @@ -176,7 +176,7 @@ class MyHomePageState extends State<MyHomePage>
}

class SecondScreen extends MyHomePage {
const SecondScreen({Key? key}) : super(key: key);
const SecondScreen({super.key});
}

// Loaded images. key is ImageUrl and value is the ImageChunkEvent (total and cumulative bytes loaded).
Expand Down
Loading

0 comments on commit 5e4cde2

Please sign in to comment.