pharmacy_mobile/lib/widgets/input_widget.dart
2025-02-21 16:51:13 +08:00

44 lines
1.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:pharmacy_mobile/widgets/dropdown_widget.dart';
class InputWidget extends StatelessWidget {
final String label;
final TextEditingController controller;
final bool? password;
final OnChangedCallback? onChanged;
final String? placeholder;
const InputWidget(
{super.key, required this.label, required this.controller, this.password, this.onChanged, this.placeholder});
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (label.isNotEmpty)
Text('$label:',
style: GoogleFonts.outfit(
textStyle:
const TextStyle(color: Color.fromRGBO(255, 255, 255, 1), fontSize: 12, fontWeight: FontWeight.w500),
)),
const Gap(8),
TextField(
controller: controller,
decoration: InputDecoration(
filled: true,
fillColor: const Color.fromRGBO(255, 255, 255, 1),
border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)),
contentPadding: const EdgeInsets.symmetric(vertical: 2, horizontal: 24),
prefixIcon: placeholder != null ? Icon(Icons.search, color: Colors.grey) : null,
hintText: placeholder),
style: GoogleFonts.outfit(textStyle: const TextStyle(color: Color.fromRGBO(0, 0, 0, 1), fontSize: 16)),
obscureText: password ?? false,
onChanged: onChanged,
),
],
);
}
}