custom_input_text 0.1.3 custom_input_text: ^0.1.3 copied to clipboard
This is a package to facilitate the text fields of email, password or a simple name
import 'package:custom_input_text/custom_input_text.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Material App',
home: Scaffold(
appBar: AppBar(
title: Text('Material App Bar'),
),
body: Example(),
),
);
}
}
class Example extends StatefulWidget {
Example({Key? key}) : super(key: key);
@override
_ExampleState createState() => _ExampleState();
}
class _ExampleState extends State<Example> {
TextEditingController emailCtrl = TextEditingController();
TextEditingController passCtrl = TextEditingController();
TextEditingController nameCtrl = TextEditingController();
TextEditingController phoneCtrl = TextEditingController();
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 25),
child: Column(
children: [
// Email Example
CustomInputText(
icon: Icons.email,
placeholder: 'Email',
textController: emailCtrl,
keyboardType: TextInputType.emailAddress,
onfocusColor: Colors.red,
),
SizedBox(height: 15,),
// Password Example
CustomInputText(
icon: Icons.lock,
placeholder: 'Password',
textController: passCtrl,
isPassword: true,
onfocusColor: Colors.blue,
validation: true // or false (default null), this isn't required.
),
SizedBox(height: 15,),
// Name Example
CustomInputText(
icon: Icons.account_box,
placeholder: 'First or Last Name',
textController: nameCtrl,
isAName: true,
onfocusColor: Colors.purple,
),
SizedBox(height: 15,),
// phoneNumber Example
CustomInputText(
icon: Icons.phone,
placeholder: 'Phone',
keyboardType: TextInputType.number,
textController: phoneCtrl,
isAPhone: true,
onfocusColor: Colors.yellow,
),
SizedBox(height: 15,),
// Disable Example
CustomInputText(
icon: Icons.block,
placeholder: 'Disable',
textController: phoneCtrl,
onfocusColor: Colors.red,
enabled: false,
),
SizedBox(height: 15,),
// bordeRadius Example
CustomInputText(
icon: Icons.border_all,
placeholder: 'Border Radius',
textController: phoneCtrl,
onfocusColor: Colors.green,
backgroundColor: Colors.deepOrange,
borderRadius: 10,
),
],
),
);
}
}