Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
fb28a0d3
Unverified
Commit
fb28a0d3
authored
Sep 15, 2022
by
Greg Spencer
Committed by
GitHub
Sep 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-Land "Actually add example templates (#111531)" (#111666)
parent
2c1b32b8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
276 additions
and
0 deletions
+276
-0
cupertino.0.dart
examples/api/lib/sample_templates/cupertino.0.dart
+67
-0
material.0.dart
examples/api/lib/sample_templates/material.0.dart
+69
-0
widgets.0.dart
examples/api/lib/sample_templates/widgets.0.dart
+70
-0
cupertino.0_test.dart
examples/api/test/sample_templates/cupertino.0_test.dart
+23
-0
material.0_test.dart
examples/api/test/sample_templates/material.0_test.dart
+24
-0
widgets.0_test.dart
examples/api/test/sample_templates/widgets.0_test.dart
+23
-0
No files found.
examples/api/lib/sample_templates/cupertino.0.dart
0 → 100644
View file @
fb28a0d3
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This is a template file for illustrating best practices when creating a
// Flutter API example that uses the Cupertino library. To use it, copy the file
// to your destination filename, search/replace 'Placeholder' with the name of
// the class this is an example for, delete this block, and implement your
// example.
//
// The name and location of this file should be:
//
// examples/api/lib/<library>/<filename_without_dart>/<lower_snake_symbol>.<index>.dart
//
// So, if your example is the third example of the Foo.bar function in the
// "baz.dart" file in the cupertino library, then the filename for your example
// should be:
//
// examples/api/lib/cupertino/baz/foo_bar.2.dart
//
// and its associated test should be in:
//
// examples/api/test/cupertino/baz/foo_bar.2_test.dart
//
// The following doc comment should remain, and be a doc comment so that the
// symbol will be linked in the IDE. Don't use the whole description of the
// example, since that should already be in the API docs where this example is
// referenced, and we don't want the two descriptions to diverge. If this sample
// is referenced more than once, link back to the instance the example file is
// named for.
/// Flutter code sample for [Placeholder].
import
'package:flutter/cupertino.dart'
;
void
main
(
)
{
runApp
(
const
SampleApp
());
}
class
SampleApp
extends
StatelessWidget
{
const
SampleApp
({
super
.
key
});
@override
Widget
build
(
BuildContext
context
)
{
return
const
CupertinoApp
(
home:
PlaceholderExample
(),
);
}
}
/// Include comments about each class, and make them dartdoc comments, so that
/// links (e.g. [Placeholder]) are active in IDEs.
///
/// Name the classes appropriately for the example (don't leave it as
/// "PlaceholderExample"!).
class
PlaceholderExample
extends
StatelessWidget
{
const
PlaceholderExample
({
super
.
key
});
@override
Widget
build
(
BuildContext
context
)
{
// Since this is an example, add plenty of comments, explaining things that
// both a newcomer and an experienced user might want to know.
//
// TRY THIS: Prefix things with "TRY THIS" in places in the example that
// might be interesting to modify when exploring what the code does.
return
const
Placeholder
();
}
}
examples/api/lib/sample_templates/material.0.dart
0 → 100644
View file @
fb28a0d3
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This is a template file for illustrating best practices when creating a
// Flutter API example that uses the Material library. To use it, copy the file
// to your destination filename, search/replace 'Placeholder' with the name of
// the class this is an example for, delete this block, and implement your
// example.
//
// The name and location of this file should be:
//
// examples/api/lib/<library>/<filename_without_dart>/<lower_snake_symbol>.<index>.dart
//
// So, if your example is the third example of the Foo.bar function in the
// "baz.dart" file in the material library, then the filename for your example
// should be:
//
// examples/api/lib/material/baz/foo_bar.2.dart
//
// and its associated test should be in:
//
// examples/api/test/material/baz/foo_bar.2_test.dart
//
// The following doc comment should remain, and be a doc comment so that the
// symbol will be linked in the IDE. Don't use the whole description of the
// example, since that should already be in the API docs where this example is
// referenced, and we don't want the two descriptions to diverge. If this sample
// is referenced more than once, link back to the instance the example file is
// named for.
/// Flutter code sample for [Placeholder].
import
'package:flutter/material.dart'
;
void
main
(
)
{
runApp
(
const
SampleApp
());
}
class
SampleApp
extends
StatelessWidget
{
const
SampleApp
({
super
.
key
});
@override
Widget
build
(
BuildContext
context
)
{
return
const
MaterialApp
(
home:
Scaffold
(
body:
PlaceholderExample
(),
),
);
}
}
/// Include comments about each class, and make them dartdoc comments, so that
/// links (e.g. [Placeholder]) are active in IDEs.
///
/// Name the classes appropriately for the example (don't leave it as
/// "PlaceholderExample"!).
class
PlaceholderExample
extends
StatelessWidget
{
const
PlaceholderExample
({
super
.
key
});
@override
Widget
build
(
BuildContext
context
)
{
// Since this is an example, add plenty of comments, explaining things that
// both a newcomer and an experienced user might want to know.
//
// TRY THIS: Prefix things with "TRY THIS" in places in the example that
// might be interesting to modify when exploring what the code does.
return
const
Placeholder
();
}
}
examples/api/lib/sample_templates/widgets.0.dart
0 → 100644
View file @
fb28a0d3
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This is a template file for illustrating best practices when creating a
// Flutter API example that uses the Widgets library. To use it, copy the file
// to your destination filename, search/replace 'Placeholder' with the name of
// the class this is an example for, delete this block, and implement your
// example.
//
// The name and location of this file should be:
//
// examples/api/lib/<library>/<filename_without_dart>/<lower_snake_symbol>.<index>.dart
//
// So, if your example is the third example of the Foo.bar function in the
// "baz.dart" file in the widgets library, then the filename for your example
// should be:
//
// examples/api/lib/widgets/baz/foo_bar.2.dart
//
// and its (required) associated test should be in:
//
// examples/api/test/widgets/baz/foo_bar.2_test.dart
//
// The following doc comment should remain, and be a doc comment so that the
// symbol will be linked in the IDE. Don't use the whole description of the
// example, since that should already be in the API docs where this example is
// referenced, and we don't want the two descriptions to diverge. If this sample
// is referenced more than once, link back to the instance the example file is
// named for.
/// Flutter code sample for [Placeholder].
import
'package:flutter/widgets.dart'
;
void
main
(
)
{
runApp
(
const
SampleApp
());
}
class
SampleApp
extends
StatelessWidget
{
const
SampleApp
({
super
.
key
});
@override
Widget
build
(
BuildContext
context
)
{
return
WidgetsApp
(
color:
const
Color
(
0xffffffff
),
builder:
(
BuildContext
context
,
Widget
?
child
)
{
return
const
PlaceholderExample
();
},
);
}
}
/// Include comments about each class, and make them dartdoc comments, so that
/// links (e.g. [Placeholder]) are active in IDEs.
///
/// Name the classes appropriately for the example (don't leave it as
/// "PlaceholderExample"!).
class
PlaceholderExample
extends
StatelessWidget
{
const
PlaceholderExample
({
super
.
key
});
@override
Widget
build
(
BuildContext
context
)
{
// Since this is an example, add plenty of comments, explaining things that
// both a newcomer and an experienced user might want to know.
//
// TRY THIS: Prefix things with "TRY THIS" in places in the example that
// might be interesting to modify when exploring what the code does.
return
const
Placeholder
();
}
}
examples/api/test/sample_templates/cupertino.0_test.dart
0 → 100644
View file @
fb28a0d3
// Copyright 2014 The Flutter Authors. 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/cupertino.dart'
;
import
'package:flutter_api_samples/sample_templates/cupertino.0.dart'
as
example
;
import
'package:flutter_test/flutter_test.dart'
;
// This is an example of a test for API example code.
//
// It only tests that the example is presenting what it is supposed to, but you
// should also test the basic functionality of the example to make sure that it
// functions as expected.
void
main
(
)
{
testWidgets
(
'Example app has a placeholder'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
SampleApp
(),
);
expect
(
find
.
byType
(
Placeholder
),
findsOneWidget
);
});
}
examples/api/test/sample_templates/material.0_test.dart
0 → 100644
View file @
fb28a0d3
// Copyright 2014 The Flutter Authors. 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/material.dart'
;
import
'package:flutter_api_samples/sample_templates/material.0.dart'
as
example
;
import
'package:flutter_test/flutter_test.dart'
;
// This is an example of a test for API example code.
//
// It only tests that the example is presenting what it is supposed to, but you
// should also test the basic functionality of the example to make sure that it
// functions as expected.
void
main
(
)
{
testWidgets
(
'Example app has a placeholder'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
SampleApp
(),
);
expect
(
find
.
byType
(
Scaffold
),
findsOneWidget
);
expect
(
find
.
byType
(
Placeholder
),
findsOneWidget
);
});
}
examples/api/test/sample_templates/widgets.0_test.dart
0 → 100644
View file @
fb28a0d3
// Copyright 2014 The Flutter Authors. 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/widgets.dart'
;
import
'package:flutter_api_samples/sample_templates/widgets.0.dart'
as
example
;
import
'package:flutter_test/flutter_test.dart'
;
// This is an example of a test for API example code.
//
// It only tests that the example is presenting what it is supposed to, but you
// should also test the basic functionality of the example to make sure that it
// functions as expected.
void
main
(
)
{
testWidgets
(
'Example app has a placeholder'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
SampleApp
(),
);
expect
(
find
.
byType
(
Placeholder
),
findsOneWidget
);
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment