rounded_text_form_field 0.0.2 rounded_text_form_field: ^0.0.2 copied to clipboard
A Flutter library for rounded text form field with custom design and decoration.
import 'package:flutter/material.dart';
import 'package:rounded_text_form_field/rounded_text_form_field.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return const MaterialApp(
title: 'Text Form Field',
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
TextEditingController nameTextField = TextEditingController(text: "");
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: const Text("Rounded Text Form Field"),
),
body: Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
children: [
const SizedBox(height: 16),
const Text(
"Name",
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
),
),
const SizedBox(height: 8),
RoundedTextFormField(
textInputAction: TextInputAction.done,
controller: nameTextField,
hintText: "Please enter your name",
validator: (value) {
if (value!.isEmpty) {
return "Please enter your name";
} else if (value.length < 4) {
return "Please enter valid name";
}
return null;
},
),
const SizedBox(height: 20),
],
),
),
));
}
}