mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 22:09:06 +00:00
Add flutter_lints to ios_app_clip (#824)
This commit is contained in:
19
ios_app_clip/analysis_options.yaml
Normal file
19
ios_app_clip/analysis_options.yaml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
include: package:flutter_lints/flutter.yaml
|
||||||
|
|
||||||
|
analyzer:
|
||||||
|
strong-mode:
|
||||||
|
implicit-casts: false
|
||||||
|
implicit-dynamic: false
|
||||||
|
|
||||||
|
linter:
|
||||||
|
rules:
|
||||||
|
avoid_types_on_closure_parameters: true
|
||||||
|
avoid_void_async: true
|
||||||
|
cancel_subscriptions: true
|
||||||
|
close_sinks: true
|
||||||
|
directives_ordering: true
|
||||||
|
package_api_docs: true
|
||||||
|
package_prefixed_library_names: true
|
||||||
|
test_types_in_equals: true
|
||||||
|
throw_in_finally: true
|
||||||
|
unnecessary_statements: true
|
||||||
@@ -7,12 +7,14 @@ import 'package:flutter/cupertino.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
runApp(Demo());
|
runApp(const Demo());
|
||||||
}
|
}
|
||||||
|
|
||||||
// The same content is shown for both the main app target and in the App
|
// The same content is shown for both the main app target and in the App
|
||||||
// Clip.
|
// Clip.
|
||||||
class Demo extends StatefulWidget {
|
class Demo extends StatefulWidget {
|
||||||
|
const Demo({Key key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StatefulWidget> createState() => _DemoState();
|
State<StatefulWidget> createState() => _DemoState();
|
||||||
}
|
}
|
||||||
@@ -22,7 +24,7 @@ class _DemoState extends State<Demo> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
DeviceInfoPlugin().iosInfo.then((IosDeviceInfo info) {
|
DeviceInfoPlugin().iosInfo.then((info) {
|
||||||
setState(() {
|
setState(() {
|
||||||
deviceInfo = '${info.name} on ${info.systemName} version '
|
deviceInfo = '${info.name} on ${info.systemName} version '
|
||||||
'${info.systemVersion}';
|
'${info.systemVersion}';
|
||||||
@@ -35,7 +37,7 @@ class _DemoState extends State<Demo> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return CupertinoApp(
|
return CupertinoApp(
|
||||||
home: CupertinoPageScaffold(
|
home: CupertinoPageScaffold(
|
||||||
navigationBar: CupertinoNavigationBar(
|
navigationBar: const CupertinoNavigationBar(
|
||||||
middle: Text('App Clip'),
|
middle: Text('App Clip'),
|
||||||
),
|
),
|
||||||
child: Center(
|
child: Center(
|
||||||
@@ -43,8 +45,8 @@ class _DemoState extends State<Demo> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(deviceInfo),
|
Text(deviceInfo),
|
||||||
Padding(padding: EdgeInsets.only(top: 18)),
|
const Padding(padding: EdgeInsets.only(top: 18)),
|
||||||
FlutterLogo(size: 128),
|
const FlutterLogo(size: 128),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -76,11 +76,25 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
flutter_lints:
|
||||||
|
dependency: "direct dev"
|
||||||
|
description:
|
||||||
|
name: flutter_lints
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.3"
|
||||||
flutter_test:
|
flutter_test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
lints:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: lints
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.1"
|
||||||
matcher:
|
matcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: ios_app_clip
|
name: ios_app_clip
|
||||||
description: An example Flutter project that can build as an App Clip.
|
description: An example Flutter project that can build as an App Clip.
|
||||||
|
|
||||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
||||||
|
|
||||||
version: 1.0.0+1
|
version: 1.0.0+1
|
||||||
|
|
||||||
@@ -13,10 +13,11 @@ dependencies:
|
|||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
||||||
cupertino_icons: ^1.0.0
|
cupertino_icons: ^1.0.0
|
||||||
device_info: '>=0.4.2+7 <2.0.0'
|
device_info: ">=0.4.2+7 <2.0.0"
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
flutter_lints: ^1.0.0
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ import 'package:flutter_test/flutter_test.dart';
|
|||||||
import 'package:ios_app_clip/main.dart';
|
import 'package:ios_app_clip/main.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets('Smoke test', (WidgetTester tester) async {
|
testWidgets('Smoke test', (tester) async {
|
||||||
// Build our app and trigger a frame.
|
// Build our app and trigger a frame.
|
||||||
await tester.pumpWidget(Demo());
|
await tester.pumpWidget(const Demo());
|
||||||
|
|
||||||
expect(find.byType(FlutterLogo), findsOneWidget);
|
expect(find.byType(FlutterLogo), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user