登录流程已全部重构
This commit is contained in:
50
lib/pages/system/login/widgets/login_agree.dart
Normal file
50
lib/pages/system/login/widgets/login_agree.dart
Normal file
@@ -0,0 +1,50 @@
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:food_health/l10n/l10n.dart';
|
||||
import 'package:food_health/router/config/route_paths.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
class LoginAgree extends StatelessWidget {
|
||||
const LoginAgree({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return RichText(
|
||||
text: TextSpan(
|
||||
style: Theme.of(context).textTheme.labelMedium,
|
||||
children: [
|
||||
TextSpan(
|
||||
text: "${L10n.of.login_tip_start} ",
|
||||
),
|
||||
TextSpan(
|
||||
text: L10n.of.login_terms,
|
||||
style: TextStyle(color: Theme.of(context).primaryColor),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () => context.push(
|
||||
RoutePaths.agreement,
|
||||
extra: {
|
||||
"title": "Terms of Service",
|
||||
"url": "https://support.curain.ai/privacy/foodcura/terms_service.html",
|
||||
},
|
||||
),
|
||||
),
|
||||
TextSpan(text: " ${L10n.of.login_and} "),
|
||||
TextSpan(
|
||||
text: L10n.of.login_privacy,
|
||||
style: TextStyle(color: Theme.of(context).primaryColor),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () => context.push(
|
||||
RoutePaths.agreement,
|
||||
extra: {
|
||||
"title": "Privacy",
|
||||
"url": "https://support.curain.ai/privacy/foodcura/privacy_policy.html",
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
46
lib/pages/system/login/widgets/login_input.dart
Normal file
46
lib/pages/system/login/widgets/login_input.dart
Normal file
@@ -0,0 +1,46 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class LoginInput extends StatelessWidget {
|
||||
final bool obscureText;
|
||||
final String hintText;
|
||||
final TextEditingController controller;
|
||||
final Widget? suffix;
|
||||
|
||||
const LoginInput({
|
||||
super.key,
|
||||
this.obscureText = false,
|
||||
required this.hintText,
|
||||
required this.controller,
|
||||
this.suffix,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextField(
|
||||
controller: controller,
|
||||
obscureText: obscureText,
|
||||
maxLength: 100,
|
||||
decoration: InputDecoration(
|
||||
hintText: hintText,
|
||||
hintStyle: Theme.of(context).textTheme.labelLarge?.copyWith(fontSize: 16),
|
||||
counterText: '',
|
||||
filled: true,
|
||||
fillColor: Theme.of(context).colorScheme.surfaceContainer,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(60),
|
||||
borderSide: BorderSide.none, // 去掉边框
|
||||
),
|
||||
isCollapsed: true,
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 14, horizontal: 20),
|
||||
suffixIcon: Container(
|
||||
padding: EdgeInsets.only(right: 20),
|
||||
child: suffix,
|
||||
),
|
||||
suffixIconConstraints: BoxConstraints(
|
||||
minWidth: 0,
|
||||
minHeight: 0,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
67
lib/pages/system/login/widgets/login_other.dart
Normal file
67
lib/pages/system/login/widgets/login_other.dart
Normal file
@@ -0,0 +1,67 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:food_health/l10n/l10n.dart';
|
||||
|
||||
///分割线
|
||||
class LoginDivider extends StatelessWidget {
|
||||
const LoginDivider({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: EdgeInsets.only(top: 20, bottom: 20),
|
||||
child: Row(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
height: 1,
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
L10n.of.login_other_login,
|
||||
style: Theme.of(context).textTheme.labelMedium,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
height: 1,
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class OtherButton extends StatelessWidget {
|
||||
final Function() onTap;
|
||||
final String icon;
|
||||
|
||||
const OtherButton({
|
||||
super.key,
|
||||
required this.onTap,
|
||||
required this.icon,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
width: 45,
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
),
|
||||
),
|
||||
child: AspectRatio(
|
||||
aspectRatio: 1,
|
||||
child: Image.asset(icon),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user