Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tasha branch #4

Merged
merged 7 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 111 additions & 25 deletions lib/pages/addnewbudget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ 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';
import 'package:smartspend/pages/managebudget.dart';

class AddNewCat extends StatefulWidget {
@override
Expand All @@ -14,6 +14,25 @@ class AddNewCat extends StatefulWidget {
}

class _AddNewCat extends State<AddNewCat> {
FocusNode _textFieldFocusNode = FocusNode();
TextEditingController _catNameController = TextEditingController();
TextEditingController _amountController = TextEditingController();
TextEditingController _descController = TextEditingController();

bool _isKeyboardAppear = false;

@override
void initState() {
super.initState();
_catNameController = TextEditingController();
}

@override
void dispose() {
_textFieldFocusNode.dispose();
_catNameController.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
Expand All @@ -40,6 +59,7 @@ class _AddNewCat extends State<AddNewCat> {
fontSize: 50,
height: 1,
color: Colors.white,
fontWeight: FontWeight.w600
)),
SizedBox(height: 70),
Text('Total Available Budget', style: TextStyle(
Expand All @@ -52,12 +72,17 @@ class _AddNewCat extends State<AddNewCat> {
fontSize: 30,
height: 1.2,
color: Colors.white,
fontWeight: FontWeight.w600
)),
],
),
),
Positioned(
top: 340,
AnimatedPositioned(
//top: 340,
duration: Duration(milliseconds: 300),
bottom: _isKeyboardAppear ? 0 : 0,
left: 0,
right: 0,
child: Container(
height: MediaQuery.of(context).size.height - 340,
width: MediaQuery.of(context).size.width,
Expand All @@ -80,6 +105,7 @@ class _AddNewCat extends State<AddNewCat> {
style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 14,
fontWeight: FontWeight.w800,
color: Color(0xff2F2F2F)
),
),
Expand All @@ -95,13 +121,24 @@ class _AddNewCat extends State<AddNewCat> {
color: Colors.white,
borderRadius: BorderRadius.circular(15.0),
),
child: const TextField(
child: TextField(
controller: _catNameController, // receive text input
style: TextStyle(
fontFamily: 'Montserrat',
fontWeight: FontWeight.w600,
),
decoration: InputDecoration(
hintText: ' Food',
hintText: 'Category Name',
hintStyle: TextStyle(
fontFamily: 'Montserrat',
fontWeight: FontWeight.w600,
fontSize: 16,
color: Color(0xFFBABABA)
),
//labelText: widget.label,
border: InputBorder.none,
contentPadding: EdgeInsets.zero,
)
contentPadding: EdgeInsets.fromLTRB(16.0, 12.0, 16.0, 12.0)
),
)
),
Container(
Expand All @@ -110,14 +147,16 @@ class _AddNewCat extends State<AddNewCat> {
Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children : [
Container(
margin: const EdgeInsets.only(left:35),
margin: const EdgeInsets.only(left:30),
child: const Text(
'Amount',
style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 14,
fontWeight: FontWeight.w600,
color: Color(0xff2F2F2F)
),
)
Expand All @@ -133,26 +172,45 @@ class _AddNewCat extends State<AddNewCat> {
color: Colors.white,
borderRadius: BorderRadius.circular(15.0),
),
child: const TextField(
child: TextField(
controller: _amountController,
focusNode: _textFieldFocusNode,
style: TextStyle(
fontFamily: 'Montserrat',
fontWeight: FontWeight.w600,
),
decoration: InputDecoration(
hintText: ' SEK',
hintText: 'SEK',
hintStyle: TextStyle(
fontFamily: 'Montserrat',
fontWeight: FontWeight.w600,
fontSize: 16,
color: Color(0xFFBABABA)
),
//labelText: widget.label,
border: InputBorder.none,
contentPadding: EdgeInsets.zero,
)
contentPadding: EdgeInsets.fromLTRB(16.0, 12.0, 16.0, 12.0)
),
onTap: () {
setState(() {
_isKeyboardAppear = true;
});
},
)
)
]
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children : [
Container(
margin: const EdgeInsets.only(left:30),
margin: const EdgeInsets.only(left:20),
child: const Text(
'Color',
style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 14,
fontWeight: FontWeight.w600,
color: Color(0xff2F2F2F)
),
)
Expand All @@ -162,7 +220,10 @@ class _AddNewCat extends State<AddNewCat> {
),
Container(
margin: EdgeInsets.only(left:20),
color: Colors.white,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(15.0), // Adjust the radius as needed
),
width: 1.5*desiredWidth/6,
height: desiredHeight,
child: Row(
Expand Down Expand Up @@ -198,9 +259,10 @@ class _AddNewCat extends State<AddNewCat> {
child: const Text(
'Description',
style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 14,
color: Color(0xff2F2F2F)
fontFamily: 'Montserrat',
fontSize: 14,
fontWeight: FontWeight.w600,
color: Color(0xff2F2F2F)
),
)
),
Expand All @@ -215,29 +277,49 @@ class _AddNewCat extends State<AddNewCat> {
color: Colors.white,
borderRadius: BorderRadius.circular(15.0),
),
child: const TextField(
child: TextField(
controller: _descController,
style: TextStyle(
fontFamily: 'Montserrat',
),
decoration: InputDecoration(
//labelText: widget.label,
border: InputBorder.none,
contentPadding: EdgeInsets.zero,
contentPadding: EdgeInsets.fromLTRB(16.0, 12.0, 16.0, 12.0)
)
)
)
]
),
Container(
padding: const EdgeInsets.only(top: 20),
alignment: Alignment.center,
child: NewCatButton(
onPressed: () {
// Handle button press
// The text here is to be added to the database
print(_catNameController.text);
print(_amountController.text);
print(_descController.text);
// Navigate to Manage Budget page
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => MainBudget())
);
},
),
),

]
)
)
),
),
]
),
);
}
}




