updateinput fields to cater for label values & Added a dropdown field widget

This commit is contained in:
2024-07-01 12:26:09 +02:00
parent 7a86144819
commit 4faa844eef
5 changed files with 90 additions and 9 deletions

View File

@@ -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<DropdownMenuEntry<String>> dropdownOptions;
//final bool editable;
const MyDropdownField({
super.key,
required this.controller,
required this.signedInUser,
//required this.hintText,
required this.dropdownOptions,
});
@override
State<MyDropdownField> createState() => _MyDropdownFieldState();
}
class _MyDropdownFieldState extends State<MyDropdownField> {
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),

View File

@@ -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,

View File

@@ -39,8 +39,10 @@ class _MyPassFieldState extends State<MyPassField> {
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,

View File

@@ -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,

View File

@@ -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,