diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000..fd16f92 --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# 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 + +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_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/lib/main.dart b/lib/main.dart index 0facec9..904fb9a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,23 +1,24 @@ import 'dart:convert'; + import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_dotenv/flutter_dotenv.dart'; +import 'package:http/http.dart' as http; import 'package:shared_preferences/shared_preferences.dart'; import 'package:sochem/models/config.dart'; +import 'package:sochem/screen/cloud.dart'; +import 'package:sochem/screen/feed.dart'; import 'package:sochem/screen/forum_page.dart'; +import 'package:sochem/screen/groups.dart'; import 'package:sochem/screen/home_screen.dart'; import 'package:sochem/screen/info.dart'; import 'package:sochem/screen/login_page.dart'; -import 'package:sochem/screen/groups.dart'; -import 'package:sochem/screen/feed.dart'; -import 'package:sochem/screen/cloud.dart'; import 'package:sochem/screen/notif.dart'; import 'package:sochem/screen/onboarding_screen.dart'; import 'package:sochem/screen/people.dart'; import 'package:sochem/screen/profile.dart'; import 'package:sochem/screen/splash_screen.dart'; -import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:sochem/utils/constants.dart'; -import 'package:flutter/services.dart'; -import 'package:http/http.dart' as http; import 'package:sochem/utils/endpoints.dart'; import 'package:sochem/widgets/error_messages.dart'; @@ -32,13 +33,13 @@ void main() async { HomeRoute: (context) => HomeScreen(), OnboardingRoute: (context) => OnboardingScreen(), FeedRoute: (context) => FeedScreen(), - CloudRoute: (context) => CloudPage(), - PeopleRoute: (context) => PeoplePage(), - GroupRoute: (context) => GroupPage(), + CloudRoute: (context) => const CloudPage(), + PeopleRoute: (context) => const PeoplePage(), + GroupRoute: (context) => const GroupPage(), NotifRoute: (context) => Notif(), - LoginRoute: (context) => LoginPage(), + LoginRoute: (context) => const LoginPage(), ProfileRoute: (context) => ProfilePage(), - ForumRoute: (context) => ForumPage(), + ForumRoute: (context) => const ForumPage(), InfoRoute: (context) => Information(), }, )); @@ -65,7 +66,8 @@ class _AppState extends State { Config config = Config(appVersion, false, false); var response = await http.get(Uri.parse(Endpoints.config)); if (response.statusCode == 200) { - config = Config.fromJson(json.decode(response.body)); + config = + Config.fromJson(json.decode(response.body) as Map); } return config; } @@ -95,12 +97,12 @@ class _AppState extends State { var myAppVersion = pref.getString(AppVersion)!; if (config.maintenance) { - return AppUnderMaintenance(); + return const AppUnderMaintenance(); } if (config.update && myAppVersion.compareTo(config.appVersion) < 0) { - return UpdateYourApp(); + return const UpdateYourApp(); } return SplashScreen(); @@ -126,16 +128,16 @@ class UpdateYourApp extends StatelessWidget { Container( width: 180, height: 180, - decoration: BoxDecoration( + decoration: const BoxDecoration( shape: BoxShape.circle, color: Colors.white, - image: DecorationImage( + image: const DecorationImage( fit: BoxFit.fill, image: AssetImage(SochemIcon), ), ), ), - Padding( + const Padding( padding: EdgeInsets.symmetric(horizontal: 10), child: Text( "We have lauched a new version of our app. Please update!", @@ -166,7 +168,7 @@ class AppUnderMaintenance extends StatelessWidget { Container( width: 180, height: 180, - decoration: BoxDecoration( + decoration: const BoxDecoration( shape: BoxShape.circle, color: Colors.white, image: DecorationImage( @@ -175,11 +177,11 @@ class AppUnderMaintenance extends StatelessWidget { ), ), ), - Padding( + const Padding( padding: EdgeInsets.symmetric(horizontal: 10), child: Text( "Sorry for the inconvinience! The app is under maintenance", - style: TextStyle( + style: const TextStyle( fontSize: 18.0, fontWeight: FontWeight.bold, color: tri1, @@ -197,7 +199,7 @@ class Loading extends StatelessWidget { @override Widget build(BuildContext context) { return Container( - child: Center(child: CircularProgressIndicator()), + child: const Center(child: const CircularProgressIndicator()), ); } } diff --git a/pubspec.yaml b/pubspec.yaml index 0861801..6c6fe41 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -27,23 +27,24 @@ dependencies: flutter: sdk: flutter flutter_dotenv: ^5.0.2 - flutter_svg: ^0.23.0+1 - font_awesome_flutter: ^9.2.0 - google_fonts: ^2.3.1 + flutter_svg: ^2.0.7 + font_awesome_flutter: ^10.5.0 + google_fonts: ^6.1.0 google_one_tap_sign_in: null - http: ^0.13.4 - intl: ^0.17.0 + http: ^1.1.0 + intl: ^0.18.1 shared_preferences: ^2.0.13 url_launcher: ^6.0.20 shape_of_view_null_safe: ^2.0.0 - flutter_html: ^2.2.1 + flutter_html: ^3.0.0-beta.2 video_player_web: ^2.0.7 wakelock_web: ^0.4.0 dev_dependencies: + flutter_launcher_icons: ^0.13.1 flutter_test: sdk: flutter - flutter_launcher_icons: ^0.9.2 + flutter_lints: ^2.0.1 flutter_icons: image_path: "assets/sochem.png" diff --git a/sochem_main.iml b/sochem_main.iml new file mode 100644 index 0000000..e5c8371 --- /dev/null +++ b/sochem_main.iml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/widget_test.dart b/test/widget_test.dart deleted file mode 100644 index fe05748..0000000 --- a/test/widget_test.dart +++ /dev/null @@ -1,30 +0,0 @@ -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility that Flutter provides. For example, you can send tap and scroll -// gestures. You can also use WidgetTester to find child widgets in the widget -// tree, read text, and verify that the values of widget properties are correct. - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:sochem/main.dart'; - -void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(App()); - - // Verify that our counter starts at 0. - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); - - // Tap the '+' icon and trigger a frame. - await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); - - // Verify that our counter has incremented. - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); - }); -}