Skip to content

Commit e4af128

Browse files
committed
trying slove lint issue
1 parent a2f49f8 commit e4af128

25 files changed

+171
-191
lines changed

lib/common/themes.dart

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import 'package:flutter/foundation.dart';
22
import 'package:flutter/material.dart';
33

44
final ThemeData darkTheme = ThemeData(
5-
primarySwatch: Colors.grey,
6-
// ignore: deprecated_member_use
75
textTheme: Typography(platform: defaultTargetPlatform).white,
86
primaryColor: Colors.white,
97
primaryTextTheme: const TextTheme(
@@ -18,10 +16,9 @@ final ThemeData darkTheme = ThemeData(
1816
// brightness: Brightness.dark,
1917
backgroundColor: const Color.fromRGBO(18, 19, 33, 1),
2018
scaffoldBackgroundColor: const Color.fromRGBO(18, 19, 33, 1),
21-
accentColor: Colors.white,
22-
colorScheme: const ColorScheme.light(primary: Colors.white),
23-
accentIconTheme: const IconThemeData(color: Colors.black),
2419
dividerColor: Colors.transparent,
20+
colorScheme: const ColorScheme.light(primary: Colors.white)
21+
.copyWith(primary: Colors.grey, secondary: Colors.white),
2522
);
2623

2724
final ThemeData lightTheme = ThemeData(
@@ -32,7 +29,6 @@ final ThemeData lightTheme = ThemeData(
3229
scaffoldBackgroundColor: Colors.white,
3330
colorScheme: const ColorScheme.dark(
3431
brightness: Brightness.light, primary: Colors.black),
35-
accentIconTheme: const IconThemeData(color: Colors.white),
3632
dividerColor: Colors.transparent,
3733
elevatedButtonTheme: ElevatedButtonThemeData(
3834
style: ElevatedButton.styleFrom(

lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class MyApp extends StatelessWidget {
4343
debugShowCheckedModeBanner: false,
4444
title: 'Explr',
4545
home: Wrapper(),
46-
onGenerateRoute: RouteGenerator.generateRoute,
46+
onGenerateRoute: RouteGenerator().generateRoute,
4747
);
4848
}
4949
}

lib/providers/books.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import 'dart:convert';
2-
3-
import 'package:cloud_firestore/cloud_firestore.dart';
42
import 'package:firebase_auth/firebase_auth.dart';
53
import 'package:flutter/cupertino.dart';
64
import 'package:http/http.dart' as http;
@@ -223,7 +221,7 @@ class Books with ChangeNotifier {
223221
final http.Response response = await http.get(Uri.parse(recommendedURL));
224222
final dynamic result = jsonDecode(response.body);
225223
print('result from Google API topBook func is $result');
226-
final List list = result['items'] as List;
224+
final List<dynamic> list = result['items'] as List<dynamic>;
227225

228226
if (result != null) {
229227
final List<Book> recommendedBooks = <Book>[];

lib/screens/auth/login.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class _LoginScreenState extends State<LoginScreen> {
3333
Form(
3434
key: formKey,
3535
child: Column(
36-
children: [
36+
children: <Widget>[
3737
EmailTextField(_emailController),
3838
PasswordTextField(_passwordController)
3939
],

lib/screens/auth/register.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import 'package:books_app/constants/colors.dart';
2-
import 'package:books_app/constants/routes.dart';
32
import 'package:books_app/services/auth.dart';
4-
import 'package:books_app/widgets/auth/auth_error_message.dart';
53
import 'package:books_app/widgets/auth/auth_navigation.dart';
64
import 'package:books_app/widgets/auth/auth_page_title.dart';
75
import 'package:books_app/widgets/button.dart';
86
import 'package:books_app/widgets/text_field.dart';
9-
import 'package:firebase_auth/firebase_auth.dart';
107
import 'package:flutter/material.dart';
118

129
class RegisterScreen extends StatefulWidget {

lib/screens/book_desciption.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import 'package:readmore/readmore.dart';
1414

1515
class BookDescription extends StatefulWidget {
1616
final Book bookFromList;
17-
const BookDescription({Key key, this.bookFromList}) : super(key: key);
17+
const BookDescription({Key key, this.bookFromList}) : super(key: key);
1818
@override
1919
_BookDescriptionState createState() => _BookDescriptionState();
2020
}
@@ -91,7 +91,7 @@ class _BookDescriptionState extends State<BookDescription>
9191
),
9292
body: NestedScrollView(
9393
scrollDirection: Axis.vertical,
94-
physics: AlwaysScrollableScrollPhysics(),
94+
physics: const AlwaysScrollableScrollPhysics(),
9595
headerSliverBuilder: (BuildContext context, bool value) {
9696
return <SliverToBoxAdapter>[
9797
SliverToBoxAdapter(

lib/screens/bookshelf.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,5 @@ class _LibraryPageState extends State<LibraryPage> {
7777
);
7878
}
7979

80-
81-
}
80+
81+
}

lib/screens/dashboard/book_list.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class _BookListState extends State<BookList> {
3030
child: Row(
3131
mainAxisAlignment: MainAxisAlignment.start,
3232
crossAxisAlignment: CrossAxisAlignment.end,
33-
children: [
33+
children: <Widget>[
3434
Text(widget.title,
3535
style: GoogleFonts.poppins(
3636
fontSize: 24, fontWeight: FontWeight.w600)),

lib/screens/dashboard/user_choice.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import 'package:books_app/constants/colors.dart';
21
import 'package:books_app/providers/user.dart';
32
import 'package:books_app/screens/user_preferences.dart';
43
import 'package:flutter/material.dart';

lib/screens/explore_nearby.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import 'package:books_app/providers/books.dart';
33
import 'package:books_app/providers/user.dart';
44
import 'package:books_app/services/database_service.dart';
55
import 'package:books_app/utils/location_helper.dart';
6-
import 'package:books_app/widgets/empty_page.dart';
76
import 'package:flutter/material.dart';
87
import 'package:provider/provider.dart';
98

@@ -15,7 +14,6 @@ class ExploreNearby extends StatefulWidget {
1514
}
1615

1716
class _ExploreNearbyState extends State<ExploreNearby> {
18-
1917
// LocationRange distance;
2018
@override
2119
Widget build(BuildContext context) {
@@ -24,7 +22,7 @@ class _ExploreNearbyState extends State<ExploreNearby> {
2422
final List<Book> within5km = Provider.of<Books>(context).within5km;
2523
final List<Book> within10km = Provider.of<Books>(context).within10km;
2624
final List<Book> within20km = Provider.of<Books>(context).within20km;
27-
List<Book> morethan20km = Provider.of<Books>(context).morethan20km;
25+
final List<Book> morethan20km = Provider.of<Books>(context).morethan20km;
2826

2927
final DatabaseService _databaseService =
3028
DatabaseService(uid: userData.uid.toString());
@@ -51,7 +49,7 @@ class _ExploreNearbyState extends State<ExploreNearby> {
5149
lon2: element.longitude);
5250

5351
// print('Distance: $dist');
54-
if (element.uid != null) if (dist <= 3 ) {
52+
if (element.uid != null) if (dist <= 3) {
5553
// print('dist <= 3: ' + element.uid.toString());
5654
_databaseService
5755
.getBooks(uid: element.uid)

lib/screens/home.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'package:books_app/constants/colors.dart';
2-
import 'package:books_app/constants/routes.dart';
32
import 'package:books_app/providers/book.dart';
43
import 'package:books_app/providers/user.dart';
54
import 'package:books_app/screens/bookshelf.dart';
@@ -89,7 +88,7 @@ class _HomeState extends State<Home> {
8988
content: Text('Location Updated Successfully!'),
9089
));
9190
});
92-
}).onError((String error, stackTrace) {
91+
}).onError((String error, StackTrace stackTrace) {
9392
print(error);
9493
print(stackTrace);
9594
SnackBar(content: Text(error.toString()));

lib/screens/more.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class PrivacyPolicy extends StatelessWidget {
4646
Widget build(BuildContext context) {
4747
return Scaffold(
4848
body: Column(
49-
children: [
49+
children: <Widget>[
5050
Container(
5151
margin: const EdgeInsets.only(top: 10),
5252
alignment: Alignment.topLeft,
@@ -80,7 +80,7 @@ class TermsCondition extends StatelessWidget {
8080
Widget build(BuildContext context) {
8181
return Scaffold(
8282
body: Column(
83-
children: [
83+
children: <Widget>[
8484
Container(
8585
margin: const EdgeInsets.only(top: 10),
8686
alignment: Alignment.topLeft,

lib/screens/profile/edit_profile.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ class _EditProfileState extends State<EditProfile> {
3131
String _imageUrl = '';
3232
@override
3333
Widget build(BuildContext context) {
34-
final userProvider = Provider.of<UserData>(context);
34+
final UserData userProvider = Provider.of<UserData>(context);
3535
final String uID = _authService.getUID;
36-
final String image = userProvider.photoURL;
36+
// final String image = userProvider.photoURL;
3737
// final UserData userData = snapshot.data as UserData
3838

3939
return Scaffold(
@@ -200,8 +200,8 @@ class _EditProfileState extends State<EditProfile> {
200200
);
201201
}
202202

203-
Future loadAdressPrefs() async {
204-
SharedPreferences _prefs = await SharedPreferences.getInstance();
203+
Future<void> loadAdressPrefs() async {
204+
final SharedPreferences _prefs = await SharedPreferences.getInstance();
205205

206206
_address = _prefs.getString('address');
207207
}

lib/screens/profile/private_profile.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ class PrivateProfile extends StatelessWidget {
2424
booksData.where((Book book) => book.isOwned == true).length;
2525
}
2626
final List<Book> ownedBooks = <Book>[];
27-
for (var book in booksData) {
27+
for (Book book in booksData) {
2828
if (book.isOwned == true) {
2929
ownedBooks.add(book);
3030
}
3131
}
3232
final List<Book> savedBooks = <Book>[];
33-
for (var book in booksData) {
33+
for (Book book in booksData) {
3434
if (book.isBookMarked == true) {
3535
savedBooks.add(book);
3636
}

lib/screens/settings_screens.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class UserTile extends StatelessWidget {
6868
}
6969

7070
class _SettingsScreenState extends State<SettingsScreen> {
71-
double _currentSlidervalue = 10.0;
71+
// double _currentSlidervalue = 10.0;
7272
double sliderValue = 10.0;
7373
bool _darkTheme = false;
7474
bool _switchValue = true;
@@ -107,7 +107,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
107107
])),
108108
body: ListView(
109109
padding: const EdgeInsets.only(right: 5, left: 5, bottom: 5),
110-
children: ListTile.divideTiles(context: context, tiles: [
110+
children: ListTile.divideTiles(context: context, tiles: <Widget>[
111111
ListTile(
112112
title: Text(
113113
'Account Settings',

lib/screens/user_preferences.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class _UserPreferenceState extends State<UserPreference> {
2525
// final TextEditingController _author = TextEditingController();
2626
// final TextEditingController _book = TextEditingController();
2727

28-
List<String> tags = [];
28+
List<String> tags = <String>[];
2929

3030
@override
3131
Widget build(BuildContext context) {
@@ -149,8 +149,8 @@ class _UserPreferenceState extends State<UserPreference> {
149149
onChanged: (List<String> val) => setState(() => tags = val),
150150
choiceItems: C2Choice.listFrom<String, String>(
151151
source: genres,
152-
value: (i, v) => v,
153-
label: (i, v) => v,
152+
value: (int i, String v) => v,
153+
label: (int i, String v) => v,
154154
),
155155
choiceStyle: const C2ChoiceStyle(
156156
borderRadius: BorderRadius.all(Radius.circular(5)),

lib/services/auth.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'package:google_sign_in/google_sign_in.dart';
88

99
class FirebaseAuthService extends ChangeNotifier {
1010
static String fbauthtoken = '';
11-
static String googleAuthToken = '';
11+
// static String googleAuthToken = '';
1212
final FirebaseAuth firebaseAuth = FirebaseAuth.instance;
1313
TokenStorage _tokenStorage = TokenStorage();
1414

@@ -65,7 +65,7 @@ class FirebaseAuthService extends ChangeNotifier {
6565
return userData;
6666
}
6767

68-
Future signInWithGoogle() async {
68+
Future<User> signInWithGoogle() async {
6969
final GoogleSignInAccount attempt = await GoogleSignIn().signIn();
7070
final GoogleSignInAuthentication authentication =
7171
await attempt.authentication;
@@ -85,7 +85,7 @@ class FirebaseAuthService extends ChangeNotifier {
8585

8686
final User currentUser = firebaseAuth.currentUser;
8787
assert(user.uid == currentUser.uid);
88-
final String googleIdtoken = await firebaseAuth.currentUser.getIdToken();
88+
// final String googleIdtoken = await firebaseAuth.currentUser.getIdToken();
8989

9090
// try {
9191
// print('entered try catch');
@@ -107,6 +107,7 @@ class FirebaseAuthService extends ChangeNotifier {
107107
await DatabaseService(uid: user.uid).updateUserData(userData);
108108
return user;
109109
}
110+
return null;
110111
}
111112

112113
//for register

0 commit comments

Comments
 (0)