Skip to content

Commit

Permalink
fix: Updated savings page (#133)
Browse files Browse the repository at this point in the history
## Description
- Updated savings page with generic declarative Ui design.
- Solves issue #7 


## Type of Change

<!--- Put an `x` in all the boxes that apply: -->

- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 🛠️ Bug fix (non-breaking change which fixes an issue)
- [ ] ❌ Breaking change (fix or feature that would cause existing
functionality to change)
- [x] 🧹 Code refactor
- [ ] ✅ Build configuration change
- [ ] 📝 Documentation
- [ ] 🗑️ Chore


## Pre-launch Checklist

- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read and ran all relevant commands as specififed in the Running
Tests section of the [Contributor Guide].
- [ ] The title of the PR follows the [Conventional Commits] guideline
- [ ] My local branch follows the naming standards in the [Deepsource
Branch Naming Convention] or [Biodiversity Branch Naming Convention]
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated `pubspec.yaml` with an appropriate new version according
to the [pub versioning philosophy],
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] All existing and new tests are passing.


[Contributor Guide]:
https://github.com/FlutterPlaza/.github/blob/main/CONTRIBUTING.md
[Conventional Commits]:
https://www.conventionalcommits.org/en/v1.0.0-beta.4/
[pub versioning philosophy]: https://dart.dev/tools/pub/versioning
[Biodiversity Branch Naming Convention]: https://bit.ly/3DyYSwM
[Deepsource Branch Naming Convention]: https://bit.ly/3Y08Gs4
  • Loading branch information
jeffrey0606 authored Mar 17, 2023
2 parents a4b1b46 + c5d83e3 commit 3dbbdb2
Show file tree
Hide file tree
Showing 10 changed files with 301 additions and 236 deletions.
4 changes: 4 additions & 0 deletions assets/fpb-assets/time_circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions assets/fpb-assets/wallet.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions lib/assets/fpb_svg.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ class SvgNames {
static String facebook = '${path}facebook.svg';
static String twitter = '${path}twitter.svg';
static String error = '${path}Cross.svg';
static String timeCircle = '${path}time_circle.svg';
static String wallet = '${path}wallet.svg';
}
7 changes: 6 additions & 1 deletion lib/router/app_route.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:auto_route/annotations.dart';
import 'package:fpb/contact_us/contact_us_page.dart';
import 'package:fpb/contact_us/view/contact_us_screen.dart';
import 'package:fpb/contact_us/view/contact_us_success_screen.dart';
import 'package:fpb/email_confirmation/email_confirmation.dart';
import 'package:fpb/home/view/home_screen.dart';
import 'package:fpb/latest_activities/view/latest_activities_screen.dart';
Expand All @@ -10,6 +10,7 @@ import 'package:fpb/phone_number_confirmation/view/phone_number_confirmation.dar
import 'package:fpb/profile/view/profile_page.dart';
import 'package:fpb/qr_code_screen/view/qr_code_screen.dart';
import 'package:fpb/savings/save_money_with_bucket/save_money_with_bucket.dart';
import 'package:fpb/savings/view/savings_page.dart';
import 'package:fpb/sign_in/view/sign_in_page.dart';
import 'package:fpb/sign_up/view/signup_page.dart';

