Skip to content
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
4 changes: 2 additions & 2 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ linter:
# `// 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
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ package com.example.cardtrading

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}
class MainActivity: FlutterActivity()
36 changes: 36 additions & 0 deletions lib/framework/controllers/authentication/get_otp_controller.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

final getOtpController = ChangeNotifierProvider(
(ref) {
return GetOtpController();
},
);

class GetOtpController extends ChangeNotifier {
int countDown = 59;
late Timer timer;

void changeCount(int count){
countDown = count;
notifyListeners();
}
void decrement(){
countDown--;
notifyListeners();
}

void startTimer() {
timer = Timer.periodic(
const Duration(seconds: 1),
(timer) {
if (countDown > 0) {
decrement();
} else {
timer.cancel();
}
},
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import 'package:cardtrading/ui/utils/theme/assets.dart';
import 'package:cardtrading/ui/utils/theme/my_strings.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

final cardDetailsController = ChangeNotifierProvider((ref) {
return CardDetailsController();
});

class CardDetailsController extends ChangeNotifier {
bool isFavourite = false;
final keys = [
AppStrings.keyCardSubjectName,
AppStrings.keyCardGrade,
AppStrings.keyCardBrand
];
final values = [
AppStrings.keyCardSubjectNameValue,
AppStrings.keyCardGradeValue,
AppStrings.keyCardBrandValue
];
final cardDetailDescription = [
AppStrings.keyExpressShipping,
AppStrings.keyAuthenticGuarantee,
AppStrings.keySecurePayment,
];
final cardDetailIcons = [
'${AppAssets.svgLocation}shipping.svg',
'${AppAssets.svgLocation}guarantee.svg',
'${AppAssets.svgLocation}payment.svg',
];

void setFavourite() {
isFavourite = !isFavourite;
notifyListeners();
}
}
14 changes: 14 additions & 0 deletions lib/framework/controllers/card_shop/card_shop_controller.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

final cardShopController = ChangeNotifierProvider((ref){
return CardShopController();
});

class CardShopController extends ChangeNotifier{
int pageIndex = 0;
void setOrIncrementPageIndex({int? index}){
pageIndex = index ?? pageIndex + 1;
notifyListeners();
}
}
14 changes: 14 additions & 0 deletions lib/framework/controllers/card_shop/shop_card_controller.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

final shopCardController = ChangeNotifierProvider((ref){
return ShopCardController();
});

class ShopCardController extends ChangeNotifier{
bool isFavourite = false;
void favourite() {
isFavourite = !isFavourite;
notifyListeners();
}
}
55 changes: 55 additions & 0 deletions lib/framework/controllers/checkout/checkout_controller.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

final checkoutController = ChangeNotifierProvider((ref) {
return CheckoutController();
});

class CheckoutController extends ChangeNotifier {
List<CartModel> cartList = [
CartModel(cardName: '2004 PANINI MEGA CRACKS LIONEL MESSI #71BIS', cardType: 'Exclusive', cardQty: 10, cardPrice: '214697.00'),
CartModel(cardName: '2004 PANINI MEGA CRACKS LIONEL MESSI #71BIS', cardType: 'Exclusive', cardQty: 5, cardPrice: '214697.00'),
];

void deleteCardFromCartList(int index){
if(cartList.length >= 2){
cartList.removeAt(index);
}else{
cartList[index].cardQty = 0;
}
notifyListeners();
}
void addCard(CartModel cartModel){
cartList.add(cartModel);
notifyListeners();
}

int uQty = 0;

void increaseQty(int index){
if(cartList[index].cardQty < 15){
cartList[index].cardQty++;
}
notifyListeners();
}

void decreaseQty(int index){
cartList[index].cardQty--;
notifyListeners();
}
}

class CartModel{
String cardName;
String cardType;
int cardQty;
String cardPrice;

CartModel({
required this.cardName,
required this.cardType,
required this.cardQty,
required this.cardPrice,
});

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

final chooseLanguageController = ChangeNotifierProvider((ref){
return ChooseLanguageController();
});

class ChooseLanguageController extends ChangeNotifier{
List<String> languages = ['English', 'عربي'];
String selectedLanguage = 'English';

void changeLanguage(int index){
selectedLanguage = languages[index];
notifyListeners();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import 'package:cardtrading/ui/utils/theme/my_strings.dart';
import 'package:email_validator/email_validator.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

final completeProfileController =
ChangeNotifierProvider((ref) => CompleteProfileController());

class CompleteProfileController extends ChangeNotifier {
bool hasReferral = false;
int page = 0;
final _firstPageFormKey = GlobalKey<FormState>();
final _secondPageFormKey = GlobalKey<FormState>();
final PageController pageController = PageController();

get firstPageFormKey => _firstPageFormKey;
get secondPageFormKey => _secondPageFormKey;

void addReferral() {
hasReferral = true;
notifyListeners();
}

void hideReferral() {
hasReferral = false;
notifyListeners();
}

String? area, block, street;
int id = 0;
List<String> areas = ['Isckon', 'Thaltej', 'NehruNagar', 'Bodakdev'];
List<String> blocks = ['Block 1', 'Block 2', 'Block 3', 'Block 4'];
List<String> streets = ['Street 1', 'Street 2', 'Street 3', 'Street 4'];
List<String> addressTypes = [
AppStrings.keyAddressTypeOne,
AppStrings.keyAddressTypeTwo,
AppStrings.keyAddressTypeThree
];


void setArea(String? value) {
area = value;
notifyListeners();
}

void setBlock(String? value) {
block = value;
notifyListeners();
}

void setStreet(String? value) {
street = value;
notifyListeners();
}

String? validateEmail(String? value){
if (!EmailValidator.validate(value!)) {
return 'Enter Valid Email';
}
return null;
}

void setId(int newId) {
id = newId;
notifyListeners();
}

void changePage(int index){
page = index;
notifyListeners();
}
void nextPage() {
pageController.nextPage(
duration: const Duration(milliseconds: 500),
curve: Curves.easeIn,
);
page++;
notifyListeners();
}


void resetPage(){
pageController.jumpToPage(0);
notifyListeners();
}
}
28 changes: 28 additions & 0 deletions lib/framework/controllers/home_screen/drawer_controller.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

final homeScreenDrawerController = ChangeNotifierProvider((ref) {
return HomeScreenDrawerController();
});

class HomeScreenDrawerController extends ChangeNotifier {
final List<String> list = [
///List of items in Home Screen drawer
'Home',
'My Orders',
'Favourites',
'Subscription Plan',
'Rewards',
'Terms & Conditions',
'Change Language',
'Refer & Earn',
'Contact Us',
'About us',
'FAQ',
];
int id = 0;
void setOrIncrementId({int? newId}){
id = newId ?? id+1;
notifyListeners();
}
}
44 changes: 44 additions & 0 deletions lib/framework/controllers/home_screen/home_screen_controller.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import 'package:cardtrading/ui/utils/theme/assets.dart';
import 'package:cardtrading/ui/utils/theme/my_strings.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

final homeScreenController = ChangeNotifierProvider(
(ref) {
return HomeScreenController();
},
);

class HomeScreenController extends ChangeNotifier {
final appBarActionList = [
'${AppAssets.svgLocation}search.svg',
'${AppAssets.svgLocation}shopping_cart.svg',
'${AppAssets.svgLocation}notification.svg',
];
final bottomNavigationBarSvgPath = [
'${AppAssets.svgLocation}home.svg',
'${AppAssets.svgLocation}portfolio.svg',
'${AppAssets.svgLocation}store.svg',
'${AppAssets.svgLocation}profile.svg',
];
final bottomNavigationBarLabels = [
AppStrings.keyHome,
AppStrings.keyPortfolio,
AppStrings.keyStore,
AppStrings.keyProfile,
];
String url = '${AppAssets.svgLocation}dark_mode.svg';
int id = 0;

void setId({int? newId}) {
id = newId ?? id + 1;
notifyListeners();
}

void changeMode() {
url == '${AppAssets.svgLocation}dark_mode.svg'
? url = '${AppAssets.svgLocation}light_mode.svg'
: url = '${AppAssets.svgLocation}dark_mode.svg';
notifyListeners();
}
}
Loading