From 4faa844eefcad08a75b3e53f2fba0769af87525a Mon Sep 17 00:00:00 2001 From: yaso-meth Date: Mon, 1 Jul 2024 12:26:09 +0200 Subject: [PATCH] updateinput fields to cater for label values & Added a dropdown field widget --- .../lib/components/myDropdownInput.dart | 69 +++++++++++++++++++ .../lib/components/myMLTextInput.dart | 7 +- .../lib/components/myPassInput.dart | 6 +- .../lib/components/mySearchInput.dart | 11 ++- .../lib/components/myTextInput.dart | 6 +- 5 files changed, 90 insertions(+), 9 deletions(-) create mode 100644 Frontend/patient_manager/lib/components/myDropdownInput.dart diff --git a/Frontend/patient_manager/lib/components/myDropdownInput.dart b/Frontend/patient_manager/lib/components/myDropdownInput.dart new file mode 100644 index 00000000..8544b754 --- /dev/null +++ b/Frontend/patient_manager/lib/components/myDropdownInput.dart @@ -0,0 +1,69 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:patient_manager/objects/appUser.dart'; + +class MyDropdownField extends StatefulWidget { + final controller; + final AppUser signedInUser; + //final String hintText; + final List> dropdownOptions; + + //final bool editable; + + const MyDropdownField({ + super.key, + required this.controller, + required this.signedInUser, + //required this.hintText, + required this.dropdownOptions, + }); + + @override + State createState() => _MyDropdownFieldState(); +} + +class _MyDropdownFieldState extends State { + var dropbownItems = ["Dr.", "Assistant"]; + // bool makeEditable() { + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 25.0), + child: DropdownMenu( + controller: widget.controller, + expandedInsets: EdgeInsets.zero, + label: const Text("Title", style: TextStyle(color: Colors.blueAccent)), + menuStyle: const MenuStyle( + backgroundColor: WidgetStatePropertyAll(Colors.white), + side: WidgetStatePropertyAll( + BorderSide(color: Colors.blueAccent, width: 2.0), + ), + ), + inputDecorationTheme: const InputDecorationTheme( + filled: true, + fillColor: Colors.white, + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.blueAccent, + width: 2.0, + ), + ), + outlineBorder: BorderSide(color: Colors.blue), + ), + dropdownMenuEntries: widget.dropdownOptions, + ), + ); + } +} + +// filled: true, +// hintText: hintText, +// hintStyle: TextStyle(color: Colors.blueGrey[400]), +// enabledBorder: const OutlineInputBorder( +// borderSide: BorderSide( +// color: Colors.blueAccent, +// width: 2.0, +// ), +// ), +// focusedBorder: const OutlineInputBorder( +// borderSide: BorderSide(color: Colors.blue), diff --git a/Frontend/patient_manager/lib/components/myMLTextInput.dart b/Frontend/patient_manager/lib/components/myMLTextInput.dart index 7b2eaf1d..783cc0bc 100644 --- a/Frontend/patient_manager/lib/components/myMLTextInput.dart +++ b/Frontend/patient_manager/lib/components/myMLTextInput.dart @@ -33,10 +33,13 @@ class MyMLTextField extends StatelessWidget { readOnly: makeEditable(), obscureText: false, decoration: InputDecoration( + label: Text(hintText), + labelStyle: const TextStyle(color: Colors.blueAccent), + alignLabelWithHint: true, fillColor: Colors.white, filled: true, - hintText: hintText, - hintStyle: TextStyle(color: Colors.blueGrey[400]), + //hintText: hintText, + //hintStyle: TextStyle(color: Colors.blueGrey[400]), enabledBorder: const OutlineInputBorder( borderSide: BorderSide( color: Colors.blueAccent, diff --git a/Frontend/patient_manager/lib/components/myPassInput.dart b/Frontend/patient_manager/lib/components/myPassInput.dart index 5e926402..567b0569 100644 --- a/Frontend/patient_manager/lib/components/myPassInput.dart +++ b/Frontend/patient_manager/lib/components/myPassInput.dart @@ -39,8 +39,10 @@ class _MyPassFieldState extends State { decoration: InputDecoration( fillColor: Colors.white, filled: true, - hintText: widget.hintText, - hintStyle: TextStyle(color: Colors.blueGrey[400]), + label: Text(widget.hintText), + labelStyle: const TextStyle(color: Colors.blueAccent), + //hintText: widget.hintText, + //hintStyle: TextStyle(color: Colors.blueGrey[400]), enabledBorder: const OutlineInputBorder( borderSide: BorderSide( color: Colors.blueAccent, diff --git a/Frontend/patient_manager/lib/components/mySearchInput.dart b/Frontend/patient_manager/lib/components/mySearchInput.dart index 7cb50c04..6e7a19cc 100644 --- a/Frontend/patient_manager/lib/components/mySearchInput.dart +++ b/Frontend/patient_manager/lib/components/mySearchInput.dart @@ -22,10 +22,15 @@ class MySearchField extends StatelessWidget { obscureText: false, decoration: InputDecoration( fillColor: Colors.white, - prefixIcon: const Icon(Icons.search), + prefixIcon: const Icon( + Icons.search, + color: Colors.blueAccent, + ), filled: true, - hintText: hintText, - hintStyle: TextStyle(color: Colors.blueGrey[400]), + label: Text(hintText), + labelStyle: const TextStyle(color: Colors.blueAccent), + //hintText: hintText, + //hintStyle: TextStyle(color: Colors.blueGrey[400]), enabledBorder: const OutlineInputBorder( borderSide: BorderSide( color: Colors.blueAccent, diff --git a/Frontend/patient_manager/lib/components/myTextInput.dart b/Frontend/patient_manager/lib/components/myTextInput.dart index da1ab217..a2be3649 100644 --- a/Frontend/patient_manager/lib/components/myTextInput.dart +++ b/Frontend/patient_manager/lib/components/myTextInput.dart @@ -29,10 +29,12 @@ class MyTextField extends StatelessWidget { readOnly: makeEditable(), obscureText: false, decoration: InputDecoration( + label: Text(hintText), + labelStyle: const TextStyle(color: Colors.blueAccent), fillColor: Colors.white, filled: true, - hintText: hintText, - hintStyle: TextStyle(color: Colors.blueGrey[400]), + //hintText: hintText, + //hintStyle: TextStyle(color: Colors.blueGrey[400]), enabledBorder: const OutlineInputBorder( borderSide: BorderSide( color: Colors.blueAccent,