voo_forms 0.3.41
voo_forms: ^0.3.41 copied to clipboard
A comprehensive cross-platform forms package with atomic design, clean architecture, and Material 3 support for Flutter applications.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'client_form_page_example.dart';
import 'readonly_form_example.dart';
import 'voo_form_field_action_example.dart';
void main() {
runApp(const VooFormsExampleApp());
}
class VooFormsExampleApp extends StatelessWidget {
const VooFormsExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'VooForms Examples',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
useMaterial3: true,
),
home: const VooFormsHomePage(),
);
}
}
class VooFormsHomePage extends StatelessWidget {
const VooFormsHomePage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('VooForms Examples'),
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
),
body: ListView(
padding: const EdgeInsets.all(16.0),
children: [
_buildExampleCard(
context,
title: 'Client Form Page',
description: 'Example showing a form with client selection and nested form modals',
icon: Icons.business,
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const ClientFormPageExample(),
),
),
),
const SizedBox(height: 12),
_buildExampleCard(
context,
title: 'Form Field Actions',
description: 'Demonstrates form field actions with adaptive UI for different screen sizes',
icon: Icons.touch_app,
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const VooFormFieldActionExample(),
),
),
),
const SizedBox(height: 12),
_buildExampleCard(
context,
title: 'Read-Only Forms',
description: 'Shows how to use the isReadOnly parameter to display forms in view-only mode',
icon: Icons.visibility,
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const ReadOnlyFormExample(),
),
),
),
const SizedBox(height: 24),
Card(
elevation: 2,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Icon(
Icons.info_outline,
color: Theme.of(context).colorScheme.primary,
),
const SizedBox(width: 8),
Text(
'About VooForms',
style: Theme.of(context).textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.bold,
),
),
],
),
const SizedBox(height: 12),
Text(
'VooForms is a comprehensive, type-safe forms package for Flutter following clean architecture, '
'atomic design pattern, and Material 3 design.',
style: Theme.of(context).textTheme.bodyMedium,
),
const SizedBox(height: 8),
Text(
'Features:',
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
fontWeight: FontWeight.w600,
),
),
const SizedBox(height: 4),
...['• Type-safe field widgets',
'• Rich validation system',
'• Custom formatters',
'• Responsive layouts',
'• Read-only mode support',
'• Form field actions',
].map((feature) => Padding(
padding: const EdgeInsets.only(left: 8.0, top: 2.0),
child: Text(
feature,
style: Theme.of(context).textTheme.bodySmall,
),
)),
],
),
),
),
],
),
);
}
Widget _buildExampleCard(
BuildContext context, {
required String title,
required String description,
required IconData icon,
required VoidCallback onTap,
}) {
return Card(
elevation: 2,
child: InkWell(
onTap: onTap,
borderRadius: BorderRadius.circular(12),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Row(
children: [
Container(
width: 48,
height: 48,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primaryContainer,
borderRadius: BorderRadius.circular(12),
),
child: Icon(
icon,
color: Theme.of(context).colorScheme.onPrimaryContainer,
),
),
const SizedBox(width: 16),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: Theme.of(context).textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 4),
Text(
description,
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
],
),
),
Icon(
Icons.arrow_forward_ios,
size: 16,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
],
),
),
),
);
}
}