Skip to content

Commit

Permalink
Feature/flutter 3.3.0 (#8)
Browse files Browse the repository at this point in the history
* Updated pubs

* Fix warnings

* Updated podfile

* Changed makefile command names

* Fix sort issue

* Material3 activated

* Fix offers cell

* Updated README
  • Loading branch information
mateusztylman committed Sep 9, 2022
1 parent 27dea9d commit 3d7ef37
Show file tree
Hide file tree
Showing 106 changed files with 516 additions and 492 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.DEFAULT_GOAL := help

fvm_rebuild_models: ## Rebuilds all auto generated Dart files
fvm_run_build_runner: ## Rebuilds all auto generated Dart files
fvm flutter pub run build_runner build --delete-conflicting-outputs

rebuild_models: ## Rebuilds all auto generated Dart files
run_build_runner: ## Rebuilds all auto generated Dart files
flutter pub run build_runner build --delete-conflicting-outputs

help:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ Before starting, run in main project folder:

To generate all the necessary files
## Environment versions
- Dart 2.16+
- Flutter 2.10.3
- Dart 2.18+
- Flutter 3.3.1

## Links
- [Merixstudio Mobile](https://www.merixstudio.com/services/mobile-app-development/)
Expand Down
2 changes: 1 addition & 1 deletion ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>9.0</string>
<string>11.0</string>
</dict>
</plist>
3 changes: 1 addition & 2 deletions ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
4 changes: 2 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/shared_preferences_ios/ios"

SPEC CHECKSUMS:
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_secure_storage: 7953c38a04c3fdbb00571bcd87d8e3b5ceb9daec
shared_preferences_ios: 548a61f8053b9b8a49ac19c1ffbc8b92c50d68ad

PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
PODFILE CHECKSUM: 985e5b058f26709dc81f9ae74ea2b2775bdbcefe

COCOAPODS: 1.11.3
6 changes: 3 additions & 3 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -418,7 +418,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -467,7 +467,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
2 changes: 2 additions & 0 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,7 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
</dict>
</plist>
1 change: 1 addition & 0 deletions lib/config/styles/theme/light_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ ThemeData get lightTheme {
textSelectionTheme: const TextSelectionThemeData(
cursorColor: AppColors.black,
),
useMaterial3: true,
visualDensity: VisualDensity.adaptivePlatformDensity,
);
}
83 changes: 55 additions & 28 deletions lib/data/factory/chart_factory.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import 'dart:math';

import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:mrx_charts/mrx_charts.dart';
import 'package:vizier/config/styles/colors/app_colors.dart';
Expand All @@ -18,11 +20,13 @@ import 'package:vizier/ui/models/chart_multi_pie_section.dart';
class ChartFactory {
const ChartFactory._();

static List<ChartMultiPieSection> fromAccountBreakdownModel(AccountBreakdownModel accountBreakdown) {
final List<TransactionCategoryModel> transactionCategories = accountBreakdown.transactionCategories
..sort(
(a, b) => b.value.compareTo(a.value),
);
static List<ChartMultiPieSection> fromAccountBreakdownModel(
AccountBreakdownModel accountBreakdown,
) {
final List<TransactionCategoryModel> transactionCategories =
accountBreakdown.transactionCategories.sorted(
(a, b) => b.value.compareTo(a.value),
);

return [
if (transactionCategories.length > 2)
Expand Down Expand Up @@ -58,15 +62,18 @@ class ChartFactory {
.toList();
}

static List<ChartLayer> fromFinancialHistoryModel(FinancialHistoryModel model) {
final List<FinancialHistoryDataModel> items = model.history
..sort(
(a, b) => a.date.compareTo(b.date),
);
static List<ChartLayer> fromFinancialHistoryModel(
FinancialHistoryModel model,
) {
final List<FinancialHistoryDataModel> items = model.history.sorted(
(a, b) => a.date.compareTo(b.date),
);
final double highest = items.highestBalanceOrSpent;
final double maxY = highest.ceilTo(_getCeil(highest));
final double from = ((items.firstOrNull?.date)?.millisecondsSinceEpoch)?.toDouble() ?? 0.0;
final double to = ((items.lastOrNull?.date)?.millisecondsSinceEpoch)?.toDouble() ?? 0.0;
final double from =
((items.firstOrNull?.date)?.millisecondsSinceEpoch)?.toDouble() ?? 0.0;
final double to =
((items.lastOrNull?.date)?.millisecondsSinceEpoch)?.toDouble() ?? 0.0;
final double frequency = (to - from) / (model.history.length - 1);
return [
ChartAxisLayer(
Expand All @@ -88,7 +95,10 @@ class ChartFactory {
),
),
),
labelX: (value) => _getLabelAxisX(model.daysBack, DateTime.fromMillisecondsSinceEpoch(value.toInt())),
labelX: (value) => _getLabelAxisX(
model.daysBack,
DateTime.fromMillisecondsSinceEpoch(value.toInt()),
),
labelY: (value) => value == 0.0 ? '' : value.formatUnits,
),
ChartGroupBarLayer(
Expand Down Expand Up @@ -133,13 +143,21 @@ class ChartFactory {
];
}

static List<ChartLayer> fromPortfolioCurrenciesHistoryModel(CompanyListingHistoryModel model) {
final List<CompanyListingHistoryDataModel> items = model.history.sortedByDate();
final double highest = items.highestValues.ceilTo(_getCeil(items.highestValues));
final double lowest = items.lowestValues.ceilFrom(_getCeil(items.lowestValues));
final double from = ((items.firstOrNull?.date)?.millisecondsSinceEpoch)?.toDouble() ?? 0.0;
final double to = ((items.lastOrNull?.date)?.millisecondsSinceEpoch)?.toDouble() ?? 0.0;
final double frequency = (to - from) / (model.daysBack == DateTime.daysPerWeek ? 6.0 : 4.0);
static List<ChartLayer> fromPortfolioCurrenciesHistoryModel(
CompanyListingHistoryModel model,
) {
final List<CompanyListingHistoryDataModel> items =
model.history.sortedByDate();
final double highest =
items.highestValues.ceilTo(_getCeil(items.highestValues));
final double lowest =
items.lowestValues.ceilFrom(_getCeil(items.lowestValues));
final double from =
((items.firstOrNull?.date)?.millisecondsSinceEpoch)?.toDouble() ?? 0.0;
final double to =
((items.lastOrNull?.date)?.millisecondsSinceEpoch)?.toDouble() ?? 0.0;
final double frequency =
(to - from) / (model.daysBack == DateTime.daysPerWeek ? 6.0 : 4.0);
return [
ChartGridLayer(
settings: ChartGridSettings(
Expand Down Expand Up @@ -176,14 +194,19 @@ class ChartFactory {
),
),
),
labelX: (value) => _getLabelAxisX(model.daysBack, DateTime.fromMillisecondsSinceEpoch(value.toInt())),
labelX: (value) => _getLabelAxisX(
model.daysBack,
DateTime.fromMillisecondsSinceEpoch(value.toInt()),
),
labelY: (value) => value.formatUnits,
),
ChartCandleLayer(
items: model.history
.map(
(element) => ChartCandleDataItem(
color: element.isProfit ? AppColors.success100 : AppColors.error300,
color: element.isProfit
? AppColors.success100
: AppColors.error300,
value1: ChartCandleDataItemValue(
max: element.value1.max,
min: element.value1.min,
Expand All @@ -201,7 +224,9 @@ class ChartFactory {
];
}

static List<ChartLayer> fromStockDataMultiPieItemList(List<ChartMultiPieSection> items) {
static List<ChartLayer> fromStockDataMultiPieItemList(
List<ChartMultiPieSection> items,
) {
return [
ChartGroupPieLayer(
items: items
Expand Down Expand Up @@ -244,10 +269,9 @@ class ChartFactory {
RetirementPlanModel retirementPlanModel, {
required int daysTo,
}) {
final List<RetirementPlanDataModel> items = retirementPlanModel.data
..sort(
(a, b) => a.date.compareTo(b.date),
);
final List<RetirementPlanDataModel> items = retirementPlanModel.data.sorted(
(a, b) => a.date.compareTo(b.date),
);
final double maxY = items
.map(
(e) => e.value,
Expand Down Expand Up @@ -284,7 +308,10 @@ class ChartFactory {
),
),
),
labelX: (value) => _getLabelAxisX(daysTo, DateTime.fromMillisecondsSinceEpoch(value.toInt())),
labelX: (value) => _getLabelAxisX(
daysTo,
DateTime.fromMillisecondsSinceEpoch(value.toInt()),
),
labelY: (value) => value.formatUnits,
),
ChartLineLayer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ class DataAuthenticationRepository extends AuthenticationRepository {
AuthenticationRequest request,
) async {
try {
final ResponseStatus<AuthenticationResponse> _response = await authenticationDataSource.getLogin(request);
return ResponseStatus<AuthenticationResponse>.success(_response.data!);
final ResponseStatus<AuthenticationResponse> response =
await authenticationDataSource.getLogin(request);
return ResponseStatus<AuthenticationResponse>.success(response.data!);
} catch (error) {
return ResponseStatus<AuthenticationResponse>.error(error);
}
Expand Down
15 changes: 9 additions & 6 deletions lib/data/repositories/finances/data_finances_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ class DataFinancesRepository extends FinancesRepository {
@override
Future<ResponseStatus<FinancesOverviewModel>> overview() async {
try {
final ResponseStatus<FinancesOverviewModel> _response = await financesDataSource.overview();
return ResponseStatus<FinancesOverviewModel>.success(_response.data!);
final ResponseStatus<FinancesOverviewModel> response =
await financesDataSource.overview();
return ResponseStatus<FinancesOverviewModel>.success(response.data!);
} catch (error) {
return ResponseStatus<FinancesOverviewModel>.error(error);
}
Expand All @@ -29,10 +30,11 @@ class DataFinancesRepository extends FinancesRepository {
required int daysBack,
}) async {
try {
final ResponseStatus<FinancialHistoryModel> _response = await financesDataSource.history(
final ResponseStatus<FinancialHistoryModel> response =
await financesDataSource.history(
daysBack: daysBack,
);
return ResponseStatus<FinancialHistoryModel>.success(_response.data!);
return ResponseStatus<FinancialHistoryModel>.success(response.data!);
} catch (error) {
return ResponseStatus<FinancialHistoryModel>.error(error);
}
Expand All @@ -43,10 +45,11 @@ class DataFinancesRepository extends FinancesRepository {
required int daysTo,
}) async {
try {
final ResponseStatus<RetirementPlanModel> _response = await financesDataSource.retirementPlan(
final ResponseStatus<RetirementPlanModel> response =
await financesDataSource.retirementPlan(
daysTo: daysTo,
);
return ResponseStatus<RetirementPlanModel>.success(_response.data!);
return ResponseStatus<RetirementPlanModel>.success(response.data!);
} catch (error) {
return ResponseStatus<RetirementPlanModel>.error(error);
}
Expand Down
5 changes: 3 additions & 2 deletions lib/data/repositories/offers/data_offers_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ class DataOffersRepository extends OffersRepository {
@override
Future<ResponseStatus<List<OfferModel>>> all() async {
try {
final ResponseStatus<List<OfferModel>> _response = await offersDataSource.all();
return ResponseStatus<List<OfferModel>>.success(_response.data!);
final ResponseStatus<List<OfferModel>> response =
await offersDataSource.all();
return ResponseStatus<List<OfferModel>>.success(response.data!);
} catch (error) {
return ResponseStatus<List<OfferModel>>.error(error);
}
Expand Down
20 changes: 12 additions & 8 deletions lib/data/repositories/portfolio/data_portfolio_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ class DataPortfolioRepository extends PortfolioRepository {
@override
Future<ResponseStatus<PortfolioOverviewModel>> overview() async {
try {
final ResponseStatus<PortfolioOverviewModel> _response = await portfolioDataSource.overview();
return ResponseStatus<PortfolioOverviewModel>.success(_response.data!);
final ResponseStatus<PortfolioOverviewModel> response =
await portfolioDataSource.overview();
return ResponseStatus<PortfolioOverviewModel>.success(response.data!);
} catch (error) {
return ResponseStatus<PortfolioOverviewModel>.error(error);
}
Expand All @@ -28,8 +29,9 @@ class DataPortfolioRepository extends PortfolioRepository {
@override
Future<ResponseStatus<List<CompanyAssetModel>>> watchlist() async {
try {
final ResponseStatus<List<CompanyAssetModel>> _response = await portfolioDataSource.watchlist();
return ResponseStatus<List<CompanyAssetModel>>.success(_response.data!);
final ResponseStatus<List<CompanyAssetModel>> response =
await portfolioDataSource.watchlist();
return ResponseStatus<List<CompanyAssetModel>>.success(response.data!);
} catch (error) {
return ResponseStatus<List<CompanyAssetModel>>.error(error);
}
Expand All @@ -38,8 +40,9 @@ class DataPortfolioRepository extends PortfolioRepository {
@override
Future<ResponseStatus<List<CompanyListingDetailsItemModel>>> details() async {
try {
final ResponseStatus<List<CompanyListingDetailsItemModel>> _response = await portfolioDataSource.details();
return ResponseStatus.success(_response.data!);
final ResponseStatus<List<CompanyListingDetailsItemModel>> response =
await portfolioDataSource.details();
return ResponseStatus.success(response.data!);
} catch (error) {
return ResponseStatus<List<CompanyListingDetailsItemModel>>.error(error);
}
Expand All @@ -51,11 +54,12 @@ class DataPortfolioRepository extends PortfolioRepository {
required int daysBack,
}) async {
try {
final ResponseStatus<CompanyListingHistoryModel> _response = await portfolioDataSource.history(
final ResponseStatus<CompanyListingHistoryModel> response =
await portfolioDataSource.history(
companyAsset: companyAsset,
daysBack: daysBack,
);
return ResponseStatus.success(_response.data!);
return ResponseStatus.success(response.data!);
} catch (error) {
return ResponseStatus<CompanyListingHistoryModel>.error(error);
}
Expand Down
9 changes: 5 additions & 4 deletions lib/data/repositories/user/data_user_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class DataUserRepository extends UserRepository {
@override
Future<ResponseStatus<UserModel>> me() async {
try {
final ResponseStatus<UserModel> _response = await userDataSource.me();
return ResponseStatus<UserModel>.success(_response.data!);
final ResponseStatus<UserModel> response = await userDataSource.me();
return ResponseStatus<UserModel>.success(response.data!);
} catch (error) {
return ResponseStatus<UserModel>.error(error);
}
Expand All @@ -26,8 +26,9 @@ class DataUserRepository extends UserRepository {
@override
Future<ResponseStatus<UserNotificationsResponse>> notifications() async {
try {
final ResponseStatus<UserNotificationsResponse> _response = await userDataSource.notifications();
return ResponseStatus<UserNotificationsResponse>.success(_response.data!);
final ResponseStatus<UserNotificationsResponse> response =
await userDataSource.notifications();
return ResponseStatus<UserNotificationsResponse>.success(response.data!);
} catch (error) {
return ResponseStatus<UserNotificationsResponse>.error(error);
}
Expand Down

0 comments on commit 3d7ef37

Please sign in to comment.