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
bd413bff
Unverified
Commit
bd413bff
authored
Jun 07, 2019
by
Jonah Williams
Committed by
GitHub
Jun 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add flutter create for the web (#34018)
parent
ef5fc1ae
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
17 deletions
+27
-17
create.dart
packages/flutter_tools/lib/src/commands/create.dart
+11
-0
project.dart
packages/flutter_tools/lib/src/project.dart
+1
-17
template.dart
packages/flutter_tools/lib/src/template.dart
+5
-0
index.html.tmpl
packages/flutter_tools/templates/app/web/index.html.tmpl
+10
-0
No files found.
packages/flutter_tools/lib/src/commands/create.dart
View file @
bd413bff
...
...
@@ -143,6 +143,14 @@ class CreateCommand extends FlutterCommand {
defaultsTo:
false
,
help:
'Generate a project using the AndroidX support libraries'
,
);
argParser
.
addFlag
(
'web'
,
negatable:
true
,
defaultsTo:
false
,
hide:
true
,
help:
'(Experimental) Generate the web specific tooling. Only supported '
'on non-stable branches'
,
);
}
@override
...
...
@@ -367,6 +375,7 @@ class CreateCommand extends FlutterCommand {
androidX:
argResults
[
'androidx'
],
androidLanguage:
argResults
[
'android-language'
],
iosLanguage:
argResults
[
'ios-language'
],
web:
argResults
[
'web'
],
);
final
String
relativeDirPath
=
fs
.
path
.
relative
(
projectDirPath
);
...
...
@@ -576,6 +585,7 @@ To edit platform code in an IDE see https://flutter.dev/developing-packages/#edi
String
flutterRoot
,
bool
renderDriverTest
=
false
,
bool
withPluginHook
=
false
,
bool
web
=
false
,
})
{
flutterRoot
=
fs
.
path
.
normalize
(
flutterRoot
);
...
...
@@ -603,6 +613,7 @@ To edit platform code in an IDE see https://flutter.dev/developing-packages/#edi
'iosLanguage'
:
iosLanguage
,
'flutterRevision'
:
FlutterVersion
.
instance
.
frameworkRevision
,
'flutterChannel'
:
FlutterVersion
.
instance
.
channel
,
'web'
:
web
&&
!
FlutterVersion
.
instance
.
isStable
,
};
}
...
...
packages/flutter_tools/lib/src/project.dart
View file @
bd413bff
...
...
@@ -586,23 +586,7 @@ class WebProject {
/// The html file used to host the flutter web application.
File
get
indexFile
=>
parent
.
directory
.
childDirectory
(
'web'
).
childFile
(
'index.html'
);
Future
<
void
>
ensureReadyForPlatformSpecificTooling
()
async
{
/// Generate index.html in build/web. Eventually we could support
/// a custom html under the web sub directory.
final
Directory
outputDir
=
fs
.
directory
(
getWebBuildDirectory
());
if
(!
outputDir
.
existsSync
())
{
outputDir
.
createSync
(
recursive:
true
);
}
final
Template
template
=
Template
.
fromName
(
'web/index.html.tmpl'
);
template
.
render
(
outputDir
,
<
String
,
dynamic
>{
'appName'
:
parent
.
manifest
.
appName
,
},
printStatusWhenWriting:
false
,
overwriteExisting:
true
,
);
}
Future
<
void
>
ensureReadyForPlatformSpecificTooling
()
async
{}
}
/// Deletes [directory] with all content.
...
...
packages/flutter_tools/lib/src/template.dart
View file @
bd413bff
...
...
@@ -85,6 +85,11 @@ class Template {
return
null
;
relativeDestinationPath
=
relativeDestinationPath
.
replaceAll
(
'
$platform
-
$language
.tmpl'
,
platform
);
}
// Only build a web project if explicitly asked.
final
bool
web
=
context
[
'web'
];
if
(
relativeDestinationPath
.
contains
(
'web'
)
&&
!
web
)
{
return
null
;
}
final
String
projectName
=
context
[
'projectName'
];
final
String
androidIdentifier
=
context
[
'androidIdentifier'
];
final
String
pluginClass
=
context
[
'pluginClass'
];
...
...
packages/flutter_tools/templates/web/index.html.tmpl
→
packages/flutter_tools/templates/
app/
web/index.html.tmpl
View file @
bd413bff
<!DOCTYPE html>
<html
lang=
"en"
>
<html>
<head>
<meta
charset=
"UTF-8"
>
<title>
{{appName}}
</title>
<script
defer
src=
"main.dart.js"
type=
"application/javascript"
></script>
<title>
{{projectName}}
</title>
</head>
<body>
<script
src=
"main.dart.js"
type=
"application/javascript"
></script>
</body>
</html>
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