| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- import 'package:electronic_assistant/resource/colors.gen.dart';
- import 'package:electronic_assistant/resource/string.gen.dart';
- import 'package:electronic_assistant/utils/expand.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:get/get.dart';
- typedef EditAgendaCallback = void Function(String content);
- void showEditAgendaDialog(
- BuildContext context, TextEditingController etFieldController,
- {String? hintTxt, EditAgendaCallback? callback}) {
- final etPrintTxt = etFieldController.text.obs;
- etFieldController.addListener(() {
- etPrintTxt.value = etFieldController.text;
- });
- showModalBottomSheet(
- context: context,
- enableDrag: false,
- isScrollControlled: true,
- backgroundColor: ColorName.transparent,
- builder: (BuildContext context) {
- return Padding(
- padding: EdgeInsets.only(
- bottom: MediaQuery.of(context).viewInsets.bottom,
- ),
- child: Container(
- padding: EdgeInsets.all(16.w),
- margin: EdgeInsets.all(12.w),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.all(Radius.circular(12.w)),
- color: "#FFFFFF".toColor(),
- ),
- child: IntrinsicHeight(
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- Row(
- children: [
- GestureDetector(
- onTap: () {
- Get.back();
- },
- child: Text(StringName.cancel.tr,
- style: TextStyle(
- color: ColorName.secondaryTextColor,
- fontSize: 14.sp)),
- ),
- const Spacer(),
- Text(StringName.agendaDetailEditTitle.tr,
- style: TextStyle(
- color: ColorName.primaryTextColor,
- fontSize: 15.sp)),
- const Spacer(),
- Obx(() {
- return GestureDetector(
- onTap: () {
- if (etFieldController.text.isEmpty) {
- return;
- }
- callback?.call(etFieldController.text);
- },
- child: Text(StringName.done.tr,
- style: TextStyle(
- color: etPrintTxt.value.isNotEmpty
- ? ColorName.colorPrimary
- : ColorName.tertiaryTextColor,
- fontSize: 15.sp)),
- );
- }),
- ],
- ),
- SizedBox(height: 16.h),
- Container(
- decoration: BoxDecoration(
- color: "#F6F5F8".toColor(),
- borderRadius: BorderRadius.circular(8),
- ),
- height: 150.h,
- child: TextField(
- maxLines: null,
- maxLength: 200,
- cursorColor: ColorName.primaryTextColor,
- style: TextStyle(
- fontSize: 15.sp, color: ColorName.primaryTextColor),
- decoration: InputDecoration(
- counterText: '',
- border: InputBorder.none,
- fillColor: Colors.transparent,
- hintText: hintTxt,
- hintStyle: TextStyle(
- fontSize: 15.sp, color: ColorName.tertiaryTextColor),
- contentPadding: EdgeInsets.symmetric(
- vertical: 14.w, horizontal: 10.w), // 设置TextField的高度
- ),
- controller: etFieldController,
- ),
- )
- ],
- ),
- ),
- ),
- );
- },
- );
- }
|