Skip to content

Commit

Permalink
Fix CI issue
Browse files Browse the repository at this point in the history
  • Loading branch information
banghuazhao committed Oct 18, 2024
1 parent 582e561 commit 9cb65d0
Show file tree
Hide file tree
Showing 25 changed files with 119 additions and 75 deletions.
12 changes: 12 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,19 @@ linter:
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.

analyzer:
strong-mode:
implicit-casts: false
implicit-dynamic: false

rules:
avoid_unused_imports: true
unused_local_variable: true
prefer_const_constructors: false
non_constant_identifier_names: false
lower_case_with_underscores: false
library_private_types_in_public_api: false
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

Expand Down
4 changes: 2 additions & 2 deletions data/lib/models/chat_chunk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ChatChunk {
if (json['choices'] != null) {
choices = <Choices>[];
json['choices'].forEach((v) {
choices!.add(new Choices.fromJson(v));
choices!.add(Choices.fromJson(v));
});
}
}
Expand All @@ -41,7 +41,7 @@ class Choices {

Choices.fromJson(Map<String, dynamic> json) {
index = json['index'];
delta = json['delta'] != null ? new Delta.fromJson(json['delta']) : null;
delta = json['delta'] != null ? Delta.fromJson(json['delta']) : null;
logprobs = json['logprobs'];
finishReason = json['finish_reason'];
}
Expand Down
2 changes: 1 addition & 1 deletion data/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ dependencies:
http: ^0.13.3
domain: # Add dependency on the domain module
path: ../domain # Local path to your domain module
uuid: ^4.5.1

dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^3.0.0
flutter_dotenv: ^5.0.2
uuid: ^3.0.7

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
Expand Down
18 changes: 16 additions & 2 deletions domain/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
include: package:flutter_lints/flutter.yaml

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
- avoid_unused_imports
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
2 changes: 0 additions & 2 deletions domain/lib/usecases/chat_session_usecase.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'package:flutter/material.dart';

import '../entities/chat_session.dart';
import '../entities/message.dart';
import '../repositories_abstract/chat_session_repository.dart';
Expand Down
1 change: 0 additions & 1 deletion domain/lib/usecases/function_tools_usecase.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'dart:convert';
/**/
import '../domain.dart';
import 'package:composite_calculator/composite_calculator.dart';

Expand Down
5 changes: 3 additions & 2 deletions domain/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ environment:
dependencies:
flutter:
sdk: flutter
uuid: ^4.5.1
composite_calculator: ^1.0.1

dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^3.0.0
uuid: ^3.0.7
composite_calculator: ^1.0.1


# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
Expand Down
2 changes: 1 addition & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ SPEC CHECKSUMS:
device_info: d7d233b645a32c40dfdc212de5cf646ca482f175
device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
fluttertoast: 9f2f8e81bb5ce18facb9748d7855bf5a756fe3db
fluttertoast: e9a18c7be5413da53898f660530c56f35edfba9c
in_app_review: 318597b3a06c22bb46dc454d56828c85f444f99d
launch_review: 75d5a956ba8eaa493e9c9d4bf4c05e505e8d5ed0
package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c
Expand Down
2 changes: 1 addition & 1 deletion lib/presentation/chat/viewModels/chat_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class ChatViewModel extends ChangeNotifier {
}

Future<void> checkFunctionCall(Message message) async {
final tool = message?.toolCalls?.first;
final tool = message.toolCalls?.first;
if (tool != null) {
final toolMessage = _functionToolsUseCase.handleToolCall(tool);
await sendMessage(toolMessage);
Expand Down
1 change: 0 additions & 1 deletion lib/presentation/chat/views/chat_message_list.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:domain/domain.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

Expand Down
2 changes: 0 additions & 2 deletions lib/presentation/more/feature_flag_page.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:swiftcomp/presentation/more/feature_flag_provider.dart';

class FeatureFlagPage extends StatelessWidget {
Expand Down
15 changes: 8 additions & 7 deletions lib/presentation/more/more_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'package:share/share.dart';
import 'package:swiftcomp/generated/l10n.dart';
import 'package:swiftcomp/presentation/more/login/login_page.dart';
import 'package:swiftcomp/presentation/more/tool_setting_page.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart';

import 'feature_flag_page.dart';

Expand Down Expand Up @@ -58,6 +58,7 @@ class _MorePageState extends State<MorePage>

@override
Widget build(BuildContext context) {
super.build(context);
return Scaffold(
appBar: AppBar(
title: const Text("More"),
Expand Down Expand Up @@ -184,8 +185,8 @@ class _MorePageState extends State<MorePage>
);

var url = params.toString();
if (await canLaunch(url)) {
await launch(url);
if (await canLaunchUrlString(url)) {
await launchUrlString(url);
} else {
throw 'Could not launch $url';
}
Expand Down Expand Up @@ -329,10 +330,10 @@ class _MorePageState extends State<MorePage>
}

class MoreRow extends StatelessWidget {
IconData leadingIcon;
IconData trailingIcon;
String title;
void Function() onTap;
final IconData leadingIcon;
final IconData trailingIcon;
final String title;
final void Function() onTap;

MoreRow(
{Key? key,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import '../../tools/model/thermal_model.dart';
import '../../tools/widget/analysis_type_row.dart';
import '../widget/transversely_thermal_constants_row.dart';


class RulesOfMixturePage extends StatefulWidget {
const RulesOfMixturePage({Key? key}) : super(key: key);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class _LaminaEngineeringConstantsPageState
});
},
),
LaminaContantsRow(
LaminaConstantsRow(
material: transverselyIsotropicMaterial,
validate: validate,
isPlaneStress: true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class _LaminaEngineeringConstantsResultPageState

@override
void initState() {
super.initState();
calculateNewAngle();
initChartData();
setState(() {});
Expand Down
3 changes: 1 addition & 2 deletions lib/presentation/tools/page/lamina_stress_strain_page.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:composite_calculator/composite_calculator.dart';
import 'package:composite_calculator/models/tensor_type.dart';
import 'package:flutter/material.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:swiftcomp/generated/l10n.dart';
Expand Down Expand Up @@ -89,7 +88,7 @@ class _LaminaStressStrainPageState extends State<LaminaStressStrainPage> {
});
},
),
LaminaContantsRow(
LaminaConstantsRow(
material: transverselyIsotropicMaterial,
validate: validate,
isPlaneStress: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class _Laminate3DPropertiesPageState extends State<Laminate3DPropertiesPage> {
});
},
),
LaminaContantsRow(
LaminaConstantsRow(
material: transverselyIsotropicMaterial,
validate: validate,
isPlaneStress: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class _LaminatePlatePropertiesPageState
});
},
),
LaminaContantsRow(
LaminaConstantsRow(
material: transverselyIsotropicMaterial,
validate: validate,
isPlaneStress: true,
Expand Down
5 changes: 1 addition & 4 deletions lib/presentation/tools/page/laminate_stress_strain_page.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import 'package:composite_calculator/composite_calculator.dart';
import 'package:composite_calculator/models/laminar_stress_strain_input.dart';
import 'package:composite_calculator/models/tensor_type.dart';
import 'package:flutter/material.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:linalg/linalg.dart';
Expand Down Expand Up @@ -82,7 +80,7 @@ class _LaminateStressStrainPageState extends State<LaminateStressStrainPage> {

List<Widget> get itemList {
return [
LaminaContantsRow(
LaminaConstantsRow(
material: transverselyIsotropicMaterial,
validate: validate,
isPlaneStress: true,
Expand Down Expand Up @@ -124,7 +122,6 @@ class _LaminateStressStrainPageState extends State<LaminateStressStrainPage> {
layerThickness: layerThickness.value ?? 0,
);

MechanicalTensor resultTensor;
if (mechanicalTensor is LaminateStress) {
input.tensorType = TensorType.stress;
input.N11 = (mechanicalTensor as LaminateStress).N11 ?? 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:math';

import 'package:composite_calculator/composite_calculator.dart';
import 'package:composite_calculator/models/tensor_type.dart';
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
Expand Down
1 change: 1 addition & 0 deletions lib/presentation/tools/page/tool_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class _ToolPageState extends State<ToolPage>

@override
Widget build(BuildContext context) {
super.build(context);
return Scaffold(
appBar: AppBar(
title: const Text("Tools")
Expand Down
2 changes: 1 addition & 1 deletion lib/presentation/tools/widget/analysis_type_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:composite_calculator/composite_calculator.dart';
import 'package:flutter/material.dart';

class AnalysisTypeRow extends StatefulWidget {
AnalysisType analysisType;
final AnalysisType analysisType;
final ValueChanged<AnalysisType> onChanged; // Callback to notify parent

AnalysisTypeRow(
Expand Down
8 changes: 4 additions & 4 deletions lib/presentation/tools/widget/lamina_constants_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ import 'package:swiftcomp/presentation/tools/model/material_model.dart';
import 'package:swiftcomp/presentation/tools/model/explain.dart';
import 'package:swiftcomp/presentation/tools/model/validate.dart';

class LaminaContantsRow extends StatefulWidget {
class LaminaConstantsRow extends StatefulWidget {
final TransverselyIsotropicMaterial material;
final bool validate;
final bool isPlaneStress;

const LaminaContantsRow(
const LaminaConstantsRow(
{Key? key, required this.material, required this.validate, required this.isPlaneStress})
: super(key: key);

@override
_LaminaContantsRowState createState() => _LaminaContantsRowState();
_LaminaConstantsRowState createState() => _LaminaConstantsRowState();
}

class _LaminaContantsRowState extends State<LaminaContantsRow> {
class _LaminaConstantsRowState extends State<LaminaConstantsRow> {
@override
Widget build(BuildContext context) {
return Card(
Expand Down
Loading

0 comments on commit 9cb65d0

Please sign in to comment.