Skip to content

Commit

Permalink
refactor: examples/alice
Browse files Browse the repository at this point in the history
  • Loading branch information
techouse committed Jun 16, 2024
1 parent 14f7c83 commit ff2b7b0
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 41 deletions.
22 changes: 9 additions & 13 deletions examples/alice/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
1include: package:very_good_analysis/analysis_options.yaml
analyzer:
exclude:
- "lib/generated_plugin_registrant.dart"
- "**.g.dart"
- "**.mocks.dart"
- "**.gen.dart"

include: package:flutter_lints/flutter.yaml

linter:
rules:
public_member_api_docs: false
flutter_style_todos: false
avoid_final_parameters: false
sort_constructors_first: false
avoid_function_literals_in_foreach_calls: false
avoid_positional_boolean_parameters: false
use_if_null_to_convert_nulls_to_bools: false
use_build_context_synchronously: false
prefer_constructors_over_static_methods: false
use_setters_to_change_properties: false
avoid_print: false
sort_pub_dependencies: false
#library_annotations: false
52 changes: 26 additions & 26 deletions examples/alice/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
import 'package:alice/alice.dart';
import 'package:flutter/material.dart';

void main() => runApp(MyApp());
void main() => runApp(const MyApp());

class MyApp extends StatefulWidget {
const MyApp({super.key});

@override
_MyAppState createState() => _MyAppState();
State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
late Alice _alice;

@override
void initState() {
_alice = Alice(
showNotification: true,
showInspectorOnShake: true,
maxCallsCount: 1000,
);

super.initState();
}
late final Alice _alice = Alice(
showNotification: true,
showInspectorOnShake: true,
maxCallsCount: 1000,
);

@override
Widget build(BuildContext context) {
Expand All @@ -32,27 +27,32 @@ class _MyAppState extends State<MyApp> {
title: const Text('Alice HTTP Inspector - Example'),
),
body: Container(
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
child: ListView(
children: [
const SizedBox(height: 8),
Text(
'Welcome to example of Alice Http Inspector. Click buttons below to generate sample data.'),
const Text(
style: TextStyle(fontSize: 14),
'Welcome to example of Alice Http Inspector. '
'Click buttons below to generate sample data.',
),
ElevatedButton(
child: Text(
onPressed: _logExampleData,
child: const Text(
'Log example data',
),
onPressed: _logExampleData,
),
const SizedBox(height: 24),
Text(
'After clicking on buttons above, you should receive notification.'
' Click on it to show inspector. You can also shake your device or click button below.'),
const SizedBox(height: 8),
const Text(
style: TextStyle(fontSize: 14),
'After clicking on buttons above, you should receive notification.'
' Click on it to show inspector. You can also shake your device or click button below.',
),
ElevatedButton(
child: Text(
onPressed: _runHttpInspector,
child: const Text(
'Run HTTP Inspector',
),
onPressed: _runHttpInspector,
)
],
),
Expand Down Expand Up @@ -84,7 +84,7 @@ class _MyAppState extends State<MyApp> {
message: 'Warning log',
),
);
final notNumber = 'afs';
const String notNumber = 'afs';
try {
int.parse(notNumber);
} catch (e, stacktrace) {
Expand Down
4 changes: 2 additions & 2 deletions examples/alice/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ dependencies:
sdk: flutter
chopper: ^8.0.0
path_provider:
alice:

alice: any
dev_dependencies:
build_runner:
chopper_generator: ^8.0.0
very_good_analysis: ^5.1.0
flutter_lints: ^4.0.0

dependency_overrides:
alice:
Expand Down

0 comments on commit ff2b7b0

Please sign in to comment.