feat:更新主题色适配

This commit is contained in:
2025-11-23 15:27:50 +08:00
parent 6308169013
commit 245edd9d27
15 changed files with 306 additions and 128 deletions

View File

@@ -4,6 +4,7 @@ import 'package:flutter_common/utils/toast_util.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:food_hub_app/apis/session.dart';
import 'package:food_hub_app/models/session.dart';
import 'package:food_hub_app/widgets/common/form.dart';
import 'package:food_hub_app/widgets/common/index.dart';
import 'package:form_builder_validators/form_builder_validators.dart';
@@ -85,7 +86,6 @@ class _LoginPage extends State<LoginPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[100],
body: Form(
key: _formKey,
child: Column(
@@ -145,7 +145,8 @@ class _LoginPage extends State<LoginPage> {
name: 'username',
initialValue: _username,
keyboardType: TextInputType.text,
decoration: formInputDecoration(
decoration: buildInputDecoration(
context: context,
hintText: "请输入账号",
prefixIcon: Icons.person,
),
@@ -169,22 +170,18 @@ class _LoginPage extends State<LoginPage> {
obscureText: _isObscure,
onSaved: (v) => _password = v!,
validator: FormBuilderValidators.required(),
decoration: InputDecoration(
prefixIcon: Icon(Icons.lock),
decoration: buildInputDecoration(
context: context,
hintText: "请输入密码",
hintStyle: TextStyle(color: Colors.grey),
border: OutlineInputBorder(),
filled: true,
fillColor: Colors.white,
prefixIcon: Icons.lock,
).copyWith(
suffixIcon: IconButton(
icon: Icon(Icons.remove_red_eye, color: _eyeColor),
onPressed: () {
final colors = Theme.of(context).colorScheme;
setState(() {
_isObscure = !_isObscure;
_eyeColor =
(_isObscure
? Colors.grey
: Theme.of(context).iconTheme.color)!;
_eyeColor = (_isObscure ? Colors.grey : colors.surface);
});
},
),