Frontend first draft
This commit is contained in:
35
frontend/pweb/lib/widgets/constrained_form.dart
Normal file
35
frontend/pweb/lib/widgets/constrained_form.dart
Normal file
@@ -0,0 +1,35 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
||||
class ConstrainedForm extends StatelessWidget {
|
||||
final GlobalKey<FormState> formKey;
|
||||
final List<Widget> children;
|
||||
final AutovalidateMode? autovalidateMode;
|
||||
|
||||
const ConstrainedForm({
|
||||
super.key,
|
||||
required this.formKey,
|
||||
required this.children,
|
||||
this.autovalidateMode,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 400),
|
||||
child: Form(
|
||||
key: formKey,
|
||||
autovalidateMode: autovalidateMode ?? AutovalidateMode.disabled,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: children,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user