| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- import 'package:flutter/material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
- import 'package:get/get.dart';
- import 'package:location/resource/assets.gen.dart';
- import 'package:location/resource/colors.gen.dart';
- import 'package:location/resource/string.gen.dart';
- import 'package:location/utils/common_expand.dart';
- import 'package:location/utils/common_style.dart';
- import 'package:location/utils/toast_util.dart';
- typedef FriendUpdateRemarkCallback = void Function(String remark);
- class FriendUpdateRemarkDialog {
- static const String _tag = "FriendUpdateRemarkDialog";
- static void show(
- {String? remark, required FriendUpdateRemarkCallback callback}) {
- SmartDialog.show(
- builder: (_) {
- return FriendUpdateRemarkView(
- remark: remark,
- callback: callback,
- );
- },
- tag: _tag);
- }
- static void dismiss() {
- SmartDialog.dismiss(tag: _tag);
- }
- }
- class FriendUpdateRemarkView extends Dialog {
- final FriendUpdateRemarkCallback callback;
- final String? remark;
- final Rx<String> _remark = Rx<String>('');
- final TextEditingController editingController = TextEditingController();
- FriendUpdateRemarkView({super.key, required this.callback, this.remark}) {
- editingController.addListener(() {
- _remark.value = editingController.text;
- });
- editingController.text = remark ?? '';
- }
- @override
- Widget build(BuildContext context) {
- return IntrinsicHeight(
- child: Container(
- width: 307.w,
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(20.w),
- ),
- child: Stack(
- children: [
- Positioned(
- top: 12.w,
- right: 12.w,
- child: GestureDetector(
- onTap: () {
- FriendUpdateRemarkDialog.dismiss();
- },
- child: Assets.images.iconDialogClose
- .image(width: 24.w, height: 24.w))),
- Column(
- children: [
- SizedBox(height: 27.w),
- Text(StringName.friendUpdateRemarkTitle,
- style: TextStyle(
- fontSize: 18.sp,
- color: ColorName.black90,
- fontWeight: FontWeight.bold)),
- SizedBox(height: 20.w),
- Container(
- padding: EdgeInsets.symmetric(horizontal: 12.w),
- decoration: BoxDecoration(
- color: '#F9F9F9'.color,
- borderRadius: BorderRadius.circular(10.w)),
- margin: EdgeInsets.symmetric(horizontal: 22.w),
- child: Row(
- children: [
- Expanded(
- child: TextField(
- controller: editingController,
- style: TextStyle(
- fontSize: 14.sp,
- color: ColorName.primaryTextColor),
- maxLines: 1,
- maxLength: 11,
- keyboardType: TextInputType.text,
- textAlignVertical: TextAlignVertical.center,
- textInputAction: TextInputAction.next,
- decoration: InputDecoration(
- hintText: StringName.friendUpdateRemarkHint,
- counterText: '',
- hintStyle: TextStyle(
- fontSize: 14, color: "#AAAAAA".toColor()),
- labelStyle: const TextStyle(
- fontSize: 14,
- color: ColorName.primaryTextColor,
- ),
- contentPadding: const EdgeInsets.all(0),
- border: const OutlineInputBorder(
- borderSide: BorderSide.none)))),
- Obx(() {
- return Text(
- _remark.value.isEmpty
- ? '0'
- : _remark.value.length.toString(),
- style: TextStyle(
- fontSize: 14.sp,
- color: _remark.value.isNotEmpty
- ? ColorName.black90
- : '#AAAAAA'.color));
- }),
- Text('/',
- style: TextStyle(
- fontSize: 14.sp, color: '#AAAAAA'.color)),
- Text('11',
- style: TextStyle(
- fontSize: 14.sp, color: '#AAAAAA'.color))
- ],
- ),
- ),
- SizedBox(height: 20.w),
- GestureDetector(
- onTap: () {
- callback(_remark.value);
- },
- child: Container(
- width: 229.w,
- height: 43.w,
- decoration: getPrimaryBtnDecoration(46.w),
- child: Center(
- child: Text(StringName.dialogSure,
- style: TextStyle(
- fontSize: 14.sp,
- color: Colors.white,
- fontWeight: FontWeight.bold)),
- ),
- ),
- ),
- SizedBox(height: 20.w)
- ],
- )
- ],
- ),
- ),
- );
- }
- }
|