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

onboarding and minor layout fixes #162

Merged
merged 3 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
Binary file added assets/openVault.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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>11.0</string>
<string>12.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '11.0'
# platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
31 changes: 28 additions & 3 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
PODS:
- Flutter (1.0.0)
- flutter_local_notifications (0.0.1):
- Flutter
- flutter_native_splash (0.0.1):
- Flutter
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5)
- permission_handler_apple (9.3.0):
- Flutter
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- sqflite (0.0.3):
- Flutter
- FMDB (>= 2.7.5)
Expand All @@ -25,13 +32,19 @@ PODS:
- sqlite3/rtree
- url_launcher_ios (0.0.1):
- Flutter
- workmanager (0.0.1):
- Flutter

DEPENDENCIES:
- Flutter (from `Flutter`)
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
- sqlite3_flutter_libs (from `.symlinks/plugins/sqlite3_flutter_libs/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- workmanager (from `.symlinks/plugins/workmanager/ios`)

SPEC REPOS:
trunk:
Expand All @@ -41,24 +54,36 @@ SPEC REPOS:
EXTERNAL SOURCES:
Flutter:
:path: Flutter
flutter_local_notifications:
:path: ".symlinks/plugins/flutter_local_notifications/ios"
flutter_native_splash:
:path: ".symlinks/plugins/flutter_native_splash/ios"
permission_handler_apple:
:path: ".symlinks/plugins/permission_handler_apple/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
sqflite:
:path: ".symlinks/plugins/sqflite/ios"
sqlite3_flutter_libs:
:path: ".symlinks/plugins/sqlite3_flutter_libs/ios"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
workmanager:
:path: ".symlinks/plugins/workmanager/ios"

SPEC CHECKSUMS:
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_local_notifications: 4cde75091f6327eb8517fa068a0a5950212d2086
flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
sqlite3: 6e2d4a4879854d0ec86b476bf3c3e30870bac273
sqlite3_flutter_libs: eb769059df0356dc52ddda040f09cacc9391a7cf
url_launcher_ios: 68d46cc9766d0c41dbdc884310529557e3cd7a86
workmanager: 0afdcf5628bbde6924c21af7836fed07b42e30e6

PODFILE CHECKSUM: 70d9d25280d0dd177a5f637cdb0f0b0b12c6a189
PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796

COCOAPODS: 1.12.1
COCOAPODS: 1.15.2
26 changes: 22 additions & 4 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
211392328957DBA96447070D /* [CP] Embed Pods Frameworks */,
6090A52EFEF53161A56AE5DE /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -216,7 +217,7 @@
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
331C8080294A63A400263BE5 = {
Expand Down Expand Up @@ -303,6 +304,23 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
6090A52EFEF53161A56AE5DE /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
Expand Down Expand Up @@ -453,7 +471,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -580,7 +598,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -629,7 +647,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
11 changes: 10 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:workmanager/workmanager.dart';
import 'package:sossoldi/utils/worker_manager.dart';

Expand All @@ -11,13 +12,21 @@ import 'providers/theme_provider.dart';
import 'routes.dart';
import 'utils/app_theme.dart';

bool? _isFirstLogin = true;

void main() async {
WidgetsFlutterBinding.ensureInitialized();
if(Platform.isAndroid){
requestNotificationPermissions();
initializeNotifications();
Workmanager().initialize(callbackDispatcher);
}
SharedPreferences preferences = await SharedPreferences.getInstance();

bool? getPref = preferences.getBool('is_first_login');
getPref == null ? await preferences.setBool('is_first_login', false) : null;
_isFirstLogin = getPref;

initializeDateFormatting('it_IT', null).then((_) => runApp(const ProviderScope(child: Launcher())));
}

Expand All @@ -35,7 +44,7 @@ class Launcher extends ConsumerWidget {
themeMode:
appThemeState.isDarkModeEnabled ? ThemeMode.dark : ThemeMode.light,
onGenerateRoute: makeRoute,
initialRoute: '/',
initialRoute: _isFirstLogin == null || _isFirstLogin! ? '/onboarding' : '/',
);
}
}
2 changes: 1 addition & 1 deletion lib/model/bank_account.dart
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class BankAccountMethods extends SossoldiDatabase {
if (maps.isNotEmpty) {
return BankAccount.fromJson(maps.first);
} else {
throw Exception('Main Account not found');
return null;
}
}

Expand Down
7 changes: 7 additions & 0 deletions lib/model/currency.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ class CurrencyMethods extends SossoldiDatabase {
return item.copy(id: id);
}

Future<void> insertAll(List<Currency> list) async {
final db = await database;
for(Currency currency in list){
await db.insert(currencyTable, currency.toJson());
}
}

Future<Currency> selectById(int id) async {
final db = await database;

Expand Down
14 changes: 12 additions & 2 deletions lib/pages/add_page/widgets/amount_section.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import "package:flutter_riverpod/flutter_riverpod.dart";

import '../../../constants/functions.dart';
Expand Down Expand Up @@ -162,7 +163,7 @@ class _AmountSectionState extends ConsumerState<AmountSection> with Functions {
),
const Spacer(),
Text(
ref.watch(bankAccountProvider)!.name,
ref.watch(bankAccountProvider)?.name ?? "",
style: Theme.of(context).textTheme.bodySmall!.copyWith(
color: grey1,
),
Expand Down Expand Up @@ -282,7 +283,10 @@ class _AmountSectionState extends ConsumerState<AmountSection> with Functions {
.headlineMedium!
.copyWith(color: typeToColor(selectedType)),
),
keyboardType: const TextInputType.numberWithOptions(decimal: true),
keyboardType: const TextInputType.numberWithOptions(decimal: true, signed: true),
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'^\d*\.?\d{0,2}')),
],
// inputFormatters: [DecimalTextInputFormatter(decimalDigits: 2)],
autofocus: false,
textAlign: TextAlign.center,
Expand All @@ -292,6 +296,12 @@ class _AmountSectionState extends ConsumerState<AmountSection> with Functions {
fontSize: 58,
fontWeight: FontWeight.bold,
),
onTapOutside: (_){
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
},
),
),
],
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/add_page/widgets/category_selector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class _CategorySelectorState extends ConsumerState<CategorySelector> with Functi
width: double.infinity,
child: categoriesList.when(
data: (categories) => ListView.builder(
itemCount: 4,
itemCount: categories.length, // to prevent range error
scrollDirection: Axis.horizontal,
shrinkWrap: true,
itemBuilder: (context, i) {
Expand Down
28 changes: 15 additions & 13 deletions lib/pages/categories/add_category.dart
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,10 @@ class _AddCategoryState extends ConsumerState<AddCategory> with Functions {
],
),
),
Container(
Align(
alignment: Alignment.bottomCenter,
child: Container(
width: double.infinity,
width: MediaQuery.sizeOf(context).width,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface,
boxShadow: [
Expand All @@ -289,24 +289,26 @@ class _AddCategoryState extends ConsumerState<AddCategory> with Functions {
)
],
),
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
padding: const EdgeInsets.only(left:24 ,right: 24, top: 16, bottom: 30),
child: Container(
decoration: BoxDecoration(
boxShadow: [defaultShadow],
borderRadius: BorderRadius.circular(8),
),
child: TextButton(
onPressed: () async {
if (selectedCategory != null) {
ref
.read(categoriesProvider.notifier)
.updateCategory(nameController.text)
.whenComplete(() => Navigator.of(context).pop());
} else {
ref
.read(categoriesProvider.notifier)
.addCategory(nameController.text)
.whenComplete(() => Navigator.of(context).pop());
if(nameController.text.isNotEmpty) {
if (selectedCategory != null) {
ref
.read(categoriesProvider.notifier)
.updateCategory(nameController.text)
.whenComplete(() => Navigator.of(context).pop());
} else {
ref
.read(categoriesProvider.notifier)
.addCategory(nameController.text)
.whenComplete(() => Navigator.of(context).pop());
}
}
},
style: TextButton.styleFrom(
Expand Down
5 changes: 3 additions & 2 deletions lib/pages/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class _HomePageState extends ConsumerState<HomePage> with Functions {
physics: const BouncingScrollPhysics(),
scrollDirection: Axis.horizontal,
itemBuilder: (context, i) {
if (i == accounts.length) {
if (i == accounts.length || accounts.isEmpty) {
fres-sudo marked this conversation as resolved.
Show resolved Hide resolved
return Padding(
padding: const EdgeInsets.fromLTRB(0, 4, 0, 16),
child: Container(
Expand Down Expand Up @@ -264,10 +264,11 @@ class _HomePageState extends ConsumerState<HomePage> with Functions {
),
),
);
} else {
} else if(accounts.isNotEmpty) {
BankAccount account = accounts[i];
return AccountsSum(account: account);
}

},
),
loading: () => const SizedBox(),
Expand Down
Loading
Loading