58 Commits

Author SHA1 Message Date
Pierre-Louis
cb9a1d623c
Use curly_braces_in_flow_control_structures for material (#104499)
* Use `curly_braces_in_flow_control_structures` for `material`

* include test/material

* add back removed comments
2022-05-25 13:17:06 +02:00
Michael Goderbauer
2cbad4b3ae
Final chapter: migrate api doc samples to super-parameters (#104007) 2022-05-17 15:35:07 -07:00
Michael Goderbauer
51bcdb9407
super parameters for framework (#100905) 2022-04-13 22:38:40 -07:00
Markus Aksli
a4b5123395
Add animationDuration property to TabController (#91987) 2021-11-03 19:15:34 -07:00
Greg Spencer
fd9ce27748
Clean up examples, remove section markers and --template args (#91133)
This does a cleanup of the examples, removing all of the "section" markers and extra comments that we don't need anymore now that the samples are no longer in the source code. It also removes the --template arguments from the {@tool dartpad} and {@tool sample} directives, since those are no longer used. It converts two examples that I discovered were still embedded into linked examples in the examples folder.

I didn't delete the templates from the snippets config folder yet, because there are still embedded samples in the dart:ui package from the engine that use them. Once dart:ui no longer uses the templates, they can be removed.

I bumped the version of the snippets package to pick up a change that allows removal of the --template argument.
2021-10-04 12:16:17 -07:00
Greg Spencer
33403bd28e
Extract Sample code into examples/api (#87280)
This extracts the sample code out from the API doc comments, and places them in separate files on disk, allowing running of the examples locally, testing them, and building of slightly larger examples.
2021-08-25 09:45:12 -07:00
Ahmed Ashour
a3dc90c4f5
Add space before curly parentheses. (#85306) 2021-07-01 13:51:05 -07:00
Alexandre Ardhuin
34059eec2c
enable lint prefer_interpolation_to_compose_strings (#83407) 2021-06-01 11:14:06 -07:00
Michael Goderbauer
b8a2456737
Enable library_private_types_in_public_api lint (#81578) 2021-05-10 16:26:16 -07:00
houyushan
94fdd88fca
When updating TabController widget, if _controller.index >= widget.length, update _animationController's value (#79535) 2021-04-08 15:34:03 -07:00
Greg Spencer
a8d820a46e
Update samples to use repo analysis options, Fix sample templates and a ton of analyzer issues (#77868) 2021-03-11 16:45:03 -08:00
Darren Austin
b9cfe053d6
Migrate some material doc samples to null safety. (#72297) 2020-12-14 19:03:05 -08:00
Michael Goderbauer
ff05ca2503
Prepare to migrate API doc samples and snippets to null safety (#72040) 2020-12-11 13:39:36 -08:00
Greg Spencer
88809aa247
Standardize dartdoc macro names (#69445) 2020-11-02 13:28:05 -08:00
Alexandre Ardhuin
f551178408
migrate material to nullsafety (#67166)
* migrate material to nullsafety

* address review comments

* address review comments

* fix build
2020-10-06 11:36:50 +02:00
Ian Hickson
77b4505c80
Fix a crash when disposing tabs (#63142) 2020-08-06 18:51:02 -07:00
Todd Volkert
b635d97674
Add widget of the week videos to documentation (#61368) 2020-07-13 13:51:03 -07:00
Ayush Bherwani
802ba9ac90
adds interactive example (#59251) 2020-06-11 11:40:03 -07:00
Alexandre Ardhuin
4d7525f05c
Opt out nnbd in packages/flutter (#59186)
* add language version 2.8 in packages/flutter

* enable non-nullable analyzer flag
2020-06-11 14:11:30 +02:00
Greg Spencer
fabf4e3d0d Reverse the sense of the terms snippet and sample. (#48254) 2020-01-08 15:28:02 -08:00
Jonathan White
1fe05983e6 Fix typos in DefaultTabController.of documentation (#46907)
Fix error in `DefaultTabController.of` documentation

Co-authored-by: Shi-Hao Hong <shihaohong@google.com>
2019-12-26 09:45:25 -08:00
Ian Hickson
449f4a6673
License update (#45373)
* Update project.pbxproj files to say Flutter rather than Chromium

Also, the templates now have an empty organization so that we don't cause people to give their apps a Flutter copyright.

* Update the copyright notice checker to require a standard notice on all files

* Update copyrights on Dart files. (This was a mechanical commit.)

* Fix weird license headers on Dart files that deviate from our conventions; relicense Shrine.

Some were already marked "The Flutter Authors", not clear why. Their
dates have been normalized. Some were missing the blank line after the
license. Some were randomly different in trivial ways for no apparent
reason (e.g. missing the trailing period).

* Clean up the copyrights in non-Dart files. (Manual edits.)

Also, make sure templates don't have copyrights.

* Fix some more ORGANIZATIONNAMEs
2019-11-27 15:04:02 -08:00
Alexandre Ardhuin
fcb40a05bb
make some BuildContext methods generics (#44189)
* make BuildContext.{ancestorStateOfType,ancestorRenderObjectOfType,rootAncestorStateOfType} generic

* make BuildContext.inheritFromWidgetOfExactType generic

* make BuildContext.ancestorInheritedElementForWidgetOfExactType generic

* make BuildContext.ancestorWidgetOfExactType generic

* fix snippet

* bump scoped_model on temp version

* update names

* Revert "bump scoped_model on temp version"

This reverts commit d1fcbba028cdb07f44738d1652391692d1ea5ec0.

* address review comments

* fix ci

* address review comments

* repeat the deprecation notice

* fix uppercase

* use of recommanded deprecation syntax

* address review comment
2019-11-22 17:35:20 +01:00
Aditya Sharma
b6c865ff9c Fix typo (#42922) 2019-10-18 15:42:28 -07:00
Shi-Hao Hong
27a12efabf
Update DefaultTabController to allow for zero tabs (#41625)
* Update DefaultTabController to allow for zero tabs
2019-10-03 06:42:22 +08:00
Alexandre Ardhuin
fecf99ff1e
enable lint avoid_bool_literals_in_conditional_expressions (#35055) 2019-06-25 17:40:05 +02:00
Hans Muller
d9f6cada1c
Tabs code/doc cleanup (#32654) 2019-05-14 12:00:03 -07:00
Shi-Hao Hong
9545c5d166
Tab Animation Sample Video (#32177)
* Improve tabs documentation regarding matching lengths

* Add Tabs animation to docs
2019-05-13 09:06:43 -07:00
Hans Muller
6d0e235cf8
Support for replacing the TabController, after disposing the old one (#32434) 2019-05-09 22:02:46 -07:00
MH Johnson
5412ef07f2
[Material] Update TabController to support dynamic Tabs (#30884)
* Update TabController to support dynamic tabs.

* Added test for single Tab showing correct color.
2019-04-29 10:35:55 -04:00
Shi-Hao Hong
b27b3d7446
Improve Tabs documentation (#31502)
Added info regarding matching lengths requirement and included links to sample implementation
2019-04-24 10:27:32 -07:00
Hans Muller
4f185ecde6
Update TabController.indexIsChanging doc (#28663) 2019-03-01 08:03:01 -08:00
Alexandre Ardhuin
387f885481
Add missing trailing commas (#28673)
* add trailing commas on list/map/parameters

* add trailing commas on Invocation with nb of arg>1

* add commas for widget containing widgets

* add trailing commas if instantiation contains trailing comma

* revert bad change
2019-03-01 08:17:55 +01:00
Greg Spencer
a6e901130e
Convert existing '## Sample code' samples to '{@tool sample}...{@end-tool}' form. (#24077)
This converts existing ## Sample code samples to {@tool sample}...{@end-tool} form.

Also:
1. Fixed a minor bug in analyze-sample-code.dart
2. Made the snippet tool only insert descriptions if the description is non-empty.
3. Moved the Card diagram to before the code sample.
2018-11-07 20:35:10 -08:00
Alexandre Ardhuin
d927c93310
Unnecessary new (#20138)
* enable lint unnecessary_new

* fix tests

* fix tests

* fix tests
2018-09-12 08:29:29 +02:00
Alexandre Ardhuin
976cffa24d
lint unnecessary_new on samples (#21539)
* lint unnecessary_new on samples

* fix tests
2018-09-07 11:00:05 +02:00
Alexandre Ardhuin
09276bea25
enable lint prefer_equal_for_default_values (#18156) 2018-06-05 08:50:40 +02:00
Konstantin Scheglov
9fe53b0d2b
Export @required from src/widgets/framework.dart (#17208) 2018-05-03 08:50:40 -07:00
Ian Hickson
ded3905102
Various documentation improvements. (#15071)
For example, mention the icon used for the drawer menu in the docs (this helps people writing unit tests); add DefaultAssetBundle sample code.
2018-03-11 03:19:18 -07:00
Ian Hickson
370c73d9bc
Audit all the "final Widget child" properties. (#13718)
This attempts to apply some of what we learnt from UX studies, namely
that people wonder how to add multiple children to widget that take
one child.
2017-12-21 15:02:35 -08:00
Jacob Richman
4ce8c94e0d Use the phrase "must not be null" everywhere instead of "cannot be null" (#11683)
when describing non-nullable method arguments.
2017-08-18 13:37:31 -07:00
Ian Hickson
db75aa768c Fix analyzer errors in sample code (#10648) 2017-06-12 19:46:38 -07:00
Hans Muller
123e9e013d Allow TabBars, TabBarViews, TabControllers, with zero or one tabs (#10608) 2017-06-12 15:44:33 -07:00
Alexandre Ardhuin
c55097da7d apply prefer_asserts_in_initializer_list lint (#10463) 2017-06-03 06:05:09 +02:00
Adam Barth
bd56c79767 Handle back during pushReplacement (#10016)
Previously, we would strand the old route in the overlay even though it had
been removed from the history.
2017-05-11 19:33:37 -07:00
Chris Bracken
0b2fb13269 Add const non-null asserts where required (#9939)
Also fixes a small typo.
2017-05-09 17:56:49 -07:00
Alexandre Ardhuin
9541848272 make @immutable const classes (#9532)
* make @immutable const

* fix build
2017-04-21 23:09:42 +02:00
Ian Hickson
14e728d01d Support chaining await calls on controllers (#9389)
With this patch, you can do:

```dart
   Future<Null> foo() async {
     try {
       await controller.forward().orCancel;
       await controller.reverse().orCancel;
       await controller.forward().orCancel;
     } on TickerCanceled {
       // did not complete
     }
   }
```

...in a State's async method, and so long as you dispose of the
controller properly in your dispose, you'll have a nice way of doing
animations in sequence without leaking the controller. try/finally
works as well, if you need to allocate resources and discard them when
canceled.

Simultaneously, you can do:

```dart
   Future<Null> foo() async {
     await controller.forward().orCancel;
     await controller.reverse().orCancel;
     await controller.forward().orCancel;
   }
```

...and have the same effect, where the method will just silently hang
(and get GC'ed) if the widget is disposed, without leaking anything,
if you don't need to catch the controller being killed.

And all this, without spurious errors for uncaught exceptions on
controllers.
2017-04-14 18:27:31 -07:00
xster
89a7fdfc56 Rename State.config to widget everywhere (#9273)
Rename State.config to State.widget
Rename State.didUpdateConfig to State.didUpdateWidget
Renamed all State subclasses' local variables named config to something else
2017-04-10 18:32:24 -07:00
Ian Hickson
8469ef03d8 Trivial tabs-related fixes (#9191)
Add some commentary around DefaultTabController.initialIndex.
Fix typo (nuull) in TabBar.
Make some asserts more detailed.
2017-04-04 20:38:29 -07:00