动我项目仓库 flutter:3.22 dart:3.4.4
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

70 lines
2.3 KiB

import 'package:dating_touchme_app/components/page_appbar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class SignaturePage extends StatefulWidget {
const SignaturePage({super.key});
@override
State<SignaturePage> createState() => _SignaturePageState();
}
class _SignaturePageState extends State<SignaturePage> {
String message = '拒绝内耗,向阳而生,用热爱抵御岁月漫长,用真诚对待每一次相遇拒绝内耗,向阳而生,用热爱抵御岁月漫长,用真诚对待每一次相遇';
final TextEditingController _messageController = TextEditingController();
@override
void initState() {
super.initState();
_messageController.value = TextEditingValue(
text: message,
selection: TextSelection.fromPosition(TextPosition(offset: message.length)),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: PageAppbar(title: "交友心声",),
body: Container(
padding: EdgeInsets.all(35.w),
child: TextField(
controller: _messageController,
maxLength: 50, // 上限
minLines: 5, // 多行
maxLines: 5, // 自适应高度
style: TextStyle(
fontSize: ScreenUtil().setWidth(26),
height: 1
),
decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(
vertical: 0,
horizontal: 0
),
hintText: "请输入交友心声",
border: const OutlineInputBorder(
borderSide: BorderSide.none, // 这将移除边框 // 可选:设置圆角
),
// 如果你希望聚焦时和未聚焦时都没有边框,也可以设置 focusedBorder 和 enabledBorder
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide.none,
borderRadius: BorderRadius.all(Radius.circular(8.0)),
),
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide.none,
borderRadius: BorderRadius.all(Radius.circular(8.0)),
),
),
onChanged: (value){
message = value;
},
),
),
);
}
}