Skip to content

Commit

Permalink
[#448] [CR] Starting Pages. Add account/budget description
Browse files Browse the repository at this point in the history
  • Loading branch information
lyskouski committed Sep 11, 2024
1 parent 77da684 commit 3ccb5cc
Show file tree
Hide file tree
Showing 9 changed files with 115 additions and 15 deletions.
6 changes: 4 additions & 2 deletions integration_test/endurance/user_flow_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,18 @@ void main() {
Scenario: Applying basic configuration through the start pages
Given I am firstly opened the app
Then I can see "Initial Setup" component
When I tap "Save (Go Next)" button
When I tap "Save (Go Next)" button
When I tap "Go Next" button
Then I can see "Acknowledge (Go Next)" button
When I tap "Acknowledge (Go Next)" button
And I tap "Save (Go Next)" button
And I tap "Go Next" button
Then I can see "Create new Account" button
When I tap on 0 index of "ListSelector" fields
And I tap "Bank Account" element
And I enter "Init Account" to "Enter Account Identifier" text field
And I enter "10000" to "Set Balance" text field
And I tap "Create new Account" button
And I tap "Go Next" button
Then I can see "Create new Budget Category" button
When I enter "Init Budget" to "Enter Budget Category Name" text field
And I enter "1000" to "Set Balance" text field
Expand Down
6 changes: 4 additions & 2 deletions integration_test/load/start_page_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,18 @@ void main() {
Scenario: Applying basic configuration through the start pages
Given I am firstly opened the app
Then I can see "Initial Setup" component
When I tap "Save (Go Next)" button
When I tap "Save (Go Next)" button
When I tap "Go Next" button
Then I can see "Acknowledge (Go Next)" button
When I tap "Acknowledge (Go Next)" button
And I tap "Save (Go Next)" button
And I tap "Go Next" button
Then I can see "Create new Account" button
When I tap on 0 index of "ListSelector" fields
And I tap "Bank Account" element
And I enter "Starting Page Account" to "Enter Account Identifier" text field
And I enter "1000" to "Set Balance" text field
And I tap "Create new Account" button
And I tap "Go Next" button
Then I can see "Create new Budget Category" button
When I enter "Starting Page Budget" to "Enter Budget Category Name" text field
And I enter "1000" to "Set Balance" text field
Expand Down
1 change: 1 addition & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ void main() async {
}
}
AppPreferences.pref = await SharedPreferences.getInstance();
await AppPreferences.clear(AppPreferences.prefPrivacyPolicy);
CurrencyDefaults.cache = AppPreferences.pref;
final appSync = AppSync();
runApp(
Expand Down
20 changes: 16 additions & 4 deletions lib/pages/start/start_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import 'package:app_finance/_classes/structure/navigation/app_route.dart';
import 'package:app_finance/_configs/theme_helper.dart';
import 'package:app_finance/pages/_interfaces/abstract_page_state.dart';
import 'package:app_finance/pages/start/widgets/about_tab.dart';
import 'package:app_finance/pages/start/widgets/account_about_tab.dart';
import 'package:app_finance/pages/start/widgets/budget_about_tab.dart';
import 'package:app_finance/pages/start/widgets/usage_tab.dart';
import 'package:app_finance/design/button/full_sized_button_widget.dart';
import 'package:app_finance/design/wrapper/tab_widget.dart';
Expand Down Expand Up @@ -89,26 +91,36 @@ class StartPageState extends AbstractPageState<StartPage> {
setState: () => _goNext(0),
isFirstBoot: currentStep == i++ && isEmpty,
),
SettingTab(
PrivacyTab(
setButton: fn,
setState: () => _goNext(1),
isFirstBoot: currentStep == i++ && isEmpty,
),
PrivacyTab(
UsageTab(
setButton: fn,
setState: () => _goNext(2),
isFirstBoot: currentStep == i++ && isEmpty,
),
UsageTab(
SettingTab(
setButton: fn,
setState: () => _goNext(3),
isFirstBoot: currentStep == i++ && isEmpty,
),
AccountTab(
AccountAboutTab(
setButton: fn,
setState: () => _goNext(4),
isFirstBoot: currentStep == i++ && isEmpty,
),
AccountTab(
setButton: fn,
setState: () => _goNext(5),
isFirstBoot: currentStep == i++ && isEmpty,
),
BudgetAboutTab(
setButton: fn,
setState: () => _goNext(6),
isFirstBoot: currentStep == i++ && isEmpty,
),
BudgetTab(
setButton: fn,
setState: () => _finalize(nav),
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/start/widgets/about_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class AboutTabState<T extends AboutTab> extends AbstractTabState<T> with Launche
}

@override
String getButtonTitle() => AppLocale.labels.saveSettingsTooltip;
String getButtonTitle() => '';

@override
Widget buildContent(BuildContext context, BoxConstraints constraints) {
Expand Down
4 changes: 3 additions & 1 deletion lib/pages/start/widgets/abstract_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ abstract class AbstractTabState<T extends AbstractTab> extends State<T> {
return FullSizedButtonWidget(
constraints: constraints,
onPressed: updateState,
title: '${getButtonTitle()} (${AppLocale.labels.goNextTooltip})',
title: getButtonTitle() != ''
? '${getButtonTitle()} (${AppLocale.labels.goNextTooltip})'
: AppLocale.labels.goNextTooltip,
icon: Icons.exit_to_app_rounded,
);
}
Expand Down
40 changes: 40 additions & 0 deletions lib/pages/start/widgets/account_about_tab.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright 2023 The terCAD team. All rights reserved.
// Use of this source code is governed by a CC BY-NC-ND 4.0 license that can be found in the LICENSE file.

import 'package:app_finance/_classes/herald/app_locale.dart';
import 'package:app_finance/_mixins/launcher_mixin.dart';
import 'package:app_finance/pages/start/widgets/abstract_tab.dart';
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:provider/provider.dart';

class AccountAboutTab extends AbstractTab {
const AccountAboutTab({
super.key,
required super.setState,
required super.setButton,
super.isFirstBoot = true,
});

@override
AccountAboutTabState createState() => AccountAboutTabState();
}

class AccountAboutTabState<T extends AccountAboutTab> extends AbstractTabState<T> with LauncherMixin {
@override
String getButtonTitle() => '';

@override
Widget buildContent(BuildContext context, BoxConstraints constraints) {
final locale = Provider.of<AppLocale>(context, listen: false);
return FutureBuilder(
future: DefaultAssetBundle.of(context).loadString('./assets/l10n/about_account_${locale.value!}.md'),
builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
if (snapshot.hasData) {
return Markdown(data: snapshot.data!.replaceAll('../images', 'resource:assets/images'));
}
return Container();
},
);
}
}
40 changes: 40 additions & 0 deletions lib/pages/start/widgets/budget_about_tab.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright 2023 The terCAD team. All rights reserved.
// Use of this source code is governed by a CC BY-NC-ND 4.0 license that can be found in the LICENSE file.

import 'package:app_finance/_classes/herald/app_locale.dart';
import 'package:app_finance/_mixins/launcher_mixin.dart';
import 'package:app_finance/pages/start/widgets/abstract_tab.dart';
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:provider/provider.dart';

class BudgetAboutTab extends AbstractTab {
const BudgetAboutTab({
super.key,
required super.setState,
required super.setButton,
super.isFirstBoot = true,
});

@override
BudgetAboutTabState createState() => BudgetAboutTabState();
}

class BudgetAboutTabState<T extends BudgetAboutTab> extends AbstractTabState<T> with LauncherMixin {
@override
String getButtonTitle() => '';

@override
Widget buildContent(BuildContext context, BoxConstraints constraints) {
final locale = Provider.of<AppLocale>(context, listen: false);
return FutureBuilder(
future: DefaultAssetBundle.of(context).loadString('./assets/l10n/about_budget_${locale.value!}.md'),
builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
if (snapshot.hasData) {
return Markdown(data: snapshot.data!.replaceAll('../images', 'resource:assets/images'));
}
return Container();
},
);
}
}
11 changes: 6 additions & 5 deletions test/e2e/start/proceed_with_initial_configuration.test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,25 @@ Feature: Verify Initial Flow
Scenario: Applying basic configuration through the start pages
Given I clear my preferences at the start
Then I can see "Initial Setup" component
When I tap "Save (Go Next)" button
And I tap "Save (Go Next)" button
Then I can see "Acknowledge (Go Next)" button
When I tap "Acknowledge (Go Next)" button
Given preferences are updated (actually, mocked)
When I tap "Go Next" button
Then I can see "Acknowledge (Go Next)" button
When I tap "Acknowledge (Go Next)" button
And I tap "Acknowledge (Go Next)" button
And I tap "Save (Go Next)" button
When I tap "Go Next" button
Then I can see "Create new Account" button
When I tap on 0 index of "ListSelector" fields
And I tap "Bank Account" element
And I enter "Starting Page Account" to "Enter Account Identifier" text field
And I select "USD" from "CurrencySelector" with "Currency Type (Code)" tooltip
And I enter "1000" to "Set Balance" text field
And I tap "Create new Account" button
And I tap "Go Next" button
Then I can see "Create new Budget Category" button
When I enter "Starting Page Budget" to "Enter Budget Category Name" text field
And I select "EUR" from "CurrencySelector" with "Currency Type (Code)" tooltip
And I enter "1000" to "Set Balance" text field
Given preferences are updated (actually, mocked)
When I tap "Create new Budget Category" button
Then I can see "Accounts, total" component
And I can see "Starting Page Account" component
Expand Down

0 comments on commit 3ccb5cc

Please sign in to comment.