Skip to content

Commit

Permalink
selected wallets UI refactor qausi SavingsCard
Browse files Browse the repository at this point in the history
  • Loading branch information
rasheedmhd committed Apr 16, 2024
1 parent c498548 commit 4536d5b
Show file tree
Hide file tree
Showing 5 changed files with 344 additions and 63 deletions.
12 changes: 2 additions & 10 deletions lib/accounts/accounts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,11 @@ class AccountsState extends ConsumerState<Accounts> {
slivers: [
SliverAppBar(
backgroundColor: const Color.fromARGB(255, 19, 194, 110),
expandedHeight: 170,
expandedHeight: 230,
flexibleSpace: FlexibleSpaceBar(
background: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
transform: GradientRotation(3.142 / 6),
colors: [
Color.fromARGB(255, 19, 194, 110),
Color.fromARGB(255, 201, 249, 226),
],
),
color: Color.fromARGB(255, 19, 194, 110),
),
child: PageView(
children: [
Expand Down
174 changes: 122 additions & 52 deletions lib/cards/savings.dart
Original file line number Diff line number Diff line change
@@ -1,81 +1,151 @@
import "package:app/accounts/transactions.dart";
import "package:app/ops/update/editWallet.dart";
// import "package:app/ops/update/saveCard.dart";
import "package:app/ops/update/topUpWallet.dart";
import "package:flutter/material.dart";
import "package:app/models/schemas.dart";
import "package:flutter_riverpod/flutter_riverpod.dart";
// import "package:font_awesome_flutter/font_awesome_flutter.dart";
import "package:font_awesome_flutter/font_awesome_flutter.dart";
// import "package:app/providers/wallets_provider.dart";

class SelectedWallets extends ConsumerWidget {
const SelectedWallets(this.wallet, {super.key});
final Wallet? wallet;
final Wallet wallet;

@override
Widget build(BuildContext context, WidgetRef ref) {
// void save() {
// showModalBottomSheet(
// showDragHandle: true,
// context: context,
// isScrollControlled: true,
// builder: (ctx) => SaveCard(wallet),
// );
// }

void showTopUpWalletPage() {
showModalBottomSheet(
showDragHandle: true,
context: context,
isScrollControlled: true,
builder: (ctx) => TopUpWalletCard(wallet),
);
}

void showEditPage() {
showModalBottomSheet(
showDragHandle: true,
context: context,
isScrollControlled: true,
builder: (ctx) => EditWalletCard(wallet),
);
}

void showTransactionsPage() {
showModalBottomSheet(
showDragHandle: true,
context: context,
isScrollControlled: true,
builder: (ctx) => TransactionsPage(wallet),
);
}

return Padding(
padding: const EdgeInsets.fromLTRB(0, 20, 0, 10),
padding: const EdgeInsets.all(20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
// const Text("Total Saved",
// style: TextStyle(
// fontSize: 25.0,
// color: Color.fromARGB(255, 255, 255, 255),
// )),
Text(
wallet.name,
style: const TextStyle(
fontSize: 25.0,
color: Color.fromARGB(255, 255, 255, 255),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
// FloatingActionButton(
// heroTag: "add",
// mini: true,
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(50)),
// elevation: 0,
// onPressed: () {},
// backgroundColor: const Color.fromARGB(255, 204, 241, 228),
// child: const Icon(
// Icons.add,
// size: 25,
// color: Color.fromARGB(255, 48, 136, 6),
// ),
// ),
Text("Wallets",
style: TextStyle(
fontSize: 25.0,
Text(
"GHS${wallet.bal}",
style: const TextStyle(
fontSize: 35.0,
fontWeight: FontWeight.w700,
color: Color.fromARGB(255, 255, 255, 255),
)
),
),
// FloatingActionButton(
// heroTag: "edit",
// mini: true,
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(50),
// ),
// elevation: 0,
// onPressed: () {},
// backgroundColor: const Color.fromARGB(255, 204, 241, 228),
// child: const FaIcon(
// FontAwesomeIcons.penToSquare,
// size: 20,
// color: Color.fromARGB(255, 48, 136, 6),
// ),
// ),
],
),
const SizedBox(
height: 12,
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Text(
"${wallet?.bal}",
style: const TextStyle(
fontSize: 35.0,
fontWeight: FontWeight.w700,
color: Color.fromARGB(255, 255, 255, 255),
FloatingActionButton(
heroTag: "add",
mini: true,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50)),
elevation: 0,
onPressed: () {
showTopUpWalletPage();
},
backgroundColor: const Color.fromARGB(255, 255, 255, 255),
child: const Icon(
Icons.add,
size: 25,
color: Color.fromARGB(255, 48, 136, 6),
),
),
// Text("Wallets",
// style: TextStyle(
// fontSize: 25.0,
// color: Color.fromARGB(255, 255, 255, 255),
// )
// ),
FloatingActionButton(
heroTag: "edit",
mini: true,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50),
),
elevation: 0,
onPressed: () {
showEditPage();
},
backgroundColor: const Color.fromARGB(255, 255, 255, 255),
child: const FaIcon(
FontAwesomeIcons.penToSquare,
size: 20,
color: Color.fromARGB(255, 48, 136, 6),
),
),
FloatingActionButton(
heroTag: "savings",
mini: true,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50),
),
elevation: 0,
onPressed: () {
showTransactionsPage();
},
backgroundColor: const Color.fromARGB(255, 255, 255, 255),
child: const FaIcon(
FontAwesomeIcons.list,
size: 20,
color: Color.fromARGB(255, 48, 136, 6),
),
),
],
),
Text(
"${wallet?.name}",
style: const TextStyle(
fontSize: 23.0,
color: Color.fromARGB(255, 255, 255, 255),
),
const SizedBox(
height: 12,
),
],
),
Expand Down
18 changes: 18 additions & 0 deletions lib/models/schemas.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,24 @@ class _Spend {
String? get getWallet => wallet?.name;
}

// [[ TOD DO ]]
// @RealmModel()
// class _Savings {
// @PrimaryKey()
// late ObjectId id;
// // amount spent
// late double amount;
// late DateTime createdAt;
// // wallet paid from for the spend
// late _Wallet? wallet;

// @Backlink(#savings)
// late Iterable<_Wallet> linkedWallet;

// String get getAmount => amount.toStringAsFixed(2);
// String? get getWallet => wallet?.name;
// }

@RealmModel()
class _Category {
@PrimaryKey()
Expand Down
Loading

0 comments on commit 4536d5b

Please sign in to comment.