//class for color picker
class ColorSelect extends StatefulWidget{

Expand All @@ -262,6 +344,9 @@ class _ColorSelect extends State<ColorSelect>{
setState(() {
chosen = color;
});
/// The hexcode here is to be added to the database
String hexCode = chosen.value.toRadixString(16).substring(2);
print(hexCode);
},
),
);
Expand All @@ -280,4 +365,5 @@ class _ColorSelect extends State<ColorSelect>{
)
);
}
}
}

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


class MainBudget extends StatefulWidget {
Expand Down Expand Up @@ -34,6 +35,7 @@ class _MainBudgetState extends State<MainBudget> {
fontSize: 50,
height: 1,
color: Colors.white,
fontWeight: FontWeight.w800
)),
SizedBox(height: 70),
Text('Total Available Budget', style: TextStyle(
Expand All @@ -46,6 +48,7 @@ class _MainBudgetState extends State<MainBudget> {
fontSize: 30,
height: 1.2,
color: Colors.white,
fontWeight: FontWeight.w600
)),
],
),
Expand Down Expand Up @@ -82,7 +85,7 @@ class LV extends StatelessWidget {
children : [
Expanded(
child: ListView.separated(
itemCount: 10,
itemCount: 2,
separatorBuilder: (context, index) => const Divider(height: 20, color: Color(0xffF5F5F5)),
itemBuilder: (BuildContext context, int index) {
return EditableBudgetCat(name: 'Food',
Expand All @@ -93,14 +96,13 @@ class LV extends StatelessWidget {
),
Container(
margin: EdgeInsets.only(top: 10, bottom: 10),
child: ElevatedButton(
child:AddCatButton(
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => AddNewCat())
);
},
child: const Text('Add New Budget')
)
)
]
Expand Down
6 changes: 2 additions & 4 deletions lib/widgets/addcat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,20 @@ class AddCatButton extends StatelessWidget {

const AddCatButton({
super.key,
required this.onPressed,
this.buttonText = "New Cateogory",
this.colorButton = const Color(0xFF535986),
this.colorText = const Color(0xFFFFFFFF),
this.widthButton = 191.06,
this.heightButton = 44,
this.buttonBorder = 15,
this.fontFamily = 'Montserrat',
required this.onPressed,
});

@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed:() {
print('Fuck');
},
onPressed: onPressed,
style: ElevatedButton.styleFrom(
backgroundColor: colorButton,
minimumSize: Size(widthButton, heightButton),
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/editablebudgetcat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class _EditableBudgetCat extends State<EditableBudgetCat> {
margin: const EdgeInsets.only(left:50.0),
child: Text(
widget.name,
style: const TextStyle(fontSize:16.0, fontFamily: 'Montserrat', color: Color(0xff2F2F2F)),
style: const TextStyle(fontSize:16.0, fontFamily: 'Montserrat', color: Color(0xff2F2F2F), fontWeight: FontWeight.w600),
)
),
Container(
Expand All @@ -120,7 +120,7 @@ class _EditableBudgetCat extends State<EditableBudgetCat> {
margin: const EdgeInsets.only(right: 10),
child: Text(
widget.number.toString(),
style: const TextStyle(fontSize:16.0, fontFamily: 'Montserrat', color: Color(0xff2F2F2F)),
style: const TextStyle(fontSize:16.0, fontFamily: 'Montserrat', color: Color(0xff2F2F2F),fontWeight: FontWeight.w600),
)
)
)
Expand Down
6 changes: 2 additions & 4 deletions lib/widgets/savenewcat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class NewCatButton extends StatelessWidget {
this.buttonText = "Done",
this.colorButton = const Color(0xFFE76201),
this.colorText = const Color(0xFFFFFFFF),
this.widthButton = 292,
this.widthButton = 330,
this.heightButton = 48,
this.buttonBorder = 10,
this.fontFamily = 'Montserrat',
Expand All @@ -24,9 +24,7 @@ class NewCatButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed:() {
print('You');
},
onPressed: onPressed,
style: ElevatedButton.styleFrom(
backgroundColor: colorButton,
minimumSize: Size(widthButton, heightButton),
Expand Down
Loading
Loading