Add --empty to the flutter create command (#113873)

This commit is contained in:
Greg Spencer
2022-10-24 14:20:03 -07:00
committed by GitHub
parent 3c2f500b1b
commit 5259e1bc6d
7 changed files with 98 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
# {{projectName}}
{{description}}
{{^withEmptyMain}}
## Getting Started
@@ -14,3 +15,4 @@ A few resources to get you started if this is your first Flutter project:
For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
{{/withEmptyMain}}

View File

@@ -1,4 +1,26 @@
import 'package:flutter/material.dart';
{{#withEmptyMain}}
void main() {
runApp(const MainApp());
}
class MainApp extends StatelessWidget {
const MainApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: Scaffold(
body: Center(
child: Text('Hello World!'),
),
),
);
}
}
{{/withEmptyMain}}
{{^withEmptyMain}}
{{#withPlatformChannelPluginHook}}
import 'dart:async';
@@ -248,3 +270,4 @@ class _MyAppState extends State<MyApp> {
}
}
{{/withFfiPluginHook}}
{{/withEmptyMain}}

View File

@@ -1,6 +1,25 @@
name: {{projectName}}
description: {{description}}
{{#withEmptyMain}}
publish_to: 'none'
version: 0.1.0
environment:
sdk: {{dartSdkVersionBounds}}
dependencies:
flutter:
sdk: flutter
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
flutter:
uses-material-design: true
{{/withEmptyMain}}
{{^withEmptyMain}}
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
@@ -100,3 +119,4 @@ flutter:
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
{{/withEmptyMain}}