import 'package:flutter/material.dart'; import 'package:project_telephony/utils/headers.dart'; import '../../base/base_style.dart'; import '../widget/plone_back_button.dart'; import '../widget/plone_bottom.dart'; typedef TextCallback = Function(String textContent); class ContentDetailsPage extends StatefulWidget { final TextCallback ploneBack; final String content; const ContentDetailsPage( {Key? key, required this.content, required this.ploneBack}) : super(key: key); @override _ContentDetailsPageState createState() => _ContentDetailsPageState(); } String content = ""; class _ContentDetailsPageState extends State { late TextEditingController _controller; @override void initState() { super.initState(); _controller = TextEditingController(text: widget.content); } @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, appBar: AppBar( elevation: 0, title: Text( '编辑短信内容', style: TextStyle( fontSize: BaseStyle.fontSize34, color: BaseStyle.color333333, fontWeight: FontWeight.bold), ), titleSpacing: 162.w, leading: const CloudBackButton(isSpecial: true), backgroundColor: kForeGroundColor), backgroundColor: Colors.white, body: _getBox(), ); } _getBox() { return Column(children: [ Container( width: 622.w, height: 960.w, decoration: BoxDecoration( color: const Color(0xFFF9F9F9), borderRadius: BorderRadius.circular(16.w)), margin: EdgeInsets.only(top: 32.w, bottom: 298.w), child: Container( // color: kForeGroundColor, margin: EdgeInsets.symmetric(horizontal: 40.w, vertical: 50.w), child: TextField( maxLines: 100, keyboardType: TextInputType.text, onEditingComplete: () { setState(() {}); // _refreshController.callRefresh(); }, onChanged: (text) { content = text; // print(content); setState(() {}); }, style: TextStyle( color: BaseStyle.color333333, fontSize: BaseStyle.fontSize28, ), controller: _controller, decoration: InputDecoration( contentPadding: EdgeInsets.zero, filled: true, isDense: true, fillColor: Colors.white, hintText: widget.content != "" ? "" : "请输入短信内容", hintStyle: TextStyle( color: widget.content != "" ? const Color(0xFF333333) : Colors.grey.shade500, fontSize: 28.sp, fontWeight: FontWeight.bold), border: InputBorder.none, ), ), ), // Text(widget.content,), ), PloneBottom( border: !content.isNotEmpty, opacity: content.isNotEmpty ? 1 : 0.4, onTap: () { setState(() {}); widget.ploneBack(content); Get.back(); // print(content); }, text: "保存", ) ]); } }