release 4.8.9
This commit is contained in:
@ -16,6 +16,9 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
final TextEditingController passwordController = TextEditingController();
|
||||
final TextEditingController confirmPasswordController = TextEditingController();
|
||||
|
||||
bool _obscurePassword = true;
|
||||
bool _obscureConfirmPassword = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@ -60,8 +63,28 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
makeInput(label: "email".tr, controller: emailController),
|
||||
makeInput(label: "password".tr, controller: passwordController, obsureText: true),
|
||||
makeInput(label: "confirm_password".tr, controller: confirmPasswordController, obsureText: true),
|
||||
//makeInput(label: "password".tr, controller: passwordController, obsureText: true),
|
||||
//makeInput(label: "confirm_password".tr, controller: confirmPasswordController, obsureText: true),
|
||||
makePasswordInput(
|
||||
label: "password".tr,
|
||||
controller: passwordController,
|
||||
obscureText: _obscurePassword,
|
||||
onToggleVisibility: () {
|
||||
setState(() {
|
||||
_obscurePassword = !_obscurePassword;
|
||||
});
|
||||
},
|
||||
),
|
||||
makePasswordInput(
|
||||
label: "confirm_password".tr,
|
||||
controller: confirmPasswordController,
|
||||
obscureText: _obscureConfirmPassword,
|
||||
onToggleVisibility: () {
|
||||
setState(() {
|
||||
_obscureConfirmPassword = !_obscureConfirmPassword;
|
||||
});
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
ElevatedButton(
|
||||
onPressed: _handleRegister,
|
||||
@ -91,6 +114,38 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget makePasswordInput({
|
||||
required String label,
|
||||
required TextEditingController controller,
|
||||
required bool obscureText,
|
||||
required VoidCallback onToggleVisibility,
|
||||
}) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(label, style: const TextStyle(fontSize: 15, fontWeight: FontWeight.w400, color: Colors.black87)),
|
||||
const SizedBox(height: 5),
|
||||
TextField(
|
||||
controller: controller,
|
||||
obscureText: obscureText,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 0, horizontal: 10),
|
||||
enabledBorder: OutlineInputBorder(borderSide: BorderSide(color: Colors.grey[400]!)),
|
||||
border: OutlineInputBorder(borderSide: BorderSide(color: Colors.grey[400]!)),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(
|
||||
obscureText ? Icons.visibility : Icons.visibility_off,
|
||||
color: Colors.grey,
|
||||
),
|
||||
onPressed: onToggleVisibility,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
void _handleRegister() {
|
||||
if (passwordController.text != confirmPasswordController.text) {
|
||||
_showErrorSnackbar("no_match".tr, "password_does_not_match".tr);
|
||||
@ -106,6 +161,7 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
indexController.register(
|
||||
emailController.text,
|
||||
passwordController.text,
|
||||
confirmPasswordController.text,
|
||||
context
|
||||
);
|
||||
// 登録が成功したと仮定し、ログインページに遷移
|
||||
|
||||
Reference in New Issue
Block a user