text_form_field_flutter 0.0.4
text_form_field_flutter: ^0.0.4 copied to clipboard
A highly customizable Flutter text form field widget with various label behaviors, styling options, and validation features.
import 'package:flutter/material.dart';
import 'package:text_form_field_flutter/text_form_field_flutter.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Text Form Field Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Flutter Text Form Field Demo'),
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
TextFormFieldFlutter(
labelText: 'Email',
hintText: 'Enter your email',
keyboardType: TextInputType.emailAddress,
prefixIcon: const Icon(Icons.email),
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter your email';
}
return null;
},
),
const SizedBox(height: 16),
TextFormFieldFlutter(
labelText: 'Password',
hintText: 'Enter your password',
obscureText: true,
prefixIcon: const Icon(Icons.lock),
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter your password';
}
return null;
},
),
],
),
),
);
}
}