chore: style grid

This commit is contained in:
shenlong-tanwen
2024-09-13 04:00:50 +05:30
parent 419d3669a2
commit 53974e7276
23 changed files with 344 additions and 127 deletions
@@ -146,6 +146,7 @@ class _LoginPageState extends State<LoginPage>
child: Column(children: [
Expanded(child: rotatingLogo),
serverUrl,
const SizedGap.sh(),
Expanded(flex: 2, child: form),
bottom,
]),
@@ -66,7 +66,8 @@ class LoginPageCubit extends Cubit<LoginPageState> with LogContext {
url = await loginService.resolveEndpoint(uri);
di<IStoreRepository>().set(StoreKey.serverEndpoint, url);
ServiceLocator.registerPostValidationServices(url);
ServiceLocator.registerApiClient(url);
ServiceLocator.registerPostValidationServices();
ServiceLocator.registerPostGlobalStates();
// Fetch server features
@@ -32,28 +32,28 @@ class LoginForm extends StatelessWidget {
Widget build(BuildContext context) {
return BlocSelector<LoginPageCubit, LoginPageState, bool>(
selector: (model) => model.isServerValidated,
builder: (_, isServerValidated) => AnimatedSwitcher(
duration: Durations.medium1,
child: SingleChildScrollView(
builder: (_, isServerValidated) => SingleChildScrollView(
child: AnimatedSwitcher(
duration: Durations.medium1,
child: isServerValidated
? _CredentialsPage(
? _CredentialsForm(
emailController: emailController,
passwordController: passwordController,
)
: _ServerPage(controller: serverUrlController),
: _ServerForm(controller: serverUrlController),
layoutBuilder: (current, previous) =>
current ?? (previous.lastOrNull ?? const SizedBox.shrink()),
),
layoutBuilder: (current, previous) =>
current ?? (previous.lastOrNull ?? const SizedBox.shrink()),
),
);
}
}
class _ServerPage extends StatelessWidget {
class _ServerForm extends StatelessWidget {
final TextEditingController controller;
final GlobalKey<FormState> _formKey = GlobalKey();
_ServerPage({required this.controller});
_ServerForm({required this.controller});
Future<void> _validateForm(BuildContext context) async {
if (_formKey.currentState?.validate() == true) {
@@ -96,20 +96,20 @@ class _ServerPage extends StatelessWidget {
}
}
class _CredentialsPage extends StatefulWidget {
class _CredentialsForm extends StatefulWidget {
final TextEditingController emailController;
final TextEditingController passwordController;
const _CredentialsPage({
const _CredentialsForm({
required this.emailController,
required this.passwordController,
});
@override
State<_CredentialsPage> createState() => _CredentialsPageState();
State<_CredentialsForm> createState() => _CredentialsFormState();
}
class _CredentialsPageState extends State<_CredentialsPage> {
class _CredentialsFormState extends State<_CredentialsForm> {
final passwordFocusNode = FocusNode();
@override