mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +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';
|
||||
|
||||
void main() {
|
||||
runApp(Demo());
|
||||
runApp(const Demo());
|
||||
}
|
||||
|
||||
// The same content is shown for both the main app target and in the App
|
||||
// Clip.
|
||||
class Demo extends StatefulWidget {
|
||||
const Demo({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _DemoState();
|
||||
}
|
||||
@@ -22,7 +24,7 @@ class _DemoState extends State<Demo> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
DeviceInfoPlugin().iosInfo.then((IosDeviceInfo info) {
|
||||
DeviceInfoPlugin().iosInfo.then((info) {
|
||||
setState(() {
|
||||
deviceInfo = '${info.name} on ${info.systemName} version '
|
||||
'${info.systemVersion}';
|
||||
@@ -35,7 +37,7 @@ class _DemoState extends State<Demo> {
|
||||
Widget build(BuildContext context) {
|
||||
return CupertinoApp(
|
||||
home: CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
navigationBar: const CupertinoNavigationBar(
|
||||
middle: Text('App Clip'),
|
||||
),
|
||||
child: Center(
|
||||
@@ -43,8 +45,8 @@ class _DemoState extends State<Demo> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(deviceInfo),
|
||||
Padding(padding: EdgeInsets.only(top: 18)),
|
||||
FlutterLogo(size: 128),
|
||||
const Padding(padding: EdgeInsets.only(top: 18)),
|
||||
const FlutterLogo(size: 128),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -76,11 +76,25 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
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:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name: ios_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
|
||||
|
||||
@@ -13,10 +13,11 @@ dependencies:
|
||||
sdk: flutter
|
||||
|
||||
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:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
flutter_lints: ^1.0.0
|
||||
|
||||
flutter:
|
||||
|
||||
@@ -15,9 +15,9 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:ios_app_clip/main.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Smoke test', (WidgetTester tester) async {
|
||||
testWidgets('Smoke test', (tester) async {
|
||||
// Build our app and trigger a frame.
|
||||
await tester.pumpWidget(Demo());
|
||||
await tester.pumpWidget(const Demo());
|
||||
|
||||
expect(find.byType(FlutterLogo), findsOneWidget);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user