update
This commit is contained in:
parent
c87b10a050
commit
f87e1511bc
13 changed files with 284 additions and 36 deletions
|
|
@ -2,41 +2,51 @@ import 'package:flutter/material.dart';
|
|||
import 'package:gap/gap.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
typedef OnChangedCallback = void Function(dynamic value);
|
||||
|
||||
class DropDownWidget extends StatelessWidget {
|
||||
final String label;
|
||||
final List list;
|
||||
final String listTitle;
|
||||
const DropDownWidget({super.key, required this.label, required this.list, required this.listTitle});
|
||||
final OnChangedCallback onChanged;
|
||||
|
||||
const DropDownWidget({
|
||||
super.key,
|
||||
required this.label,
|
||||
required this.list,
|
||||
required this.listTitle,
|
||||
required this.onChanged,
|
||||
});
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(label,
|
||||
style: GoogleFonts.outfit(
|
||||
textStyle: const TextStyle(color: Colors.white, fontSize: 16),
|
||||
)),
|
||||
const Gap(8),
|
||||
DropdownMenu(
|
||||
initialSelection: '',
|
||||
dropdownMenuEntries: [
|
||||
for (var item in list) DropdownMenuEntry(label: item[listTitle].toString(), value: item[listTitle])
|
||||
],
|
||||
textStyle: TextStyle(color: Colors.white),
|
||||
Text(
|
||||
'$label:',
|
||||
style: GoogleFonts.outfit(
|
||||
textStyle: const TextStyle(color: Colors.white, fontSize: 16),
|
||||
),
|
||||
),
|
||||
const Gap(8),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10), // Set the desired border radius
|
||||
border: Border.all(color: Colors.white), // Set the border color
|
||||
),
|
||||
child: DropdownMenu(
|
||||
initialSelection: '',
|
||||
dropdownMenuEntries: [
|
||||
for (var item in list)
|
||||
DropdownMenuEntry(
|
||||
label: item[listTitle].toString(),
|
||||
value: item[listTitle],
|
||||
)
|
||||
],
|
||||
onSelected: onChanged,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
textStyle: GoogleFonts.outfit(textStyle: TextStyle(color: Colors.white))),
|
||||
),
|
||||
|
||||
// DropdownButton(
|
||||
// isExpanded: true,
|
||||
// value: list,
|
||||
// onChanged: (_) {},
|
||||
// items: list.map((item) {
|
||||
// return DropdownMenuItem(
|
||||
// value: item,
|
||||
// child: Text(item, overflow: TextOverflow.ellipsis, maxLines: 1),
|
||||
// );
|
||||
// }).toList(),
|
||||
// ),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class InputWidget extends StatelessWidget {
|
|||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(label,
|
||||
Text('$label:',
|
||||
style: GoogleFonts.outfit(
|
||||
textStyle: const TextStyle(color: Colors.white, fontSize: 16),
|
||||
)),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue