Skip to content

Commit

Permalink
ci: Adjusts linter with flutterando_analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
vitoria-soares committed Sep 1, 2022
1 parent 70c84fb commit 6d72f6b
Show file tree
Hide file tree
Showing 15 changed files with 174 additions and 45 deletions.
2 changes: 2 additions & 0 deletions analysis_option.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include: package:flutterando_analysis/flutter_package.yaml

2 changes: 1 addition & 1 deletion example/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
include: package:flutterando_analysis/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
Expand Down
30 changes: 18 additions & 12 deletions example/integration_test/asuka_integration_test.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ignore_for_file: unnecessary_statements

import 'package:asuka/asuka.dart';
import 'package:example/src/home.controller.dart';
import 'package:flutter/material.dart';
Expand All @@ -7,12 +9,12 @@ import 'package:integration_test/integration_test.dart';
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

var controller = HomeController();
final controller = HomeController();

testWidgets(
'AsukaSnackbar.warning appears',
(tester) async {
const String content = 'test';
const content = 'test';
await tester.pumpWidget(
showSnackbar(AsukaSnackbar.warning('test'), 'Warning'),
);
Expand All @@ -28,7 +30,7 @@ void main() {
testWidgets(
'AsukaSnackbar.success appears',
(tester) async {
const String content = 'test';
const content = 'test';
await tester.pumpWidget(
showSnackbar(AsukaSnackbar.success('test'), 'Success'),
);
Expand All @@ -44,7 +46,7 @@ void main() {
testWidgets(
'AsukaSnackbar.alert appears',
(tester) async {
const String content = 'test';
const content = 'test';
await tester.pumpWidget(
showSnackbar(AsukaSnackbar.alert('test'), 'Alert'),
);
Expand All @@ -60,7 +62,7 @@ void main() {
testWidgets(
'AsukaSnackbar.info appears',
(tester) async {
const String content = 'test';
const content = 'test';
await tester.pumpWidget(
showSnackbar(AsukaSnackbar.info('test'), 'Info'),
);
Expand All @@ -76,9 +78,13 @@ void main() {
testWidgets(
'AsukaSnackbar.message appears',
(tester) async {
const String content = 'test';
await tester
.pumpWidget(showSnackbar(AsukaSnackbar.message('test'), 'Message'));
const content = 'test';
await tester.pumpWidget(
showSnackbar(
AsukaSnackbar.message('test'),
'Message',
),
);

// Create the Finders.
final btnFinder = find.text('Message');
Expand All @@ -92,7 +98,7 @@ void main() {
testWidgets(
'controller.onClickSnackbar appears',
(tester) async {
const String content = 'New Snackbar';
const content = 'New Snackbar';
await tester.pumpWidget(
MaterialApp(
builder: Asuka.builder,
Expand Down Expand Up @@ -132,7 +138,7 @@ void main() {
testWidgets(
'controller.onClickDialog appears',
(tester) async {
const String content = 'Dialog';
const content = 'Dialog';
await tester.pumpWidget(
MaterialApp(
builder: Asuka.builder,
Expand Down Expand Up @@ -181,7 +187,7 @@ void main() {
testWidgets(
'controller.onClickBottomSheet showBottomSheet appears',
(tester) async {
const String content = 'Cancel';
const content = 'Cancel';
await tester.pumpWidget(
MaterialApp(
builder: Asuka.builder,
Expand Down Expand Up @@ -243,7 +249,7 @@ void main() {
testWidgets(
'controller.onClickModalBottomSheet showModalBottomSheet appears',
(tester) async {
const String content = 'Cancel';
const content = 'Cancel';
await tester.pumpWidget(
MaterialApp(
builder: Asuka.builder,
Expand Down
1 change: 1 addition & 0 deletions example/ios/Flutter/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
1 change: 1 addition & 0 deletions example/ios/Flutter/Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
41 changes: 41 additions & 0 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
16 changes: 8 additions & 8 deletions example/lib/src/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class _HomePageState extends State<HomePage> {
backgroundColor: Colors.grey[200],
appBar: AppBar(
centerTitle: true,
title: const Text("Asuka"),
title: const Text('Asuka'),
),
body: ListView(
padding: const EdgeInsets.all(20),
Expand Down Expand Up @@ -52,43 +52,43 @@ class _HomePageState extends State<HomePage> {
),
const SizedBox(height: 10),
ElevatedButton(
onPressed: homeController.onClickBottomSheet,
child: const Text('ModalSheet'),
onPressed: () => homeController.onClickBottomSheet(),
),
ElevatedButton(
child: const Text('SnackBar Warning'),
onPressed: () {
AsukaSnackbar.warning("Warning").show();
AsukaSnackbar.warning('Warning').show();
},
),
ElevatedButton(
child: const Text('SnackBar Success'),
onPressed: () {
AsukaSnackbar.success("Success").show();
AsukaSnackbar.success('Success').show();
},
),
ElevatedButton(
child: const Text('SnackBar alert'),
onPressed: () {
AsukaSnackbar.alert("alert").show();
AsukaSnackbar.alert('alert').show();
},
),
ElevatedButton(
child: const Text('SnackBar info'),
onPressed: () {
AsukaSnackbar.info("info").show();
AsukaSnackbar.info('info').show();
},
),
ElevatedButton(
child: const Text('SnackBar message'),
onPressed: () {
AsukaSnackbar.message("message").show();
AsukaSnackbar.message('message').show();
},
),
Row(
children: [
Hero(
tag: "HeroTag",
tag: 'HeroTag',
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
Expand Down
26 changes: 13 additions & 13 deletions example/lib/src/second/second_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ class _SecondPageState extends State<SecondPage> {
resizeToAvoidBottomInset: false,
appBar: AppBar(
centerTitle: true,
title: const Text("Asuka"),
title: const Text('Asuka'),
),
body: Center(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Hero(
tag: "HeroTag",
tag: 'HeroTag',
child: Container(
height: 100,
color: Colors.red,
Expand All @@ -35,55 +35,55 @@ class _SecondPageState extends State<SecondPage> {
child: const Text('Back to Home'),
onPressed: () {
Navigator.pop(context);
}),
},),
ElevatedButton(
child: const Text('Back to Home'),
onPressed: () {
Navigator.pop(context);
}),
},),
ElevatedButton(
child: const Text('Back to Home'),
onPressed: () {
Navigator.pop(context);
}),
},),
ElevatedButton(
child: const Text('Back to Home'),
onPressed: () {
Navigator.pop(context);
}),
},),
ElevatedButton(
child: const Text('Back to Home'),
onPressed: () {
Navigator.pop(context);
}),
},),
ElevatedButton(
child: const Text('Back to Home'),
onPressed: () {
Navigator.pop(context);
}),
},),
ElevatedButton(
child: const Text('Back to Home'),
onPressed: () {
Navigator.pop(context);
}),
},),
ElevatedButton(
child: const Text('Back to Home'),
onPressed: () {
Navigator.pop(context);
}),
},),
ElevatedButton(
child: const Text('Back to Home'),
onPressed: () {
Navigator.pop(context);
}),
},),
ElevatedButton(
child: const Text('Back to Home'),
onPressed: () {
Navigator.pop(context);
}),
},),
],
),
),
));
),);
}
}
1 change: 1 addition & 0 deletions example/macos/Flutter/Flutter-Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
1 change: 1 addition & 0 deletions example/macos/Flutter/Flutter-Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
40 changes: 40 additions & 0 deletions example/macos/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
platform :osx, '10.11'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_macos_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_macos_build_settings(target)
end
end
Loading

0 comments on commit 6d72f6b

Please sign in to comment.