WIP: feat(ui): Migrate to new UI implementation
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:moonwell_launcher/app/design_system/mw_authentication.dart';
|
||||
import 'package:widgetbook/widgetbook.dart';
|
||||
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook;
|
||||
|
||||
@widgetbook.UseCase(
|
||||
name: 'default',
|
||||
type: MwAuthenticationForm,
|
||||
path: '[Authentication]',
|
||||
)
|
||||
Widget buildMwAuthenticationFormUseCase(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: 420,
|
||||
child: MwAuthenticationForm(
|
||||
usernameController: TextEditingController(
|
||||
text: context.knobs.string(label: 'username', initialValue: ''),
|
||||
),
|
||||
passwordController: TextEditingController(
|
||||
text: context.knobs.string(label: 'password', initialValue: ''),
|
||||
),
|
||||
onSubmit: () => debugPrint('Authentication form submitted'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@widgetbook.UseCase(
|
||||
name: 'loading',
|
||||
type: MwAuthenticationForm,
|
||||
path: '[Authentication]',
|
||||
)
|
||||
Widget buildMwAuthenticationFormLoadingUseCase(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: 420,
|
||||
child: MwAuthenticationForm(
|
||||
usernameController: TextEditingController(text: 'moonwalker'),
|
||||
passwordController: TextEditingController(text: 'password'),
|
||||
loading: true,
|
||||
onSubmit: () => debugPrint('Loading authentication form submitted'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@widgetbook.UseCase(
|
||||
name: 'api_error',
|
||||
type: MwAuthenticationForm,
|
||||
path: '[Authentication]',
|
||||
)
|
||||
Widget buildMwAuthenticationFormApiErrorUseCase(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: 420,
|
||||
child: MwAuthenticationForm(
|
||||
usernameController: TextEditingController(text: 'moonwalker'),
|
||||
passwordController: TextEditingController(),
|
||||
error: context.knobs.string(
|
||||
label: 'error',
|
||||
initialValue: 'Неверный логин или пароль.',
|
||||
),
|
||||
onSubmit: () => debugPrint('Errored authentication form submitted'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@widgetbook.UseCase(
|
||||
name: 'long_russian_copy',
|
||||
type: MwAuthenticationForm,
|
||||
path: '[Authentication]',
|
||||
)
|
||||
Widget buildMwAuthenticationFormLongRussianCopyUseCase(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: 420,
|
||||
child: MwAuthenticationForm(
|
||||
usernameController: TextEditingController(),
|
||||
passwordController: TextEditingController(),
|
||||
error:
|
||||
'Не удалось связаться с сервером авторизации. Проверьте подключение '
|
||||
'к интернету и повторите попытку через несколько минут.',
|
||||
onSubmit: () => debugPrint('Long-copy authentication form submitted'),
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user