81 lines
2.6 KiB
Dart
81 lines
2.6 KiB
Dart
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'),
|
|
),
|
|
);
|
|
}
|