101 lines
3.4 KiB
Dart
101 lines
3.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
import '../state/session_state.dart';
|
|
|
|
class SignupScreen extends StatefulWidget {
|
|
const SignupScreen({super.key});
|
|
|
|
@override
|
|
State<SignupScreen> createState() => _SignupScreenState();
|
|
}
|
|
|
|
class _SignupScreenState extends State<SignupScreen> {
|
|
final _invite = TextEditingController();
|
|
final _name = TextEditingController();
|
|
|
|
@override
|
|
void dispose() {
|
|
_invite.dispose();
|
|
_name.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final session = context.watch<SessionState>();
|
|
final theme = Theme.of(context);
|
|
final scheme = theme.colorScheme;
|
|
return Scaffold(
|
|
body: SafeArea(
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 24),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
const Spacer(flex: 3),
|
|
Center(
|
|
child: Container(
|
|
width: 72,
|
|
height: 72,
|
|
decoration: BoxDecoration(
|
|
color: scheme.primaryContainer,
|
|
borderRadius: BorderRadius.circular(22),
|
|
),
|
|
child: Icon(Icons.auto_awesome, size: 34, color: scheme.onPrimaryContainer),
|
|
),
|
|
),
|
|
const SizedBox(height: 20),
|
|
Text(
|
|
'와카뷰',
|
|
textAlign: TextAlign.center,
|
|
style: theme.textTheme.displaySmall?.copyWith(fontWeight: FontWeight.w800),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
'나를 대신해 답하는, 나만의 와카뷰',
|
|
textAlign: TextAlign.center,
|
|
style: theme.textTheme.bodyLarge?.copyWith(color: scheme.onSurfaceVariant),
|
|
),
|
|
const Spacer(flex: 3),
|
|
Text('초대 코드로 클로즈드 베타에 참여합니다', style: theme.textTheme.labelLarge),
|
|
const SizedBox(height: 12),
|
|
TextField(
|
|
controller: _invite,
|
|
decoration: const InputDecoration(
|
|
labelText: '초대 코드',
|
|
prefixIcon: Icon(Icons.vpn_key),
|
|
),
|
|
textInputAction: TextInputAction.next,
|
|
),
|
|
const SizedBox(height: 12),
|
|
TextField(
|
|
controller: _name,
|
|
decoration: const InputDecoration(
|
|
labelText: '표시 이름',
|
|
prefixIcon: Icon(Icons.person_outline),
|
|
),
|
|
textInputAction: TextInputAction.done,
|
|
),
|
|
if (session.error != null) ...[
|
|
const SizedBox(height: 12),
|
|
Text(session.error!, style: TextStyle(color: scheme.error)),
|
|
],
|
|
const SizedBox(height: 20),
|
|
FilledButton(
|
|
onPressed: session.loading
|
|
? null
|
|
: () => session.signup(_invite.text.trim(), _name.text.trim()),
|
|
child: session.loading
|
|
? const SizedBox(height: 20, width: 20, child: CircularProgressIndicator(strokeWidth: 2))
|
|
: const Text('시작하기'),
|
|
),
|
|
const SizedBox(height: 32),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|