Skip to content

Commit

Permalink
Merge pull request #7 from xMadKing/som-branch
Browse files Browse the repository at this point in the history
som-update
  • Loading branch information
xMadKing authored Dec 27, 2023
2 parents 9929924 + 9bf6420 commit c8413f9
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 105 deletions.
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
#org.gradle.java.home = /Library/Java/JavaVirtualMachines/jdk-18.0.2.1.jdk/Contents/Home
#org.gradle.java.home = C:/Program Files/Java/jdk-18.0.2.1

7 changes: 3 additions & 4 deletions lib/pages/addnewbudget.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:smartspend/widgets/backbutton.dart';
import 'package:flutter_colorpicker/flutter_colorpicker.dart';
import 'package:smartspend/widgets/savenewcat.dart';
Expand Down Expand Up @@ -152,7 +151,7 @@ class _AddNewCat extends State<AddNewCat> {
Container(
margin: const EdgeInsets.only(left:30),
child: const Text(
'Amount',
'Limit',
style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 14,
Expand Down Expand Up @@ -280,8 +279,8 @@ class _AddNewCat extends State<AddNewCat> {

//class for color picker
class ColorSelect extends StatefulWidget{
double desiredW;
double desiredH;
final double desiredW;
final double desiredH;

ColorSelect({super.key, required this.desiredH, required this.desiredW});

Expand Down
118 changes: 80 additions & 38 deletions lib/pages/managebudget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import 'package:smartspend/widgets/backbutton.dart';
import 'package:smartspend/widgets/editablebudgetcat.dart';
import 'package:smartspend/pages/addnewbudget.dart';
import 'package:smartspend/widgets/addcat.dart';

import 'package:smartspend/backend/category.dart';
import 'package:smartspend/backend/wyrm/database.dart';

class MainBudget extends StatefulWidget {
const MainBudget({super.key});
Expand All @@ -13,6 +14,10 @@ class MainBudget extends StatefulWidget {
}

class _MainBudgetState extends State<MainBudget> {

//calculate available budget in acc
//double available = ;

@override
Widget build(BuildContext context) {
return Scaffold(
Expand All @@ -24,31 +29,31 @@ class _MainBudgetState extends State<MainBudget> {
left: 20,
child: CustomizedBackButton(),
),
const Positioned(
Positioned(
top: 100,
left: 30,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Manage\nBudget", style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 50,
height: 1,
color: Colors.white,
fontWeight: FontWeight.w800
fontFamily: 'Montserrat',
fontSize: 50,
height: 1,
color: Colors.white,
fontWeight: FontWeight.w800
)),
SizedBox(height: 70),
Text('Total Available Budget', style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 12,
color: Colors.white,
)),
Text('FROM USER DATA', style: TextStyle( //should be the number of money available in the account
fontFamily: 'Montserrat',
fontSize: 30,
height: 1.2,
color: Colors.white,
fontWeight: FontWeight.w600
Text("Available", style: TextStyle( //should be the number of money available in the account
fontFamily: 'Montserrat',
fontSize: 30,
height: 1.2,
color: Colors.white,
fontWeight: FontWeight.w600
)),
],
),
Expand Down Expand Up @@ -76,36 +81,73 @@ class _MainBudgetState extends State<MainBudget> {



class LV extends StatelessWidget {
class LV extends StatefulWidget {
const LV({super.key});

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

class _LV extends State<LV> {
late List<Category> categories;
Wyrm database = Wyrm();
bool load = false;

Future<void> initArgs() async {
categories = await database.categories();

setState(() {
load = true;
});
}

@override
void initState() {
super.initState();
initArgs();
}

@override
Widget build(BuildContext context) {
if (load == false) {
return EditableBudgetCat(
name: "No category founded", // Access the property of Category
color: Colors.red,
number: 0,
);
}
return Column(
children : [
Expanded(
child: ListView.separated(
itemCount: 2,
separatorBuilder: (context, index) => const Divider(height: 20, color: Color(0xffF5F5F5)),
itemBuilder: (BuildContext context, int index) {
return EditableBudgetCat(name: 'Food',
color: Colors.deepOrange,
number: 4500);
},
)
children: [
Padding(
padding: EdgeInsets.only(top: 10)
),
Expanded(
child: ListView.separated(
itemCount: categories.length,
separatorBuilder: (context, index) =>
const Divider(height: 20, color: Color(0xffF5F5F5)),
itemBuilder: (BuildContext context, int index) {
return EditableBudgetCat(
name: categories[index].categoryName, // Access the property of Category
color: Color(categories[index].categoryColor),
number: categories[index].spendingLimit,
);
},
),
Container(
margin: EdgeInsets.only(top: 10, bottom: 10),
child:AddCatButton(
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => AddNewCat())
);
},
)
)
]
),
Container(
margin: EdgeInsets.only(top: 10, bottom: 10),
child: AddCatButton(
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => AddNewCat(),
),
);
},
),
),
],
);
}
}
}
23 changes: 1 addition & 22 deletions lib/widgets/editablebudgetcat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:flutter_slidable/flutter_slidable.dart';
class EditableBudgetCat extends StatefulWidget{
final String name;
final Color color;
final double number;
final num number;

const EditableBudgetCat({super.key, required this.name, required this.color, required this.number});

Expand Down Expand Up @@ -38,27 +38,6 @@ class _EditableBudgetCat extends State<EditableBudgetCat> {
motion: const BehindMotion(),
extentRatio: 0.35,
children: [
Expanded(
child: Align(
alignment: Alignment.centerRight,
child: InkWell(
onTap: () {},
child: Container(
alignment: Alignment.center,
width: 60,
height: height,
decoration: const BoxDecoration(
color:Colors.white,
//borderRadius: BorderRadius.circular(20.0)
),
child: const Icon(
Icons.edit_document,
color: Color(0xffBABABA),
)
)
)
)
),
Expanded(
child: Align(
alignment: Alignment.centerRight,
Expand Down
Loading

0 comments on commit c8413f9

Please sign in to comment.