a10a2db27a
- 新增 visual_design_language.md 设计规范文档 - 新增 auth 设计 tokens (authBackground, authCard, authInput, feedback 系列等) - 重构登录/注册/验证码/重置密码页面为新设计系统 - 新增 AuthHeroHeader, AuthSurfaceCard, AuthSection, AuthField, PasswordField 组件 - 重构 AppBanner 和 Toast 支持多类型配置 (info/success/warning/error) - 后端 AgentScope: 重整 schemas/prompts/tools 作用域, 新增协议文档 - 更新 AGENTS.md 集成视觉设计语言约束
52 lines
1.2 KiB
Dart
52 lines
1.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../../../core/theme/design_tokens.dart';
|
|
import 'auth_field.dart';
|
|
|
|
class PasswordField extends StatefulWidget {
|
|
const PasswordField({
|
|
super.key,
|
|
required this.controller,
|
|
required this.label,
|
|
required this.hint,
|
|
this.onChanged,
|
|
});
|
|
|
|
final TextEditingController controller;
|
|
final String label;
|
|
final String hint;
|
|
final ValueChanged<String>? onChanged;
|
|
|
|
@override
|
|
State<PasswordField> createState() => _PasswordFieldState();
|
|
}
|
|
|
|
class _PasswordFieldState extends State<PasswordField> {
|
|
bool _obscured = true;
|
|
|
|
void _toggleVisibility() {
|
|
setState(() {
|
|
_obscured = !_obscured;
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AuthField(
|
|
label: widget.label,
|
|
hint: widget.hint,
|
|
controller: widget.controller,
|
|
obscureText: _obscured,
|
|
onChanged: widget.onChanged,
|
|
suffixIcon: IconButton(
|
|
onPressed: _toggleVisibility,
|
|
tooltip: _obscured ? '显示密码' : '隐藏密码',
|
|
icon: Icon(
|
|
_obscured ? Icons.visibility_off_rounded : Icons.visibility_rounded,
|
|
color: AppColors.authInputIcon,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|