Flutter boilerplate is a base setup that can be used for building all new flutter applications.
- Components
- common
- all other screen components
- Helpers
- helpers required for purpose
- Layout
- Provides layout components like bottom navigation wrapper
- Screens
- All screens components will lie here
- Theme
- All theme data lies here
- Routing
- Authentication
- Custom components
- State management
Flutter boilerplate comes with basic layout which supports scaffold along with bottom navigation bar you can pass a argument to hide navigation
getPages: getPageWrapper([
PageWrapper(path: '/login', child: Login(), navbar: false),
PageWrapper(path: '/home', child: const Home()),
PageWrapper(path: '/content', child: const Content()),
PageWrapper(path: '/calendar', child: const Calendar()),
PageWrapper(path: '/profile', child: const Account()),
PageWrapper(path: "/otp", child: const OTP(), navbar: false)
]),
Wrapper around Column provides spacing property additionally
VStack(
spacing: 8.0,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
"Heading 1",
style: TextStyles.h1,
),
const Text(
"Heading 2",
style: TextStyles.h2,
)])
Wrapper around Row provides spacing property additionally
HStack(
spacing: 8.0,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
"Heading 1",
style: TextStyles.h1,
),
const Text(
"Heading 2",
style: TextStyles.h2,
)])
Wrapper Image component Row provides border radius property additionally
BorderedImage(
width: double.infinity,
height: 400,
fit: BoxFit.cover,
borderRadius: 4.0,
url:"url")
Wrapper around the flutter form for making form handling easy. Instead of writing flutter code everytime you can define your form in List of Maps which contains all the form details like placeholder, validator, helperText CustomForm will handle everything for you.
Supports TextInput
, DateInput
and Checkbox
now
List<Map<String, dynamic>> otpForm = [
{
"type": FormFieldType.text,
"name": "otp",
"placeholder": "OTP",
"validator": ValidationBuilder(requiredMessage: "OTP is required").build(),
"helperText": "OTP is 12345 😃",
"autocorrect": false,
"obscureText": true,
}
];
class OTPForm extends StatelessWidget {
OTPForm({Key? key}) : super(key: key);
final login = Get.find<AuthController>().login;
@override
Widget build(BuildContext context) {
return CustomForm(
fields: otpForm,
onSubmit: (value) {
print(value); // All form field values in the form of Map<String, dynamic>
if (value["otp"] == "12345") {
login();
Get.toNamed('/home');
}
},
submitButtonChild: const Text(
"Login",
style: TextStyles.buttonText1,
),
);
}
}
Sometimes you need to render multiple form fields in a row you can do that using the type
FormFieldType.row
[
{
"type": FormFieldType.row,
"fields": [
{
"type": FormFieldType.text,
"name": "principleAmount",
"placeholder": "Principle",
},
{
"type": FormFieldType.text,
"name": "interestRate",
"placeholder": "Interest rate",
},
{
"type": FormFieldType.checkbox,
"name": "selected",
"title": "Selected",
},
]
},
];
- Custom Colors
- Font sizes
- Spacing sizes / insets
- Screen sizes
- getx for state management and routing
- form_validator for validating the forms
- date_time_picker for date input