58 lines
1.6 KiB
Dart
58 lines
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
import 'package:together_mobile/common/constants.dart';
|
|
import 'package:together_mobile/screens/signin_signup/components/email_signup.dart';
|
|
import 'components/username_signup.dart';
|
|
|
|
class SignupScreen extends StatefulWidget {
|
|
const SignupScreen({super.key});
|
|
|
|
@override
|
|
State<SignupScreen> createState() => _SignupScreenState();
|
|
}
|
|
|
|
class _SignupScreenState extends State<SignupScreen> {
|
|
String _method = 'username';
|
|
|
|
void chageSigninMethod() {
|
|
if (_method == 'username') {
|
|
_method = 'email';
|
|
} else {
|
|
_method = 'username';
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
leading: IconButton(
|
|
icon: const Icon(Icons.arrow_back),
|
|
onPressed: () => context.pop(),
|
|
),
|
|
title: _method == 'username' ? const Text('用户名注册') : const Text('邮箱注册'),
|
|
centerTitle: true,
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () {
|
|
setState(() {
|
|
chageSigninMethod();
|
|
});
|
|
},
|
|
style: TextButton.styleFrom(foregroundColor: kContentColorDark),
|
|
child: Text(
|
|
_method == 'username' ? '邮箱注册' : '用户名注册',
|
|
style: const TextStyle(color: kContentColorDark),
|
|
),
|
|
),
|
|
],
|
|
backgroundColor: kSecondaryColor,
|
|
),
|
|
body: _method == 'username'
|
|
? const UsernameSignupBody()
|
|
: const EmailSignupBody(),
|
|
);
|
|
}
|
|
}
|