mb_contact_form

A plug-and-play contact form widget for Flutter — name, email, and message with built-in validation.

pub version pub points license flutter

Drop-in contact form with name, email, and message fields. Validates input and opens the device mail app with a pre-filled message on submit — no backend required.


Features

✦ Name, email, and message fields with built-in validation
✦ Opens native mail app on submit — no backend or API keys needed
✦ Optional icons on each field
✦ Optional "Contact Form" heading
✦ Works on Android, iOS, web, and desktop

Installation

Add to your pubspec.yaml:

dependencies:
  mb_contact_form: ^1.0.2

Then run:

flutter pub get

Usage

import 'package:mb_contact_form/mb_contact_form.dart';

MBContactForm(
  destinationEmail: 'you@example.com',
  withIcons: true,
  hasHeading: true,
)

Place it anywhere in your widget tree — inside a Scaffold, a Column, a modal sheet, wherever fits.


Parameters

Parameter Type Default Description
destinationEmail String required Email address that receives the submitted message
withIcons bool required Show icons next to each field
hasHeading bool true Show "Contact Form" heading at the top of the card

How It Works

When the user taps Submit:

  1. All fields are validated — name (first + last), email format, non-empty message.
  2. A mailto: URI is built with subject Feedback from <name> and the body set to the message.
  3. The device's default mail app opens with everything pre-filled.
user fills form → taps Submit → validation passes
    └── mailto: URI constructed
            └── native mail app opens, pre-filled ✅

Contributing

Contributions are welcome! Please follow the conventional commits format when committing.


Made with 🎯 by @moulibheemaneti
MIT License

Libraries

mb_contact_form
Copyright 2021 Author : Mouli Bheemaneti