Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flutter_lints rules added #57

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -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
44 changes: 23 additions & 21 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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(),
},
));
Expand All @@ -65,7 +66,8 @@ class _AppState extends State<App> {
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<String, dynamic>);
}
return config;
}
Expand Down Expand Up @@ -95,12 +97,12 @@ class _AppState extends State<App> {
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();
Expand All @@ -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!",
Expand Down Expand Up @@ -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(
Expand All @@ -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,
Expand All @@ -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()),
);
}
}
15 changes: 8 additions & 7 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
18 changes: 18 additions & 0 deletions sochem_main.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/.idea" />
<excludeFolder url="file://$MODULE_DIR$/.pub" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Flutter Plugins" level="project" />
<orderEntry type="library" name="Dart Packages" level="project" />
</component>
</module>
30 changes: 0 additions & 30 deletions test/widget_test.dart

This file was deleted.