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
66127250
Commit
66127250
authored
Oct 03, 2016
by
Hans Muller
Committed by
GitHub
Oct 03, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Gallery example code display initialization (#6176)
parent
35de41d6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
6 deletions
+59
-6
demo.dart
examples/flutter_gallery/lib/gallery/demo.dart
+2
-3
example_code_parser.dart
...ples/flutter_gallery/lib/gallery/example_code_parser.dart
+2
-1
example_code_display_test.dart
examples/flutter_gallery/test/example_code_display_test.dart
+53
-0
markdown_raw.dart
packages/flutter_markdown/lib/src/markdown_raw.dart
+2
-2
No files found.
examples/flutter_gallery/lib/gallery/demo.dart
View file @
66127250
...
...
@@ -115,14 +115,13 @@ class FullScreenCodeDialogState extends State<FullScreenCodeDialog> {
String
_exampleCode
;
@override
void
initState
()
{
super
.
initState
();
void
dependenciesChanged
()
{
getExampleCode
(
config
.
exampleCodeTag
,
DefaultAssetBundle
.
of
(
context
)).
then
((
String
code
)
{
setState
(()
{
_exampleCode
=
code
;
});
});
super
.
dependenciesChanged
();
}
@override
...
...
examples/flutter_gallery/lib/gallery/example_code_parser.dart
View file @
66127250
...
...
@@ -18,7 +18,8 @@ Future<String> getExampleCode(String tag, AssetBundle bundle) async {
}
Future
<
Null
>
_parseExampleCode
(
AssetBundle
bundle
)
async
{
final
String
code
=
await
bundle
.
loadString
(
'lib/gallery/example_code.dart'
);
final
String
code
=
await
bundle
.
loadString
(
'lib/gallery/example_code.dart'
)
??
'// lib/gallery/example_code.dart not found
\n
'
;
_exampleCode
=
<
String
,
String
>{};
final
List
<
String
>
lines
=
code
.
split
(
'
\n
'
);
...
...
examples/flutter_gallery/test/example_code_display_test.dart
0 → 100644
View file @
66127250
// Copyright 2016 The Chromium 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_gallery/gallery/app.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
Finder
byTooltip
(
WidgetTester
tester
,
String
message
)
{
return
find
.
byWidgetPredicate
((
Widget
widget
)
{
return
widget
is
Tooltip
&&
widget
.
message
==
message
;
});
}
void
main
(
)
{
TestWidgetsFlutterBinding
binding
=
TestWidgetsFlutterBinding
.
ensureInitialized
();
if
(
binding
is
LiveTestWidgetsFlutterBinding
)
binding
.
allowAllFrames
=
true
;
testWidgets
(
'Flutter gallery button example code displays'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/6147
await
tester
.
pumpWidget
(
new
GalleryApp
());
await
tester
.
pump
();
// see https://github.com/flutter/flutter/issues/1865
await
tester
.
pump
();
// triggers a frame
// Scroll the Buttons demo into view so that a tap will succeed
final
Point
allDemosOrigin
=
tester
.
getTopRight
(
find
.
text
(
'Demos'
));
final
Point
buttonsDemoOrigin
=
tester
.
getTopRight
(
find
.
text
(
'Buttons'
));
final
double
scrollDelta
=
buttonsDemoOrigin
.
y
-
allDemosOrigin
.
y
;
await
tester
.
scrollAt
(
allDemosOrigin
,
new
Offset
(
0.0
,
-
scrollDelta
));
await
tester
.
pump
();
// start the scroll
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
// Launch the buttons demo and then prove that showing the example
// code dialog does not crash.
await
tester
.
tap
(
find
.
text
(
'Buttons'
));
await
tester
.
pump
();
// start animation
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
// end animation
await
tester
.
tap
(
find
.
text
(
'RAISED'
));
await
tester
.
pump
();
// start animation
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
// end animation
await
tester
.
tap
(
byTooltip
(
tester
,
'Show example code'
));
await
tester
.
pump
();
// start animation
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
// end animation
expect
(
find
.
text
(
'Example code'
),
findsOneWidget
);
});
}
packages/flutter_markdown/lib/src/markdown_raw.dart
View file @
66127250
...
...
@@ -130,9 +130,9 @@ class MarkdownBodyRaw extends StatefulWidget {
class
_MarkdownBodyRawState
extends
State
<
MarkdownBodyRaw
>
{
@override
void
initState
()
{
super
.
initState
();
void
dependenciesChanged
()
{
_buildMarkdownCache
();
super
.
dependenciesChanged
();
}
@override
...
...
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