diff --git a/lib/pages/addnewbudget.dart b/lib/pages/addnewbudget.dart index b12814c..7923a1f 100644 --- a/lib/pages/addnewbudget.dart +++ b/lib/pages/addnewbudget.dart @@ -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 @@ -14,6 +14,25 @@ class AddNewCat extends StatefulWidget { } class _AddNewCat extends State { + 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) { @@ -40,6 +59,7 @@ class _AddNewCat extends State { fontSize: 50, height: 1, color: Colors.white, + fontWeight: FontWeight.w600 )), SizedBox(height: 70), Text('Total Available Budget', style: TextStyle( @@ -52,12 +72,17 @@ class _AddNewCat extends State { 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, @@ -80,6 +105,7 @@ class _AddNewCat extends State { style: TextStyle( fontFamily: 'Montserrat', fontSize: 14, + fontWeight: FontWeight.w800, color: Color(0xff2F2F2F) ), ), @@ -95,13 +121,24 @@ class _AddNewCat extends State { 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( @@ -110,14 +147,16 @@ class _AddNewCat extends State { 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) ), ) @@ -133,26 +172,45 @@ class _AddNewCat extends State { 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) ), ) @@ -162,7 +220,10 @@ class _AddNewCat extends State { ), 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( @@ -198,9 +259,10 @@ class _AddNewCat extends State { child: const Text( 'Description', style: TextStyle( - fontFamily: 'Montserrat', - fontSize: 14, - color: Color(0xff2F2F2F) + fontFamily: 'Montserrat', + fontSize: 14, + fontWeight: FontWeight.w600, + color: Color(0xff2F2F2F) ), ) ), @@ -215,29 +277,49 @@ class _AddNewCat extends State { 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{ @@ -262,6 +344,9 @@ class _ColorSelect extends State{ setState(() { chosen = color; }); + /// The hexcode here is to be added to the database + String hexCode = chosen.value.toRadixString(16).substring(2); + print(hexCode); }, ), ); @@ -280,4 +365,5 @@ class _ColorSelect extends State{ ) ); } -} \ No newline at end of file +} + diff --git a/lib/pages/managebudget.dart b/lib/pages/managebudget.dart index ffff4e3..5d1e69c 100644 --- a/lib/pages/managebudget.dart +++ b/lib/pages/managebudget.dart @@ -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 { @@ -34,6 +35,7 @@ class _MainBudgetState extends State { fontSize: 50, height: 1, color: Colors.white, + fontWeight: FontWeight.w800 )), SizedBox(height: 70), Text('Total Available Budget', style: TextStyle( @@ -46,6 +48,7 @@ class _MainBudgetState extends State { fontSize: 30, height: 1.2, color: Colors.white, + fontWeight: FontWeight.w600 )), ], ), @@ -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', @@ -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') ) ) ] diff --git a/lib/widgets/addcat.dart b/lib/widgets/addcat.dart index 05bf34d..e27c9f9 100644 --- a/lib/widgets/addcat.dart +++ b/lib/widgets/addcat.dart @@ -12,6 +12,7 @@ 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), @@ -19,15 +20,12 @@ class AddCatButton extends StatelessWidget { 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), diff --git a/lib/widgets/editablebudgetcat.dart b/lib/widgets/editablebudgetcat.dart index 29be33d..35d456c 100644 --- a/lib/widgets/editablebudgetcat.dart +++ b/lib/widgets/editablebudgetcat.dart @@ -110,7 +110,7 @@ class _EditableBudgetCat extends State { 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( @@ -120,7 +120,7 @@ class _EditableBudgetCat extends State { 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), ) ) ) diff --git a/lib/widgets/savenewcat.dart b/lib/widgets/savenewcat.dart index a9b4568..6454c0f 100644 --- a/lib/widgets/savenewcat.dart +++ b/lib/widgets/savenewcat.dart @@ -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', @@ -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), diff --git a/pubspec.lock b/pubspec.lock index faa4bfe..444e55e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,18 +5,18 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "36a321c3d2cbe01cbcb3540a87b8843846e0206df3e691fa7b23e19e78de6d49" + sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051 url: "https://pub.dev" source: hosted - version: "65.0.0" + version: "64.0.0" analyzer: dependency: transitive description: name: analyzer - sha256: dfe03b90ec022450e22513b5e5ca1f01c0c01de9c3fba2f7fd233cb57a6b9a07 + sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893" url: "https://pub.dev" source: hosted - version: "6.3.0" + version: "6.2.0" archive: dependency: transitive description: @@ -141,10 +141,10 @@ packages: dependency: transitive description: name: coverage - sha256: "8acabb8306b57a409bf4c83522065672ee13179297a6bb0cb9ead73948df7c76" + sha256: "595a29b55ce82d53398e1bcc2cba525d7bd7c59faeb2d2540e9d42c390cfeeeb" url: "https://pub.dev" source: hosted - version: "1.7.2" + version: "1.6.4" crypto: dependency: transitive description: @@ -213,10 +213,10 @@ packages: dependency: transitive description: name: file - sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" url: "https://pub.dev" source: hosted - version: "7.0.0" + version: "6.1.4" fixnum: dependency: transitive description: @@ -399,22 +399,6 @@ packages: url: "https://pub.dev" source: hosted version: "4.8.1" - leak_tracker: - dependency: transitive - description: - name: leak_tracker - sha256: "04be76c4a4bb50f14904e64749237e541e7c7bcf7ec0b196907322ab5d2fc739" - url: "https://pub.dev" - source: hosted - version: "9.0.16" - leak_tracker_testing: - dependency: transitive - description: - name: leak_tracker_testing - sha256: b06739349ec2477e943055aea30172c5c7000225f79dad4702e2ec0eda79a6ff - url: "https://pub.dev" - source: hosted - version: "1.0.5" lints: dependency: transitive description: @@ -443,18 +427,18 @@ packages: dependency: transitive description: name: material_color_utilities - sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" url: "https://pub.dev" source: hosted - version: "0.8.0" + version: "0.5.0" meta: dependency: transitive description: name: meta - sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.10.0" mime: dependency: transitive description: @@ -579,10 +563,10 @@ packages: dependency: transitive description: name: platform - sha256: "0a279f0707af40c890e80b1e9df8bb761694c074ba7e1d4ab1bc4b728e200b59" + sha256: ae68c7bfcd7383af3629daafb32fb4e8681c7154428da4febcff06200585f102 url: "https://pub.dev" source: hosted - version: "3.1.3" + version: "3.1.2" plugin_platform_interface: dependency: transitive description: @@ -611,10 +595,10 @@ packages: dependency: transitive description: name: process - sha256: "266ca5be5820feefc777793d0a583acfc8c40834893c87c00c6c09e2cf58ea42" + sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" url: "https://pub.dev" source: hosted - version: "5.0.1" + version: "4.2.4" pub_semver: dependency: transitive description: @@ -872,10 +856,10 @@ packages: dependency: transitive description: name: vm_service - sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + sha256: c538be99af830f478718b51630ec1b6bee5e74e52c8a802d328d9e71d35d2583 url: "https://pub.dev" source: hosted - version: "13.0.0" + version: "11.10.0" watcher: dependency: transitive description: @@ -888,10 +872,10 @@ packages: dependency: transitive description: name: web - sha256: edc8a9573dd8c5a83a183dae1af2b6fd4131377404706ca4e5420474784906fa + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 url: "https://pub.dev" source: hosted - version: "0.4.0" + version: "0.3.0" web_socket_channel: dependency: transitive description: @@ -904,10 +888,10 @@ packages: dependency: transitive description: name: webdriver - sha256: "003d7da9519e1e5f329422b36c4dcdf18d7d2978d1ba099ea4e45ba490ed845e" + sha256: "3c923e918918feeb90c4c9fdf1fe39220fa4c0e8e2c0fffaded174498ef86c49" url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "3.0.2" webkit_inspection_protocol: dependency: transitive description: