feat:引入TDDesign组件

This commit is contained in:
2025-07-11 14:00:58 +08:00
parent dfbbdc587f
commit b56b822e01
5 changed files with 319 additions and 383 deletions

View File

@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:food_hub_app/widgets/common/index.dart';
import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:tdesign_flutter/tdesign_flutter.dart';
class LoginPage extends StatefulWidget {
const LoginPage({super.key});
@@ -27,7 +28,7 @@ class _LoginPage extends State<LoginPage> {
(_formKey.currentState as FormState).save();
Navigator.pushNamed(context, '/home');
} else {
showErrorToast("请先输入信息");
// showErrorToast("请先输入信息");
}
}
@@ -184,40 +185,22 @@ class _LoginPage extends State<LoginPage> {
child: SizedBox(
height: 45,
width: double.infinity,
child: ElevatedButton(
style: ButtonStyle(
backgroundColor: WidgetStateProperty.all(Colors.green),
shape: WidgetStateProperty.all(
RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
),
),
child: Text(
'登录',
style: TextStyle(fontSize: 24, color: Colors.white),
),
onPressed: () => loginClick(context),
),
child: TDButton(
text: '登录',
size: TDButtonSize.large,
type: TDButtonType.fill,
shape: TDButtonShape.rectangle,
theme: TDButtonTheme.primary,
onTap: () => loginClick(context)
)
),
);
}
Widget buildOtherLoginText() {
return SizedBox(
width: double.infinity,
child: Stack(
alignment: Alignment.center,
children: [
const Divider(color: Colors.grey, thickness: 0.5),
Container(
padding: const EdgeInsets.symmetric(horizontal: 16),
color: Colors.white, // 与背景色一致,覆盖横线
child: const Text(
'其他方式登录',
style: TextStyle(color: Colors.grey, fontSize: 14),
),
),
],
),
return TDDivider(
text: '其他方式登录',
alignment: TextAlignment.center,
);
}