Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6673acc

Browse files
authored
Merge in the flutter gallery (flutter#176)
1 parent 428041b commit 6673acc

File tree

734 files changed

+198940
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

734 files changed

+198940
-0
lines changed

gallery/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Flutter Gallery
2+
3+
Flutter Gallery is a resource to help developers evaluate and use Flutter.
4+
It is a collection of material design widgets, behaviors, and vignettes
5+
implemented with Flutter. We often get asked how one can see Flutter in
6+
action, and this gallery demonstrates what Flutter provides and how it
7+
behaves in the wild.
8+
9+
## Supported Platforms
10+
11+
The Flutter Gallery application has been built to support multiple platforms. This includes:
12+
13+
* Android
14+
* iOS
15+
* web
16+
* macOS
17+
* Linux
18+
* Windows
19+
20+
That being said, extra steps must be taken to [enable Desktop support](https://github.com/flutter/flutter/wiki/Desktop-shells#tooling).
21+
22+
Additionally, the UI adapts between mobile and desktop layouts regardless of the platform it runs on. This is determined based on window size as outlined in [adaptive.dart](https://github.com/material-components/material-components-flutter-gallery/blob/master/gallery/lib/layout/adaptive.dart).
23+
24+
## To include a new splash animation
25+
26+
1. Convert your animation to a `.gif` file. Ideally, use a background color of `0xFF030303` to ensure the animation blends into the background of the app.
27+
28+
2. Add your new `.gif` file to the assets directory under `assets/splash_effects`. Ensure the name follows the format `splash_effect_$num.gif`. The number should be the next number after the current largest number in the repository.
29+
30+
3. Update the map `_effectDurations` in [splash.dart](https://github.com/material-components/material-components-flutter-gallery/blob/master/gallery/lib/pages/splash.dart) to include the number of the new `.gif` as well as its estimated duration. The duration is used to determine how long to display the splash animation at launch.

gallery/codeviewer_cli/.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Files and directories created by pub
2+
.dart_tool/
3+
.packages
4+
# Remove the following pattern if you wish to check in your lock file
5+
pubspec.lock
6+
7+
# Conventional directory for build outputs
8+
build/
9+
10+
# Directory created by dartdoc
11+
doc/api/

gallery/codeviewer_cli/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 1.0.0
2+
3+
- Initial version

gallery/codeviewer_cli/README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
A command-line application to highlight dart source code.
2+
3+
## Overview
4+
5+
Code segments are highlighted before the app is compiled.
6+
This is done because the highlighting process can take 300ms to finish, creating a noticeable delay when the demo switches to code page.
7+
8+
The highlighter takes all files in the `gallery/lib/demos/` folder and scans each.
9+
Highlighted code widgets are stored in the `gallery/lib/codeviewer/code_segments.dart` file.
10+
Under the root directory, run `make update-code-segments` to run the highlighter.
11+
12+
Wrap a block of code with lines `// BEGIN yourDemoName` and `// END` to mark it for highlighting. The block in between, as well as any copyright notice and imports at the beginning of the file, are automatically taken and highlighted, and stored as `static TextSpan yourDemoName(BuildContext context)` in `gallery/lib/codeviewer/code_segments.dart`.
13+
To display the code, go to `gallery/lib/data/demos.dart`, and add `code: CodeSegments.yourDemoName,` to your `GalleryDemoConfiguration` object.
14+
15+
## Multiple blocks of code
16+
17+
Use the following method to join multiple blocks of code into a single segment:
18+
```
19+
// BEGIN yourDemo#2
20+
a();
21+
// END
22+
b();
23+
// BEGIN yourDemo#1
24+
c();
25+
// END
26+
```
27+
The generated code will be
28+
```
29+
c();
30+
a();
31+
```
32+
33+
Code blocks can nest or overlap. In these cases, specify which file(s) to `END`.
34+
35+
The following source file
36+
```
37+
// BEGIN demoOne
38+
a();
39+
// BEGIN demoTwo
40+
b();
41+
// END demoOne
42+
c();
43+
// END demoTwo
44+
```
45+
will create the following segments:
46+
(demoOne)
47+
```
48+
a();
49+
b();
50+
```
51+
(demoTwo)
52+
```
53+
b();
54+
c();
55+
```
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Defines a default set of lint rules enforced for
2+
# projects at Google. For details and rationale,
3+
# see https://github.com/dart-lang/pedantic#enabled-lints.
4+
include: package:pedantic/analysis_options.yaml
5+
6+
# For lint rules and documentation, see http://dart-lang.github.io/linter/lints.
7+
# Uncomment to specify additional rules.
8+
# linter:
9+
# rules:
10+
# - camel_case_types
11+
12+
analyzer:
13+
# exclude:
14+
# - path/to/excluded/files/**
15+
16+
linter:
17+
rules:
18+
- avoid_types_on_closure_parameters
19+
- avoid_void_async
20+
- await_only_futures
21+
- camel_case_types
22+
- cancel_subscriptions
23+
- close_sinks
24+
- constant_identifier_names
25+
- control_flow_in_finally
26+
- empty_statements
27+
- hash_and_equals
28+
- implementation_imports
29+
- non_constant_identifier_names
30+
- package_api_docs
31+
- package_names
32+
- package_prefixed_library_names
33+
- test_types_in_equals
34+
- throw_in_finally
35+
- unnecessary_brace_in_string_interps
36+
- unnecessary_getters_setters
37+
- unnecessary_new
38+
- unnecessary_statements
39+
- directives_ordering

gallery/codeviewer_cli/bin/main.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright 2019 The Flutter team. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'package:codeviewer_cli/segment_generator.dart';
6+
7+
main(List<String> arguments) {
8+
writeSegments(
9+
sourceDirectoryPath: '../gallery/lib/demos',
10+
targetFilePath: '../gallery/lib/codeviewer/code_segments.dart',
11+
);
12+
}

0 commit comments

Comments
 (0)