Skip to content

Commit

Permalink
refactor: fixed code to pass the flutter analyze check!
Browse files Browse the repository at this point in the history
  • Loading branch information
IamMuuo committed Aug 24, 2024
1 parent a065eb3 commit 257908b
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
1 change: 0 additions & 1 deletion lib/pages/auth/register_page.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:academia/exports/barrel.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:lottie/lottie.dart';

Expand Down
1 change: 1 addition & 0 deletions lib/pages/courses/course_view_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class CourseViewPage extends StatelessWidget {
.deleteCourseTopic(data);

HapticFeedback.heavyImpact().then((value) {
if (!context.mounted) return;
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content:
Expand Down
6 changes: 1 addition & 5 deletions lib/pages/tool_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class _ToolsPageState extends State<ToolsPage> {
foundTools = _allTools;
}

void _runToolFilter(String enteredKeyWord) {
void runToolFilter(String enteredKeyWord) {
List<Map<String, dynamic>> results = [];
if (enteredKeyWord.isEmpty) {
results = _allTools;
Expand Down Expand Up @@ -86,10 +86,6 @@ class _ToolsPageState extends State<ToolsPage> {
},
icon: const Icon(Ionicons.information_circle),
),
IconButton(
onPressed: () {},
icon: const Icon(Ionicons.search_circle_outline),
)
],
),
SliverPadding(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class ExamsTimeTableController extends GetxController {
}
}


void nextQuote() {
if (quotes.isNotEmpty && index.value < 49) {
index.value++;
Expand All @@ -62,7 +61,7 @@ class ExamsTimeTableController extends GetxController {
}
}

Future<List<Exam>> fetchExams(List<String> units) async {
Future<List<Exam>> fetchExams(List<String> units) async {
const String apiUrl = "http://academia.erick.serv00.net/timetables/exams/";

try {
Expand Down Expand Up @@ -104,7 +103,8 @@ class ExamsTimeTableController extends GetxController {

return examData;
} else {
throw Exception("Failed to load exams. Status code: ${response.statusCode}");
throw Exception(
"Failed to load exams. Status code: ${response.statusCode}");
}
} catch (e) {
throw Exception("Error fetching exams: $e");
Expand Down Expand Up @@ -158,7 +158,6 @@ class ExamsTimeTableController extends GetxController {
List<String> courseTitles = courses
.map((e) => "${e.unit.replaceAll('-', '')}${e.section.split('-')[0]}")
.toList();
print(courseTitles);

// Fetch from server and store in the database
exams = await fetchExams(courseTitles);
Expand Down
3 changes: 3 additions & 0 deletions lib/tools/todo/todo_view_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class _TodoViewPageState extends State<TodoViewPage> {
lastDate: DateTime.now().add(const Duration(days: 365)),
).then((selectedDate) {
if (selectedDate != null) {
if (!mounted) return;
showTimePicker(
context: context,
initialTime: TimeOfDay.now(),
Expand Down Expand Up @@ -214,6 +215,7 @@ class _TodoViewPageState extends State<TodoViewPage> {
.then((value) {
todoController.getAllTodos();
if (value) {
if (!context.mounted) return;
showDialog(
context: context,
builder: (context) => AlertDialog(
Expand Down Expand Up @@ -251,6 +253,7 @@ class _TodoViewPageState extends State<TodoViewPage> {
todoController
.deleteTodo(widget.todo!)
.then((value) {
if (!context.mounted) return;
if (value) {
Navigator.pop(context);
Navigator.pop(context);
Expand Down
5 changes: 3 additions & 2 deletions lib/tools/todo/widgets/todo_items_section.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:academia/exports/barrel.dart';
import 'package:get/get.dart';
import 'package:flutter/services.dart';

class TodoItemSection extends StatefulWidget {
const TodoItemSection({super.key});
Expand All @@ -13,7 +12,7 @@ class _TodoItemSectionState extends State<TodoItemSection> {
final todoController = Get.find<TodoController>();
late List<Todo> allTodos;

List<Todo> _getDueTodos() {
List<Todo> getDueTodos() {
DateTime now = DateTime.now();

List<Todo> dueTodos = todoController.allTodos
Expand Down Expand Up @@ -54,6 +53,7 @@ class _TodoItemSectionState extends State<TodoItemSection> {
todoController
.deleteTodo(currentTodo)
.then((value) {
if (!context.mounted) return;
if (value) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
Expand Down Expand Up @@ -90,6 +90,7 @@ class _TodoItemSectionState extends State<TodoItemSection> {
ontap: () {
HapticFeedback.heavyImpact().then((value) {
todoController.updateTodo(currentTodo);
if (!context.mounted) return;
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text("Task updated sucessfully"),
Expand Down
5 changes: 3 additions & 2 deletions lib/widgets/tool_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class _ToolCardState extends State<ToolCard> {
color: Theme.of(context).colorScheme.shadow,
),
borderRadius: BorderRadius.circular(4),
color: Theme.of(context).colorScheme.background,
color: Theme.of(context).colorScheme.surface,
),
child: Column(
children: [
Expand All @@ -62,7 +62,8 @@ class _ToolCardState extends State<ToolCard> {
alignment: Alignment.centerLeft,
child: Text(widget.description),
),
ButtonBar(
OverflowBar(
alignment: MainAxisAlignment.end,
children: [
TextButton(
child: Text(widget.action),
Expand Down
4 changes: 2 additions & 2 deletions lib/workers/background_worker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void callbackDispatcher() {
storyController.fetchStories().then(
(value) {
value.fold((l) {
print("You pussy $l");
debugPrint("You pussy $l");
}, (r) {
notificationsController.createInstantNotification(
"Hey there you!",
Expand All @@ -23,7 +23,7 @@ void callbackDispatcher() {
});
},
);
print("hey");
debugPrint("hey");
break;
default:
}
Expand Down

0 comments on commit 257908b

Please sign in to comment.