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

null safety added to the project #77

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion lib/dashboard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Dashboard extends StatefulWidget {
}

class _DashboardState extends State<Dashboard> {
PageController _pageController;
PageController _pageController = PageController();
int _currentIndex = 0;

@override
Expand Down
14 changes: 7 additions & 7 deletions lib/helpers/slide_route.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';

class SlideRightRoute extends PageRouteBuilder<SlideRightRoute> {
SlideRightRoute({this.page})
SlideRightRoute({required this.page})
: super(
pageBuilder: (
BuildContext context,
Expand All @@ -26,8 +26,8 @@ class SlideRightRoute extends PageRouteBuilder<SlideRightRoute> {
final Widget page;
}

class SlideLeftRoute extends PageRouteBuilder<SlideLeftRoute> {
SlideLeftRoute({this.page})
class SlideLeftRoute extends PageRouteBuilder<Widget> {
SlideLeftRoute({required this.page})
: super(
pageBuilder: (
BuildContext context,
Expand All @@ -52,8 +52,8 @@ class SlideLeftRoute extends PageRouteBuilder<SlideLeftRoute> {
final Widget page;
}

class SlideTopRoute extends PageRouteBuilder<SlideTopRoute> {
SlideTopRoute({this.page})
class SlideTopRoute extends PageRouteBuilder<Widget> {
SlideTopRoute({required this.page})
: super(
pageBuilder: (
BuildContext context,
Expand All @@ -78,8 +78,8 @@ class SlideTopRoute extends PageRouteBuilder<SlideTopRoute> {
final Widget page;
}

class SlideBottomRoute extends PageRouteBuilder<SlideBottomRoute> {
SlideBottomRoute({this.page})
class SlideBottomRoute extends PageRouteBuilder<Widget> {
SlideBottomRoute({required this.page})
: super(
pageBuilder: (
BuildContext context,
Expand Down
2 changes: 1 addition & 1 deletion lib/views/cart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:retro_shopping/widgets/retro_button.dart';

class Cart extends StatefulWidget {
const Cart({
Key key,
Key? key,
}) : super(key: key);

@override
Expand Down
14 changes: 7 additions & 7 deletions lib/views/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Home extends StatelessWidget {
final GlobalKey<ScaffoldState> _drawerKey = GlobalKey();

void _openDrawer() {
_drawerKey.currentState.openDrawer();
_drawerKey.currentState!.openDrawer();
}

@override
Expand Down Expand Up @@ -38,22 +38,22 @@ class Home extends StatelessWidget {
onTap: () {
_openDrawer();
},
child: RetroButton(
child: const RetroButton(
upperColor: Colors.white,
lowerColor: Colors.black,
width: 35,
height: 35,
borderColor: Colors.white,
child: const Icon(Icons.menu),
child: Icon(Icons.menu),
),
),
RetroButton(
const RetroButton(
upperColor: Colors.white,
lowerColor: Colors.black,
width: 35,
height: 35,
borderColor: Colors.white,
child: const Padding(
child: Padding(
padding: EdgeInsets.only(top: 7, left: 6),
child: Icon(
RelicIcons.cart,
Expand Down Expand Up @@ -213,7 +213,7 @@ class Home extends StatelessWidget {

class DrawerWidget extends StatelessWidget {
const DrawerWidget({
Key key,
Key? key,
}) : super(key: key);

@override
Expand Down Expand Up @@ -250,7 +250,7 @@ class DrawerWidget extends StatelessWidget {
}

Widget _createDrawerItem(
{IconData icon, String title, GestureTapCallback onTap}) {
{required String title, IconData? icon, GestureTapCallback? onTap}) {
return ListTile(
title: Row(
children: <Widget>[
Expand Down
6 changes: 3 additions & 3 deletions lib/views/profile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ProfilePage extends StatelessWidget {

class WishlistSection extends StatelessWidget {
const WishlistSection({
Key key,
Key? key,
}) : super(key: key);

@override
Expand Down Expand Up @@ -105,7 +105,7 @@ class WishlistSection extends StatelessWidget {

class OrdersSection extends StatelessWidget {
const OrdersSection({
Key key,
Key? key,
}) : super(key: key);

@override
Expand Down Expand Up @@ -198,7 +198,7 @@ class OrdersSection extends StatelessWidget {

class TopSection extends StatelessWidget {
const TopSection({
Key key,
Key? key,
}) : super(key: key);

@override
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/bottom_nav_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class FloatingNavBar extends StatefulWidget {
}

class _FloatingNavBarState extends State<FloatingNavBar> {
PageController controller;
late PageController controller;

@override
void initState() {
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/payment/cart_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class CartItem extends StatefulWidget {
}

class _CartItemState extends State<CartItem> {
TextEditingController controller;
TextEditingController controller = TextEditingController();

@override
void initState() {
Expand Down
8 changes: 4 additions & 4 deletions lib/widgets/payment/order_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import 'package:retro_shopping/helpers/constants.dart';

class OrderItem extends StatelessWidget {
const OrderItem(
{this.title,
this.image,
this.ordered,
this.status,
{required this.title,
required this.image,
required this.ordered,
required this.status,
this.delivered = false});
final String title;
final String image;
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/payment/payment_successful.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:retro_shopping/helpers/constants.dart';

class PaymentSuccessful extends StatelessWidget {
const PaymentSuccessful({
Key key,
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
Expand Down
10 changes: 6 additions & 4 deletions lib/widgets/payment/payment_window.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:retro_shopping/helpers/constants.dart';
import 'package:retro_shopping/widgets/payment/payment_successful.dart';
import 'package:retro_shopping/widgets/retro_button.dart';
// ignore: import_of_legacy_library_into_null_safe
import 'package:razorpay_flutter/razorpay_flutter.dart';
import 'package:fluttertoast/fluttertoast.dart';

Expand All @@ -11,7 +12,7 @@ class PaymentWindow extends StatefulWidget {
}

class _PaymentWindowState extends State<PaymentWindow> {
int cnt1, cnt2;
int? cnt1, cnt2;
final Razorpay _razorpay = Razorpay();
@override
void initState() {
Expand Down Expand Up @@ -42,7 +43,8 @@ class _PaymentWindowState extends State<PaymentWindow> {
try {
_razorpay.open(options);
} catch (e) {
debugPrint(e.toString());
// ignore: avoid_print
print(e);
}
}

Expand Down Expand Up @@ -122,7 +124,7 @@ class _PaymentWindowState extends State<PaymentWindow> {
GestureDetector(
onTap: () {
setState(() {
cnt2 = cnt2 + 1;
cnt2 = cnt2! + 1;
cnt1 = 0;
});
if (cnt2 == 2) {
Expand Down Expand Up @@ -199,7 +201,7 @@ class _PaymentWindowState extends State<PaymentWindow> {
GestureDetector(
onTap: () {
setState(() {
cnt1 = cnt1 + 1;
cnt1 = cnt1! + 1;
cnt2 = 0;
});
if (cnt1 == 2) {
Expand Down
14 changes: 6 additions & 8 deletions lib/widgets/product/product_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ import 'package:retro_shopping/widgets/product/product_page.dart';

class ProductCard extends StatelessWidget {
const ProductCard(
{Key key,
this.text,
this.owner,
this.amount,
this.image,
this.seller,
this.height})
: super(key: key);
{required this.text,
required this.owner,
required this.amount,
required this.image,
required this.seller,
required this.height});
final String text;
final String owner;
final String amount;
Expand Down
16 changes: 8 additions & 8 deletions lib/widgets/product/product_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import '../retro_button.dart';
// ignore: must_be_immutable
class ProductPage extends StatefulWidget {
ProductPage(
{this.text,
this.prodHeight,
this.seller,
this.owner,
this.amount,
this.image});
{required this.text,
required this.prodHeight,
required this.seller,
required this.owner,
required this.amount,
required this.image});
String text;
String image;
String owner;
Expand Down Expand Up @@ -63,13 +63,13 @@ class _ProductPageState extends State<ProductPage> {
child: const Icon(Icons.arrow_back),
),
),
RetroButton(
const RetroButton(
upperColor: Colors.white,
lowerColor: Colors.black,
width: 35,
height: 35,
borderColor: Colors.white,
child: const Padding(
child: Padding(
padding: EdgeInsets.only(top: 7, left: 6),
child: Icon(
RelicIcons.cart,
Expand Down
28 changes: 14 additions & 14 deletions lib/widgets/retro_button.dart
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import 'package:flutter/material.dart';

// ignore: must_be_immutable
class RetroButton extends StatefulWidget {
RetroButton(
{this.child,
this.upperColor,
this.lowerColor,
this.width,
this.height,
this.borderColor});
Widget child;
Color upperColor;
Color lowerColor;
double width;
double height;
Color borderColor;
const RetroButton(
{required this.child,
required this.upperColor,
required this.lowerColor,
required this.width,
required this.height,
required this.borderColor});
final Widget child;
final Color upperColor;
final Color lowerColor;
final double width;
final double height;
final Color borderColor;

@override
_RetroButtonState createState() => _RetroButtonState();
}
Expand Down
16 changes: 9 additions & 7 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,25 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1

environment:
sdk: ">=2.7.0 <3.0.0"
sdk: ">=2.12.0 <3.0.0"

dependencies:
flutter:
sdk: flutter

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
adobe_xd: ^1.1.0+1
cupertino_icons: ^0.1.3
fluttertoast: ^7.1.8
google_fonts: ^2.0.0
fluttertoast: ^8.0.1-nullsafety.0
cupertino_icons: ^1.0.2
firebase_core: ^1.0.0
google_fonts: ^1.1.0
razorpay_flutter: 1.1.0

adobe_xd: ^1.1.0+1


dependency_overrides:
razorpay_flutter: ^1.1.0

dependency_overrides:
flutter_svg: ^0.20.0-nullsafety.3

dev_dependencies:
Expand Down