1.列表,筛选完成和未完成

2.详情,增加checkout
This commit is contained in:
zhutao
2025-09-24 10:22:35 +08:00
parent 9b3c08dabc
commit ca376d9393
19 changed files with 838 additions and 542 deletions

View File

@@ -14,7 +14,9 @@ import '../../../router/config/route_paths.dart';
import '../../../utils/common.dart';
import '../../../widgets/ui_kit/button/custom_button.dart';
import 'widget/agreement_box.dart';
import 'widget/widget.dart';
import 'widget/login_input.dart';
import 'widget/login_header.dart';
import 'widget/login_other.dart';
class LoginPage extends StatefulWidget {
const LoginPage({super.key});
@@ -48,7 +50,11 @@ class _LoginPageState extends State<LoginPage> {
try {
await Dio().get(
'https://captive.apple.com/hotspot-detect.html',
options: Options(sendTimeout: const Duration(seconds: 3), receiveTimeout: const Duration(seconds: 3), headers: {'Cache-Control': 'no-cache'}),
options: Options(
sendTimeout: const Duration(seconds: 3),
receiveTimeout: const Duration(seconds: 3),
headers: {'Cache-Control': 'no-cache'},
),
);
return true;
} catch (_) {
@@ -58,11 +64,16 @@ class _LoginPageState extends State<LoginPage> {
void _initGoogleSign() {
if (isAndroid()) {
_googleSignIn.initialize(clientId: null, serverClientId: "512878764950-0bsl98c4q4p695mlmfn35qhmr2ld5n0o.apps.googleusercontent.com");
_googleSignIn.initialize(
clientId: null,
serverClientId:
"512878764950-0bsl98c4q4p695mlmfn35qhmr2ld5n0o.apps.googleusercontent.com",
);
} else {
_googleSignIn.initialize(
clientId: "512878764950-4hpppthg6c8p98mkfcro99echkftbbmo.apps.googleusercontent.com",
serverClientId: "512878764950-0bsl98c4q4p695mlmfn35qhmr2ld5n0o.apps.googleusercontent.com",
serverClientId:
"512878764950-0bsl98c4q4p695mlmfn35qhmr2ld5n0o.apps.googleusercontent.com",
);
}
@@ -76,7 +87,7 @@ class _LoginPageState extends State<LoginPage> {
}
///谷歌登录
void _handleGoogleSignIn() async {
void _handGoogleSignIn() async {
try {
// 如果用户未登录,则启动标准的 Google 登录
if (_googleSignIn.supportsAuthenticate()) {
@@ -112,7 +123,9 @@ class _LoginPageState extends State<LoginPage> {
///apple登录
void _handAppleSignIn() async {
try {
final credential = await SignInWithApple.getAppleIDCredential(scopes: [AppleIDAuthorizationScopes.email, AppleIDAuthorizationScopes.fullName]);
final credential = await SignInWithApple.getAppleIDCredential(
scopes: [AppleIDAuthorizationScopes.email, AppleIDAuthorizationScopes.fullName],
);
EasyLoading.show(status: "Logging in...");
var res = await thirdLoginApi(credential.identityToken!, OtherLoginType.apple);
EasyLoading.dismiss();
@@ -138,7 +151,10 @@ class _LoginPageState extends State<LoginPage> {
});
var isRegister = await checkRegisterApi(_emailController.text);
if (!isRegister) {
context.push(RoutePaths.loginCode, extra: {"email": _emailController.text, "password": _passwordController.text});
context.push(
RoutePaths.loginCode,
extra: {"email": _emailController.text, "password": _passwordController.text},
);
} else {
var res = await loginApi(_emailController.text, _passwordController.text);
_onLogin(res);
@@ -174,9 +190,9 @@ class _LoginPageState extends State<LoginPage> {
children: [
LogoBox(),
PageHeader(),
InputBox(hintText: "Email", controller: _emailController),
LoginInput(hintText: "Email", controller: _emailController),
SizedBox(height: 15),
InputBox(
LoginInput(
obscureText: _hidePassword,
hintText: "Password",
controller: _passwordController,
@@ -196,23 +212,12 @@ class _LoginPageState extends State<LoginPage> {
Container(
margin: EdgeInsets.only(top: 20),
height: 45,
child: CustomButton(loading: _subLoading, round: false, onPressed: _handSubmit, child: Text("Continue")),
),
LoginDivider(),
OtherButton(
title: "Continue with Google",
icon: "assets/image/google.png",
onTap: () {
_handleGoogleSignIn();
},
),
SizedBox(height: 15),
OtherButton(
title: "Continue with Apple",
icon: "assets/image/apple.png",
onTap: () {
_handAppleSignIn();
},
child: CustomButton(
loading: _subLoading,
round: false,
onPressed: _handSubmit,
child: Text("Continue"),
),
),
Container(
width: double.infinity,
@@ -220,6 +225,26 @@ class _LoginPageState extends State<LoginPage> {
alignment: Alignment.center,
child: AgreementBox(),
),
LoginDivider(),
Row(
spacing: 20,
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
OtherButton(
onTap: () {
_handGoogleSignIn();
},
icon: "assets/image/google.png",
),
OtherButton(
onTap: () {
_handAppleSignIn();
},
icon: "assets/image/apple.png",
),
],
),
],
),
),