初始化

This commit is contained in:
zhutao
2025-11-19 17:56:39 +08:00
commit 1b28239352
115 changed files with 5440 additions and 0 deletions

View File

@@ -0,0 +1,71 @@
import 'package:app/router/route_paths.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
class LoginAgree extends StatelessWidget {
final ValueChanged<bool?>? onChanged;
final bool value;
const LoginAgree({
super.key,
this.onChanged,
required this.value,
});
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: 25,
child: Transform.scale(
scale: 0.8,
child: Checkbox(
value: value,
shape: CircleBorder(),
onChanged: onChanged,
),
),
),
RichText(
text: TextSpan(
style: Theme.of(context).textTheme.labelMedium,
children: [
TextSpan(
text: "注册或登录即表示您了解并同意",
),
TextSpan(
text: "服务条款",
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: ""),
TextSpan(
text: "隐私协议",
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",
},
),
),
],
),
),
],
);
}
}

View File

@@ -0,0 +1,49 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class LoginInput extends StatelessWidget {
final String hintText;
final int maxLength;
final TextEditingController controller;
final Widget? suffix;
const LoginInput({
super.key,
required this.hintText,
this.maxLength = 11,
required this.controller,
this.suffix,
});
@override
Widget build(BuildContext context) {
return TextField(
controller: controller,
maxLength: maxLength,
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly, // 只允许 0-9
],
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),
suffixIconConstraints: BoxConstraints(minWidth: 0, minHeight: 0),
suffixIcon: suffix != null
? Container(
padding: EdgeInsets.only(right: 20),
child: suffix,
)
: null,
),
);
}
}