Expand All @@ -26,6 +27,10 @@ import 'package:fpb/sign_up/view/signup_page.dart';
name: 'HomeRouter',
page: HomeScreen,
children: [
AutoRoute(
path: 'savings',
page: SavingsPage,
),
AutoRoute(
path: 'profile',
page: ProfileScreen,
Expand Down
292 changes: 57 additions & 235 deletions lib/savings/view/savings_page.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// ignore_for_file: omit_local_variable_types, prefer_final_locals

import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:fpb/assets/fpb_svg.dart';
import 'package:fpb/l10n/l10n.dart';
import 'package:fpb/router/app_route.gr.dart';
import 'package:fpb/savings/view/widgets/account_card.dart';
import 'package:fpb/savings/view/widgets/account_type_tile.dart';
import 'package:fpb/savings/view/widgets/savings_screen_title.dart';

class SavingsPage extends StatefulWidget {
const SavingsPage({super.key});
Expand All @@ -14,255 +16,75 @@ class SavingsPage extends StatefulWidget {
}

class _SavingsPageState extends State<SavingsPage> {
int pageIndex = 1;

void onChanged(int index) {
setState(() {
pageIndex = index;
});
}


@override
Widget build(BuildContext context) {
final l10n = context.l10n;
final theme = Theme.of(context);
final colors = theme.colorScheme;
return LayoutBuilder(
builder: (context, box) {
return Padding(
padding: EdgeInsets.only(
left: box.maxHeight * 0.025,
right: box.maxHeight * 0.025,
top: box.maxHeight * 0.1,
),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
return Scaffold(
body: Padding(
padding: EdgeInsets.only(
left: box.maxHeight * 0.025,
right: box.maxHeight * 0.025,
top: box.maxHeight * 0.1,
),
child: SingleChildScrollView(
child: Column(
children: [
Text(
l10n.savingsTitle,
style: theme.textTheme.titleLarge,
SavingsScreenTitle(
box: box,
),
ElevatedButton(
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all(colors.secondary),
),
onPressed: () {
context.router.push(ProfileRoute());
},
child: Row(
children: [
const Icon(
Icons.add,
color: Colors.white,
size: 12,
),
SizedBox(
width: box.maxWidth * 0.03,
),
Text(
l10n.savingsNewSavingsAccountLabel,
style:
Theme.of(context).textTheme.titleSmall?.copyWith(
// color: AppColors.onSurfaceW,
),
),
],
),
SizedBox(
height: box.maxHeight * 0.05,
),
],
),
SizedBox(
height: box.maxHeight * 0.025,
),
Container(
height: box.maxHeight * 0.3,
width: box.maxWidth * .85,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: Colors.white,
),
child: Padding(
padding: EdgeInsets.only(
left: box.maxHeight * 0.025,
right: box.maxHeight * 0.025,
top: box.maxHeight * 0.025,
bottom: box.maxHeight * 0.015,
),
child: Column(
children: [
Row(
children: [
Image.asset(
'assets/fpb-assets/orange_clock_icon.png',
),
SizedBox(
width: box.maxHeight * 0.02,
),
Text(
l10n.savingsTimeBlockedAccounts,
style: Theme.of(context).textTheme.titleMedium,
),
],
),
SizedBox(
height: box.maxHeight * 0.01,
),
Column(
// ignore: avoid_redundant_argument_values
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'My Tesla New Model X',
style: Theme.of(context).textTheme.titleMedium,
),
Text(
r'$ 1,280.45',
style: Theme.of(context).textTheme.titleSmall,
),
],
),
SizedBox(
height: box.maxHeight * 0.01,
),
Text(
AccountsCard(
accountTitle: l10n.savingsTimeBlockedAccounts,
svgnames: SvgNames.timeCircle,
box: box,
l10n: l10n,
accountTypeTiles: [
AccountTypeTile(
tileText: 'My Tesla Model X',
amount: '\$ 1,280.45',
tileSubText:
l10n.savingsMyTeslaModelXBlockedTimelineText,
style: Theme.of(context).textTheme.labelMedium,
),
],
),
SizedBox(
height: box.maxHeight * 0.01,
),
const Divider(),
SizedBox(
height: box.maxHeight * 0.01,
),
Column(
// ignore: avoid_redundant_argument_values
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
l10n.savingsNewDroneText,
style: Theme.of(context).textTheme.titleMedium,
),
Text(
r'$ 79.45',
style: Theme.of(context).textTheme.titleSmall,
),
],
),
SizedBox(
height: box.maxHeight * 0.01,
),
Text(
l10n.savingsNewDroneBlockedTimelineText,
style: Theme.of(context).textTheme.labelMedium,
),
],
box: box,
),
AccountTypeTile(
tileText: l10n.savingsNewDroneText,
amount: '\$ 79.45',
box: box,
tileSubText: l10n.savingsNewDroneBlockedTimelineText,
)
],
),
),
),
SizedBox(
height: box.maxHeight * 0.025,
),
Container(
height: box.maxHeight * 0.3,
width: box.maxWidth * .85,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: Colors.white,
),
child: Padding(
padding: EdgeInsets.only(
left: box.maxHeight * 0.025,
right: box.maxHeight * 0.025,
top: box.maxHeight * 0.025,
SizedBox(
height: box.maxHeight * 0.025,
),
child: Column(
children: [
Row(
children: [
Image.asset('assets/fpb-assets/Fill 2.png'),
SizedBox(
width: box.maxHeight * 0.02,
),
Text(
l10n.savingsStandardAccountsLabel,
style: Theme.of(context).textTheme.titleMedium,
),
],
),
SizedBox(
height: box.maxHeight * 0.01,
),
Column(
// ignore: avoid_redundant_argument_values
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
l10n.savingsMortgageText,
style: Theme.of(context).textTheme.titleMedium,
),
Text(
r'$ 22,500.50',
style: Theme.of(context).textTheme.titleSmall,
),
],
),
],
),
SizedBox(
height: box.maxHeight * 0.025,
),
const Divider(),
SizedBox(
height: box.maxHeight * 0.01,
),
Column(
// ignore: avoid_redundant_argument_values
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
l10n.savingsNewDroneText,
style: Theme.of(context).textTheme.titleMedium,
),
Text(
r'$ 79.45',
style: Theme.of(context).textTheme.titleSmall,
),
],
),
SizedBox(
height: box.maxHeight * 0.01,
),
],
AccountsCard(
accountTitle: l10n.savingsStandardAccountsLabel,
svgnames: SvgNames.wallet,
box: box,
l10n: l10n,
accountTypeTiles: [
AccountTypeTile(
tileText: l10n.savingsMortgageText,
amount: '\$ 22,500.50',
tileSubText: '',
box: box,
),
AccountTypeTile(
tileText: l10n.savingsNewDroneText,
amount: '\$ 79.45',
box: box,
tileSubText: '',
)
],
),
),
)
],
),
],
),
),
);
},
Expand Down
Loading

0 comments on commit 3dbbdb2

Please sign in to comment.