63 lines
2.0 KiB
Dart
63 lines
2.0 KiB
Dart
|
|
import 'package:flutter/material.dart';
|
||
|
|
|
||
|
|
import '../l10n/app_localizations.dart';
|
||
|
|
|
||
|
|
/// 登录页(桩)。
|
||
|
|
///
|
||
|
|
/// Task 3 实现:真实登录、错误本地化(含 AUTH_RATE_LIMITED / 429 重试等待)、
|
||
|
|
/// 会话持久化与退出登录。
|
||
|
|
class LoginPage extends StatelessWidget {
|
||
|
|
const LoginPage({super.key});
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
final l10n = AppLocalizations.of(context);
|
||
|
|
return Scaffold(
|
||
|
|
appBar: AppBar(title: Text(l10n.appName)),
|
||
|
|
body: Center(
|
||
|
|
child: ConstrainedBox(
|
||
|
|
constraints: const BoxConstraints(maxWidth: 420),
|
||
|
|
child: Padding(
|
||
|
|
padding: const EdgeInsets.all(24),
|
||
|
|
child: Column(
|
||
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
||
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||
|
|
children: [
|
||
|
|
TextField(
|
||
|
|
decoration: InputDecoration(
|
||
|
|
labelText: l10n.username,
|
||
|
|
border: const OutlineInputBorder(),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
const SizedBox(height: 16),
|
||
|
|
TextField(
|
||
|
|
obscureText: true,
|
||
|
|
enableSuggestions: false,
|
||
|
|
autocorrect: false,
|
||
|
|
decoration: InputDecoration(
|
||
|
|
labelText: l10n.password,
|
||
|
|
border: const OutlineInputBorder(),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
const SizedBox(height: 24),
|
||
|
|
FilledButton(
|
||
|
|
// 桩:直接进入主壳;Task 3 接真实认证。
|
||
|
|
onPressed: () =>
|
||
|
|
Navigator.of(context).pushReplacementNamed('/home'),
|
||
|
|
child: Text(l10n.login),
|
||
|
|
),
|
||
|
|
const SizedBox(height: 12),
|
||
|
|
Text(
|
||
|
|
l10n.loginHint,
|
||
|
|
textAlign: TextAlign.center,
|
||
|
|
style: Theme.of(context).textTheme.bodySmall,
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|