-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commit from GitHub Actions (Forui Samples Presubmit)
- Loading branch information
Showing
1 changed file
with
44 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import 'package:auto_route/auto_route.dart'; | ||
import 'package:flutter/widgets.dart'; | ||
|
||
import 'package:auto_route/auto_route.dart'; | ||
import 'package:forui/forui.dart'; | ||
|
||
import 'package:forui_samples/sample_scaffold.dart'; | ||
|
||
@RoutePage() | ||
|
@@ -14,31 +16,29 @@ class CheckboxPage extends SampleScaffold { | |
|
||
@override | ||
Widget child(BuildContext context) => Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
Padding( | ||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 30), | ||
child: FCheckbox( | ||
enabled: enabled, | ||
), | ||
), | ||
], | ||
); | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
Padding( | ||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 30), | ||
child: FCheckbox( | ||
enabled: enabled, | ||
), | ||
), | ||
], | ||
); | ||
} | ||
|
||
@RoutePage() | ||
class FormCheckboxPage extends SampleScaffold { | ||
|
||
FormCheckboxPage({ | ||
@queryParam super.theme, | ||
}); | ||
|
||
@override | ||
Widget child(BuildContext context) => const Padding( | ||
padding: EdgeInsets.all(15.0), | ||
child: LoginForm(), | ||
); | ||
|
||
padding: EdgeInsets.all(15.0), | ||
child: LoginForm(), | ||
); | ||
} | ||
|
||
class LoginForm extends StatefulWidget { | ||
|
@@ -58,35 +58,35 @@ class _LoginFormState extends State<LoginForm> { | |
|
||
@override | ||
Widget build(BuildContext context) => Form( | ||
key: _formKey, | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
FTextField.email( | ||
hint: '[email protected]', | ||
help: const Text(''), | ||
validator: (value) => (value?.contains('@') ?? false) ? null : 'Please enter a valid email.', | ||
), | ||
const SizedBox(height: 4), | ||
FTextField.password( | ||
hint: '', | ||
help: const Text(''), | ||
validator: (value) => 8 <= (value?.length ?? 0) ? null : 'Password must be at least 8 characters long.', | ||
), | ||
const SizedBox(height: 4), | ||
Row( | ||
key: _formKey, | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
const FCheckbox(), | ||
const SizedBox(width: 7), | ||
Text('Remember password?', style: context.theme.typography.sm), | ||
FTextField.email( | ||
hint: '[email protected]', | ||
help: const Text(''), | ||
validator: (value) => (value?.contains('@') ?? false) ? null : 'Please enter a valid email.', | ||
), | ||
const SizedBox(height: 4), | ||
FTextField.password( | ||
hint: '', | ||
help: const Text(''), | ||
validator: (value) => 8 <= (value?.length ?? 0) ? null : 'Password must be at least 8 characters long.', | ||
), | ||
const SizedBox(height: 4), | ||
Row( | ||
children: [ | ||
const FCheckbox(), | ||
const SizedBox(width: 7), | ||
Text('Remember password?', style: context.theme.typography.sm), | ||
], | ||
), | ||
const SizedBox(height: 30), | ||
FButton( | ||
label: const Text('Login'), | ||
onPress: () => _formKey.currentState!.validate(), | ||
), | ||
], | ||
), | ||
const SizedBox(height: 30), | ||
FButton( | ||
label: const Text('Login'), | ||
onPress: () => _formKey.currentState!.validate(), | ||
), | ||
], | ||
), | ||
); | ||
); | ||
} |