Skip to content

Commit

Permalink
style: use super parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
narcodico committed Jun 17, 2022
1 parent 57469ee commit 35b5960
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 41 deletions.
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ linter:
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
- use_super_parameters
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

Expand Down
9 changes: 5 additions & 4 deletions lib/about/about.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import 'package:flutter/material.dart';

class AboutScreen extends StatelessWidget {
const AboutScreen({Key? key}) : super(key: key);
const AboutScreen({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('about'), backgroundColor: Colors.blue),

body: const Center(child: Text('About this app...'),),
body: const Center(
child: Text('About this app...'),
),
);
}
}
}
4 changes: 2 additions & 2 deletions lib/home/home.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import 'package:flutter/material.dart';
import 'package:quizapp/login/login.dart';
import 'package:quizapp/services/auth.dart';
import 'package:quizapp/shared/shared.dart';
import 'package:quizapp/topics/topics.dart';
import 'package:quizapp/services/auth.dart';

class HomeScreen extends StatelessWidget {
const HomeScreen({Key? key}) : super(key: key);
const HomeScreen({super.key});

@override
Widget build(BuildContext context) {
Expand Down
11 changes: 5 additions & 6 deletions lib/login/login.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'package:flutter/material.dart';
import 'package:sign_in_with_apple/sign_in_with_apple.dart';
import 'package:quizapp/services/auth.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:quizapp/services/auth.dart';
import 'package:sign_in_with_apple/sign_in_with_apple.dart';

class LoginScreen extends StatelessWidget {
const LoginScreen({Key? key}) : super(key: key);
const LoginScreen({super.key});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -58,12 +58,11 @@ class LoginButton extends StatelessWidget {
final Function loginMethod;

const LoginButton(
{Key? key,
{super.key,
required this.text,
required this.icon,
required this.color,
required this.loginMethod})
: super(key: key);
required this.loginMethod});

@override
Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void main() {
}

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

@override
State<App> createState() => _AppState();
Expand Down
2 changes: 1 addition & 1 deletion lib/profile/profile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:quizapp/services/services.dart';
import 'package:quizapp/shared/shared.dart';

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

@override
State<ProfileScreen> createState() => _ProfileScreenState();
Expand Down
8 changes: 4 additions & 4 deletions lib/quiz/quiz.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:quizapp/shared/loading.dart';
import 'package:quizapp/shared/progress_bar.dart';

class QuizScreen extends StatelessWidget {
const QuizScreen({Key? key, required this.quizId}) : super(key: key);
const QuizScreen({super.key, required this.quizId});
final String quizId;

@override
Expand Down Expand Up @@ -59,7 +59,7 @@ class QuizScreen extends StatelessWidget {

class StartPage extends StatelessWidget {
final Quiz quiz;
const StartPage({Key? key, required this.quiz}) : super(key: key);
const StartPage({super.key, required this.quiz});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -91,7 +91,7 @@ class StartPage extends StatelessWidget {

class CongratsPage extends StatelessWidget {
final Quiz quiz;
const CongratsPage({Key? key, required this.quiz}) : super(key: key);
const CongratsPage({super.key, required this.quiz});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -130,7 +130,7 @@ class CongratsPage extends StatelessWidget {

class QuestionPage extends StatelessWidget {
final Question question;
const QuestionPage({Key? key, required this.question}) : super(key: key);
const QuestionPage({super.key, required this.question});

@override
Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion lib/shared/bottom_nav.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';

class BottomNavBar extends StatelessWidget {
const BottomNavBar({Key? key}) : super(key: key);
const BottomNavBar({super.key});

@override
Widget build(BuildContext context) {
Expand Down
5 changes: 2 additions & 3 deletions lib/shared/error.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import 'package:flutter/material.dart';

class ErrorMessage extends StatelessWidget {

final String message;

const ErrorMessage({Key? key, this.message = 'it broke'}) : super(key: key);
const ErrorMessage({super.key, this.message = 'it broke'});

@override
Widget build(BuildContext context) {
return Center(
Expand Down
7 changes: 4 additions & 3 deletions lib/shared/loading.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';

class Loader extends StatelessWidget {
const Loader({Key? key}) : super(key: key);
const Loader({super.key});

@override
Widget build(BuildContext context) {
Expand All @@ -13,7 +14,7 @@ class Loader extends StatelessWidget {
}

class LoadingScreen extends StatelessWidget {
const LoadingScreen({Key? key}) : super(key: key);
const LoadingScreen({super.key});

@override
Widget build(BuildContext context) {
Expand All @@ -23,4 +24,4 @@ class LoadingScreen extends StatelessWidget {
),
);
}
}
}
7 changes: 3 additions & 4 deletions lib/shared/progress_bar.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import 'package:flutter/material.dart';
import 'package:quizapp/services/models.dart';
import 'package:provider/provider.dart';
import 'package:quizapp/services/models.dart';

class AnimatedProgressbar extends StatelessWidget {
final double value;
final double height;

const AnimatedProgressbar({Key? key, required this.value, this.height = 12})
: super(key: key);
const AnimatedProgressbar({super.key, required this.value, this.height = 12});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -58,7 +57,7 @@ class AnimatedProgressbar extends StatelessWidget {
}

class TopicProgress extends StatelessWidget {
const TopicProgress({Key? key, required this.topic}) : super(key: key);
const TopicProgress({super.key, required this.topic});

final Topic topic;

Expand Down
10 changes: 4 additions & 6 deletions lib/topics/drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import 'package:provider/provider.dart';
import 'package:quizapp/quiz/quiz.dart';
import 'package:quizapp/services/models.dart';


class TopicDrawer extends StatelessWidget {
final List<Topic> topics;
const TopicDrawer({ Key? key, required this.topics}) : super(key: key);
const TopicDrawer({super.key, required this.topics});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -43,7 +42,7 @@ class TopicDrawer extends StatelessWidget {

class QuizList extends StatelessWidget {
final Topic topic;
const QuizList({Key? key, required this.topic}) : super(key: key);
const QuizList({super.key, required this.topic});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -91,8 +90,7 @@ class QuizBadge extends StatelessWidget {
final String quizId;
final Topic topic;

const QuizBadge({Key? key, required this.quizId, required this.topic})
: super(key: key);
const QuizBadge({super.key, required this.quizId, required this.topic});

@override
Widget build(BuildContext context) {
Expand All @@ -104,4 +102,4 @@ class QuizBadge extends StatelessWidget {
return const Icon(FontAwesomeIcons.solidCircle, color: Colors.grey);
}
}
}
}
10 changes: 5 additions & 5 deletions lib/topics/topic_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:quizapp/topics/drawer.dart';

class TopicItem extends StatelessWidget {
final Topic topic;
const TopicItem({ Key? key, required this.topic}) : super(key: key);
const TopicItem({super.key, required this.topic});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -60,7 +60,7 @@ class TopicItem extends StatelessWidget {
class TopicScreen extends StatelessWidget {
final Topic topic;

const TopicScreen({Key? key,required this.topic}) : super(key: key);
const TopicScreen({super.key, required this.topic});

@override
Widget build(BuildContext context) {
Expand All @@ -76,11 +76,11 @@ class TopicScreen extends StatelessWidget {
),
Text(
topic.title,
style:
const TextStyle(height: 2, fontSize: 20, fontWeight: FontWeight.bold),
style: const TextStyle(
height: 2, fontSize: 20, fontWeight: FontWeight.bold),
),
QuizList(topic: topic)
]),
);
}
}
}
2 changes: 1 addition & 1 deletion lib/topics/topics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:quizapp/topics/drawer.dart';
import 'package:quizapp/topics/topic_item.dart';

class TopicsScreen extends StatelessWidget {
const TopicsScreen({Key? key}) : super(key: key);
const TopicsScreen({super.key});

@override
Widget build(BuildContext context) {
Expand Down

0 comments on commit 35b5960

Please sign in to comment.