Skip to content

Commit

Permalink
transaction page completed
Browse files Browse the repository at this point in the history
  • Loading branch information
ashiqu-ali committed Jan 31, 2024
1 parent 17a57e6 commit 61d32bb
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 8 deletions.
4 changes: 3 additions & 1 deletion lib/pages/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,13 @@ class _HomePageState extends State<HomePage> {
if (snapshot.hasData) {
getTotalBalance(snapshot.data!);
return ListView(
physics: const BouncingScrollPhysics(),
children: [
const HomeProfile(),
TotalBalance(totalBalance: totalBalance, totalIncome: totalIncome, totalExpense: totalExpense),
const Heading(headng: "Recent Transaction"),
RecentTransaction(data: snapshot.data!)
RecentTransaction(data: snapshot.data!),
SizedBox(height: large)
],
);
} else {
Expand Down
8 changes: 5 additions & 3 deletions lib/pages/main_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import 'package:expense_tracker/componets/heading.dart';
import 'package:expense_tracker/pages/demoPage.dart';
import 'package:expense_tracker/pages/home_page.dart';
import 'package:expense_tracker/pages/profile_page.dart';
import 'package:expense_tracker/pages/summary_page.dart';
import 'package:expense_tracker/pages/transaction_page.dart';
import 'package:expense_tracker/utils/style.dart';
import 'package:flutter/material.dart';

Expand All @@ -19,8 +21,8 @@ class _MainPageState extends State<MainPage> {
Widget buildTabContent(int index){
switch(index){
case 0:return const HomePage();
case 1:return Container();
case 2:return DeleteHive();
case 1:return SummaryChart();
case 2:return TransactionPage();
case 3:return const ProfilePage();
default:return const HomePage();

Expand All @@ -47,7 +49,7 @@ class _MainPageState extends State<MainPage> {
items: [
BottomNavigationBarItem(icon: Image.asset("assets/icons/home.png"), label: 'Home'),
BottomNavigationBarItem(icon: Image.asset("assets/icons/chart-vertical.png"), label: 'Stat'),
BottomNavigationBarItem(icon: Image.asset("assets/icons/wallet.png"), label: 'Wallet'),
BottomNavigationBarItem(icon: Image.asset("assets/icons/wallet.png"), label: 'Transaction'),
BottomNavigationBarItem(icon: Image.asset("assets/icons/user.png"), label: 'Account')
],

Expand Down
33 changes: 33 additions & 0 deletions lib/pages/transaction_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import 'package:expense_tracker/componets/heading.dart';
import 'package:expense_tracker/componets/transaction_tile.dart';
import 'package:expense_tracker/controller/db_helper.dart';
import 'package:flutter/material.dart';

class TransactionPage extends StatelessWidget {
TransactionPage({super.key});

DbHelper dbHelper = DbHelper();

@override
Widget build(BuildContext context) {
return Scaffold(
body: FutureBuilder<List<Map<dynamic,dynamic>>>(
future: dbHelper.fetch(),
builder: (context, snapshot){
if(snapshot.hasError){
return const Center(child: Text('Unexpected Error!'));
}if(snapshot.hasData){
return ListView(
children: [
const Heading(headng: "Transaction"),
Transaction(length: snapshot.data!.length, data: snapshot.data!)
],
);
} else {
return const Center(child: Text('List Empty'));
}
}
),
);
}
}
7 changes: 4 additions & 3 deletions lib/utils/style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ TextStyle heading4 = GoogleFonts.poppins(
fontWeight: FontWeight.w600,color: heading,fontSize: 14);

//sizes
var medium = 30.0;
var small = 16.0;
var xsmall = 10.0;
double large = 40.0;
double medium = 30.0;
double small = 16.0;
double xsmall = 10.0;
18 changes: 17 additions & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.6"
equatable:
dependency: transitive
description:
name: equatable
sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2
url: "https://pub.dev"
source: hosted
version: "2.0.5"
fake_async:
dependency: transitive
description:
Expand All @@ -73,6 +81,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.0"
fl_chart:
dependency: "direct main"
description:
name: fl_chart
sha256: b5e2b0f13d93f8c532b5a2786bfb44580de1f50b927bf95813fa1af617e9caf8
url: "https://pub.dev"
source: hosted
version: "0.66.1"
flutter:
dependency: "direct main"
description: flutter
Expand Down Expand Up @@ -338,4 +354,4 @@ packages:
version: "1.0.4"
sdks:
dart: ">=3.2.1 <4.0.0"
flutter: ">=3.10.0"
flutter: ">=3.16.0"
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ dependencies:
hive: ^2.2.3
flutter_snake_navigationbar: ^0.6.1
hive_flutter: ^1.1.0
fl_chart: ^0.66.1

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 61d32bb

Please sign in to comment.