Skip to content

Commit

Permalink
Fixed the color selector button, now works as intended
Browse files Browse the repository at this point in the history
  • Loading branch information
xMadKing committed Dec 19, 2023
1 parent 1898df7 commit c0f7e7b
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 79 deletions.
117 changes: 62 additions & 55 deletions lib/pages/addnewbudget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -197,55 +197,13 @@ class _AddNewCat extends State<AddNewCat> {
});
},
)
)
]
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children : [
Container(
margin: const EdgeInsets.only(left:20),
child: const Text(
'Color',
style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 14,
fontWeight: FontWeight.w600,
color: Color(0xff2F2F2F)
),
)
),
Container(
padding: const EdgeInsets.only(top:5),
),
Container(
margin: EdgeInsets.only(left:20),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(15.0), // Adjust the radius as needed
),
width: 1.5*desiredWidth/6,
height: desiredHeight,
child: Row(
children: [
Container(
margin: const EdgeInsets.only(left:15),
width: desiredHeight/2,
height: desiredHeight/2,
child: ClipRRect(
borderRadius: BorderRadius.circular(desiredHeight/2),
child: ColorSelect()
)
),
const Padding(
padding: EdgeInsets.only(left: 10),
),
const Icon(Icons.arrow_drop_down_outlined, color: Color(0xFF2F2F2F))
]
)
)
]
),
ColorSelect(
desiredH: desiredHeight,
desiredW: desiredWidth
),
]
),
Container(
Expand Down Expand Up @@ -322,8 +280,10 @@ class _AddNewCat extends State<AddNewCat> {

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

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

@override
State<StatefulWidget> createState() => _ColorSelect();
Expand All @@ -344,7 +304,7 @@ class _ColorSelect extends State<ColorSelect>{
setState(() {
chosen = color;
});
/// The hexcode here is to be added to the database
// The hexcode here is to be added to the database
String hexCode = chosen.value.toRadixString(16).substring(2);
print(hexCode);
},
Expand All @@ -356,13 +316,60 @@ class _ColorSelect extends State<ColorSelect>{

@override
Widget build(BuildContext context) {
return InkWell(
onTap: ColorPickerpop,
child: Container(
width: 50,
height: 50,
color: chosen,
)
return GestureDetector(
onTap: () => ColorPickerpop(),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children : [
Container(
margin: const EdgeInsets.only(left:20),
child: const Text(
'Color',
style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 14,
fontWeight: FontWeight.w600,
color: Color(0xff2F2F2F)
),
)
),
Container(
padding: const EdgeInsets.only(top:5),
),
Container(
margin: EdgeInsets.only(left:20),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(15.0), // Adjust the radius as needed
),
width: 1.5*widget.desiredW/6,
height: widget.desiredH,
child: Row(
children: [
Container(
margin: const EdgeInsets.only(left:15),
width: widget.desiredH/2,
height: widget.desiredH/2,
child: ClipRRect(
borderRadius: BorderRadius.circular(widget.desiredH/2),
child: InkWell(
child: Container(
width: 50,
height: 50,
color: chosen,
)
)
)
),
const Padding(
padding: EdgeInsets.only(left: 10),
),
const Icon(Icons.arrow_drop_down_outlined, color: Color(0xFF2F2F2F))
]
)
)
]
),
);
}
}
Expand Down
64 changes: 40 additions & 24 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ packages:
dependency: transitive
description:
name: _fe_analyzer_shared
sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051
sha256: "36a321c3d2cbe01cbcb3540a87b8843846e0206df3e691fa7b23e19e78de6d49"
url: "https://pub.dev"
source: hosted
version: "64.0.0"
version: "65.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893"
sha256: dfe03b90ec022450e22513b5e5ca1f01c0c01de9c3fba2f7fd233cb57a6b9a07
url: "https://pub.dev"
source: hosted
version: "6.2.0"
version: "6.3.0"
archive:
dependency: transitive
description:
Expand Down Expand Up @@ -141,10 +141,10 @@ packages:
dependency: transitive
description:
name: coverage
sha256: "595a29b55ce82d53398e1bcc2cba525d7bd7c59faeb2d2540e9d42c390cfeeeb"
sha256: "8acabb8306b57a409bf4c83522065672ee13179297a6bb0cb9ead73948df7c76"
url: "https://pub.dev"
source: hosted
version: "1.6.4"
version: "1.7.2"
crypto:
dependency: transitive
description:
Expand Down Expand Up @@ -213,10 +213,10 @@ packages:
dependency: transitive
description:
name: file
sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d"
sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
url: "https://pub.dev"
source: hosted
version: "6.1.4"
version: "7.0.0"
fixnum:
dependency: transitive
description:
Expand Down Expand Up @@ -407,6 +407,22 @@ 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:
Expand Down Expand Up @@ -435,18 +451,18 @@ packages:
dependency: transitive
description:
name: material_color_utilities
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
url: "https://pub.dev"
source: hosted
version: "0.5.0"
version: "0.8.0"
meta:
dependency: transitive
description:
name: meta
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
url: "https://pub.dev"
source: hosted
version: "1.10.0"
version: "1.11.0"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -571,10 +587,10 @@ packages:
dependency: transitive
description:
name: platform
sha256: ae68c7bfcd7383af3629daafb32fb4e8681c7154428da4febcff06200585f102
sha256: "0a279f0707af40c890e80b1e9df8bb761694c074ba7e1d4ab1bc4b728e200b59"
url: "https://pub.dev"
source: hosted
version: "3.1.2"
version: "3.1.3"
plugin_platform_interface:
dependency: transitive
description:
Expand Down Expand Up @@ -603,10 +619,10 @@ packages:
dependency: transitive
description:
name: process
sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09"
sha256: "266ca5be5820feefc777793d0a583acfc8c40834893c87c00c6c09e2cf58ea42"
url: "https://pub.dev"
source: hosted
version: "4.2.4"
version: "5.0.1"
pub_semver:
dependency: transitive
description:
Expand Down Expand Up @@ -888,10 +904,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: c538be99af830f478718b51630ec1b6bee5e74e52c8a802d328d9e71d35d2583
sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957
url: "https://pub.dev"
source: hosted
version: "11.10.0"
version: "13.0.0"
watcher:
dependency: transitive
description:
Expand All @@ -904,26 +920,26 @@ packages:
dependency: transitive
description:
name: web
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
sha256: edc8a9573dd8c5a83a183dae1af2b6fd4131377404706ca4e5420474784906fa
url: "https://pub.dev"
source: hosted
version: "0.3.0"
version: "0.4.0"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b
sha256: "045ec2137c27bf1a32e6ffa0e734d532a6677bf9016a0d1a406c54e499ff945b"
url: "https://pub.dev"
source: hosted
version: "2.4.0"
version: "2.4.1"
webdriver:
dependency: transitive
description:
name: webdriver
sha256: "3c923e918918feeb90c4c9fdf1fe39220fa4c0e8e2c0fffaded174498ef86c49"
sha256: "003d7da9519e1e5f329422b36c4dcdf18d7d2978d1ba099ea4e45ba490ed845e"
url: "https://pub.dev"
source: hosted
version: "3.0.2"
version: "3.0.3"
webkit_inspection_protocol:
dependency: transitive
description:
Expand Down

0 comments on commit c0f7e7b

Please sign in to comment.