Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Migrated to null-safety
- Added support v2 embedding
  • Loading branch information
umair13adil committed Feb 4, 2023
1 parent 7723061 commit 3033fa9
Show file tree
Hide file tree
Showing 210 changed files with 1,465 additions and 1,500 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 29
compileSdkVersion 31

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -40,7 +40,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.openflutter.openflutterecommerce"
minSdkVersion 18
targetSdkVersion 29
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
4 changes: 2 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name="io.flutter.app.FlutterApplication"
android:label="openflutterecommerce"
android:icon="@mipmap/ic_launcher">
<activity
Expand All @@ -16,7 +15,8 @@
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
android:windowSoftInputMode="adjustResize"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
Expand Down
2 changes: 1 addition & 1 deletion lib/config/app_settings.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class AppSettings {
static bool cacheIsEnabled;
static bool cacheIsEnabled = true;
static bool profileEnabled = true;
}
162 changes: 81 additions & 81 deletions lib/config/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,93 +58,93 @@ class OpenFlutterEcommerceTheme {
iconTheme: IconThemeData(color: AppColors.black),
textTheme: theme.textTheme.copyWith(
caption: TextStyle(
color: AppColors.black,
fontSize: 18,
fontFamily: 'Metropolis',
fontWeight: FontWeight.w400,
))),
color: AppColors.black,
fontSize: 18,
fontFamily: 'Metropolis',
fontWeight: FontWeight.w400,
))),
textTheme: theme.textTheme
.copyWith(
//over image white text
headline5: theme.textTheme.headline5.copyWith(
fontSize: 48,
color: AppColors.white,
fontFamily: 'Metropolis',
fontWeight: FontWeight.w900,
),
headline6: theme.textTheme.headline6.copyWith(
fontSize: 24,
color: AppColors.black,
fontWeight: FontWeight.w900,
fontFamily: 'Metropolis',
), //
//over image white text
headline5: theme.textTheme.headline5?.copyWith(
fontSize: 48,
color: AppColors.white,
fontFamily: 'Metropolis',
fontWeight: FontWeight.w900,
),
headline6: theme.textTheme.headline6?.copyWith(
fontSize: 24,
color: AppColors.black,
fontWeight: FontWeight.w900,
fontFamily: 'Metropolis',
), //

//product title
headline4: theme.textTheme.headline4.copyWith(
color: AppColors.black,
fontSize: 16,
fontWeight: FontWeight.w400,
fontFamily: 'Metropolis',
),
//product title
headline4: theme.textTheme.headline4?.copyWith(
color: AppColors.black,
fontSize: 16,
fontWeight: FontWeight.w400,
fontFamily: 'Metropolis',
),

headline3: theme.textTheme.headline3.copyWith(
fontFamily: 'Metropolis',
fontWeight: FontWeight.w400,
),
//product price
headline2: theme.textTheme.headline2.copyWith(
color: AppColors.lightGray,
fontSize: 14,
fontFamily: 'Metropolis',
fontWeight: FontWeight.w400,
),
headline1: theme.textTheme.headline1.copyWith(
fontFamily: 'Metropolis',
fontWeight: FontWeight.w500,
),
headline3: theme.textTheme.headline3?.copyWith(
fontFamily: 'Metropolis',
fontWeight: FontWeight.w400,
),
//product price
headline2: theme.textTheme.headline2?.copyWith(
color: AppColors.lightGray,
fontSize: 14,
fontFamily: 'Metropolis',
fontWeight: FontWeight.w400,
),
headline1: theme.textTheme.headline1?.copyWith(
fontFamily: 'Metropolis',
fontWeight: FontWeight.w500,
),

subtitle2: theme.textTheme.subtitle2.copyWith(
fontSize: 18,
color: AppColors.black,
fontFamily: 'Metropolis',
fontWeight: FontWeight.w400,
),
subtitle2: theme.textTheme.subtitle2?.copyWith(
fontSize: 18,
color: AppColors.black,
fontFamily: 'Metropolis',
fontWeight: FontWeight.w400,
),

subtitle1: theme.textTheme.subtitle1.copyWith(
fontSize: 24,
color: AppColors.darkGray,
fontFamily: 'Metropolis',
fontWeight: FontWeight.w500,
),
//red button with white text
button: theme.textTheme.button.copyWith(
fontSize: 14,
color: AppColors.white,
fontFamily: 'Metropolis',
fontWeight: FontWeight.w500,
),
//black caption title
caption: theme.textTheme.caption.copyWith(
fontSize: 34,
color: AppColors.black,
fontFamily: 'Metropolis',
fontWeight: FontWeight.w700,
),
//light gray small text
bodyText1: theme.textTheme.bodyText1.copyWith(
color: AppColors.lightGray,
fontSize: 11,
fontFamily: 'Metropolis',
fontWeight: FontWeight.w400,
),
//view all link
bodyText2: theme.textTheme.bodyText2.copyWith(
color: AppColors.black,
fontSize: 11,
fontFamily: 'Metropolis',
fontWeight: FontWeight.w400,
),
)
subtitle1: theme.textTheme.subtitle1?.copyWith(
fontSize: 24,
color: AppColors.darkGray,
fontFamily: 'Metropolis',
fontWeight: FontWeight.w500,
),
//red button with white text
button: theme.textTheme.button?.copyWith(
fontSize: 14,
color: AppColors.white,
fontFamily: 'Metropolis',
fontWeight: FontWeight.w500,
),
//black caption title
caption: theme.textTheme.caption?.copyWith(
fontSize: 34,
color: AppColors.black,
fontFamily: 'Metropolis',
fontWeight: FontWeight.w700,
),
//light gray small text
bodyText1: theme.textTheme.bodyText1?.copyWith(
color: AppColors.lightGray,
fontSize: 11,
fontFamily: 'Metropolis',
fontWeight: FontWeight.w400,
),
//view all link
bodyText2: theme.textTheme.bodyText2?.copyWith(
color: AppColors.black,
fontSize: 11,
fontFamily: 'Metropolis',
fontWeight: FontWeight.w400,
),
)
.apply(fontFamily: 'Metropolis'),
buttonTheme: theme.buttonTheme.copyWith(
minWidth: 50,
Expand Down
2 changes: 1 addition & 1 deletion lib/data/error/exceptions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class LocalDbExceptionimplements implements Exception {}
class EntityModelMapperException implements Exception {
final String message;

EntityModelMapperException({@required this.message});
EntityModelMapperException({required this.message});
}

class RemoteServerException implements Exception {}
Expand Down
6 changes: 3 additions & 3 deletions lib/data/local/data_source.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:openflutterecommerce/domain/entities/entity.dart';
import 'package:sqflite/sqflite.dart';

abstract class DataSource {
Database db;
late Database db;

String get tableName;

Expand All @@ -19,12 +19,12 @@ abstract class DataSource {

// get a record in the table
Future<Entity> get(int id) async {
return null;
return Future.value(null);
}

// get all records in the table
Future<List<Entity>> all() async {
return null;
return [];
}

// insert a record into the table
Expand Down
2 changes: 1 addition & 1 deletion lib/data/local/db_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:sqflite/sqflite.dart';

class SQLiteDbProvider {

static Database db;
static late Database db;

static Future<void> open() async {
db = await openDatabase(
Expand Down
4 changes: 2 additions & 2 deletions lib/data/local/local_category_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ class LocalCategoryRepository extends CategoryRepository{
@override
Future<List<ProductCategory>> getCategories({int parentCategoryId = 0}) async {
// TODO: implement getCategories
return null;
return Future.value(null);
}

@override
Future<ProductCategory> getCategoryDetails(int categoryId) {
// TODO: implement getCategoryDetails
return null;
return Future.value(null);
}

}
6 changes: 3 additions & 3 deletions lib/data/local/local_product_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ class LocalProductRepository implements ProductRepository {
int categoryId = 0,
bool isFavorite = false,
SortRules sortRules = const SortRules(),
FilterRules filterRules}) {
required FilterRules filterRules}) {
// TODO: implement getProducts
return null;
return Future.value(null);
}

@override
Future<FilterRules> getPossibleFilterOptions(int categoryId) {
// TODO: implement getPossibleFilterOptions
return null;
return Future.value(null);
}
}
2 changes: 1 addition & 1 deletion lib/data/local/local_promo_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class LocalPromoRepository implements PromoRepository {
@override
Future<List<Promo>> getPromoList() {
// TODO: implement getPromoList
return null;
return Future.value(null);
}

}
4 changes: 2 additions & 2 deletions lib/data/local/product/product_category_data_source.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ProductCategoryDataSource extends DataSource {
description: maps[i]['description'],
image: maps[i]['image'],
thumb: maps[i]['thumb'],
parentId: maps[i]['parentId'],
parentId: maps[i]['parentId'], orderNumber: null!, count: null!,
);
});
}
Expand All @@ -33,7 +33,7 @@ class ProductCategoryDataSource extends DataSource {
description: maps[0]['description'],
image: maps[0]['image'],
thumb: maps[0]['thumb'],
parentId: maps[0]['parentId'],
parentId: maps[0]['parentId'], orderNumber: null!, count: null!,
);
}

Expand Down
8 changes: 4 additions & 4 deletions lib/data/local/product/product_data_source.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ProductDataSource extends DataSource {
price: (maps[i]['price'] as num).toDouble(),
discountPercent: (maps[i]['discountPercent'] as num).toDouble(),
//TODO: get full list of categories
categories: [ProductCategoryEntity(id: (maps[i]['categoryId'] as num).toInt())],
categories: [ProductCategoryEntity(id: (maps[i]['categoryId'] as num).toInt(), title: '', description: '', image: '', thumb: '', parentId: null!, orderNumber: null!, count: null!)],
amount: maps[i]['amount'],
description: maps[i]['description'],
isFavourite: maps[i]['isFavourite'].toString() == '1',
Expand All @@ -27,7 +27,7 @@ class ProductDataSource extends DataSource {
rating2Count: maps[i]['rating2Count'],
rating3Count: maps[i]['rating3Count'],
rating4Count: maps[i]['rating4Count'],
rating5Count: maps[i]['rating5Count'],
rating5Count: maps[i]['rating5Count'], subTitle: '', hashTags: [], selectableAttributes: [],
);
});
}
Expand All @@ -46,7 +46,7 @@ class ProductDataSource extends DataSource {
thumb: maps[0]['thumb'],
price: maps[0]['price'],
discountPercent: (maps[0]['discountPercent'] as num).toDouble(),
categories: [ProductCategoryEntity(id: (maps[0]['categoryId'] as num).toInt())],
categories: [ProductCategoryEntity(id: (maps[0]['categoryId'] as num).toInt(), title: '', description: '', image: '', thumb: '', parentId: null!, orderNumber: null!, count: null!)],
amount: maps[0]['amount'],
description: maps[0]['description'],
isFavourite: maps[0]['isFavourite'].toString() == '1',
Expand All @@ -55,7 +55,7 @@ class ProductDataSource extends DataSource {
rating2Count: maps[0]['rating2Count'],
rating3Count: maps[0]['rating3Count'],
rating4Count: maps[0]['rating4Count'],
rating5Count: maps[0]['rating5Count'],
rating5Count: maps[0]['rating5Count'], subTitle: '', hashTags: [], selectableAttributes: [],
);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/data/local/promo/promo_code_data_source.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class PromoCodeDataSource extends DataSource {
promoCode: maps[i]['promoCode'],
discountPercent: maps[i]['discountPercent'],
belongsToUser: maps[i]['belongsToUser'].toString() == '1',
wasUsed: maps[i]['wasUsed'].toString() == '1',
wasUsed: maps[i]['wasUsed'].toString() == '1', dateExpires: null!,
);
});
}
Expand All @@ -35,7 +35,7 @@ class PromoCodeDataSource extends DataSource {
promoCode: maps[0]['promoCode'],
discountPercent: maps[0]['discountPercent'],
belongsToUser: maps[0]['belongsToUser'].toString() == '1',
wasUsed: maps[0]['wasUsed'].toString() == '1',
wasUsed: maps[0]['wasUsed'].toString() == '1', dateExpires: null!,
);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/data/local/user/user_data_source.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class UserDataSource extends DataSource {
newArrivalsNotification:
maps[i]['newArrivalsNotification'].toString() == '1',
deliveryStatusChanges:
maps[i]['deliveryStatusChanges'].toString() == '1',
maps[i]['deliveryStatusChanges'].toString() == '1', token: '',
);
});
}
Expand All @@ -42,7 +42,7 @@ class UserDataSource extends DataSource {
salesNotification: maps[0]['salesNotification'].toString() == '1',
newArrivalsNotification:
maps[0]['newArrivalsNotification'].toString() == '1',
deliveryStatusChanges: maps[0]['deliveryStatusChanges'].toString() == '1',
deliveryStatusChanges: maps[0]['deliveryStatusChanges'].toString() == '1', token: '',
);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/data/model/app_user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ class AppUser {
final String password;
final String token;

AppUser({this.email, this.password, this.token});
AppUser({required this.email, required this.password, required this.token});
}
Loading

0 comments on commit 3033fa9

Please sign in to comment.